@l10nmonster/server 3.0.0-alpha.10 → 3.0.0-alpha.11

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.
Files changed (41) hide show
  1. package/index.js +24 -0
  2. package/package.json +1 -1
  3. package/routes/info.js +10 -0
  4. package/routes/status.js +16 -24
  5. package/routes/tm.js +33 -0
  6. package/ui/dist/assets/Cart-jHOAGjwC.js +1 -0
  7. package/ui/dist/assets/Job-vnJpBXcp.js +1 -0
  8. package/ui/dist/assets/Providers-DUp_y6mi.js +1 -0
  9. package/ui/dist/assets/Sources-CC5dBiir.js +1 -0
  10. package/ui/dist/assets/Status-SRPm28Cg.js +1 -0
  11. package/ui/dist/assets/StatusDetail-DqXzi16U.js +1 -0
  12. package/ui/dist/assets/TM-CUqywRKC.js +1 -0
  13. package/ui/dist/assets/TMDetail-Bl4xHL_X.js +1 -0
  14. package/ui/dist/assets/Welcome-D33rOKBc.js +1 -0
  15. package/ui/dist/assets/{api-lUcpjS_e.js → api-CQ_emPlI.js} +1 -1
  16. package/ui/dist/assets/badge-D0XxOmqE.js +1 -0
  17. package/ui/dist/assets/{grid-Ct9nMDCu.js → grid-c9ySqPWI.js} +1 -1
  18. package/ui/dist/assets/index-BHll-Wur.js +1 -0
  19. package/ui/dist/assets/index-CE6JgXwC.js +76 -0
  20. package/ui/dist/assets/input-C_b-hL0i.js +1 -0
  21. package/ui/dist/assets/link-BJrTt4Ej.js +1 -0
  22. package/ui/dist/assets/namespace-DqVzlNZ0.js +1 -0
  23. package/ui/dist/assets/select-B7OxVhQ5.js +1 -0
  24. package/ui/dist/assets/{tooltip-CJa6_LB4.js → tooltip-DsbPmc5I.js} +1 -1
  25. package/ui/dist/assets/{use-field-context-BUNHqjYw.js → use-field-context-DPgnX2eS.js} +1 -1
  26. package/ui/dist/assets/{use-presence-context-BX_JHICA.js → use-presence-context-w7qGDwCc.js} +1 -1
  27. package/ui/dist/assets/useQuery-DJATtsyt.js +1 -0
  28. package/ui/dist/assets/{v-stack-CIRZgxKK.js → v-stack-BLV93Nj6.js} +1 -1
  29. package/ui/dist/index.html +1 -1
  30. package/ui/dist/assets/Cart-D5N7n5W3.js +0 -1
  31. package/ui/dist/assets/Providers-DQro218B.js +0 -1
  32. package/ui/dist/assets/Sources-BWjVGVNQ.js +0 -1
  33. package/ui/dist/assets/Status-C0BCLcoa.js +0 -1
  34. package/ui/dist/assets/TM-DwJjbV3D.js +0 -1
  35. package/ui/dist/assets/TMDetail-Dx7FUqxf.js +0 -1
  36. package/ui/dist/assets/Welcome-CeVYvAKN.js +0 -1
  37. package/ui/dist/assets/badge-BwRiDO79.js +0 -1
  38. package/ui/dist/assets/index-7BvmfFYo.js +0 -76
  39. package/ui/dist/assets/index-DYRyEtJ_.js +0 -1
  40. package/ui/dist/assets/namespace-DnzAbJc8.js +0 -1
  41. package/ui/dist/assets/useQuery-BJCiEOEF.js +0 -1
package/index.js CHANGED
@@ -47,6 +47,15 @@ export default class serve {
47
47
  // Mount the API router under the /api prefix
48
48
  app.use('/api', apiRouter);
49
49
 
50
+ // API 404 handler - must come before the UI catch-all
51
+ app.use('/api/*splat', (req, res) => {
52
+ res.status(404).json({
53
+ error: 'API endpoint not found',
54
+ path: req.path,
55
+ method: req.method
56
+ });
57
+ });
58
+
50
59
  if (options.ui || options.open) {
51
60
  const uiDistPath = path.join(import.meta.dirname, 'ui', 'dist');
52
61
  app.use(express.static(uiDistPath)); // rest of dist files
@@ -118,6 +127,21 @@ export default class serve {
118
127
  console.log('');
119
128
  });
120
129
 
130
+ // Handle server binding errors
131
+ server.on('error', (error) => {
132
+ if (error.code === 'EADDRINUSE') {
133
+ const addressStr = host ? `${host}:${port}` : `port ${port}`;
134
+ throw new Error(`Failed to bind server: Address ${addressStr} is already in use`);
135
+ } else if (error.code === 'EACCES') {
136
+ const addressStr = host ? `${host}:${port}` : `port ${port}`;
137
+ throw new Error(`Failed to bind server: Permission denied for ${addressStr}`);
138
+ } else if (error.code === 'EADDRNOTAVAIL') {
139
+ throw new Error(`Failed to bind server: Address ${host} is not available on this system`);
140
+ } else {
141
+ throw new Error(`Failed to bind server: ${error.message}`);
142
+ }
143
+ });
144
+
121
145
  return server;
122
146
  }
123
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l10nmonster/server",
3
- "version": "3.0.0-alpha.10",
3
+ "version": "3.0.0-alpha.11",
4
4
  "description": "L10n Monster Manager",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/routes/info.js CHANGED
@@ -9,6 +9,16 @@ export function setupInfoRoute(router, mm, serverPackage) {
9
9
  description: serverPackage.description,
10
10
  baseDir: path.resolve(getBaseDir()),
11
11
  providers: mm.dispatcher.providers.map(p => p.id),
12
+ channels: Object.keys(mm.rm.channels),
13
+ tmStores: mm.getTmStoreIds().map(id => {
14
+ const tmStore = mm.getTmStore(id);
15
+ return {
16
+ id: tmStore.id,
17
+ type: tmStore.constructor.name,
18
+ access: tmStore.access,
19
+ partitioning: tmStore.partitioning,
20
+ };
21
+ }),
12
22
  });
13
23
  });
14
24
  }
package/routes/status.js CHANGED
@@ -5,34 +5,26 @@ export function setupStatusRoute(router, mm) {
5
5
  logInfo`/status`;
6
6
  try {
7
7
  const status = await mm.getTranslationStatus();
8
-
9
- // Transform the structure from:
10
8
  // source_lang -> target_lang -> channel -> project -> data
11
- // to:
12
- // channel -> project -> source_lang -> target_lang -> data
13
- const flippedStatus = {};
14
- let projectCount = 0;
15
- for (const [sourceLang, targetLangs] of Object.entries(status)) {
16
- for (const [targetLang, channels] of Object.entries(targetLangs)) {
17
- for (const [channelId, projects] of Object.entries(channels)) {
18
- projectCount++;
19
- for (const [projectName, data] of Object.entries(projects)) {
20
- // Initialize nested structure if it doesn't exist
21
- flippedStatus[channelId] ??= {};
22
- flippedStatus[channelId][projectName] ??= {};
23
- flippedStatus[channelId][projectName][sourceLang] ??= {};
24
-
25
- // Set the data at the new location
26
- flippedStatus[channelId][projectName][sourceLang][targetLang] = data;
27
- }
28
- }
29
- }
30
- }
31
- logVerbose`Returned translation status for ${projectCount} projects`;
32
- res.json(flippedStatus);
9
+ logVerbose`Returned translation status`;
10
+ res.json(status);
33
11
  } catch (error) {
34
12
  console.error('Error fetching status: ', error);
35
13
  res.status(500).json({ message: 'Problems fetching status data' });
36
14
  }
37
15
  });
16
+
17
+ router.get('/status/:sourceLang/:targetLang', async (req, res) => {
18
+ const { sourceLang, targetLang } = req.params;
19
+ logInfo`/status/${sourceLang}/${targetLang}`;
20
+ try {
21
+ const tm = mm.tmm.getTM(sourceLang, targetLang);
22
+ const tus = tm.getUntranslatedContent();
23
+ logVerbose`Returned ${tus.length} untranslated TUs for ${sourceLang}->${targetLang}`;
24
+ res.json(tus);
25
+ } catch (error) {
26
+ logInfo`Error: ${error.message}`;
27
+ res.status(500).json({ error: error.message });
28
+ }
29
+ });
38
30
  }
package/routes/tm.js CHANGED
@@ -35,4 +35,37 @@ export function setupTmRoutes(router, mm) {
35
35
  logVerbose`Returned TM search results for ${data.length} entries`;
36
36
  res.json({ data, page: pageInt, limit: limitInt });
37
37
  });
38
+
39
+ router.get('/tm/job/:jobGuid', async (req, res) => {
40
+ logInfo`/tm/job/${req.params.jobGuid}`;
41
+
42
+ try {
43
+ const { jobGuid } = req.params;
44
+
45
+ if (!jobGuid) {
46
+ return res.status(400).json({
47
+ error: 'Missing jobGuid parameter'
48
+ });
49
+ }
50
+
51
+ const job = await mm.tmm.getJob(jobGuid);
52
+
53
+ if (!job) {
54
+ return res.status(404).json({
55
+ error: 'Job not found',
56
+ jobGuid
57
+ });
58
+ }
59
+
60
+ logVerbose`Returned job data for ${jobGuid}`;
61
+ res.json(job);
62
+
63
+ } catch (error) {
64
+ logInfo`Error fetching job ${req.params.jobGuid}: ${error.message}`;
65
+ res.status(500).json({
66
+ error: 'Failed to fetch job',
67
+ message: error.message
68
+ });
69
+ }
70
+ });
38
71
  }
@@ -0,0 +1 @@
1
+ import{r as c,m as j,j as e,t as De,v as Te,w as ze,x as Oe,y as Re,b as Ee,g as We,z as Le,A as Me,C as Z,D as ke,G as te,H as Be,I as Je,J as Fe,B as l,F as z,T as a,S as Ne,f as P}from"./index-CE6JgXwC.js";import{u as $e}from"./useQuery-DJATtsyt.js";import{c as Ie,f as Ue}from"./api-CQ_emPlI.js";import{V as D}from"./v-stack-BLV93Nj6.js";import{B as K}from"./badge-D0XxOmqE.js";import{e as He,c as re,a as y,f as H,u as Ge,b as qe,d as Ye,n as Ve}from"./index-BHll-Wur.js";import{u as Qe}from"./use-field-context-DPgnX2eS.js";import{S as _e,a as Xe,b as Ze,c as Ke,d as et,e as tt,f as rt,g as ot}from"./select-B7OxVhQ5.js";import{b as G,a as q,s as oe,P as se}from"./use-presence-context-w7qGDwCc.js";const[ne,st]=re({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:"<RenderStrategyPropsProvider />"}),ie=t=>He()(t,["lazyMount","unmountOnExit"]),[ae,w]=re({name:"DialogContext",hookName:"useDialogContext",providerName:"<DialogProvider />"}),le=c.forwardRef((t,r)=>{const n=w(),s=st(),i=G({...s,present:n.open}),u=j(n.getBackdropProps(),i.getPresenceProps(),t);return i.unmounted?null:e.jsx(y.div,{...u,ref:H(i.ref,r)})});le.displayName="DialogBackdrop";const ce=c.forwardRef((t,r)=>{const n=w(),s=j(n.getCloseTriggerProps(),t);return e.jsx(y.button,{...s,ref:r})});ce.displayName="DialogCloseTrigger";const de=c.forwardRef((t,r)=>{const n=w(),s=q(),i=j(n.getContentProps(),s.getPresenceProps(),t);return s.unmounted?null:e.jsx(y.div,{...i,ref:H(s.ref,r)})});de.displayName="DialogContent";const ue=c.forwardRef((t,r)=>{const n=w(),s=j(n.getDescriptionProps(),t);return e.jsx(y.div,{...s,ref:r})});ue.displayName="DialogDescription";const he=c.forwardRef((t,r)=>{const n=w(),s=j(n.getPositionerProps(),t);return q().unmounted?null:e.jsx(y.div,{...s,ref:r})});he.displayName="DialogPositioner";const nt=t=>{const r=c.useId(),{getRootNode:n}=Ge(),{dir:s}=qe(),i={id:r,getRootNode:n,dir:s,...t},u=Ye(De,i);return Te(u,Ve)},it=t=>{const[r,{children:n,...s}]=oe(t),[i]=ie(r),u=nt(s),h=G(j({present:u.open},r));return e.jsx(ae,{value:u,children:e.jsx(ne,{value:i,children:e.jsx(se,{value:h,children:n})})})},at=t=>{const[r,{value:n,children:s}]=oe(t),[i]=ie(r),u=G(j({present:n.open},r));return e.jsx(ae,{value:n,children:e.jsx(ne,{value:i,children:e.jsx(se,{value:u,children:s})})})},pe=c.forwardRef((t,r)=>{const n=w(),s=j(n.getTitleProps(),t);return e.jsx(y.h2,{...s,ref:r})});pe.displayName="DialogTitle";const ge=c.forwardRef((t,r)=>{const n=w(),s=q(),i=j({...n.getTriggerProps(),"aria-controls":s.unmounted?void 0:n.getTriggerProps()["aria-controls"]},t);return e.jsx(y.button,{...i,ref:r})});ge.displayName="DialogTrigger";var lt=t=>{if(!t)return;const r=ze(t),n=Oe(t),s=Re(t),i=()=>{requestAnimationFrame(()=>{t.style.height="auto";let g;r.boxSizing==="content-box"?g=t.scrollHeight-(parseFloat(r.paddingTop)+parseFloat(r.paddingBottom)):g=t.scrollHeight+parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),r.maxHeight!=="none"&&g>parseFloat(r.maxHeight)?(r.overflowY==="hidden"&&(t.style.overflowY="scroll"),g=parseFloat(r.maxHeight)):r.overflowY!=="hidden"&&(t.style.overflowY="hidden"),t.style.height=`${g}px`})};t.addEventListener("input",i),t.form?.addEventListener("reset",i);const u=Object.getPrototypeOf(t),h=Object.getOwnPropertyDescriptor(u,"value");Object.defineProperty(t,"value",{...h,set(){h?.set?.apply(this,arguments),i()}});const S=new n.ResizeObserver(()=>{requestAnimationFrame(()=>i())});S.observe(t);const b=new n.MutationObserver(()=>i());return b.observe(t,{attributes:!0,attributeFilter:["rows","placeholder"]}),s.fonts?.addEventListener("loadingdone",i),()=>{t.removeEventListener("input",i),t.form?.removeEventListener("reset",i),s.fonts?.removeEventListener("loadingdone",i),S.disconnect(),b.disconnect()}};const xe=c.forwardRef((t,r)=>{const{autoresize:n,...s}=t,i=c.useRef(null),u=Qe(),h=j(u?.getTextareaProps(),{style:{resize:n?"none":void 0}},s);return c.useEffect(()=>{if(n)return lt(i.current)},[n]),e.jsx(y.textarea,{...h,ref:H(r,i)})});xe.displayName="FieldTextarea";const{withRootProvider:fe,withContext:v}=Ie({key:"dialog"});fe(at,{defaultProps:{unmountOnExit:!0,lazyMount:!0}});const k=fe(it,{defaultProps:{unmountOnExit:!0,lazyMount:!0}});v(ge,"trigger",{forwardAsChild:!0});const B=v(he,"positioner",{forwardAsChild:!0}),J=v(de,"content",{forwardAsChild:!0});v(ue,"description",{forwardAsChild:!0});const F=v(pe,"title",{forwardAsChild:!0}),N=v(ce,"closeTrigger",{forwardAsChild:!0});c.forwardRef(function(r,n){const s=w();return e.jsx(Ee.button,{...r,ref:n,onClick:()=>s.setOpen(!1)})});const $=v(le,"backdrop",{forwardAsChild:!0}),I=v("div","body");v("div","footer");const U=v("div","header"),{withContext:ct}=We({key:"textarea"}),dt=ct(xe);var ut=class extends Le{#r;#o=void 0;#e;#t;constructor(t,r){super(),this.#r=t,this.setOptions(r),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#r.defaultMutationOptions(t),Me(this.options,r)||this.#r.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#e,observer:this}),r?.mutationKey&&this.options.mutationKey&&Z(r.mutationKey)!==Z(this.options.mutationKey)?this.reset():this.#e?.state.status==="pending"&&this.#e.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#e?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#n(t)}getCurrentResult(){return this.#o}reset(){this.#e?.removeObserver(this),this.#e=void 0,this.#s(),this.#n()}mutate(t,r){return this.#t=r,this.#e?.removeObserver(this),this.#e=this.#r.getMutationCache().build(this.#r,this.options),this.#e.addObserver(this),this.#e.execute(t)}#s(){const t=this.#e?.state??ke();this.#o={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#n(t){te.batch(()=>{if(this.#t&&this.hasListeners()){const r=this.#o.variables,n=this.#o.context;t?.type==="success"?(this.#t.onSuccess?.(t.data,r,n),this.#t.onSettled?.(t.data,null,r,n)):t?.type==="error"&&(this.#t.onError?.(t.error,r,n),this.#t.onSettled?.(void 0,t.error,r,n))}this.listeners.forEach(r=>{r(this.#o)})})}};function ee(t,r){const n=Be(),[s]=c.useState(()=>new ut(n,t));c.useEffect(()=>{s.setOptions(t)},[s,t]);const i=c.useSyncExternalStore(c.useCallback(h=>s.subscribe(te.batchCalls(h)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),u=c.useCallback((h,S)=>{s.mutate(h,S).catch(Je)},[s]);if(i.error&&Fe(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}const ht=({langPairKey:t,tus:r,onRemoveTU:n})=>{const[s,i]=c.useState(""),[u,h]=c.useState(!1),[S,b]=c.useState(!1),[g,A]=c.useState(null),[d,f]=c.useState(""),[m,W]=c.useState(""),[C,Y]=c.useState(null),[me,V]=c.useState(!1),{data:be={},isLoading:je}=$e({queryKey:["info"],queryFn:()=>Ue("/api/info")}),ve=be.providers||[],Q=ee({mutationFn:async({sourceLang:o,targetLang:p,tus:x,providerList:T})=>{const M=await fetch("/api/dispatcher/createJobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceLang:o,targetLang:p,tus:x,providerList:T})});if(!M.ok){const Ae=await M.json();throw new Error(Ae.message||"Failed to create jobs")}return M.json()}}),L=ee({mutationFn:async({jobs:o,instructions:p})=>{const x=await fetch("/api/dispatcher/startJobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jobs:o,instructions:p})});if(!x.ok){const T=await x.json();throw new Error(T.message||"Failed to start jobs")}return x.json()}});function _(o){return o.map(p=>typeof p=="string"?p:`{{${p.t}}}`).join("")}function Se(o){return new Date(o).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}const Ce=async()=>{if(!s){alert("Please select a provider first");return}const o=Array.isArray(r)?r:r.tus;try{const x=(await Q.mutateAsync({sourceLang:R,targetLang:E,tus:o,providerList:[s]})).find(T=>T.translationProvider===s);x?(A(x),f(""),h(!0)):(W(`Provider "${s}" did not accept any of the selected translation units.`),b(!0))}catch(p){W(`Failed to create job: ${p.message}`),b(!0)}},ye=o=>{i(o)},we=async()=>{if(g)try{const o=await L.mutateAsync({jobs:[g],instructions:d||void 0}),p=o.find(x=>x.jobGuid===g.jobGuid)||o[0];Y(p),h(!1),V(!0)}catch(o){W(`Failed to start job: ${o.message}`),b(!0)}},X=()=>{if(V(!1),Y(null),A(null),f(""),g&&g.tus){const o=new Set(g.tus.map(x=>x.guid)),p=Array.isArray(r)?r:r.tus;for(let x=p.length-1;x>=0;x--)o.has(p[x].guid)&&n(t,x)}},Pe=o=>o===0?"Free":o==null?"Unknown":`$${o.toFixed(2)}`,O=Array.isArray(r)?r:r.tus,R=Array.isArray(r)?t.split("|")[0]||t.split("→")[0]:r.sourceLang,E=Array.isArray(r)?t.split("|")[1]||t.split("→").slice(1).join("→"):r.targetLang;return e.jsxs(l,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsxs(D,{gap:4,align:"stretch",children:[e.jsx(l,{children:e.jsxs(z,{align:"center",justify:"space-between",mb:2,children:[e.jsxs(z,{align:"center",gap:3,children:[e.jsx(K,{colorPalette:"blue",size:"sm",children:R}),e.jsx(a,{color:"fg.muted",fontSize:"lg",children:"→"}),e.jsx(K,{colorPalette:"green",size:"sm",children:E}),e.jsxs(z,{align:"center",gap:3,ml:4,children:[e.jsxs(_e,{size:"sm",width:"250px",value:s?[s]:[],onValueChange:o=>{},positioning:{strategy:"absolute",placement:"bottom-start",flip:!0,gutter:4},children:[e.jsxs(Xe,{children:[e.jsx(a,{fontSize:"sm",flex:"1",textAlign:"left",children:s||"Select Provider"}),e.jsx(Ze,{})]}),e.jsx(Ke,{children:e.jsx(et,{zIndex:1e3,bg:"white",borderWidth:"1px",borderColor:"border.default",borderRadius:"md",shadow:"lg",minW:"250px",maxH:"200px",overflow:"auto",children:je?e.jsxs(l,{p:3,textAlign:"center",children:[e.jsx(Ne,{size:"sm"}),e.jsx(a,{fontSize:"sm",color:"fg.muted",mt:2,children:"Loading providers..."})]}):ve.map(o=>e.jsxs(tt,{item:o,value:o,onClick:()=>ye(o),children:[e.jsx(rt,{children:o}),e.jsx(ot,{})]},o))})})]}),e.jsx(P,{size:"sm",colorPalette:"blue",onClick:Ce,disabled:!s,loading:Q.isPending,children:"Create Job"})]})]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:[O.length," ",O.length===1?"TU":"TUs"]})]})}),e.jsx(l,{bg:"white",borderRadius:"md",overflow:"auto",children:e.jsxs(l,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(l,{as:"thead",bg:"blue.subtle",borderBottom:"2px",borderColor:"blue.muted",shadow:"sm",children:e.jsxs(l,{as:"tr",children:[e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"120px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"GUID"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"350px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"SOURCE"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"350px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"TARGET"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"center",minW:"40px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"QUALITY"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"120px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"PROVIDER"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"left",minW:"120px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"TIMESTAMP"})}),e.jsx(l,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",textAlign:"center",minW:"100px",children:e.jsx(a,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"ACTION"})})]})}),e.jsx(l,{as:"tbody",children:O.map((o,p)=>e.jsxs(l,{as:"tr",_hover:{bg:"gray.subtle"},children:[e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(a,{fontSize:"xs",fontFamily:"mono",color:"blue.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:o.guid})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(a,{fontSize:"xs",noOfLines:2,dir:R?.startsWith("he")||R?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(o.nsrc)?_(o.nsrc):o.nsrc})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(a,{fontSize:"xs",noOfLines:2,dir:E?.startsWith("he")||E?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(o.ntgt)?_(o.ntgt):o.ntgt})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(a,{fontSize:"xs",children:o.q})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(a,{fontSize:"xs",children:o.translationProvider||o.provider})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(a,{fontSize:"xs",color:"fg.muted",children:Se(o.ts)})}),e.jsx(l,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsx(P,{size:"xs",colorPalette:"red",variant:"outline",onClick:()=>n(t,p),children:"Remove"})})]},`${o.guid}-${p}`))})]})})]}),e.jsxs(k,{open:u,onOpenChange:o=>h(o.open),children:[e.jsx($,{}),e.jsx(B,{children:e.jsxs(J,{maxW:"500px",children:[e.jsxs(U,{children:[e.jsx(F,{children:"Job Created Successfully"}),e.jsx(N,{})]}),e.jsx(I,{children:g&&e.jsxs(D,{gap:4,align:"stretch",children:[e.jsxs(l,{children:[e.jsxs(a,{fontSize:"lg",fontWeight:"bold",color:"green.600",children:[g.tus?.length||0," TUs accepted out of ",O.length," sent"]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Provider: ",s]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Estimated Cost: ",Pe(g.estimatedCost)]})]}),e.jsxs(l,{children:[e.jsx(a,{fontSize:"sm",fontWeight:"bold",mb:2,children:"Job Instructions (optional):"}),e.jsx(dt,{placeholder:"Enter any specific instructions for this translation job...",value:d,onChange:o=>f(o.target.value),rows:3})]}),e.jsxs(z,{gap:3,children:[e.jsx(P,{colorPalette:"gray",variant:"outline",onClick:()=>{h(!1),A(null),f("")},flex:"1",disabled:L.isPending,children:"Cancel"}),e.jsx(P,{colorPalette:"green",onClick:we,loading:L.isPending,flex:"1",children:"Push Job"})]})]})})]})})]}),e.jsxs(k,{open:S,onOpenChange:o=>b(o.open),children:[e.jsx($,{}),e.jsx(B,{children:e.jsxs(J,{maxW:"400px",children:[e.jsxs(U,{children:[e.jsx(F,{children:"Job Creation Failed"}),e.jsx(N,{})]}),e.jsx(I,{children:e.jsxs(D,{gap:4,align:"stretch",children:[e.jsx(a,{color:"red.600",children:m}),e.jsx(P,{colorPalette:"red",onClick:()=>b(!1),w:"100%",children:"Close"})]})})]})})]}),e.jsxs(k,{open:me,onOpenChange:o=>{o.open||X()},children:[e.jsx($,{}),e.jsx(B,{children:e.jsxs(J,{maxW:"400px",children:[e.jsxs(U,{children:[e.jsx(F,{children:"Job Started Successfully"}),e.jsx(N,{})]}),e.jsx(I,{children:C&&e.jsxs(D,{gap:4,align:"stretch",children:[e.jsxs(l,{children:[e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Job ID: ",e.jsx(a,{as:"span",fontFamily:"mono",color:"blue.600",cursor:"pointer",_hover:{textDecoration:"underline"},onClick:o=>{o.preventDefault(),window.open(`/job/${C.jobGuid}`,"_blank")},children:C.jobGuid})]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Provider: ",C.translationProvider]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Language Pair: ",C.sourceLang," → ",C.targetLang]}),e.jsxs(a,{fontSize:"sm",color:"fg.muted",children:["Status: ",e.jsx(a,{as:"span",fontWeight:"bold",color:C.status==="completed"?"green.600":"orange.600",children:C.status})]})]}),e.jsx(l,{children:e.jsx(P,{colorPalette:"blue",onClick:X,w:"100%",children:"Close & Remove TUs from Cart"})})]})})]})})]})]})},Ct=()=>{const[t,r]=c.useState({}),[n,s]=c.useState(!0),i=()=>{try{const d=sessionStorage.getItem("tmCart");return d?JSON.parse(d):{}}catch(d){return console.error("Error loading cart:",d),{}}},u=d=>{sessionStorage.setItem("tmCart",JSON.stringify(d)),window.dispatchEvent(new Event("cartUpdated"))},h=()=>{s(!0);const d=i();r(d),s(!1)},S=(d,f)=>{const m=i();m[d]&&(Array.isArray(m[d])?(m[d].splice(f,1),m[d].length===0&&delete m[d]):(m[d].tus.splice(f,1),m[d].tus.length===0&&delete m[d]),u(m),h())},b=()=>{u({}),h()},g=()=>Object.values(t).reduce((d,f)=>Array.isArray(f)?d+f.length:d+(f.tus?f.tus.length:0),0);if(c.useEffect(()=>{h()},[]),n)return e.jsx(l,{py:6,px:6,children:e.jsx(a,{children:"Loading cart..."})});const A=g();return e.jsx(l,{py:6,px:6,children:e.jsxs(D,{gap:6,align:"stretch",children:[e.jsxs(z,{align:"center",justify:"space-between",children:[e.jsx(a,{fontSize:"2xl",fontWeight:"bold",children:"Translation Memory Cart"}),A>0&&e.jsx(P,{colorPalette:"red",variant:"outline",onClick:b,children:"Empty Cart"})]}),A===0?e.jsxs(l,{p:8,textAlign:"center",borderWidth:"1px",borderRadius:"lg",bg:"bg.muted",children:[e.jsx(a,{fontSize:"lg",color:"fg.default",mb:2,children:"Your cart is empty"}),e.jsx(a,{color:"fg.muted",children:"Add translation units from the TM pages to get started"})]}):e.jsx(D,{gap:6,align:"stretch",children:Object.entries(t).map(([d,f])=>e.jsx(ht,{langPairKey:d,tus:f,onRemoveTU:S},d))})]})})};export{Ct as default};
@@ -0,0 +1 @@
1
+ import{r as p,W as I,X as $,m as S,j as e,e as D,B as o,S as G,T as t,F as f,f as q}from"./index-CE6JgXwC.js";import{A as V}from"./namespace-DqVzlNZ0.js";import{B as u}from"./badge-D0XxOmqE.js";import{c as H,f as M}from"./api-CQ_emPlI.js";import{e as v,b as K,u as Q,d as X,n as Y,c as Z,a as w}from"./index-BHll-Wur.js";import{S as _,V as j}from"./v-stack-BLV93Nj6.js";import{u as ee}from"./useQuery-DJATtsyt.js";const re=n=>v()(n,["defaultOpen","disabled","id","ids","lazyMount","onExitComplete","onOpenChange","open","unmountOnExit"]),te=(n={})=>{const{lazyMount:i,unmountOnExit:l,...s}=n,h=p.useId(),g=p.useRef(!1),{dir:C}=K(),{getRootNode:z}=Q(),y={id:h,dir:C,getRootNode:z,...s},b=X(I,y),r=$(b,Y);r.visible&&(g.current=!0);const a=!r.visible&&!g.current&&i||l&&!r.visible&&g.current;return{...r,isUnmounted:a}},[T,F]=Z({name:"CollapsibleContext",hookName:"useCollapsibleContext",providerName:"<CollapsibleProvider />"}),L=p.forwardRef((n,i)=>{const[l,s]=re(n),h=te(l),g=S(h.getRootProps(),s);return e.jsx(T,{value:h,children:e.jsx(w.div,{...g,ref:i})})});L.displayName="CollapsibleRoot";const U=p.forwardRef((n,i)=>{const l=F();if(l.isUnmounted)return null;const s=S(l.getContentProps(),n);return e.jsx(w.div,{...s,ref:i})});U.displayName="CollapsibleContent";const O=p.forwardRef((n,i)=>{const[{value:l},s]=v()(n,["value"]),h=S(l.getRootProps(),s);return e.jsx(T,{value:l,children:e.jsx(w.div,{...h,ref:i})})});O.displayName="CollapsibleRootProvider";const B=p.forwardRef((n,i)=>{const l=F(),s=S(l.getTriggerProps(),n);return e.jsx(w.button,{...s,ref:i})});B.displayName="CollapsibleTrigger";const{withProvider:E,withContext:J}=H({key:"collapsible"});E(O,"root",{forwardAsChild:!0});const se=E(L,"root",{forwardAsChild:!0});J(B,"trigger",{forwardAsChild:!0});const oe=J(U,"content",{forwardAsChild:!0}),k=p.forwardRef(function(i,l){return e.jsx(_,{align:"center",...i,direction:"row",ref:l})});function N(n){return n.map(i=>typeof i=="string"?i:`{{${i.t}}}`).join("")}function R(n){return new Date(n).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ne(n){return n===0?"Free":n==null?"Unknown":`$${n.toFixed(2)}`}const fe=()=>{const{jobGuid:n}=D(),[i,l]=p.useState({}),{data:s,isLoading:h,error:g}=ee({queryKey:["job",n],queryFn:()=>M(`/api/tm/job/${n}`),retry:(r,a)=>a?.status===404?!1:r<3});if(h)return e.jsx(o,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(G,{size:"xl"})});if(g)return e.jsx(o,{mt:5,px:6,children:e.jsxs(o,{p:4,bg:"red.subtle",borderRadius:"md",borderWidth:"1px",borderColor:"red.muted",children:[e.jsx(t,{fontWeight:"bold",color:"red.600",mb:2,children:"Error"}),e.jsx(t,{color:"red.600",children:g?.message||"Failed to fetch job data"})]})});if(!s)return e.jsx(o,{mt:5,px:6,children:e.jsx(V,{status:"warning",children:e.jsxs(o,{children:[e.jsx(t,{fontWeight:"bold",children:"Job Not Found"}),e.jsxs(t,{children:["Job with GUID ",n," was not found."]})]})})});const C=r=>{switch(r?.toLowerCase()){case"done":case"completed":return"green";case"failed":case"error":return"red";case"in-progress":case"running":return"orange";default:return"gray"}},z=(r,a)=>{const x=new Set(["jobGuid","guid","rid","sid","nsrc","ntgt","notes","q","prj"]),P=Object.entries(r).filter(([d])=>!x.has(d)),A=r.guid||a,W=i[A]||!1;return e.jsx(o,{p:4,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",mb:4,children:e.jsxs(j,{gap:3,align:"stretch",children:[e.jsx(f,{justify:"space-between",align:"start",wrap:"wrap",children:e.jsxs(j,{gap:1,align:"stretch",children:[e.jsxs(f,{align:"center",gap:2,children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"GUID:"}),e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",wordBreak:"break-all",children:r.guid})]}),r.rid&&e.jsxs(f,{align:"center",gap:2,children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"RID:"}),e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",wordBreak:"break-all",children:r.rid})]}),r.sid&&e.jsxs(f,{align:"center",gap:2,children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"SID:"}),e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:r.sid})]})]})}),e.jsxs(o,{children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"Source:"}),e.jsx(t,{fontSize:"sm",p:2,bg:"blue.subtle",borderRadius:"md",dir:s.sourceLang?.startsWith("he")||s.sourceLang?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(r.nsrc)?N(r.nsrc):r.nsrc})]}),e.jsxs(o,{children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"Target:"}),e.jsx(t,{fontSize:"sm",p:2,bg:"green.subtle",borderRadius:"md",dir:s.targetLang?.startsWith("he")||s.targetLang?.startsWith("ar")?"rtl":"ltr",children:Array.isArray(r.ntgt)?N(r.ntgt):r.ntgt})]}),r.notes&&e.jsxs(o,{children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",color:"fg.muted",children:"Notes:"}),e.jsxs(o,{p:2,bg:"yellow.subtle",borderRadius:"md",children:[r.notes.desc&&e.jsx(t,{fontSize:"xs",mb:2,whiteSpace:"pre-wrap",children:r.notes.desc}),r.notes.ph&&e.jsxs(o,{children:[e.jsx(t,{fontSize:"xs",fontWeight:"bold",mb:1,children:"Placeholders:"}),Object.entries(r.notes.ph).map(([d,c])=>e.jsxs(o,{mb:1,children:[e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:d}),e.jsxs(t,{fontSize:"xs",color:"gray.600",children:[c.desc," (e.g., ",c.sample,")"]})]},d))]})]})]}),P.length>0&&e.jsxs(o,{children:[e.jsxs(f,{align:"center",justify:"space-between",mb:2,children:[e.jsx(q,{size:"xs",variant:"ghost",onClick:()=>l(d=>({...d,[A]:!W})),p:1,children:e.jsx(t,{fontSize:"xs",color:"blue.600",children:W?"Hide additional properties":`Show ${P.length} additional properties`})}),e.jsxs(k,{gap:2,children:[r.prj&&e.jsx(u,{size:"sm",colorPalette:"purple",children:r.prj}),r.q&&e.jsxs(u,{size:"sm",colorPalette:"blue",children:["Q: ",r.q]})]})]}),e.jsx(se,{open:W,children:e.jsx(oe,{children:e.jsx(o,{p:3,bg:"gray.subtle",borderRadius:"md",children:P.map(([d,c])=>{let m=c;return d==="ts"&&typeof c=="number"?m=R(c):typeof c=="object"?m=JSON.stringify(c,null,2):m=String(c),e.jsxs(f,{align:"start",mb:2,gap:2,children:[e.jsxs(t,{fontSize:"xs",fontWeight:"bold",color:"gray.600",minW:"fit-content",children:[d,":"]}),e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",flex:"1",wordBreak:"break-all",children:m})]},d)})})})})]})]})},r.guid||a)},y=new Set(["jobGuid","sourceLang","targetLang","translationProvider","updatedAt","taskName","inflight","status","tus","estimatedCost"]),b=Object.entries(s).filter(([r])=>!y.has(r));return e.jsxs(o,{p:6,minH:"100vh",bg:"gray.50",children:[e.jsxs(t,{fontSize:"3xl",fontWeight:"bold",mb:6,color:"fg.default",children:["Job ",s.jobGuid]}),e.jsxs(j,{gap:6,align:"stretch",maxW:"6xl",mx:"auto",children:[e.jsx(o,{p:6,bg:"white",borderRadius:"lg",shadow:"sm",children:e.jsxs(j,{gap:4,align:"stretch",children:[e.jsxs(f,{justify:"space-between",align:"center",wrap:"wrap",children:[e.jsxs(k,{gap:6,wrap:"wrap",align:"center",children:[e.jsxs(o,{children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",children:"Language Pair:"}),e.jsxs(t,{fontSize:"sm",children:[s.sourceLang," → ",s.targetLang]})]}),e.jsxs(o,{children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",children:"Provider:"}),e.jsx(t,{fontSize:"sm",children:s.translationProvider})]}),s.updatedAt&&e.jsxs(o,{children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",children:"Updated:"}),e.jsx(t,{fontSize:"sm",children:R(new Date(s.updatedAt).getTime())})]}),s.taskName&&e.jsxs(o,{children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",children:"Task:"}),e.jsx(t,{fontSize:"sm",children:s.taskName})]}),s.estimatedCost!==void 0&&e.jsxs(o,{children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",children:"Estimated Cost:"}),e.jsx(t,{fontSize:"sm",children:ne(s.estimatedCost)})]}),s.inflight?.length>0&&e.jsxs(u,{colorPalette:"orange",size:"sm",children:[s.inflight.length," TUs In Flight"]})]}),e.jsx(u,{size:"lg",colorPalette:C(s.status),children:s.status?.toUpperCase()})]}),b.length>0&&e.jsxs(o,{mt:4,pt:4,borderTop:"1px",borderColor:"border.default",children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"fg.muted",mb:3,children:"Additional Properties"}),e.jsx(o,{bg:"gray.subtle",p:3,borderRadius:"md",children:b.map(([r,a])=>{let x=a;return r==="ts"&&typeof a=="number"?x=R(a):typeof a=="object"?x=JSON.stringify(a,null,2):x=String(a),e.jsxs(f,{align:"start",mb:2,gap:2,children:[e.jsxs(t,{fontSize:"xs",fontWeight:"bold",color:"gray.600",minW:"fit-content",children:[r,":"]}),e.jsx(t,{fontSize:"xs",fontFamily:"mono",color:"blue.600",flex:"1",wordBreak:"break-all",children:x})]},r)})})]})]})}),s.inflight?.length>0&&e.jsxs(o,{p:4,bg:"orange.subtle",borderRadius:"lg",borderWidth:"1px",borderColor:"orange.muted",children:[e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"orange.700",mb:2,children:"Translation In Progress"}),e.jsxs(t,{fontSize:"sm",color:"orange.600",children:[s.inflight.length," translation unit",s.inflight.length===1?"":"s"," ",s.inflight.length===1?"is":"are"," still being translated."]})]}),e.jsxs(o,{children:[e.jsxs(t,{fontSize:"xl",fontWeight:"bold",mb:4,children:["Translation Units (",s.tus?.length||0,")"]}),s.tus?.length>0?s.tus.map((r,a)=>z(r,a)):e.jsx(o,{p:6,bg:"white",borderRadius:"lg",textAlign:"center",children:e.jsx(t,{color:"fg.muted",children:"No translation units found."})})]})]})]})};export{fe as default};
@@ -0,0 +1 @@
1
+ import{j as e,B as s,T as r,r as S,R as y,S as z,F as W}from"./index-CE6JgXwC.js";import{A as w}from"./namespace-DqVzlNZ0.js";import{u as v}from"./useQuery-DJATtsyt.js";import{f as C}from"./api-CQ_emPlI.js";import{V as p}from"./v-stack-BLV93Nj6.js";import{G as R}from"./grid-c9ySqPWI.js";import{B as P}from"./badge-D0XxOmqE.js";const A=({providers:n,selectedProvider:l,onProviderSelect:i})=>{const d=Object.keys(n||{});return e.jsxs(s,{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(p,{gap:2,align:"stretch",children:[d.map(o=>e.jsxs(s,{p:3,borderRadius:"md",cursor:"pointer",bg:l===o?"blue.subtle":"white",borderWidth:"1px",borderColor:l===o?"blue.600":"border.default",_hover:{bg:l===o?"blue.subtle":"gray.subtle"},onClick:()=>i(o),children:[e.jsx(r,{fontSize:"sm",fontWeight:"medium",noOfLines:2,children:o}),n[o]?.info?.type&&e.jsx(r,{fontSize:"xs",color:"fg.muted",mt:1,children:n[o].info.type})]},o)),d.length===0&&e.jsx(r,{color:"fg.muted",fontSize:"sm",textAlign:"center",mt:4,children:"No providers found"})]})]})},O=({provider:n,providerId:l})=>{if(!n)return e.jsx(s,{p:6,textAlign:"center",children:e.jsx(r,{color:"fg.muted",children:"Select a provider to view details"})});const{info:i,properties:d}=n,o=t=>{if(!t)return t;const h={31:"#ef4444",32:"#22c55e",33:"#eab308",34:"#3b82f6",35:"#a855f7",36:"#06b6d4",39:"inherit"},a=[];let c=0,m="inherit";const b=/\u001B\[([0-9;]*)m/g;let x;for(;(x=b.exec(t))!==null;){if(x.index>c){const g=t.slice(c,x.index);a.push(e.jsx("span",{style:{color:m},children:g},`${c}-text`))}const f=x[1];h[f]&&(m=h[f]),c=x.index+x[0].length}if(c<t.length){const f=t.slice(c);a.push(e.jsx("span",{style:{color:m},children:f},`${c}-text`))}return a.length>0?a:t},u=t=>Array.isArray(t)?t.map((h,a)=>e.jsxs(s,{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:o(h)})]},a)):e.jsx(r,{fontSize:"sm",children:o(t)}),j=t=>typeof t=="object"&&t!==null?e.jsx(s,{as:"pre",fontSize:"xs",bg:"bg.muted",p:2,borderRadius:"md",overflow:"auto",maxH:"200px",children:JSON.stringify(t,null,2)}):e.jsx(r,{fontSize:"sm",children:String(t)});return e.jsx(s,{width:"75%",p:6,overflow:"auto",children:e.jsxs(p,{gap:6,align:"stretch",children:[e.jsx(s,{children:e.jsx(r,{fontSize:"2xl",fontWeight:"bold",mb:2,children:l})}),e.jsxs(s,{p:4,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsx(r,{fontSize:"lg",fontWeight:"semibold",mb:4,children:"Properties"}),Object.keys(d).length===0?e.jsx(r,{color:"fg.muted",fontSize:"sm",children:"No properties available"}):e.jsx(p,{gap:4,align:"stretch",children:Object.entries(d).map(([t,h])=>e.jsxs(s,{children:[e.jsxs(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",mb:2,children:[t,":"]}),e.jsx(s,{pl:4,children:j(h)})]},t))})]}),e.jsxs(s,{p:4,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:[e.jsx(r,{fontSize:"lg",fontWeight:"semibold",mb:4,children:"Information"}),e.jsxs(R,{templateColumns:"auto 1fr",gap:3,alignItems:"start",children:[e.jsx(r,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Type:"}),e.jsx(P,{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(s,{children:u(i.description)})]})]})]})]})})},L=()=>{const[n,l]=S.useState(null),{data:i={},isLoading:d,error:o}=v({queryKey:["providers"],queryFn:()=>C("/api/providers")});return y.useEffect(()=>{i&&Object.keys(i).length>0&&!n&&l(Object.keys(i)[0])},[i,n]),d?e.jsx(s,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(z,{size:"xl"})}):o?e.jsx(s,{mt:5,px:6,children:e.jsx(w,{status:"error",children:e.jsxs(s,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:o?.message||"Failed to fetch provider data"})]})})}):e.jsx(s,{py:6,px:6,children:e.jsx(s,{borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",overflow:"hidden",minH:"70vh",children:e.jsxs(W,{children:[e.jsx(A,{providers:i,selectedProvider:n,onProviderSelect:l}),e.jsx(O,{provider:i[n],providerId:n})]})})})};export{L as default};
@@ -0,0 +1 @@
1
+ import{j as e,B as r,T as t,F as u,S as g}from"./index-CE6JgXwC.js";import{A as p}from"./namespace-DqVzlNZ0.js";import{G as h}from"./grid-c9ySqPWI.js";import{V as f}from"./v-stack-BLV93Nj6.js";import{u as j}from"./useQuery-DJATtsyt.js";import{f as b}from"./api-CQ_emPlI.js";import{B as m}from"./badge-D0XxOmqE.js";import{T as S,a as w,b as y,c as z,d as M}from"./tooltip-DsbPmc5I.js";import"./use-presence-context-w7qGDwCc.js";import"./index-BHll-Wur.js";const C=({item:o})=>{const x=s=>{const l=new Date,d=new Date(s),a=l-d,n=Math.floor(a/1e3),i=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"short"});return n<60?i.format(-n,"second"):n<3600?i.format(-Math.floor(n/60),"minute"):n<86400?i.format(-Math.floor(n/3600),"hour"):n<2592e3?i.format(-Math.floor(n/86400),"day"):n<31536e3?i.format(-Math.floor(n/2592e3),"month"):i.format(-Math.floor(n/31536e3),"year")},c=s=>new Date(s).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(r,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.default",bg:"yellow.subtle",w:"100%",children:e.jsxs(h,{templateColumns:"2fr 80px 3fr 80px 80px 100px",gap:4,alignItems:"center",children:[e.jsxs(r,{children:[e.jsx(t,{fontSize:"xs",color:"fg.muted",mb:1,children:"Project"}),e.jsx(t,{fontSize:"sm",fontWeight:"semibold",children:o.prj||"Default"})]}),e.jsxs(r,{children:[e.jsx(t,{fontSize:"xs",color:"fg.muted",mb:1,children:"Source"}),e.jsx(m,{colorPalette:"blue",size:"sm",children:o.sourceLang})]}),e.jsxs(r,{children:[e.jsxs(t,{fontSize:"xs",color:"fg.muted",mb:1,children:["Targets (",o.targetLangs.length,")"]}),e.jsx(u,{wrap:"wrap",gap:1,children:o.targetLangs.map(s=>e.jsx(m,{colorPalette:"green",size:"sm",children:s},s))})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"fg.muted",mb:1,children:"Resources"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:o.resCount.toLocaleString()})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"fg.muted",mb:1,children:"Segments"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:o.segmentCount.toLocaleString()})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"fg.muted",mb:1,children:"Modified"}),e.jsxs(S,{children:[e.jsx(w,{asChild:!0,children:e.jsx(t,{fontSize:"xs",color:"fg.muted",cursor:"help",children:x(o.lastModified)})}),e.jsx(y,{children:e.jsxs(z,{children:[e.jsx(M,{}),e.jsx(t,{fontSize:"sm",children:c(o.lastModified)})]})})]})]})]})})},P=()=>{const{data:o={},isLoading:x,error:c}=j({queryKey:["activeContentStats"],queryFn:()=>b("/api/activeContentStats")});return x?e.jsx(r,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(g,{size:"xl"})}):c?e.jsx(r,{mt:5,px:6,children:e.jsx(p,{status:"error",children:e.jsxs(r,{children:[e.jsx(t,{fontWeight:"bold",children:"Error"}),e.jsx(t,{children:c})]})})}):e.jsx(r,{py:6,px:6,children:e.jsx(f,{gap:6,align:"stretch",children:Object.keys(o).length===0?e.jsx(r,{p:6,borderWidth:"1px",borderRadius:"md",bg:"white",textAlign:"center",children:e.jsx(t,{color:"fg.muted",children:"No active content found."})}):e.jsx(f,{gap:6,align:"center",children:Object.entries(o).map(([s,l])=>e.jsx(r,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",minW:"600px",maxW:"1200px",w:"100%",children:e.jsxs(f,{gap:4,align:"stretch",children:[e.jsx(r,{children:e.jsx(t,{fontSize:"xl",fontWeight:"bold",color:"blue.600",mb:2,children:s})}),l.length===0?e.jsx(r,{p:6,borderWidth:"1px",borderRadius:"md",bg:"bg.muted",textAlign:"center",w:"100%",children:e.jsx(t,{color:"fg.muted",fontSize:"sm",children:"No content found for this channel"})}):e.jsx(h,{templateColumns:{base:"1fr",lg:"repeat(auto-fit, minmax(600px, 1fr))"},gap:4,justifyItems:"center",children:l.sort((d,a)=>new Date(a.lastModified)-new Date(d.lastModified)).map((d,a)=>e.jsx(C,{item:d},a))})]})},s))})})})};export{P as default};
@@ -0,0 +1 @@
1
+ import{r as p,m as b,j as e,c as H,a as M,b as R,d as $,T as d,B as n,F as f,u as Q,S as E,L as U}from"./index-CE6JgXwC.js";import{A as D}from"./namespace-DqVzlNZ0.js";import{G}from"./grid-c9ySqPWI.js";import{L as K}from"./link-BJrTt4Ej.js";import{c as k,f as _}from"./api-CQ_emPlI.js";import{c as J,a as j,u as V,b as X,d as Y,n as Z,e as q}from"./index-BHll-Wur.js";import{u as T}from"./use-field-context-DPgnX2eS.js";import{u as ee}from"./useQuery-DJATtsyt.js";import{B as y}from"./badge-D0XxOmqE.js";import{T as te,a as se,b as re,c as oe,d as ie}from"./tooltip-DsbPmc5I.js";import"./use-presence-context-w7qGDwCc.js";const[z,w]=J({name:"SwitchContext",hookName:"useSwitchContext",providerName:"<SwitchProvider />"}),W=p.forwardRef((a,l)=>{const s=w(),t=b(s.getControlProps(),a);return e.jsx(j.span,{...t,ref:l})});W.displayName="SwitchControl";const N=p.forwardRef((a,l)=>{const s=w(),t=b(s.getHiddenInputProps(),a),o=T();return e.jsx(j.input,{"aria-describedby":o?.ariaDescribedby,...t,ref:l})});N.displayName="SwitchHiddenInput";const I=p.forwardRef((a,l)=>{const s=w(),t=b(s.getLabelProps(),a);return e.jsx(j.span,{...t,ref:l})});I.displayName="SwitchLabel";const ne=a=>{const l=p.useId(),{getRootNode:s}=V(),{dir:t}=X(),o=T(),i={id:l,ids:{label:o?.ids.label,hiddenInput:o?.ids.control},dir:t,disabled:o?.disabled,readOnly:o?.readOnly,invalid:o?.invalid,required:o?.required,getRootNode:s,...a},r=Y(M,i);return H(r,Z)},A=p.forwardRef((a,l)=>{const[s,t]=q()(a,["checked","defaultChecked","disabled","form","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]),o=ne(s),i=b(o.getRootProps(),t);return e.jsx(z,{value:o,children:e.jsx(j.label,{...i,ref:l})})});A.displayName="SwitchRoot";const L=p.forwardRef((a,l)=>{const[{value:s},t]=q()(a,["value"]),o=b(s.getRootProps(),t);return e.jsx(z,{value:s,children:e.jsx(j.label,{...o,ref:l})})});L.displayName="SwitchRootProvider";const O=p.forwardRef((a,l)=>{const s=w(),t=b(s.getThumbProps(),a);return e.jsx(j.span,{...t,ref:l})});O.displayName="SwitchThumb";const{withProvider:le,withContext:C}=k({key:"card"}),ae=le("div","root"),de=C("div","body");C("div","header");C("div","footer");C("h3","title");C("p","description");const{withProvider:B,withContext:P,useStyles:ce}=k({key:"switch"});B(L,"root",{forwardAsChild:!0});const he=B(A,"root",{forwardAsChild:!0}),ue=P(I,"label",{forwardAsChild:!0}),F=P(O,"thumb",{forwardAsChild:!0}),pe=P(W,"control",{forwardAsChild:!0,defaultProps:{children:e.jsx(F,{})}});p.forwardRef(function(l,s){const t=w(),o=ce(),{fallback:i,children:r,unstyled:h,...c}=l;return e.jsx(R.span,{ref:s,"data-checked":$(t.checked),...c,css:[h?void 0:o.indicator,l.css],children:t.checked?r:i})});p.forwardRef(function(l,s){const t=w(),{fallback:o,children:i,...r}=l;return e.jsx(R.span,{ref:s,"data-checked":$(t.checked),...r,children:t.checked?i:o})});const xe=N,fe=({project:a})=>{const{projectName:l,pairSummary:s,pairSummaryByStatus:t,translationStatus:o}=a,i={translated:t.translated||0,"in flight":t["in flight"]||0,"low quality":t["low quality"]||0,untranslated:t.untranslated||0},r=Object.values(i).reduce((u,m)=>u+m,0),h=r>0?Math.round(i.translated/r*100):0,c=r>0?Math.round(i["in flight"]/r*100):0,g=r>0?Math.round(i["low quality"]/r*100):0,S=r>0?Math.round(i.untranslated/r*100):0;return e.jsx(ae,{variant:"outline",bg:"yellow.subtle",children:e.jsxs(de,{children:[e.jsx(d,{fontSize:"lg",fontWeight:"semibold",mb:2,children:l}),e.jsx(n,{mb:3,children:e.jsxs(f,{align:"center",gap:2,mb:1,children:[e.jsxs(te,{children:[e.jsx(se,{asChild:!0,children:e.jsxs(n,{flex:"1",bg:"bg.muted",rounded:"full",height:"10px",cursor:"help",position:"relative",overflow:"hidden",children:[e.jsx(n,{position:"absolute",top:"0",left:"0",height:"100%",width:`${h}%`,bg:"green.solid",transition:"width 0.3s ease"}),e.jsx(n,{position:"absolute",top:"0",left:`${h}%`,height:"100%",width:`${c}%`,bg:"blue.solid",transition:"width 0.3s ease"}),e.jsx(n,{position:"absolute",top:"0",left:`${h+c}%`,height:"100%",width:`${g}%`,bg:"yellow.solid",transition:"width 0.3s ease"}),e.jsx(n,{position:"absolute",top:"0",left:`${h+c+g}%`,height:"100%",width:`${S}%`,bg:"red.solid",transition:"width 0.3s ease"})]})}),e.jsx(re,{children:e.jsxs(oe,{maxW:"300px",bg:"bg.default",borderWidth:"1px",borderColor:"border.default",shadow:"lg",zIndex:1e3,children:[e.jsx(ie,{}),e.jsxs(n,{p:2,children:[e.jsx(d,{fontSize:"sm",fontWeight:"bold",mb:2,color:"fg.default",children:"Translation Status Details"}),o&&o.length>0?e.jsx(n,{children:o.map((u,m)=>{const x=u.q===null?"untranslated":u.q===0?"in flight":u.q>=u.minQ?"translated":"low quality",v=x==="translated"?"green.solid":x==="in flight"?"blue.solid":x==="low quality"?"yellow.solid":"red.solid";return e.jsxs(f,{align:"center",gap:2,mb:1,children:[e.jsx(n,{w:"8px",h:"8px",bg:v,borderRadius:"full"}),e.jsxs(d,{fontSize:"xs",color:"fg.default",children:["Q: ",u.q||"null"," | Segs: ",u.seg," | Words: ",u.words," | Chars: ",u.chars]})]},m)})}):e.jsxs(n,{children:[e.jsxs(f,{align:"center",gap:2,mb:1,children:[e.jsx(n,{w:"8px",h:"8px",bg:"green.solid",borderRadius:"full"}),e.jsxs(d,{fontSize:"xs",color:"fg.default",children:["Translated: ",i.translated]})]}),e.jsxs(f,{align:"center",gap:2,mb:1,children:[e.jsx(n,{w:"8px",h:"8px",bg:"blue.solid",borderRadius:"full"}),e.jsxs(d,{fontSize:"xs",color:"fg.default",children:["In Flight: ",i["in flight"]]})]}),e.jsxs(f,{align:"center",gap:2,mb:1,children:[e.jsx(n,{w:"8px",h:"8px",bg:"yellow.solid",borderRadius:"full"}),e.jsxs(d,{fontSize:"xs",color:"fg.default",children:["Low Quality: ",i["low quality"]]})]}),e.jsxs(f,{align:"center",gap:2,children:[e.jsx(n,{w:"8px",h:"8px",bg:"red.solid",borderRadius:"full"}),e.jsxs(d,{fontSize:"xs",color:"fg.default",children:["Untranslated: ",i.untranslated]})]})]})]})]})})]}),e.jsxs(d,{fontSize:"sm",color:"fg.muted",minW:"45px",children:[h,"%"]})]})}),e.jsxs(f,{gap:2,flexWrap:"wrap",align:"center",children:[e.jsxs(y,{variant:"subtle",colorPalette:"blue",children:["Segments: ",s.segs.toLocaleString()]}),e.jsxs(y,{variant:"subtle",colorPalette:"green",children:["Words: ",s.words.toLocaleString()]}),e.jsxs(y,{variant:"subtle",colorPalette:"purple",children:["Chars: ",s.chars.toLocaleString()]}),i.untranslated>0&&e.jsxs(y,{variant:"solid",colorPalette:"red",children:["Untranslated: ",i.untranslated.toLocaleString()]}),i["low quality"]>0&&e.jsxs(y,{variant:"solid",colorPalette:"orange",children:["Low Quality: ",i["low quality"].toLocaleString()]})]})]})})},$e=()=>{Q();const[a,l]=p.useState(!1),{data:s={},isLoading:t,error:o}=ee({queryKey:["status"],queryFn:()=>_("/api/status")});if(t)return e.jsx(n,{display:"flex",justifyContent:"center",mt:5,children:e.jsx(E,{size:"xl"})});if(o)return e.jsx(n,{mt:5,px:6,children:e.jsx(D,{status:"error",children:e.jsxs(n,{children:[e.jsx(d,{fontWeight:"bold",children:"Error"}),e.jsx(d,{children:o})]})})});const i=r=>{const h=Object.values(r).reduce((c,g)=>c+g,0);return h===0?100:Math.round((r.translated||0)/h*100)};return e.jsxs(n,{py:6,px:6,children:[e.jsx(f,{align:"center",gap:3,mb:6,children:e.jsxs(he,{checked:a,onCheckedChange:r=>l(r.checked),children:[e.jsx(xe,{}),e.jsx(pe,{children:e.jsx(F,{})}),e.jsx(ue,{children:e.jsx(d,{fontSize:"md",fontWeight:"medium",children:"Hide complete"})})]})}),Object.entries(s).map(([r,h])=>Object.entries(h).map(([c,g])=>e.jsxs(n,{mb:6,p:4,borderWidth:"1px",borderRadius:"md",bg:"white",borderColor:"border.default",children:[e.jsx(n,{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap",mb:4,children:e.jsxs(K,{as:U,to:`/status/${r}/${c}`,fontSize:"xl",fontWeight:"semibold",color:"blue.600",_hover:{textDecoration:"underline"},children:[r," → ",c]})}),Object.entries(g).map(([S,u])=>e.jsxs(n,{mb:4,children:[e.jsx(n,{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap",mb:3,children:e.jsxs(n,{children:[e.jsx(d,{fontSize:"sm",color:"fg.muted",mb:1,children:"Channel"}),e.jsx(d,{fontSize:"lg",fontWeight:"medium",color:"green.600",children:S})]})}),e.jsx(G,{templateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:4,children:Object.entries(u).filter(([m,x])=>a?i(x.pairSummaryByStatus)<100:!0).map(([m,x])=>e.jsx(fe,{project:{translationStatus:x.details||[],pairSummary:x.pairSummary,pairSummaryByStatus:x.pairSummaryByStatus,projectName:m}},`${r}-${c}-${S}-${m}`))})]},`${r}-${c}-${S}`))]},`${r}-${c}`))),Object.keys(s).length===0&&!t&&e.jsx(d,{mt:4,color:"fg.muted",children:"No active content found."})]})};export{$e as default};
@@ -0,0 +1 @@
1
+ import{e as $,u as q,r as a,j as e,B as t,S as F,T as o,F as y,f as G}from"./index-CE6JgXwC.js";import{A as H}from"./namespace-DqVzlNZ0.js";import{C as v,a as A,b as k,I as j}from"./input-C_b-hL0i.js";import{V as x}from"./v-stack-BLV93Nj6.js";import{T as J,a as K,b as M,c as _,d as Q}from"./tooltip-DsbPmc5I.js";import{u as X}from"./useQuery-DJATtsyt.js";import{f as Y}from"./api-CQ_emPlI.js";import"./index-BHll-Wur.js";import"./use-field-context-DPgnX2eS.js";import"./use-presence-context-w7qGDwCc.js";function B(l){return l.map(c=>typeof c=="string"?c:`{{${c.t}}}`).join("")}const ce=()=>{const{sourceLang:l,targetLang:c}=$();q();const[u,m]=a.useState(new Set),[W,R]=a.useState({guid:"",channel:"",prj:"",rid:"",sid:"",nsrc:"",group:"",mf:""}),[p,T]=a.useState({guid:"",channel:"",prj:"",rid:"",sid:"",nsrc:"",group:"",mf:""}),S=a.useRef(),C=a.useRef(null),d=a.useRef({}),{data:w=[],isLoading:z,isError:I,error:D}=X({queryKey:["statusDetail",l,c],queryFn:()=>Y(`/api/status/${l}/${c}`)}),h=a.useMemo(()=>w.length?w.filter(r=>Object.entries(W).every(([s,n])=>{if(!n.trim())return!0;const i=r[s];return i==null?!1:s==="nsrc"&&Array.isArray(i)?B(i).toLowerCase().includes(n.toLowerCase()):String(i).toLowerCase().includes(n.toLowerCase())})):[],[w,W]),f=a.useCallback(r=>{C.current=r},[]),g=a.useCallback(()=>{C.current=null},[]),b=a.useCallback((r,s)=>{T(n=>({...n,[r]:s})),m(new Set),clearTimeout(S.current),S.current=setTimeout(()=>{R(n=>({...n,[r]:s}))},300)},[]),O=(r,s)=>{const n=new Set(u);s?n.add(r):n.delete(r),m(n)},E=r=>{if(r){const s=new Set(h.map((n,i)=>i));m(s)}else m(new Set)},L=()=>{const r=sessionStorage.getItem("statusCart");return r?JSON.parse(r):{}},N=r=>{sessionStorage.setItem("statusCart",JSON.stringify(r))},P=()=>{const r=L(),s=`${l}|${c}`;r[s]||(r[s]={sourceLang:l,targetLang:c,tus:[]});const n=Array.from(u).map(i=>h[i]);r[s].tus.push(...n),N(r),m(new Set),window.dispatchEvent(new Event("cartUpdated"))},U=h.length>0&&u.size===h.length,V=u.size>0&&u.size<h.length;return a.useEffect(()=>{if(C.current&&d.current[C.current]){const r=d.current[C.current];setTimeout(()=>{if(r&&document.contains(r)){r.focus();const s=r.value.length;r.setSelectionRange(s,s)}},10)}},[h]),a.useEffect(()=>()=>{S.current&&clearTimeout(S.current)},[]),z?e.jsx(t,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(F,{size:"xl"})}):I?e.jsx(t,{mt:5,px:6,children:e.jsx(H,{status:"error",children:e.jsxs(t,{children:[e.jsx(o,{fontWeight:"bold",children:"Error"}),e.jsx(o,{children:D?.message||"Failed to fetch status data"})]})})}):e.jsx(t,{py:6,px:6,children:e.jsxs(x,{gap:6,align:"stretch",children:[e.jsxs(t,{children:[e.jsxs(y,{align:"center",justify:"space-between",mb:2,children:[e.jsxs(y,{align:"center",gap:3,children:[e.jsxs(o,{fontSize:"2xl",fontWeight:"bold",children:["Untranslated Content: ",l," → ",c]}),z&&e.jsx(F,{size:"sm"})]}),u.size>0&&e.jsxs(G,{colorPalette:"blue",onClick:P,children:["Add to Cart (",u.size," ",u.size===1?"TU":"TUs",")"]})]}),e.jsxs(o,{color:"fg.muted",children:["Translation units requiring translation (",h.length," of ",w.length," shown)"]})]}),e.jsxs(t,{bg:"white",borderRadius:"lg",shadow:"sm",overflow:"auto",maxH:"70vh",children:[e.jsxs(t,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(t,{as:"thead",position:"sticky",top:0,bg:"orange.subtle",zIndex:1,borderBottom:"2px",borderColor:"orange.muted",shadow:"sm",children:e.jsxs(t,{as:"tr",children:[e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(v,{checked:U,onCheckedChange:r=>E(r.checked),children:[e.jsx(A,{ref:r=>{r&&(r.indeterminate=V)}}),e.jsx(k,{})]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"GUID"}),e.jsx(j,{size:"xs",placeholder:"Filter GUID...",value:p.guid,onChange:r=>b("guid",r.target.value),onFocus:()=>f("guid"),onBlur:g,ref:r=>{r&&(d.current.guid=r)},bg:"yellow.subtle"},"guid-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"CHANNEL"}),e.jsx(j,{size:"xs",placeholder:"Filter channel...",value:p.channel,onChange:r=>b("channel",r.target.value),onFocus:()=>f("channel"),onBlur:g,ref:r=>{r&&(d.current.channel=r)},bg:"yellow.subtle"},"channel-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"PRJ"}),e.jsx(j,{size:"xs",placeholder:"Filter project...",value:p.prj,onChange:r=>b("prj",r.target.value),onFocus:()=>f("prj"),onBlur:g,ref:r=>{r&&(d.current.prj=r)},bg:"yellow.subtle"},"prj-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"RID"}),e.jsx(j,{size:"xs",placeholder:"Filter RID...",value:p.rid,onChange:r=>b("rid",r.target.value),onFocus:()=>f("rid"),onBlur:g,ref:r=>{r&&(d.current.rid=r)},bg:"yellow.subtle"},"rid-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"SID"}),e.jsx(j,{size:"xs",placeholder:"Filter SID...",value:p.sid,onChange:r=>b("sid",r.target.value),onFocus:()=>f("sid"),onBlur:g,ref:r=>{r&&(d.current.sid=r)},bg:"yellow.subtle"},"sid-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"NSRC"}),e.jsx(j,{size:"xs",placeholder:"Filter source...",value:p.nsrc,onChange:r=>b("nsrc",r.target.value),onFocus:()=>f("nsrc"),onBlur:g,ref:r=>{r&&(d.current.nsrc=r)},bg:"yellow.subtle",dir:l?.startsWith("he")||l?.startsWith("ar")?"rtl":"ltr"},"nsrc-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"GROUP"}),e.jsx(j,{size:"xs",placeholder:"Filter group...",value:p.group,onChange:r=>b("group",r.target.value),onFocus:()=>f("group"),onBlur:g,ref:r=>{r&&(d.current.group=r)},bg:"yellow.subtle"},"group-input")]})}),e.jsx(t,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:"MF"}),e.jsx(j,{size:"xs",placeholder:"Filter mf...",value:p.mf,onChange:r=>b("mf",r.target.value),onFocus:()=>f("mf"),onBlur:g,ref:r=>{r&&(d.current.mf=r)},bg:"yellow.subtle"},"mf-input")]})})]})}),e.jsx(t,{as:"tbody",children:h.map((r,s)=>e.jsxs(t,{as:"tr",_hover:{bg:"gray.subtle"},children:[e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsxs(v,{checked:u.has(s),onCheckedChange:n=>O(s,n.checked),children:[e.jsx(A,{}),e.jsx(k,{})]})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",fontFamily:"mono",color:"orange.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:r.guid})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:r.channel})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:r.prj})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:r.rid})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:r.sid})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:r.notes&&(r.notes.desc?.trim()||r.notes.ph&&Object.keys(r.notes.ph).length>0)?e.jsxs(J,{children:[e.jsx(K,{asChild:!0,children:e.jsx(o,{fontSize:"xs",noOfLines:2,cursor:"help",dir:l?.startsWith("he")||l?.startsWith("ar")?"rtl":"ltr",children:B(r.nsrc)})}),e.jsx(M,{children:e.jsxs(_,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(Q,{}),e.jsxs(t,{children:[r.notes.desc?.trim()&&e.jsx(o,{fontSize:"sm",mb:2,whiteSpace:"pre-wrap",color:"black",children:r.notes.desc}),r.notes.ph&&Object.keys(r.notes.ph).length>0&&e.jsxs(t,{children:[e.jsx(o,{fontSize:"xs",fontWeight:"bold",color:"gray.600",mb:1,children:"Placeholders:"}),Object.entries(r.notes.ph).map(([n,i])=>e.jsxs(t,{mb:1,children:[e.jsx(o,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:n}),e.jsxs(o,{fontSize:"xs",color:"gray.600",children:[i.desc," (e.g., ",i.sample,")"]})]},n))]})]})]})})]}):e.jsx(o,{fontSize:"xs",noOfLines:2,dir:l?.startsWith("he")||l?.startsWith("ar")?"rtl":"ltr",children:B(r.nsrc)})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:r.group})}),e.jsx(t,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:r.mf})})]},`${r.guid}-${s}`))})]}),h.length===0&&!z&&e.jsx(y,{justify:"center",p:8,children:e.jsx(o,{color:"fg.muted",children:"No untranslated content found for the current filters"})})]})]})})};export{ce as default};
@@ -0,0 +1 @@
1
+ import{u as f,j as e,B as t,L as j,T as s,r as g,S as b}from"./index-CE6JgXwC.js";import{A as p}from"./namespace-DqVzlNZ0.js";import{G as u}from"./grid-c9ySqPWI.js";import{S,a as w,b as y,c as z,d as W,e as C,f as A,g as $}from"./select-B7OxVhQ5.js";import{V as h}from"./v-stack-BLV93Nj6.js";import{u as v}from"./useQuery-DJATtsyt.js";import{f as I}from"./api-CQ_emPlI.js";import{L as P}from"./link-BJrTt4Ej.js";import{B as T}from"./badge-D0XxOmqE.js";import"./index-BHll-Wur.js";import"./use-presence-context-w7qGDwCc.js";import"./use-field-context-DPgnX2eS.js";const k=({sourceLang:d,targetLang:l,providers:x})=>{f();const c=o=>{switch(o){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(h,{gap:4,align:"stretch",children:[e.jsx(t,{children:e.jsx(t,{mb:2,children:e.jsxs(P,{as:j,to:`/tm/${d}/${l}`,fontSize:"xl",fontWeight:"semibold",color:"blue.600",_hover:{textDecoration:"underline"},children:[d," → ",l]})})}),e.jsx(h,{gap:3,align:"stretch",children:x.map((o,m)=>e.jsx(t,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.default",bg:"yellow.subtle",children:e.jsxs(u,{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(s,{fontSize:"xs",color:"fg.muted",mb:1,children:"Provider"}),e.jsx(s,{fontSize:"sm",fontWeight:"semibold",noOfLines:1,title:o.translationProvider,children:o.translationProvider})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(s,{fontSize:"xs",color:"fg.muted",mb:1,children:"Status"}),e.jsx(T,{colorPalette:c(o.status),size:"sm",children:o.status})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(s,{fontSize:"xs",color:"fg.muted",mb:1,children:"TUs"}),e.jsx(s,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:o.tuCount.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(s,{fontSize:"xs",color:"fg.muted",mb:1,children:"Unique"}),e.jsx(s,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:o.distinctGuids.toLocaleString()})]}),e.jsxs(t,{textAlign:"center",children:[e.jsx(s,{fontSize:"xs",color:"fg.muted",mb:1,children:"Jobs"}),e.jsx(s,{fontSize:"sm",fontWeight:"bold",color:"teal.600",children:o.jobCount.toLocaleString()})]})]})},m))})]})})},H=()=>{const d=f(),{data:l={},isLoading:x,error:c}=v({queryKey:["tmStats"],queryFn:()=>I("/api/tm/stats")}),o=g.useMemo(()=>{const r=[];return Object.entries(l).forEach(([i,n])=>{Object.keys(n).forEach(a=>{r.push({value:`${i}|${a}`,label:`${i} → ${a}`,sourceLang:i,targetLang:a})})}),r.sort((i,n)=>i.label.localeCompare(n.label))},[l]),m=r=>{if(r){const[i,n]=r.split("|");d(`/tm/${i}/${n}`)}};return x?e.jsx(t,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(b,{size:"xl"})}):c?e.jsx(t,{mt:5,px:6,children:e.jsx(p,{status:"error",children:e.jsxs(t,{children:[e.jsx(s,{fontWeight:"bold",children:"Error"}),e.jsx(s,{children:c})]})})}):e.jsx(t,{py:6,px:6,children:e.jsxs(h,{gap:6,align:"stretch",children:[o.length>0&&e.jsx(t,{width:"300px",mx:"auto",children:e.jsxs(S,{positioning:{strategy:"absolute",placement:"bottom-start",flip:!0,gutter:4,offset:{mainAxis:0,crossAxis:0}},children:[e.jsxs(w,{children:[e.jsx(s,{fontSize:"sm",flex:"1",textAlign:"left",color:"fg.muted",children:"Select language pair..."}),e.jsx(y,{})]}),e.jsx(z,{children:e.jsx(W,{zIndex:1e3,bg:"white",borderWidth:"1px",borderColor:"border.default",borderRadius:"md",shadow:"lg",maxH:"200px",overflow:"auto",minWidth:"300px",width:"300px",children:o.map(r=>e.jsxs(C,{item:r.value,value:r.value,onClick:()=>m(r.value),children:[e.jsx(A,{children:r.label}),e.jsx($,{})]},r.value))})})]})}),Object.keys(l).length===0?e.jsx(t,{p:6,borderWidth:"1px",borderRadius:"md",bg:"white",textAlign:"center",children:e.jsx(s,{color:"fg.muted",children:"No translation memory data found."})}):e.jsx(u,{templateColumns:{base:"1fr",lg:"repeat(auto-fit, minmax(600px, 1fr))"},gap:6,maxW:"none",w:"100%",children:Object.entries(l).flatMap(([r,i])=>Object.entries(i).map(([n,a])=>e.jsx(k,{sourceLang:r,targetLang:n,providers:a},`${r}-${n}`)))})]})})};export{H as default};
@@ -0,0 +1 @@
1
+ import{i as N,h as re,k as se,e as oe,u as ne,r as a,j as e,B as r,S as I,T as o,F as z,f as ie}from"./index-CE6JgXwC.js";import{A as le}from"./namespace-DqVzlNZ0.js";import{C as O,a as D,b as E,I as j}from"./input-C_b-hL0i.js";import{V as x}from"./v-stack-BLV93Nj6.js";import{T as G,a as M,b as q,c as U,d as L}from"./tooltip-DsbPmc5I.js";import{Q as ae,u as ce,f as de}from"./api-CQ_emPlI.js";import"./index-BHll-Wur.js";import"./use-field-context-DPgnX2eS.js";import"./use-presence-context-w7qGDwCc.js";var he=class extends ae{constructor(s,i){super(s,i)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){super.setOptions({...s,behavior:N()})}getOptimisticResult(s){return s.behavior=N(),super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,i){const{state:d}=s,m=super.createResult(s,i),{isFetching:w,isRefetching:W,isError:h,isRefetchError:F}=m,f=d.fetchMeta?.fetchMore?.direction,v=h&&f==="forward",S=w&&f==="forward",c=h&&f==="backward",y=w&&f==="backward";return{...m,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:se(i,d.data),hasPreviousPage:re(i,d.data),isFetchNextPageError:v,isFetchingNextPage:S,isFetchPreviousPageError:c,isFetchingPreviousPage:y,isRefetchError:F&&!v&&!c,isRefetching:W&&!S&&!y}}};function ue(s,i){return ce(s,he)}function T(s){return s.map(i=>typeof i=="string"?i:`{{${i.t}}}`).join("")}function Q(s){return new Date(s).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}const Ce=()=>{const{sourceLang:s,targetLang:i}=oe();ne();const[d,m]=a.useState(new Set),[w,W]=a.useState({guid:"",rid:"",sid:"",nsrc:"",ntgt:"",q:"",translationProvider:"",ts:"",jobGuid:""}),[h,F]=a.useState({guid:"",rid:"",sid:"",nsrc:"",ntgt:"",q:"",translationProvider:"",ts:"",jobGuid:""}),f=a.useRef(),v=a.useRef(),S=a.useRef(null),c=a.useRef({}),y=a.useMemo(()=>["tmSearch",s,i,w],[s,i,w]),{data:B,isLoading:P,isError:$,error:J,fetchNextPage:A,hasNextPage:R,isFetchingNextPage:k}=ue({queryKey:y,queryFn:async({pageParam:t=1})=>{const n=new URLSearchParams({sourceLang:s,targetLang:i,page:t.toString(),limit:"100",...Object.fromEntries(Object.entries(w).filter(([C,te])=>te.trim()!==""))});return await de(`/api/tm/search?${n}`)},getNextPageParam:(t,n)=>t.data.length===parseInt(t.limit)?n.length+1:void 0,staleTime:3e4,refetchOnWindowFocus:!1,placeholderData:t=>t}),u=a.useMemo(()=>B?.pages.flatMap(t=>t.data)||[],[B]),_=a.useCallback(t=>{P||k||(f.current&&f.current.disconnect(),f.current=new IntersectionObserver(n=>{n[0].isIntersecting&&R&&A()}),t&&f.current.observe(t))},[P,k,R,A]),g=a.useCallback(t=>{S.current=t},[]),b=a.useCallback(()=>{S.current=null},[]),p=a.useCallback((t,n)=>{F(l=>({...l,[t]:n})),m(new Set),clearTimeout(v.current),v.current=setTimeout(()=>{W(l=>({...l,[t]:n}))},300)},[]),V=(t,n)=>{const l=new Set(d);n?l.add(t):l.delete(t),m(l)},H=t=>{if(t){const n=new Set(u.map((l,C)=>C));m(n)}else m(new Set)},K=()=>{const t=sessionStorage.getItem("tmCart");return t?JSON.parse(t):{}},X=t=>{sessionStorage.setItem("tmCart",JSON.stringify(t))},Y=()=>{const t=K(),n=`${s}|${i}`;t[n]||(t[n]={sourceLang:s,targetLang:i,tus:[]});const l=Array.from(d).map(C=>u[C]);t[n].tus.push(...l),X(t),m(new Set),window.dispatchEvent(new Event("cartUpdated"))},Z=u.length>0&&d.size===u.length,ee=d.size>0&&d.size<u.length;return a.useEffect(()=>{if(S.current&&c.current[S.current]){const t=c.current[S.current];setTimeout(()=>{if(t&&document.contains(t)){t.focus();const n=t.value.length;t.setSelectionRange(n,n)}},10)}},[u]),a.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),P&&u.length===0&&!B?e.jsx(r,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(I,{size:"xl"})}):$?e.jsx(r,{mt:5,px:6,children:e.jsx(le,{status:"error",children:e.jsxs(r,{children:[e.jsx(o,{fontWeight:"bold",children:"Error"}),e.jsx(o,{children:J?.message||"Failed to fetch translation memory data"})]})})}):e.jsx(r,{py:6,px:6,children:e.jsxs(x,{gap:6,align:"stretch",children:[e.jsx(r,{children:e.jsxs(z,{align:"center",justify:"space-between",mb:2,children:[e.jsxs(z,{align:"center",gap:3,children:[e.jsxs(o,{fontSize:"2xl",fontWeight:"bold",children:["Translation Memory: ",s," → ",i]}),P&&e.jsx(I,{size:"sm"})]}),d.size>0&&e.jsxs(ie,{colorPalette:"blue",onClick:Y,children:["Add to Cart (",d.size," ",d.size===1?"TU":"TUs",")"]})]})}),e.jsxs(r,{bg:"white",borderRadius:"lg",shadow:"sm",overflow:"auto",maxH:"70vh",children:[e.jsxs(r,{as:"table",w:"100%",fontSize:"sm",children:[e.jsx(r,{as:"thead",position:"sticky",top:0,bg:"blue.subtle",zIndex:1,borderBottom:"2px",borderColor:"blue.muted",shadow:"sm",children:e.jsxs(r,{as:"tr",children:[e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"60px",textAlign:"center",children:e.jsxs(O,{checked:Z,onCheckedChange:t=>H(t.checked),children:[e.jsx(D,{ref:t=>{t&&(t.indeterminate=ee)}}),e.jsx(E,{})]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"GUID"}),e.jsx(j,{size:"xs",placeholder:"Filter GUID...",value:h.guid,onChange:t=>p("guid",t.target.value),onFocus:()=>g("guid"),onBlur:b,ref:t=>{t&&(c.current.guid=t)},bg:"yellow.subtle"},"guid-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"JOB GUID"}),e.jsx(j,{size:"xs",placeholder:"Filter Job GUID...",value:h.jobGuid,onChange:t=>p("jobGuid",t.target.value),onFocus:()=>g("jobGuid"),onBlur:b,ref:t=>{t&&(c.current.jobGuid=t)},bg:"yellow.subtle"},"jobGuid-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"RID"}),e.jsx(j,{size:"xs",placeholder:"Filter RID...",value:h.rid,onChange:t=>p("rid",t.target.value),onFocus:()=>g("rid"),onBlur:b,ref:t=>{t&&(c.current.rid=t)},bg:"yellow.subtle"},"rid-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"150px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"SID"}),e.jsx(j,{size:"xs",placeholder:"Filter SID...",value:h.sid,onChange:t=>p("sid",t.target.value),onFocus:()=>g("sid"),onBlur:b,ref:t=>{t&&(c.current.sid=t)},bg:"yellow.subtle"},"sid-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"NSRC"}),e.jsx(j,{size:"xs",placeholder:"Filter source...",value:h.nsrc,onChange:t=>p("nsrc",t.target.value),onFocus:()=>g("nsrc"),onBlur:b,ref:t=>{t&&(c.current.nsrc=t)},bg:"yellow.subtle",dir:s?.startsWith("he")||s?.startsWith("ar")?"rtl":"ltr"},"nsrc-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"350px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"NTGT"}),e.jsx(j,{size:"xs",placeholder:"Filter target...",value:h.ntgt,onChange:t=>p("ntgt",t.target.value),onFocus:()=>g("ntgt"),onBlur:b,ref:t=>{t&&(c.current.ntgt=t)},bg:"yellow.subtle",dir:i?.startsWith("he")||i?.startsWith("ar")?"rtl":"ltr"},"ntgt-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"40px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Q"}),e.jsx(j,{size:"xs",placeholder:"Quality...",value:h.q,onChange:t=>p("q",t.target.value),onFocus:()=>g("q"),onBlur:b,ref:t=>{t&&(c.current.q=t)},bg:"yellow.subtle"},"q-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Provider"}),e.jsx(j,{size:"xs",placeholder:"Provider...",value:h.translationProvider,onChange:t=>p("translationProvider",t.target.value),onFocus:()=>g("translationProvider"),onBlur:b,ref:t=>{t&&(c.current.translationProvider=t)},bg:"yellow.subtle"},"translationProvider-input")]})}),e.jsx(r,{as:"th",p:3,borderBottom:"1px",borderColor:"border.default",minW:"120px",textAlign:"left",children:e.jsxs(x,{gap:2,align:"stretch",children:[e.jsx(o,{fontSize:"sm",fontWeight:"bold",color:"blue.600",children:"Timestamp"}),e.jsx(j,{size:"xs",placeholder:"Date...",value:h.ts,onChange:t=>p("ts",t.target.value),onFocus:()=>g("ts"),onBlur:b,ref:t=>{t&&(c.current.ts=t)},bg:"yellow.subtle"},"ts-input")]})})]})}),e.jsx(r,{as:"tbody",children:u.map((t,n)=>e.jsxs(r,{as:"tr",ref:n===u.length-20?_:null,_hover:{bg:"gray.subtle"},children:[e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",textAlign:"center",children:e.jsxs(O,{checked:d.has(n),onCheckedChange:l=>V(n,l.checked),children:[e.jsx(D,{}),e.jsx(E,{})]})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",fontFamily:"mono",color:"blue.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",children:t.guid})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",fontFamily:"mono",color:"green.600",userSelect:"all",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxW:"100px",cursor:"pointer",_hover:{textDecoration:"underline"},onClick:l=>{l.preventDefault(),window.open(`/job/${t.jobGuid}`,"_blank")},children:t.jobGuid})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.rid})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",wordBreak:"break-all",whiteSpace:"normal",children:t.sid})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:t.notes?e.jsxs(G,{children:[e.jsx(M,{asChild:!0,children:e.jsx(o,{fontSize:"xs",noOfLines:2,cursor:"help",dir:s?.startsWith("he")||s?.startsWith("ar")?"rtl":"ltr",children:T(t.nsrc)})}),e.jsx(q,{children:e.jsxs(U,{maxW:"400px",bg:"yellow.100",borderWidth:"1px",borderColor:"yellow.300",shadow:"lg",children:[e.jsx(L,{}),e.jsxs(r,{children:[t.notes.desc&&e.jsx(o,{fontSize:"sm",mb:2,whiteSpace:"pre-wrap",color:"black",children:t.notes.desc}),t.notes.ph&&e.jsxs(r,{children:[e.jsx(o,{fontSize:"xs",fontWeight:"bold",color:"gray.600",mb:1,children:"Placeholders:"}),Object.entries(t.notes.ph).map(([l,C])=>e.jsxs(r,{mb:1,children:[e.jsx(o,{fontSize:"xs",fontFamily:"mono",color:"blue.600",children:l}),e.jsxs(o,{fontSize:"xs",color:"gray.600",children:[C.desc," (e.g., ",C.sample,")"]})]},l))]})]})]})})]}):e.jsx(o,{fontSize:"xs",noOfLines:2,dir:s?.startsWith("he")||s?.startsWith("ar")?"rtl":"ltr",children:T(t.nsrc)})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",noOfLines:2,dir:i?.startsWith("he")||i?.startsWith("ar")?"rtl":"ltr",children:T(t.ntgt)})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:t.q})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsx(o,{fontSize:"xs",children:t.translationProvider})}),e.jsx(r,{as:"td",p:3,borderBottom:"1px",borderColor:"border.subtle",children:e.jsxs(G,{children:[e.jsx(M,{asChild:!0,children:e.jsx(o,{fontSize:"xs",color:"fg.muted",cursor:"help",children:Q(t.ts)})}),e.jsx(q,{children:e.jsxs(U,{children:[e.jsx(L,{}),e.jsxs(o,{fontSize:"sm",children:["Job Date: ",Q(t.updatedAt)]})]})})]})})]},`${t.guid}-${n}`))})]}),k&&e.jsx(z,{justify:"center",p:4,children:e.jsx(I,{size:"md"})}),!R&&u.length>0&&e.jsx(z,{justify:"center",p:4,children:e.jsx(o,{color:"fg.muted",fontSize:"sm",children:"No more results"})}),u.length===0&&!P&&e.jsx(z,{justify:"center",p:8,children:e.jsx(o,{color:"fg.muted",children:"No translation units found for the current filters"})})]})]})})};export{Ce as default};
@@ -0,0 +1 @@
1
+ import{j as e,B as o,S as h,T as r,F as i}from"./index-CE6JgXwC.js";import{A as x}from"./namespace-DqVzlNZ0.js";import{B as a}from"./badge-D0XxOmqE.js";import{G as f}from"./grid-c9ySqPWI.js";import{V as n}from"./v-stack-BLV93Nj6.js";import{u as g}from"./useQuery-DJATtsyt.js";import{f as m}from"./api-CQ_emPlI.js";const z=()=>{const{data:t,isLoading:c,error:d}=g({queryKey:["info"],queryFn:()=>m("/api/info")});return c?e.jsx(o,{display:"flex",justifyContent:"center",mt:20,children:e.jsx(h,{size:"xl"})}):d?e.jsx(o,{mt:10,px:6,children:e.jsx(x,{status:"error",children:e.jsxs(o,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:d})]})})}):e.jsx(o,{py:8,px:6,children:e.jsxs(n,{gap:8,align:"stretch",maxW:"6xl",mx:"auto",children:[t&&e.jsx(o,{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(i,{direction:"column",gap:4,children:[e.jsxs(i,{align:"center",gap:4,children:[e.jsx("img",{src:"/logo.svg",alt:"L10n Monster",width:"60",height:"60"}),e.jsx(o,{children:e.jsx(r,{fontSize:"xl",fontWeight:"bold",color:"fg.default",lineHeight:"1.2",children:t.description})})]}),e.jsxs(n,{gap:3,align:"stretch",children:[e.jsxs(o,{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:t.version})]}),e.jsxs(o,{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:t.baseDir})]})]}),e.jsx(o,{position:"absolute",top:"-10px",right:"-10px",width:"80px",height:"80px",bg:"blue.subtle",borderRadius:"full",opacity:"0.5",zIndex:"-1"})]})}),t&&e.jsxs(f,{templateColumns:{base:"1fr",md:"1fr 1fr"},gap:6,children:[e.jsxs(o,{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 (",t.channels?.length||0,")"]}),e.jsxs(n,{gap:2,align:"stretch",maxH:"300px",overflow:"auto",children:[t.channels?.map((s,l)=>e.jsx(a,{variant:"subtle",colorPalette:"blue",fontSize:"xs",p:2,borderRadius:"md",children:s},l)),(!t.channels||t.channels.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No channels configured"})]})]}),e.jsxs(o,{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 (",t.tmStores?.length||0,")"]}),e.jsxs(n,{gap:3,align:"stretch",maxH:"300px",overflow:"auto",children:[t.tmStores?.map((s,l)=>e.jsxs(o,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"border.subtle",bg:"bg.subtle",children:[e.jsxs(i,{justify:"space-between",align:"center",mb:2,children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",color:"fg.default",children:s.id}),e.jsx(a,{variant:"subtle",colorPalette:"gray",fontSize:"xs",children:s.type})]}),e.jsxs(i,{gap:4,flexWrap:"wrap",fontSize:"xs",color:"fg.muted",children:[e.jsxs(r,{children:[e.jsx(r,{as:"span",fontWeight:"medium",children:"Access:"})," ",s.access]}),e.jsxs(r,{children:[e.jsx(r,{as:"span",fontWeight:"medium",children:"Partitioning:"})," ",s.partitioning]})]})]},l)),(!t.tmStores||t.tmStores.length===0)&&e.jsx(r,{fontSize:"sm",color:"fg.muted",children:"No TM stores configured"})]})]})]})]})})};export{z as default};
@@ -1 +1 @@
1
- import{a8 as J,r as C,t as j,b as M,j as c,a7 as _,a9 as B,aa as X,D as q,ab as V,ac as b,G as Q,ad as k,L as N,ae as F,af as Z,ag as ee,ah as te,ai as se,aj as W,J as K,M as re,K as ie}from"./index-7BvmfFYo.js";function ne(e){const{key:t,recipe:s}=e,r=J();return C.useMemo(()=>{const i=s||(t!=null?r.getSlotRecipe(t):{});return r.sva(structuredClone(i))},[t,s,r])}const ae=e=>e.charAt(0).toUpperCase()+e.slice(1),ge=e=>{const{key:t,recipe:s}=e,r=ae(t||s.className||"Component"),[i,m]=j({name:`${r}StylesContext`,errorMessage:`use${r}Styles returned is 'undefined'. Seems you forgot to wrap the components in "<${r}.Root />" `}),[n,S]=j({name:`${r}ClassNameContext`,errorMessage:`use${r}ClassNames returned is 'undefined'. Seems you forgot to wrap the components in "<${r}.Root />" `,strict:!1}),[h,v]=j({strict:!1,name:`${r}PropsContext`,providerName:`${r}PropsContext`,defaultValue:{}});function a(p){const{unstyled:o,...g}=p,f=ne({key:t,recipe:g.recipe||s}),[y,R]=C.useMemo(()=>f.splitVariantProps(g),[g,f]);return{styles:C.useMemo(()=>o?X:f(y),[o,y,f]),classNames:f.classNameMap,props:R}}function E(p,o={}){const{defaultProps:g}=o,f=y=>{const R=v(),x=C.useMemo(()=>B(g,R,y),[R,y]),{styles:w,classNames:T,props:d}=a(x);return c.jsx(i,{value:w,children:c.jsx(n,{value:T,children:c.jsx(p,{...d})})})};return f.displayName=p.displayName||p.name,f}return{StylesProvider:i,ClassNamesProvider:n,PropsProvider:h,usePropsContext:v,useRecipeResult:a,withProvider:(p,o,g)=>{const{defaultProps:f,...y}=g??{},R=M(p,{},y),x=C.forwardRef((w,T)=>{const d=v(),l=C.useMemo(()=>B(f??{},d,w),[d,w]),{styles:O,props:P,classNames:I}=a(l),G=I[o],H=c.jsx(i,{value:O,children:c.jsx(n,{value:I,children:c.jsx(R,{ref:T,...P,css:[O[o],l.css],className:_(l.className,G)})})});return g?.wrapElement?.(H,l)??H});return x.displayName=p.displayName||p.name,x},withContext:(p,o,g)=>{const f=M(p,{},g),y=C.forwardRef((R,x)=>{const{unstyled:w,...T}=R,d=m(),O=S()?.[o];return c.jsx(f,{...T,css:[!w&&o?d[o]:void 0,R.css],ref:x,className:_(R.className,O)})});return y.displayName=p.displayName||p.name,y},withRootProvider:E,useStyles:m,useClassNames:S}},be=e=>c.jsx(M.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:c.jsx("path",{d:"M20 6 9 17l-5-5"})}),xe=e=>c.jsx(M.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:c.jsx("path",{d:"m6 9 6 6 6-6"})}),Se=e=>c.jsx(M.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...e,children:c.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z"})}),we=e=>c.jsx(M.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...e,children:c.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"})}),Oe=e=>c.jsx(M.svg,{viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",...e,children:c.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 7H13V9H11V7ZM11 11H13V17H11V11Z"})}),Pe=e=>c.jsx(M.svg,{viewBox:"0 0 24 24",fill:"currentColor",...e,children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z"})});var Me=class extends q{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#r=V(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#f=void 0;#t=void 0;#a;#l;#r;#i;#C;#u;#d;#o;#c;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),A(this.#e,this.options)?this.#h():this.updateResult(),this.#R())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return D(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return D(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#b(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,s=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof b(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#e.setOptions(this.options),t._defaulted&&!Q(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&$(this.#e,s,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#e!==s||b(this.options.enabled,this.#e)!==b(t.enabled,this.#e)||k(this.options.staleTime,this.#e)!==k(t.staleTime,this.#e))&&this.#m();const i=this.#v();r&&(this.#e!==s||b(this.options.enabled,this.#e)!==b(t.enabled,this.#e)||i!==this.#n)&&this.#y(i)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),s=this.createResult(t,e);return ce(this,s)&&(this.#t=s,this.#l=this.options,this.#a=this.#e.state),s}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),t?.(r),r==="promise"&&!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),s=this.#s.getQueryCache().build(this.#s,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#h(e){this.#x();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(N)),t}#m(){this.#g();const e=k(this.options.staleTime,this.#e);if(F||this.#t.isStale||!Z(e))return;const s=ee(this.#t.dataUpdatedAt,e)+1;this.#o=setTimeout(()=>{this.#t.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#b(),this.#n=e,!(F||b(this.options.enabled,this.#e)===!1||!Z(this.#n)||this.#n===0)&&(this.#c=setInterval(()=>{(this.options.refetchIntervalInBackground||te.isFocused())&&this.#h()},this.#n))}#R(){this.#m(),this.#y(this.#v())}#g(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}#b(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const s=this.#e,r=this.options,i=this.#t,m=this.#a,n=this.#l,h=e!==s?e.state:this.#f,{state:v}=e;let a={...v},E=!1,u;if(t._optimisticResults){const l=this.hasListeners(),O=!l&&A(e,t),P=l&&$(e,s,t,r);(O||P)&&(a={...a,...se(v.data,e.options)}),t._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:L,errorUpdatedAt:p,status:o}=a;u=a.data;let g=!1;if(t.placeholderData!==void 0&&u===void 0&&o==="pending"){let l;i?.isPlaceholderData&&t.placeholderData===n?.placeholderData?(l=i.data,g=!0):l=typeof t.placeholderData=="function"?t.placeholderData(this.#d?.state.data,this.#d):t.placeholderData,l!==void 0&&(o="success",u=W(i?.data,l,t),E=!0)}if(t.select&&u!==void 0&&!g)if(i&&u===m?.data&&t.select===this.#C)u=this.#u;else try{this.#C=t.select,u=t.select(u),u=W(i?.data,u,t),this.#u=u,this.#i=null}catch(l){this.#i=l}this.#i&&(L=this.#i,u=this.#u,p=Date.now(),o="error");const f=a.fetchStatus==="fetching",y=o==="pending",R=o==="error",x=y&&f,w=u!==void 0,d={status:o,fetchStatus:a.fetchStatus,isPending:y,isSuccess:o==="success",isError:R,isInitialLoading:x,isLoading:x,data:u,dataUpdatedAt:a.dataUpdatedAt,error:L,errorUpdatedAt:p,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:a.dataUpdateCount>0||a.errorUpdateCount>0,isFetchedAfterMount:a.dataUpdateCount>h.dataUpdateCount||a.errorUpdateCount>h.errorUpdateCount,isFetching:f,isRefetching:f&&!y,isLoadingError:R&&!w,isPaused:a.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:R&&w,isStale:U(e,t),refetch:this.refetch,promise:this.#r,isEnabled:b(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const l=I=>{d.status==="error"?I.reject(d.error):d.data!==void 0&&I.resolve(d.data)},O=()=>{const I=this.#r=d.promise=V();l(I)},P=this.#r;switch(P.status){case"pending":e.queryHash===s.queryHash&&l(P);break;case"fulfilled":(d.status==="error"||d.data!==P.value)&&O();break;case"rejected":(d.status!=="error"||d.error!==P.reason)&&O();break}}return d}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#l=this.options,this.#a.data!==void 0&&(this.#d=this.#e),Q(t,e))return;this.#t=t;const s=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#p.size)return!0;const m=new Set(i??this.#p);return this.options.throwOnError&&m.add("error"),Object.keys(this.#t).some(n=>{const S=n;return this.#t[S]!==e[S]&&m.has(S)})};this.#S({listeners:s()})}#x(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#f=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}#S(e){K.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function oe(e,t){return b(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function A(e,t){return oe(e,t)||e.state.data!==void 0&&D(e,t,t.refetchOnMount)}function D(e,t,s){if(b(t.enabled,e)!==!1&&k(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&U(e,t)}return!1}function $(e,t,s,r){return(e!==t||b(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&U(e,s)}function U(e,t){return b(t.enabled,e)!==!1&&e.isStaleByTime(k(t.staleTime,e))}function ce(e,t){return!Q(e.getCurrentResult(),t)}var Y=C.createContext(!1),he=()=>C.useContext(Y);Y.Provider;function le(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ue=C.createContext(le()),de=()=>C.useContext(ue),pe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},fe=e=>{C.useEffect(()=>{e.clearReset()},[e])},Ce=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||re(s,[e.error,r])),me=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>t(s(...r)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ve=(e,t)=>e.isLoading&&e.isFetching&&!t,ye=(e,t)=>e?.suspense&&t.isPending,z=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function Ee(e,t,s){const r=he(),i=de(),m=ie(),n=m.defaultQueryOptions(e);m.getDefaultOptions().queries?._experimental_beforeQuery?.(n),n._optimisticResults=r?"isRestoring":"optimistic",me(n),pe(n,i),fe(i);const S=!m.getQueryCache().get(n.queryHash),[h]=C.useState(()=>new t(m,n)),v=h.getOptimisticResult(n),a=!r&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(E=>{const u=a?h.subscribe(K.batchCalls(E)):N;return h.updateResult(),u},[h,a]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),C.useEffect(()=>{h.setOptions(n)},[n,h]),ye(n,v))throw z(n,h,i);if(Ce({result:v,errorResetBoundary:i,throwOnError:n.throwOnError,query:m.getQueryCache().get(n.queryHash),suspense:n.suspense}))throw v.error;return m.getDefaultOptions().queries?._experimental_afterQuery?.(n,v),n.experimental_prefetchInRender&&!F&&ve(v,r)&&(S?z(n,h,i):m.getQueryCache().get(n.queryHash)?.promise)?.catch(N).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?v:h.trackResult(v)}async function Ie(e,t={}){try{const s=await fetch(e,t);if(!s.ok){let r;try{r=await s.json()}catch{}const i=r?.message||`HTTP error! status: ${s.status}`;throw new Error(i)}return await s.json()}catch(s){throw console.error("API Fetch Error:",s),s}}export{Se as C,Oe as I,Me as Q,we as W,xe as a,be as b,ge as c,Pe as d,Ie as f,Ee as u};
1
+ import{ab as J,r as C,Y as L,b as E,j as h,aa as _,ac as B,ad as X,z as q,ae as V,af as b,A as N,ag as T,I as Q,ah as F,ai as Z,aj as ee,ak as te,al as se,am as A,G as Y,J as re,H as ie}from"./index-CE6JgXwC.js";function ne(e){const{key:t,recipe:s}=e,r=J();return C.useMemo(()=>{const i=s||(t!=null?r.getSlotRecipe(t):{});return r.sva(structuredClone(i))},[t,s,r])}const ae=e=>e.charAt(0).toUpperCase()+e.slice(1),ge=e=>{const{key:t,recipe:s}=e,r=ae(t||s.className||"Component"),[i,o]=L({name:`${r}StylesContext`,errorMessage:`use${r}Styles returned is 'undefined'. Seems you forgot to wrap the components in "<${r}.Root />" `}),[n,w]=L({name:`${r}ClassNameContext`,errorMessage:`use${r}ClassNames returned is 'undefined'. Seems you forgot to wrap the components in "<${r}.Root />" `,strict:!1}),[l,v]=L({strict:!1,name:`${r}PropsContext`,providerName:`${r}PropsContext`,defaultValue:{}});function a(f){const{unstyled:c,...g}=f,m=ne({key:t,recipe:g.recipe||s}),[y,R]=C.useMemo(()=>m.splitVariantProps(g),[g,m]);return{styles:C.useMemo(()=>c?X:m(y),[c,y,m]),classNames:m.classNameMap,props:R}}function I(f,c={}){const{defaultProps:g}=c,m=y=>{const R=v(),x=C.useMemo(()=>B(g,R,y),[R,y]),{styles:S,classNames:k,props:p}=a(x);return h.jsx(i,{value:S,children:h.jsx(n,{value:k,children:h.jsx(f,{...p})})})};return m.displayName=f.displayName||f.name,m}return{StylesProvider:i,ClassNamesProvider:n,PropsProvider:l,usePropsContext:v,useRecipeResult:a,withProvider:(f,c,g)=>{const{defaultProps:m,...y}=g??{},R=E(f,{},y),x=C.forwardRef((S,k)=>{const p=v(),u=C.useMemo(()=>B(m??{},p,S),[p,S]),{styles:O,props:P,classNames:M}=a(u),G=M[c],H=h.jsx(i,{value:O,children:h.jsx(n,{value:M,children:h.jsx(R,{ref:k,...P,css:[O[c],u.css],className:_(u.className,G)})})});return g?.wrapElement?.(H,u)??H});return x.displayName=f.displayName||f.name,x},withContext:(f,c,g)=>{const m=E(f,{},g),y=C.forwardRef((R,x)=>{const{unstyled:S,...k}=R,p=o(),O=w()?.[c];return h.jsx(m,{...k,css:[!S&&c?p[c]:void 0,R.css],ref:x,className:_(R.className,O)})});return y.displayName=f.displayName||f.name,y},withRootProvider:I,useStyles:o,useClassNames:w}},be=e=>h.jsx(E.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:h.jsx("path",{d:"M20 6 9 17l-5-5"})}),xe=e=>h.jsx(E.svg,{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:h.jsx("path",{d:"m6 9 6 6 6-6"})}),we=e=>h.jsx(E.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...e,children:h.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z"})}),Se=e=>h.jsx(E.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...e,children:h.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"})}),Oe=e=>h.jsx(E.svg,{viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",...e,children:h.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 7H13V9H11V7ZM11 11H13V17H11V11Z"})}),Pe=e=>h.jsx(E.svg,{viewBox:"0 0 24 24",fill:"currentColor",...e,children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.7071 6.70711C19.0976 6.31658 19.0976 5.68342 18.7071 5.29289C18.3166 4.90237 17.6834 4.90237 17.2929 5.29289L12 10.5858L6.70711 5.29289C6.31658 4.90237 5.68342 4.90237 5.29289 5.29289C4.90237 5.68342 4.90237 6.31658 5.29289 6.70711L10.5858 12L5.29289 17.2929C4.90237 17.6834 4.90237 18.3166 5.29289 18.7071C5.68342 19.0976 6.31658 19.0976 6.70711 18.7071L12 13.4142L17.2929 18.7071C17.6834 19.0976 18.3166 19.0976 18.7071 18.7071C19.0976 18.3166 19.0976 17.6834 18.7071 17.2929L13.4142 12L18.7071 6.70711Z"})});var Ee=class extends q{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#r=V(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#f=void 0;#t=void 0;#a;#l;#r;#i;#m;#u;#d;#o;#c;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),W(this.#e,this.options)?this.#h():this.updateResult(),this.#R())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return D(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return D(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#b(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,s=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof b(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#e.setOptions(this.options),t._defaulted&&!N(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&$(this.#e,s,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#e!==s||b(this.options.enabled,this.#e)!==b(t.enabled,this.#e)||T(this.options.staleTime,this.#e)!==T(t.staleTime,this.#e))&&this.#C();const i=this.#v();r&&(this.#e!==s||b(this.options.enabled,this.#e)!==b(t.enabled,this.#e)||i!==this.#n)&&this.#y(i)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),s=this.createResult(t,e);return ce(this,s)&&(this.#t=s,this.#l=this.options,this.#a=this.#e.state),s}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),t?.(r),r==="promise"&&!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),s=this.#s.getQueryCache().build(this.#s,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#h(e){this.#x();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Q)),t}#C(){this.#g();const e=T(this.options.staleTime,this.#e);if(F||this.#t.isStale||!Z(e))return;const s=ee(this.#t.dataUpdatedAt,e)+1;this.#o=setTimeout(()=>{this.#t.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#b(),this.#n=e,!(F||b(this.options.enabled,this.#e)===!1||!Z(this.#n)||this.#n===0)&&(this.#c=setInterval(()=>{(this.options.refetchIntervalInBackground||te.isFocused())&&this.#h()},this.#n))}#R(){this.#C(),this.#y(this.#v())}#g(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}#b(){this.#c&&(clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const s=this.#e,r=this.options,i=this.#t,o=this.#a,n=this.#l,l=e!==s?e.state:this.#f,{state:v}=e;let a={...v},I=!1,d;if(t._optimisticResults){const u=this.hasListeners(),O=!u&&W(e,t),P=u&&$(e,s,t,r);(O||P)&&(a={...a,...se(v.data,e.options)}),t._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:j,errorUpdatedAt:f,status:c}=a;d=a.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&c==="pending"){let u;i?.isPlaceholderData&&t.placeholderData===n?.placeholderData?(u=i.data,g=!0):u=typeof t.placeholderData=="function"?t.placeholderData(this.#d?.state.data,this.#d):t.placeholderData,u!==void 0&&(c="success",d=A(i?.data,u,t),I=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===o?.data&&t.select===this.#m)d=this.#u;else try{this.#m=t.select,d=t.select(d),d=A(i?.data,d,t),this.#u=d,this.#i=null}catch(u){this.#i=u}this.#i&&(j=this.#i,d=this.#u,f=Date.now(),c="error");const m=a.fetchStatus==="fetching",y=c==="pending",R=c==="error",x=y&&m,S=d!==void 0,p={status:c,fetchStatus:a.fetchStatus,isPending:y,isSuccess:c==="success",isError:R,isInitialLoading:x,isLoading:x,data:d,dataUpdatedAt:a.dataUpdatedAt,error:j,errorUpdatedAt:f,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:a.dataUpdateCount>0||a.errorUpdateCount>0,isFetchedAfterMount:a.dataUpdateCount>l.dataUpdateCount||a.errorUpdateCount>l.errorUpdateCount,isFetching:m,isRefetching:m&&!y,isLoadingError:R&&!S,isPaused:a.fetchStatus==="paused",isPlaceholderData:I,isRefetchError:R&&S,isStale:U(e,t),refetch:this.refetch,promise:this.#r,isEnabled:b(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const u=M=>{p.status==="error"?M.reject(p.error):p.data!==void 0&&M.resolve(p.data)},O=()=>{const M=this.#r=p.promise=V();u(M)},P=this.#r;switch(P.status){case"pending":e.queryHash===s.queryHash&&u(P);break;case"fulfilled":(p.status==="error"||p.data!==P.value)&&O();break;case"rejected":(p.status!=="error"||p.error!==P.reason)&&O();break}}return p}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#l=this.options,this.#a.data!==void 0&&(this.#d=this.#e),N(t,e))return;this.#t=t;const s=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#p.size)return!0;const o=new Set(i??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#t).some(n=>{const w=n;return this.#t[w]!==e[w]&&o.has(w)})};this.#w({listeners:s()})}#x(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#f=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}#w(e){Y.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function oe(e,t){return b(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function W(e,t){return oe(e,t)||e.state.data!==void 0&&D(e,t,t.refetchOnMount)}function D(e,t,s){if(b(t.enabled,e)!==!1&&T(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&U(e,t)}return!1}function $(e,t,s,r){return(e!==t||b(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&U(e,s)}function U(e,t){return b(t.enabled,e)!==!1&&e.isStaleByTime(T(t.staleTime,e))}function ce(e,t){return!N(e.getCurrentResult(),t)}var K=C.createContext(!1),he=()=>C.useContext(K);K.Provider;function le(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ue=C.createContext(le()),de=()=>C.useContext(ue),pe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},fe=e=>{C.useEffect(()=>{e.clearReset()},[e])},me=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||re(s,[e.error,r])),Ce=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>t(s(...r)):t(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},ve=(e,t)=>e.isLoading&&e.isFetching&&!t,ye=(e,t)=>e?.suspense&&t.isPending,z=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function Ie(e,t,s){const r=he(),i=de(),o=ie(),n=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(n),n._optimisticResults=r?"isRestoring":"optimistic",Ce(n),pe(n,i),fe(i);const w=!o.getQueryCache().get(n.queryHash),[l]=C.useState(()=>new t(o,n)),v=l.getOptimisticResult(n),a=!r&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(I=>{const d=a?l.subscribe(Y.batchCalls(I)):Q;return l.updateResult(),d},[l,a]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),C.useEffect(()=>{l.setOptions(n)},[n,l]),ye(n,v))throw z(n,l,i);if(me({result:v,errorResetBoundary:i,throwOnError:n.throwOnError,query:o.getQueryCache().get(n.queryHash),suspense:n.suspense}))throw v.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(n,v),n.experimental_prefetchInRender&&!F&&ve(v,r)&&(w?z(n,l,i):o.getQueryCache().get(n.queryHash)?.promise)?.catch(Q).finally(()=>{l.updateResult()}),n.notifyOnChangeProps?v:l.trackResult(v)}async function Me(e,t={}){try{const s=await fetch(e,t);if(!s.ok){let r;try{r=await s.json()}catch{}const i=r?.message||`HTTP error! status: ${s.status}`,o=new Error(i);throw o.status=s.status,o.response=s,o}return await s.json()}catch(s){if(console.error("API Fetch Error:",s),s.status||s.response)throw s;const r=new Error(s.message||"Network error");throw r.originalError=s,r}}export{xe as C,Oe as I,Ee as Q,Se as W,be as a,Pe as b,ge as c,we as d,Me as f,Ie as u};
@@ -0,0 +1 @@
1
+ import{g as e}from"./index-CE6JgXwC.js";const{withContext:t}=e({key:"badge"}),a=t("span");export{a as B};
@@ -1 +1 @@
1
- import{r as g,j as p,b as w}from"./index-7BvmfFYo.js";const x=g.forwardRef(function(o,r){const{templateAreas:t,column:s,row:e,autoFlow:i,autoRows:a,templateRows:l,autoColumns:n,templateColumns:d,inline:m,...u}=o;return p.jsx(w.div,{...u,ref:r,css:[{display:m?"inline-grid":"grid",gridTemplateAreas:t,gridAutoColumns:n,gridColumn:s,gridRow:e,gridAutoFlow:i,gridAutoRows:a,gridTemplateRows:l,gridTemplateColumns:d},o.css]})});export{x as G};
1
+ import{r as g,j as p,b as w}from"./index-CE6JgXwC.js";const x=g.forwardRef(function(o,r){const{templateAreas:t,column:s,row:e,autoFlow:i,autoRows:a,templateRows:l,autoColumns:n,templateColumns:d,inline:m,...u}=o;return p.jsx(w.div,{...u,ref:r,css:[{display:m?"inline-grid":"grid",gridTemplateAreas:t,gridAutoColumns:n,gridColumn:s,gridRow:e,gridAutoFlow:i,gridAutoRows:a,gridTemplateRows:l,gridTemplateColumns:d},o.css]})});export{x as G};
@@ -0,0 +1 @@
1
+ import{r as c,m as J,Z as B,_ as Z,$ as G,a0 as H,a1 as w,a2 as V,a3 as K,a4 as b,a5 as D,a6 as Q,a7 as X,a8 as Y}from"./index-CE6JgXwC.js";function tt(t,n){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${n}`}function A(t={}){const{name:n,strict:r=!0,hookName:o="useContext",providerName:u="Provider",errorMessage:i,defaultValue:d}=t,f=c.createContext(d);f.displayName=n;function g(){const v=c.useContext(f);if(!v&&r){const y=new Error(i??tt(o,u));throw y.name="ContextError",Error.captureStackTrace?.(y,g),y}return v}return[f.Provider,g,f]}const[at,it]=A({name:"EnvironmentContext",hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:{getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window}});function et(...t){return n=>{const r=[];for(const o of t)if(typeof o=="function"){const u=o(n);typeof u=="function"&&r.push(u)}else o&&(o.current=n);if(r.length)return()=>{for(const o of r)o()}}}function nt(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}const j=t=>{const n=c.memo(c.forwardRef((r,o)=>{const{asChild:u,children:i,...d}=r;if(!u)return c.createElement(t,{...d,ref:o},i);if(!c.isValidElement(i))return null;const f=c.Children.only(i),g=nt(f);return c.cloneElement(f,{...J(d,f.props),ref:o?et(o,g):g})}));return n.displayName=t.displayName||t.name,n},rt=()=>{const t=new Map;return new Proxy(j,{apply(n,r,o){return j(o[0])},get(n,r){const o=r;return t.has(o)||t.set(o,j(o)),t.get(o)}})},ft=rt(),[lt,dt]=A({name:"LocaleContext",hookName:"useLocaleContext",providerName:"<LocaleProvider />",strict:!1,defaultValue:{dir:"ltr",locale:"en-US"}}),gt=()=>(t,n)=>n.reduce((r,o)=>{const[u,i]=r,d=o;return i[d]!==void 0&&(u[d]=i[d]),delete i[d],[u,i]},[{},{...t}]);var L=B(),F=typeof globalThis.document<"u"?c.useLayoutEffect:c.useEffect;function k(t){const n=t().value??t().defaultValue,r=t().isEqual??Object.is,[o]=c.useState(n),[u,i]=c.useState(o),d=t().value!==void 0,f=c.useRef(u);f.current=d?t().value:u;const g=c.useRef(f.current);F(()=>{g.current=f.current},[u,t().value]);const v=p=>{const m=g.current,E=b(p)?p(m):p;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:E,prev:m}),d||i(E),r(E,m)||t().onChange?.(E,m)};function y(){return d?t().value:u}return{initial:o,ref:f,get:y,set(p){(t().sync?L.flushSync:K)(()=>v(p))},invoke(p,m){t().onChange?.(p,m)},hash(p){return t().hash?.(p)??String(p)}}}k.cleanup=t=>{c.useEffect(()=>t,[])};k.ref=t=>{const n=c.useRef(t);return{get:()=>n.current,set:r=>{n.current=r}}};function ot(t){const n=c.useRef(t);return{get(r){return n.current[r]},set(r,o){n.current[r]=o}}}var st=(t,n)=>{const r=c.useRef(!1),o=c.useRef(!1);c.useEffect(()=>{if(r.current&&o.current)return n();o.current=!0},[...(t??[]).map(u=>typeof u=="function"?u():u)]),c.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[])};function pt(t,n={}){const r=c.useMemo(()=>{const{id:e,ids:s,getRootNode:l}=n;return Z({id:e,ids:s,getRootNode:l})},[n]),o=(...e)=>{t.debug&&console.log(...e)},u=t.props?.({props:G(n),scope:r})??n,i=ct(u),d=t.context?.({prop:i,bindable:k,scope:r,flush:_,getContext(){return g},getComputed(){return P},getRefs(){return M},getEvent(){return E()}}),f=U(d),g={get(e){return f.current?.[e].ref.current},set(e,s){f.current?.[e].set(s)},initial(e){return f.current?.[e].initial},hash(e){const s=f.current?.[e].get();return f.current?.[e].hash(s)}},v=c.useRef(new Map),y=c.useRef(null),p=c.useRef(null),m=c.useRef({type:""}),E=()=>({...m.current,current(){return m.current},previous(){return p.current}}),$=()=>({...x,matches(...e){return e.includes(x.ref.current)},hasTag(e){return!!t.states[x.ref.current]?.tags?.includes(e)}}),M=ot(t.refs?.({prop:i,context:g})??{}),h=()=>({state:$(),context:g,event:E(),prop:i,send:W,action:S,guard:q,track:st,refs:M,computed:P,flush:_,scope:r,choose:T}),S=e=>{const s=b(e)?e(h()):e;if(!s)return;const l=s.map(a=>{const R=t.implementations?.actions?.[a];return R||D(`[zag-js] No implementation found for action "${JSON.stringify(a)}"`),R});for(const a of l)a?.(h())},q=e=>b(e)?e(h()):t.implementations?.guards?.[e](h()),O=e=>{const s=b(e)?e(h()):e;if(!s)return;const l=s.map(R=>{const C=t.implementations?.effects?.[R];return C||D(`[zag-js] No implementation found for effect "${JSON.stringify(R)}"`),C}),a=[];for(const R of l){const C=R?.(h());C&&a.push(C)}return()=>a.forEach(R=>R?.())},T=e=>Q(e).find(s=>{let l=!s.guard;return X(s.guard)?l=!!q(s.guard):b(s.guard)&&(l=s.guard(h())),l}),P=e=>{H(t.computed,()=>"[zag-js] No computed object found on machine");const s=t.computed[e];return s({context:g,event:E(),prop:i,refs:M,scope:r,computed:P})},x=k(()=>({defaultValue:t.initialState({prop:i}),onChange(e,s){s&&(v.current.get(s)?.(),v.current.delete(s)),s&&S(t.states[s]?.exit),S(y.current?.actions);const l=O(t.states[e]?.effects);if(l&&v.current.set(e,l),s===V){S(t.entry);const a=O(t.effects);a&&v.current.set(V,a)}S(t.states[e]?.entry)}})),z=c.useRef(void 0),N=c.useRef(w.NotStarted);F(()=>{queueMicrotask(()=>{const l=N.current===w.Started;N.current=w.Started,o(l?"rehydrating...":"initializing...");const a=z.current??x.initial;x.invoke(a,l?x.get():V)});const e=v.current,s=x.ref.current;return()=>{o("unmounting..."),z.current=s,N.current=w.Stopped,e.forEach(l=>l?.()),v.current=new Map,y.current=null,queueMicrotask(()=>{S(t.exit)})}},[]);const I=()=>"ref"in x?x.ref.current:x.get(),W=e=>{queueMicrotask(()=>{if(N.current!==w.Started)return;p.current=m.current,m.current=e;let s=I();const l=t.states[s].on?.[e.type]??t.on?.[e.type],a=T(l);if(!a)return;y.current=a;const R=a.target??s;o("transition",e.type,a.target||s,`(${a.actions})`);const C=R!==s;C?L.flushSync(()=>x.set(R)):a.reenter&&!C?x.invoke(s,s):S(a.actions??[])})};return t.watch?.(h()),{state:$(),send:W,context:g,prop:i,scope:r,refs:M,computed:P,event:E(),getStatus:()=>N.current}}function U(t){const n=c.useRef(t);return n.current=t,n}function ct(t){const n=U(t);return function(o){return n.current[o]}}function _(t){queueMicrotask(()=>{L.flushSync(()=>t())})}var mt=Y(t=>t);export{ft as a,dt as b,A as c,pt as d,gt as e,et as f,mt as n,it as u};