PageSourceSearch

https://scribomate.ai/_next/static/chunks/3244-9403a29de0eb2a5e.js

js scribomate.ai collected 2026-10-05 12:39:45 UTC 20,620 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3244],{356:(e,t,r)=>{r.d(t,{U:()=>a});var s=r(12115),i=r(28713),n=r(95324);function a(e){let[t,r]=(0,s.useState)(null),[a,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{if(!e){r(null),l(!0);return}let t=!1;return l(!1),r(null),(async()=>{try{let s=(0,i.U)(),{data:a,error:l}=await s.from("sys_jobs_pipeline").select("id, status, created_at").eq("book_id",e).eq("kind","whiteboard-full").order("created_at",{ascending:!1}).limit(1);if(t)return;if(l)n.v.warn("[useActivePipelineForBook] lookup failed",{context:"useActivePipelineForBook",error:l.message,metadata:{bookId:e}});else{let e=a?.[0];e&&("pending"===e.status||"running"===e.status)&&r(e.id)}}catch(r){t||n.v.warn("[useActivePipelineForBook] lookup threw",{context:"useActivePipelineForBook",error:String(r),metadata:{bookId:e}})}finally{t||l(!0)}})(),()=>{t=!0}},[e]),{activePipelineId:t,hasResolved:a}}},546:(e,t,r)=>{r.d(t,{$:()=>a});var s=r(95155);r(12115);var i=r(62432);let n={"violet-pink":"bg-gradient-to-r from-violet-500 to-pink-500","cyan-violet":"bg-gradient-to-r from-cyan-500 to-violet-500"};function a(e){let{percent:t,gradient:r="cyan-violet",className:a}=e;return(0,s.jsx)("div",{className:(0,i.cn)("h-2 rounded-full bg-highlight overflow-hidden",a),children:(0,s.jsx)("div",{className:(0,i.cn)("h-full transition-all duration-700 ease-out",n[r]),style:{width:`${t}%`}})})}},8463:(e,t,r)=>{r.d(t,{M:()=>l});var s=r(12115),i=r(18759),n=r(95324),a=r(96132);function l(){let[e,t]=(0,s.useState)(null),[r,l]=(0,s.useState)(!0),[o,c]=(0,s.useState)(null),d=(0,s.useRef)(!0),u=(0,s.useCallback)(async()=>{l(!0),c(null);try{let e=await (0,a.n)("/api/mira-cards/state");if(!d.current)return;if(e.ok){let r=await e.json();t(r)}else{let r=await e.json().catch(()=>({}));c(r.error??`HTTP ${e.status}`),t(null)}}catch(e){if(n.v.warn("[useMiraState] fetch failed",{context:"useMiraState",error:e instanceof Error?e.message:String(e)}),!d.current)return;c(String(e)),t(null)}finally{d.current&&l(!1)}},[]);return(0,s.useEffect)(()=>{d.current=!0,u();let e=i.m.on("bookListChanged",()=>{u()});return()=>{d.current=!1,e()}},[u]),{state:e,isLoading:r,error:o,refetch:u}}},9696:(e,t,r)=>{r.d(t,{W:()=>u});var s=r(95155);r(12115);var i=r(76439),n=r(62432),a=r(92841),l=r(62685);let o={common:"",magic:"ring-2 ring-violet-500/60",epic:"ring-2 ring-orange-500/70",legendary:"ring-2 ring-amber-400 shadow-[0_0_22px_-2px_rgba(245,158,11,0.6)]"},c={red:"bg-gradient-to-br from-red-700 to-red-900",amber:"bg-gradient-to-br from-amber-700 to-amber-900",cyan:"bg-gradient-to-br from-cyan-700 to-cyan-900",orange:"bg-gradient-to-br from-orange-700 to-orange-900",violet:"bg-gradient-to-br from-violet-700 to-violet-900",green:"bg-gradient-to-br from-green-700 to-green-900",mint:"bg-gradient-to-br from-emerald-700 to-emerald-900"},d={xs:"w-12 aspect-[5/7]",sm:"w-16 aspect-[5/7]",md:"w-24 aspect-[5/7]",lg:"w-40 aspect-[5/7]"};function u(e){let{card:t,imageUrl:r,upgradeLevel:u=0,animationProfile:m="reduced",locked:h=!1,offlineDisabled:x=!1,size:f="md",tilt:p,showName:b=!0,locale:g="de",onClick:y,className:v,title:w}=e,j=t.i18n[g],k=p?{transform:`rotate(${p}deg)`}:void 0;if(h)return(0,s.jsx)("div",{style:{...k,background:"repeating-linear-gradient(135deg, #f5f0e3 0 4px, #ece4d0 4px 5px)"},className:(0,n.cn)(d[f],"relative rounded-[2px] overflow-hidden","border border-dashed border-text-muted/60","flex items-center justify-center",v),children:(0,s.jsx)("span",{className:"font-serif italic text-text-muted/70",style:{fontSize:"xs"===f?28:"sm"===f?36:"md"===f?48:64},children:"?"})});let N=y?"button":"div",C=(0,a.P$)(u,t.rarity,m),_=(0,a.ps)(u,m);return(0,s.jsxs)(N,{type:y?"button":void 0,onClick:y,style:{...k,...C},title:w,"aria-disabled":x||void 0,className:(0,n.cn)(d[f],"relative rounded-lg overflow-hidden text-left",c[t.tone]??"bg-slate-700",(u&l.yJ)==0&&o[t.rarity],(u&l.yJ)!=0&&"border-solid",y&&!x&&"cursor-pointer transition-transform hover:scale-[1.02]",x&&"opacity-50 cursor-not-allowed",v),"aria-label":j.name,children:[r?(0,s.jsx)("img",{src:r,alt:j.name,draggable:!1,
1crossOrigin:"anonymous",className:(0,n.cn)("absolute inset-0 w-full h-full object-cover",_)}):(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-white/60 text-4xl",children:t.symbol}),(0,s.jsx)(a.zG,{level:u,rarity:t.rarity,animationProfile:m,borderRadius:8}),x&&(0,s.jsx)("span",{"aria-hidden":"true",className:(0,n.cn)("absolute top-1 right-1 z-20 inline-flex items-center justify-center rounded-full","bg-red-500/15 text-red-600 dark:text-red-400","xs"===f?"w-4 h-4":"sm"===f?"w-5 h-5":"w-6 h-6"),children:(0,s.jsx)(i.A,{className:"xs"===f?"w-2.5 h-2.5":"sm"===f?"w-3 h-3":"w-3.5 h-3.5"})}),b&&(0,s.jsx)("div",{className:"absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-black/70 to-transparent z-10",children:(0,s.jsx)("div",{className:"text-white text-xs font-serif font-semibold leading-tight",children:j.name})})]})}},13993:(e,t,r)=>{r.d(t,{e:()=>s});function s(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"whiteboard.pipeline.phaseNames",s=t(`${r}.${e.currentPhase}`,e.currentPhase);return{phaseLabel:s,percent:Math.min(99,Math.max(2,e.progressPercent)),subProgressText:e.subPhaseProgress?`${e.subPhaseProgress.current}/${e.subPhaseProgress.total}`:null}}},27239:(e,t,r)=>{r.d(t,{e:()=>i});var s=r(356);function i(e){let{activePipelineId:t,hasResolved:r}=(0,s.U)(e);return{resumedPipelineId:t,hasResolved:r}}},27888:(e,t,r)=>{r.d(t,{_:()=>c,t:()=>d});var s=r(95155),i=r(12115),n=r(47650),a=r(79114),l=r(50897),o=r(62432);function c(e){let{name:t,age:r,onEdit:i,className:n}=e,{t:c}=(0,a.Bd)(),d=!t||!r;return(0,s.jsxs)("div",{className:(0,o.cn)("flex items-center gap-3 px-4 py-2 rounded-full","bg-panel border border-border text-text-secondary","text-sm",n),children:[d?(0,s.jsx)("span",{className:"font-serif italic",children:c("miraCards.kidChip.missing")}):(0,s.jsxs)("span",{className:"font-serif italic",children:[c("miraCards.kidChip.prefix"),": ",(0,s.jsx)("span",{className:"text-text-primary",children:t}),","," ",r," ",c("miraCards.kidChip.years")]}),(0,s.jsx)(l.$_,{size:"sm",onClick:i,children:c("miraCards.kidChip.edit")})]})}function d(e){let{open:t,initialName:r,initialAge:o,onClose:c,onSave:d}=e,{t:u}=(0,a.Bd)(),[m,h]=(0,i.useState)(r??""),[x,f]=(0,i.useState)(o??5),[p,b]=(0,i.useState)(!1),[g,y]=(0,i.useState)(t),[v,w]=(0,i.useState)(!1),[j,k]=(0,i.useState)(null);if((0,i.useEffect)(()=>{"u">typeof document&&k(document.body)},[]),(0,i.useEffect)(()=>{if(t)y(!0),requestAnimationFrame(()=>w(!0));else{w(!1);let e=setTimeout(()=>y(!1),280);return()=>clearTimeout(e)}},[t]),(0,i.useEffect)(()=>{t&&(h(r??""),f(o??5))},[t,r,o]),!g||!j)return null;let N=m.trim().length>0&&x>=2&&x<=13,C=async()=>{if(N){b(!0);try{await d(m.trim(),x),c()}finally{b(!1)}}};return(0,n.createPortal)((0,s.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 transition-[background-color,backdrop-filter] duration-[280ms] ease-out",onClick:c,style:{background:v?"rgba(26,24,21,.6)":"rgba(26,24,21,0)",backdropFilter:v?"blur(4px)":"blur(0px)",WebkitBackdropFilter:v?"blur(4px)":"blur(0px)"},children:(0,s.jsxs)("div",{className:"bg-panel w-full sm:max-w-md rounded-2xl p-6 shadow-2xl",style:{transform:v?"scale(1)":"scale(0.96)",opacity:+!!v,transition:"transform 220ms ease-out, opacity 220ms ease-out",willChange:"transform, opacity"},onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h3",{className:"font-serif text-lg text-text-primary mb-4",children:u("miraCards.kidChip.sheet.title")}),(0,s.jsxs)("label",{className:"block mb-3",children:[(0,s.jsx)("span",{className:"text-sm text-text-secondary",children:u("miraCards.kidChip.sheet.name")}),(0,s.jsx)("input",{type:"text",value:m,onChange:e=>h(e.target.value),placeholder:u("miraCards.kidChip.sheet.namePlaceholder"),maxLength:40,className:"w-full mt-1 px-3 py-2 border border-border rounded-md bg-background"})]}),(0,s.jsxs)("label",{className:"block mb-5",children:[(0,s.jsxs)("span",{className:"text-sm text-text-secondary",children:[u("miraCards.kidChip.sheet.age"),": ",x]}),(0,s.jsx)("input",{type:"range",min:2,max:13,value:x,onChange:e=>f(Number(e.target.value)),className:"w-full mt-2"})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,s.jsx)(l.$_,{onClick:c,children:u("miraCards.kidChip.sheet.cancel")}),(0,s.jsx)(l.$_,{size:"lg",onClick:C,children:p?"…":u("miraCards.kidChip.sheet.save")})]})]})}),j)}},28076:(e,t,r)=>{r.d(t,{OfflineFallbackServer:()=>u,p:()=>d,s:()=>c});var s=r(95155);r(12115);var i=r(76439),n=r(80723),a=r(73321),l=r(6839),o=r(75638);function c(e){let{title:t,body:r,backLabel:l,hideBack:c}=e,d=(0,o.Se)(),u=(0,a.useRouter)();return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-16 text-center text-text-primary",children:[(0,s.jsx)(i.A,{className:"w-12 h-12 text-text-muted","aria-hidden":"true"}),(0,s.jsx)("h1",{className:"text-xl font-semibold",children:t??d("pwa.offline.fallback.title")}),(0,s.jsx)("p",{className:"max-w-md text-sm text-text-secondary",children:r??d("pwa.offline.fallback.body")}),!c&&(0,s.jsxs)("button",{type:"button",onClick:()=>u.back(),className:"mt-2 inline-flex items-center gap-2 rounded-md border border-border bg-panel px-4 py-2 text-sm hover:bg-highlight-hover",children:[(0,s.jsx)(n.A,{className:"w-4 h-4"}),l??d("pwa.offline.fallback.back")]})]})}function d(e){let{children:t}=e,{isOnline:r}=(0,l.nD)();return r?(0,s.jsx)(s.Fragment,{children:t}):(0,s.jsx)(c,{})}function u(e){let{title:t,body:r,backLabel:a,backHref:l}=e;return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-16 text-center text-text-primary",children:[(0,s.jsx)(i.A,{className:"w-12 h-12 text-text-muted","aria-hidden":"true"}),(0,s.jsx)("h1",{className:"text-xl font-semibold",children:t}),(0,s.jsx)("p",{className:"max-w-md text-sm text-text-secondary",children:r}),(0,s.jsxs)("a",{href:l,className:"mt-2 inline-flex items-center gap-2 rounded-md border border-border bg-panel px-4 py-2 text-sm hover:bg-highlight-hover",children:[(0,s.jsx)(n.A,{className:"w-4 h-4"}),a]})]})}},39854:(e,t,r)=>{r.d(t,{S:()=>s});function s(e,t,r){return e.on("postgres_changes",t,r)}},50455:(e,t,r)=>{r.d(t,{K:()=>n});let s={pending:"PENDING",running:"PROCESSING",completed:"COMPLETED",failed:"ERROR"},i={status:"PENDING",currentPhase:"init",subPhase:null,subPhaseProgress:null,progressPercent:0,phaseResults:{},warnings:[]},n=e=>{let{pipeline:t,children:r}=e;if(!t)return i;let n=t.input_config??{},a=n.options?.conversationRounds??4,l=n.options?.sectionCount??5,o=t.current_phase??"init",c=t.sub_phase??null,d=r.filter(e=>"whiteboard-chat"===e.use_case&&"completed"===e.status).length,u=r.some(e=>"whiteboard-chat"===e.use_case&&("pending"===e.status||"running"===e.status)),m=r.filter(e=>"generate-whiteboard-story-section"===e.use_case&&"completed"===e.status).length,h=r.some(e=>"generate-whiteboard-story-section"===e.use_case&&("pending"===e.status||"running"===e.status)),x=null;"story"===o&&"conversation"===c?x={current:Math.min(d+ +!!u,a),total:a}:"section-writing"===o&&(x={current:Math.min(m+ +!!h,l),total:l});let f={},p=["init","story","section-writing","done"],b=p.indexOf(o);for(let e=0;e<p.length;e++)(e<b||"done"===o&&e<=b)&&(f[p[e]]={phase:p[e],status:"success",durationMs:0});return"failed"===t.status&&(f[o]={phase:o,status:"error",durationMs:0,error:t.error_message??void 0}),{status:s[t.status],currentPhase:o,subPhase:c,subPhaseProgress:x,progressPercent:t.progress_percent??0,phaseResults:f,warnings:[],bookId:t.book_id??void 0,startedAt:t.started_at??void 0,inputConfig:n}}},60545:(e,t,r)=>{r.d(t,{q:()=>c});var s=r(12115),i=r(95324),n=r(61319),a=r(96132);let l=new Map;async function o(e){let t=l.get(e.mode);if(t)return t;let r=(async()=>{try{let t=await (0,a.n)(`/api/mira-cards/${e.mode}/initiate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.body)});if(!t.ok){let e=await t.json().catch(()=>null);return{ok:!1,apiError:(0,n.I4)(t.status,e)}}let r=await t.json();return{ok:!0,jobId:r.jobId,bookId:r.bookId}}catch(t){return i.v.error(`[mira-cards/${e.mode}] Submit failed`,{context:`MiraCards${e.mode}`,error:String(t)}),{ok:!1,apiError:{kind:"unknown",status:0,message:String(t)}}}})();return l.set(e.mode,r),r.finally(()=>l.delete(e.mode)),r}
1function c(){let[e,t]=(0,s.useState)(!1),[r,i]=(0,s.useState)(null);return{initiate:(0,s.useCallback)(async e=>{t(!0),i(null);try{let t=await o(e);return t.ok||i(t.apiError),t}finally{t(!1)}},[]),isSubmitting:e,error:r}}},61319:(e,t,r)=>{r.d(t,{I4:()=>i,QN:()=>n,Yo:()=>s});class s extends Error{constructor(e,t){super("Insufficient credits"),this.creditsRequired=e,this.creditsRemaining=t,this.kind="insufficient-credits",this.name="InsufficientCreditsError",Object.setPrototypeOf(this,s.prototype)}}function i(e,t){let r=t??{};return 402===e&&r.error?.code==="INSUFFICIENT_CREDITS"?{kind:"insufficient-credits",creditsRequired:Number(r.error.details?.creditsRequired??0),creditsRemaining:Number(r.error.details?.creditsRemaining??0)}:{kind:"unknown",status:e,message:r.error?.message??`HTTP ${e}`}}function n(e){return e instanceof s?{creditsRequired:e.creditsRequired,creditsRemaining:e.creditsRemaining}:e&&"object"==typeof e&&"kind"in e&&"insufficient-credits"===e.kind?{creditsRequired:Number(e.creditsRequired??0),creditsRemaining:Number(e.creditsRemaining??0)}:null}},84489:(e,t,r)=>{r.d(t,{J:()=>x});var s=r(95155),i=r(12115),n=r(73321),a=r(79114),l=r(13545),o=r(6296),c=r(89463),d=r(50455),u=r(13993),m=r(546);let h={init:{de:["Mortimer schn\xfcrt seine Schuhe.","Das Tintenfass \xf6ffnet sich leise.","Mira holt ihre Schreibfeder."],en:["Mortimer ties his shoes.","An inkpot opens with a hush.","Mira fetches her quill."]},story:{de:["Figuren stellen sich vor.","Der Schauplatz \xf6ffnet seine T\xfcr.","Konflikte werden abgewogen.","Das Echo des Walds wird befragt.","Die Stimmung sucht ihre Farbe."],en:["Characters introduce themselves.","The setting opens its door.","Conflicts are being weighed.","The wood is asked for its echo.","The mood is choosing its colour."]},"section-writing":{de:["Das erste Kapitel zieht ein.","Eine Szene wird gelesen — und \xfcberarbeitet.","Der Held tappt durchs Halbdunkel.","Ein Dialog wird geprobt.","Das Tempo kalibriert sich."],en:["The first chapter sits down.","A scene is read — and rewritten.","The hero stumbles through half-light.","A dialogue is being rehearsed.","The pacing tunes itself."]},done:{de:["Gleich kannst du lesen."],en:["You can read in a moment."]}};function x(e){let{pipelineId:t,bookId:r,derivedPitch:x,onRetry:f}=e,{t:p,i18n:b}=(0,a.Bd)(),g=(0,n.useRouter)(),y=b.language?.toLowerCase().startsWith("en")?"en":"de",v=(0,c.r)({pipelineId:t,mapper:d.K}),w=v.isCompleted,j=v.isFailed,k=v.view,{phaseLabel:N,percent:C,subProgressText:_}=(0,u.e)(k,p,"miraCards.pipeline.phaseNames");(0,i.useEffect)(()=>{w&&r&&g.replace(`/books/${r}/read`)},[w,r,g]);let[S,P]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(w||j)return;let e=setInterval(()=>P(e=>e+1),6e3);return()=>clearInterval(e)},[w,j]),(0,i.useEffect)(()=>{P(0)},[k.currentPhase]);let E=(0,i.useMemo)(()=>{var e;let t;return e=k.currentPhase,0===(t=(h[e]??h.story)[y]).length?"":t[S%t.length]},[k.currentPhase,y,S]);return j?(0,s.jsxs)("div",{className:"max-w-2xl mx-auto px-6 py-16 text-center",children:[(0,s.jsx)(l.A,{className:"w-12 h-12 mx-auto mb-4 text-red-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-text-primary mb-3",children:"de"===y?"Die Geschichte konnte nicht fertig werden.":"The story could not be finished."}),v.error&&(0,s.jsx)("p",{className:"text-sm text-text-muted mb-6 max-w-md mx-auto",children:v.error}),f&&(0,s.jsx)("button",{onClick:f,className:"px-6 py-3 rounded-xl bg-violet-500 text-white font-semibold hover:bg-violet-600 transition-colors",children:"de"===y?"↺ Nochmal versuchen":"↺ Try again"})]}):w?(0,s.jsxs)("div",{className:"max-w-2xl mx-auto px-6 py-16 text-center",children:[(0,s.jsx)(o.A,{className:"w-8 h-8 mx-auto mb-4 text-violet-500 animate-spin"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"de"===y?"Geschichte wird ge\xf6ffnet…":"Opening your story…"})]}):(0,s.jsxs)("div",{className:"max-w-2xl mx-auto px-6 py-16 text-center",children:[(0,s.jsx)("div",{className:"relative w-16 h-16 mx-auto mb-6",children:(0,s.jsx)("div",{className:"w-16 h-16 rounded-full bg-violet-500/10 flex items-center justify-center",children:(0,s.jsx)(o.A,{className:"w-7 h-7 text-violet-500 animate-spin"})})}),(0,s.jsx)("h2",{className:"text-2xl font-serif italic text-text-primary mb-2",children:"de"===y?"Die Geschichte entsteht…":"The story is taking shape…"}),(0,s.jsxs)("p",{className:"text-sm text-text-secondary mb-8",children:[N,_?` \xb7 ${_}`:""]}),(0,s.jsxs)("div",{className:"max-w-md mx-auto mb-8",children:[(0,s.jsx)(m.$,{percent:C,gradient:"violet-pink"}),(0,s.jsxs)("div",{className:"text-[10px] tracking-[0.2em] text-text-muted mt-2 uppercase",children:[C,"%"]})]}),x&&(0,s.jsxs)("p",{className:"font-serif italic text-text-secondary text-sm max-w-md mx-auto leading-relaxed",children:["„",x,'"']}),(0,s.jsx)("div",{className:"mt-10 min-h-[2.5rem]",children:(0,s.jsx)("p",{className:"font-serif italic text-text-muted text-sm max-w-md mx-auto leading-relaxed animate-fade-in",children:E},`${k.currentPhase}-${S}`)}),(0,s.jsx)("p",{className:"text-xs text-text-muted mt-6",children:"de"===y?"Etwa 2–3 Minuten. Du kannst die Seite offen lassen.":"About 2–3 minutes. Feel free to leave this page open."})]})}},89463:(e,t,r)=>{r.d(t,{r:()=>o});
1var s=r(12115),i=r(28713),n=r(39854),a=r(95324),l=r(96132);function o(e){let{pipelineId:t,mapper:r}=e,[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)([]),[x,f]=(0,s.useState)(!1),p=(0,s.useRef)(r);p.current=r;let b=(0,s.useRef)(null),g=(0,s.useRef)(null),y=(0,s.useRef)(null),v=(0,s.useCallback)(async()=>{if(t)try{let e=await (0,l.n)(`/api/jobs/pipeline/${t}/status?include_children=true`);if(!e.ok){404!==e.status&&a.v.warn("usePipelineJob — fetch returned non-ok",{context:"usePipelineJob",metadata:{pipelineId:t,httpStatus:e.status}});return}let r=(await e.json()).data,s=r.children??[],i=r.exportChildren??[],{children:n,exportChildren:o,...d}=r;c(d),u([...s].sort((e,t)=>e.created_at.localeCompare(t.created_at))),h([...i].sort((e,t)=>e.created_at.localeCompare(t.created_at)))}catch(e){a.v.error("usePipelineJob — fetch failed",{context:"usePipelineJob",metadata:{pipelineId:t},error:e instanceof Error?e.message:String(e)})}},[t]);(0,s.useEffect)(()=>{if(!t){c(null),u([]),h([]),f(!1);return}f(!0);let e=(0,i.U)().channel(`pipeline_parent_${t}`),r=(0,n.S)(e,{event:"UPDATE",schema:"public",table:"sys_jobs_pipeline",filter:`id=eq.${t}`},e=>{c(e.new??null)}).subscribe(async e=>{"SUBSCRIBED"===e?(await v(),f(!1)):("CHANNEL_ERROR"===e||"TIMED_OUT"===e)&&(a.v.warn("usePipelineJob — parent channel error",{context:"usePipelineJob",metadata:{pipelineId:t,subStatus:e}}),f(!1))});return b.current=r,()=>{r.unsubscribe(),b.current=null}},[t,v]),(0,s.useEffect)(()=>{if(!t)return;let e=(0,i.U)().channel(`pipeline_children_${t}`),r=(0,n.S)(e,{event:"*",schema:"public",table:"sys_jobs_llm",filter:`pipeline_id=eq.${t}`},e=>{let t=e.new;t?.id&&u(e=>(function(e,t){let r=e.findIndex(e=>e.id===t.id);if(-1===r)return[...e,t].sort((e,t)=>e.created_at.localeCompare(t.created_at));let s=[...e];return s[r]={...s[r],...t},s})(e,t))}).subscribe();return g.current=r,()=>{r.unsubscribe(),g.current=null}},[t]),(0,s.useEffect)(()=>{if(!t)return;let e=(0,i.U)().channel(`pipeline_export_children_${t}`),r=(0,n.S)(e,{event:"*",schema:"public",table:"sys_jobs_export",filter:`pipeline_id=eq.${t}`},e=>{let t=e.new;t?.id&&h(e=>(function(e,t){let r=e.findIndex(e=>e.id===t.id);if(-1===r)return[...e,t].sort((e,t)=>e.created_at.localeCompare(t.created_at));let s=[...e];return s[r]={...s[r],...t},s})(e,t))}).subscribe();return y.current=r,()=>{r.unsubscribe(),y.current=null}},[t]),(0,s.useEffect)(()=>{if(!t)return;let e=()=>{"visible"===document.visibilityState&&o?.status&&"completed"!==o.status&&"failed"!==o.status&&v()};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[t,o?.status,v]);let w=(0,s.useMemo)(()=>p.current({pipeline:o,children:d,exportChildren:m}),[o,d,m]);return{pipelineId:t,status:o?.status??null,view:w,pipeline:o,children:d,exportChildren:m,isLoading:x,isCompleted:o?.status==="completed",isFailed:o?.status==="failed",error:o?.error_message??null,refetch:v}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.