videobook 0.2.2 → 0.2.3
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.
- package/CHANGELOG.md +25 -0
- package/README.md +7 -8
- package/dist/book-manager.js +40 -2
- package/dist/env-secrets.js +1 -0
- package/dist/image-edit-models.js +1 -0
- package/dist/media/catalog.js +13 -0
- package/dist/media/cost.js +79 -6
- package/dist/media/json-schema.js +7 -0
- package/dist/media/ref-fields.js +11 -3
- package/dist/media/request.js +49 -0
- package/dist/provider-usage.js +19 -7
- package/dist/tools/estimate-cost.js +4 -4
- package/dist/tools/provider-key-status.js +2 -0
- package/package.json +13 -13
- package/ui/assets/{alive-captions-C48o6dfv.js → alive-captions-4QySEGdt.js} +1 -1
- package/ui/assets/confirm-bodies-Bw818V9J.js +1 -0
- package/ui/assets/{fullscreen-4m0qtZ7w.js → fullscreen-CzTnPPG5.js} +1 -1
- package/ui/assets/{goal-ui-2pUWP_B2.js → goal-ui-CosrK_ko.js} +1 -1
- package/ui/assets/index-C9xjFEGL.js +37 -0
- package/ui/assets/{inspector-CnKySYc5.js → inspector-BN2fezh4.js} +1 -1
- package/ui/assets/{jobs-ui-lRoS1MbL.js → jobs-ui-C4Wgy6I1.js} +1 -1
- package/ui/assets/{music-video-BQnnPp-X.js → music-video-BSj8SgbQ.js} +1 -1
- package/ui/assets/{ui-OHFUngrc.js → ui-Cpr6zMTA.js} +1 -1
- package/ui/assets/{videobook-DZ58pKW5.js → videobook-B5G0jMoi.js} +13 -13
- package/ui/index.html +8 -8
- package/ui/assets/confirm-bodies-aq6Az8Md.js +0 -1
- package/ui/assets/index-DmDH4gYr.js +0 -37
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,j as t,a as H,b as vn}from"./vendor-react-Dj7D1fD4.js";import{da as Sn,bE as Ge,db as Nn,bP as In,bH as An,cm as dt,bQ as zt,dc as Cn,dd as Gt,de as Ut,df as kn,dg as Bt,dh as at,di as He,dj as me,dk as wn,dl as We,dm as Ft,dn as Mn,dp as Qe,dq as $n,dr as Pn,ds as Tn,an as Ot,am as Rn,dt as Ln,du as Dn,dv as _n,bB as En,dw as Gn,dx as Fn,dy as On,dz as Vn,dA as zn,dB as Jt,ad as Je,dC as Un,dD as Bn,dE as Jn,dF as Kn,dG as Hn,dH as qn,aj as Wn,dI as Qn}from"./videobook-DZ58pKW5.js";import{M as Xn,A as gt,b as Yn,R as Zn,D as es,c as ts,d as ns,e as ss,C as is,a as os,f as rs,u as as,N as ls,g as Kt,h as cs,i as ds,j as ps}from"./ui-OHFUngrc.js";import{n as Xe,b as Fe}from"./vendor-yctIZ9Dz.js";import{G as us}from"./confirm-bodies-aq6Az8Md.js";import{H as Ht,j as ms,i as Ee,c as qt,e as fs,an as hs,B as Wt,a4 as gs,$ as Qt,m as ys,C as Xt,X as xs,J as js,al as pt,ao as bs,R as vs,a3 as Ss,ad as Ns}from"./vendor-icons-CGqhCIXV.js";const Is=new Set(["extract_audio","split_video","prompt","analyze","concat","splice"]);function Yt(i){return Is.has(i)}const As=["prompt","provider","model","operation","tool","startSeconds","endSeconds","overlap","frameMode","timestampSeconds","generationMode"];function qe(i){return typeof i=="number"&&Number.isFinite(i)?String(i):"0"}function Cs(i,e=[]){const n=i.inputs?.generationSettings,r=!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(s=>{const a=s[1];return typeof a=="string"||typeof a=="number"||typeof a=="boolean"}));return{...Object.fromEntries(e.flatMap(s=>{const a=i.inputs?.[s.name];return typeof a=="string"||typeof a=="number"||typeof a=="boolean"?[[s.name,a]]:[]})),...r}}function Ze(i,e=[]){const n=i.inputs?.frameMode;return{prompt:i.prompt??"",provider:i.provider??"",model:i.model??"",operation:i.operation??"",tool:i.tool??"",startSeconds:qe(i.inputs?.startSeconds),endSeconds:qe(i.inputs?.endSeconds),overlap:qe(i.inputs?.overlap),frameMode:n==="time"||n==="last"?n:"first",timestampSeconds:qe(i.inputs?.timestampSeconds),generationMode:typeof i.inputs?.generationMode=="string"?i.inputs.generationMode:"",generationSettings:Cs(i,e)}}function ks(i,e,n=[]){const r=Bn(i,e,n);if(!r||!Ge(i.type))return Ze(i);const o=We(e,i.type,r),s=Ze(i,o?.controls);return{...s,...r,generationMode:o?Qe(o,n,s.generationMode):s.generationMode}}function ws(i,e,n=[]){const r=Ze(i,n);return As.some(o=>e[o]!==r[o])||JSON.stringify(e.generationSettings)!==JSON.stringify(r.generationSettings)}function lt(i){if(!i.trim())return!1;const e=Number(i);return Number.isFinite(e)&&e>=0}function Ms(i,e){return Ge(i.type)?!!(e.provider.trim()&&e.model.trim()&&e.operation.trim()&&e.tool.trim()):i.type==="split_video"?lt(e.startSeconds)&<(e.endSeconds):i.type==="splice"&&e.operation==="splice_video"?lt(e.overlap):!0}function Zt(i,e,n=[]){const r={...i.inputs??{}};delete r.generationMode,delete r.generationSettings;for(const o of n)delete r[o.name];return{...r,...e.generationMode?{generationMode:e.generationMode}:{},...Object.keys(e.generationSettings).length>0?{generationSettings:e.generationSettings}:{}}}function Vt(i,e,n=[],r=n){const o=Ze(i,n),s={};return e.prompt!==o.prompt&&(s.prompt=e.prompt),Yt(i.type)||(e.provider!==o.provider&&(s.provider=e.provider||void 0),e.model!==o.model&&(s.model=e.model||void 0),e.operation!==o.operation&&(s.operation=e.operation||void 0),e.tool!==o.tool&&(s.tool=e.tool||void 0)),Ge(i.type)&&(e.generationMode!==o.generationMode||JSON.stringify(e.generationSettings)!==JSON.stringify(o.generationSettings))&&(s.inputs=Zt(i,e,r)),i.type==="split_video"&&(e.startSeconds!==o.startSeconds||e.endSeconds!==o.endSeconds)&&(s.inputs={...i.inputs??{},startSeconds:Number(e.startSeconds),endSeconds:Number(e.endSeconds)}),i.type==="splice"&&e.operation==="splice_video"&&e.overlap!==o.overlap&&(s.inputs={...i.inputs??{},overlap:Number(e.overlap)}),s}function $s(i){return i.type==="extract_audio"?["video"]:i.type==="split_video"?["video","analysis"]:i.type==="analysis"?["result"]:i.type==="image"?["media","segment"]:i.type==="audio"||i.type==="video"?["media"]:[]}function Ps(i,e){const n=e.filter(r=>r.target===i.id).map(r=>r.targetInput);return[...new Set([...$s(i),...n])]}function ct(i){return i.type==="video"||i.type==="generate_video"||i.type==="concat"||i.type==="splice"}function Ts(i,e){return i||e>0}function en(i){if(i.classList.remove("inspector-source-picker-above"),!i.open)return;const e=i.querySelector("summary");e?.scrollIntoView({block:"nearest",inline:"nearest"});const n=i.querySelector(".inspector-source-picker-options"),r=i.closest(".inspector-media-content")??i.closest(".inspector-analysis-body")??i.closest(".inspector-body");if(!n||!r)return;const o=r.getBoundingClientRect(),s=(e??i).getBoundingClientRect(),a=o.bottom-s.bottom,c=s.top-o.top,d=Math.min(252,n.scrollHeight||160);a<d&&c>a&&i.classList.add("inspector-source-picker-above")}function Rs(i,e,n){return n.id===i.id?!1:i.type==="analysis"?e==="result"&&n.type==="analyze":i.type==="extract_audio"?e==="video"&&ct(n):i.type==="split_video"?e==="analysis"?n.type==="analysis":e==="video"?ct(n):!1:i.type==="prompt"&&e==="analysis"?n.type==="analysis":i.type==="audio"&&e==="media"?n.type==="extract_audio"||n.type==="generate_audio":i.type==="video"&&e==="media"?n.type==="split_video":i.type==="image"&&e==="media"?n.type==="generate_image":i.type==="image"&&e==="segment"?ct(n):!0}function Ls(i){const e=z.c(6),{address:n,onOpen:r}=i,o=`Open @${n} fullscreen`,s=`Open @${n} fullscreen`;let a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Qt,{size:14}),c=t.jsx("span",{children:"Fullscreen"}),e[0]=a,e[1]=c):(a=e[0],c=e[1]);let d;return e[2]!==r||e[3]!==o||e[4]!==s?(d=t.jsx("div",{className:"inspector-media-actions",role:"group","aria-label":"Video preview actions",children:t.jsx("span",{className:"inspector-media-action-slot",children:t.jsxs("button",{type:"button",className:"inspector-fullscreen-button","aria-label":o,title:s,onClick:r,children:[a,c]})})}),e[2]=r,e[3]=o,e[4]=s,e[5]=d):d=e[5],d}function Ds(i){const e=z.c(18),{address:n,previewUrl:r,onOpen:o,onEdit:s}=i,a=`Open @${n} fullscreen`,c=`@${n}`;let d;e[0]!==r||e[1]!==c?(d=t.jsx("img",{src:r,alt:c},r),e[0]=r,e[1]=c,e[2]=d):d=e[2];let l;e[3]!==o||e[4]!==a||e[5]!==d?(l=t.jsx("button",{type:"button",className:"inspector-cell-media-open","aria-label":a,onClick:o,children:d}),e[3]=o,e[4]=a,e[5]=d,e[6]=l):l=e[6];const u=`Edit @${n} image`,f=`Edit @${n} image`;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(gs,{size:13}),e[7]=m):m=e[7];let h;e[8]!==s||e[9]!==u||e[10]!==f?(h=t.jsxs("button",{type:"button",className:"inspector-edit-button","aria-label":u,title:f,onClick:s,children:[m,"Edit"]}),e[8]=s,e[9]=u,e[10]=f,e[11]=h):h=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("span",{className:"inspector-cell-media-zoom","aria-hidden":"true",children:[t.jsx(Qt,{size:13}),"Full"]}),e[12]=j):j=e[12];let y;e[13]!==h?(y=t.jsxs("span",{className:"inspector-cell-media-overlay",children:[h,j]}),e[13]=h,e[14]=y):y=e[14];let N;return e[15]!==y||e[16]!==l?(N=t.jsxs("div",{className:"inspector-cell-media-frame",children:[l,y]}),e[15]=y,e[16]=l,e[17]=N):N=e[17],N}function _s(i){const e=z.c(11),{address:n,waveform:r,mediaUrl:o}=i,[s,a]=H.useState(0);let c;e[0]!==s||e[1]!==r?(c=t.jsx("span",{className:"inspector-audio-waveform",children:r.length>0?t.jsx(Kt,{peaks:r,progress:s}):t.jsx(cs,{})}),e[0]=s,e[1]=r,e[2]=c):c=e[2];const d=`@${n} audio`;let l,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h=>{const j=h.currentTarget;a(Number.isFinite(j.duration)&&j.duration>0?Math.min(1,Math.max(0,j.currentTime/j.duration)):0)},u=()=>a(0),e[3]=l,e[4]=u):(l=e[3],u=e[4]);let f;e[5]!==o||e[6]!==d?(f=t.jsx("audio",{src:o,"aria-label":d,controls:!0,preload:"metadata",onTimeUpdate:l,onEnded:u},o),e[5]=o,e[6]=d,e[7]=f):f=e[7];let m;return e[8]!==c||e[9]!==f?(m=t.jsxs("div",{className:"inspector-audio-stage",children:[c,f]}),e[8]=c,e[9]=f,e[10]=m):m=e[10],m}function ut(i){const e=z.c(34),{asset:n,address:r,allowFullscreen:o,overlayMetadata:s,onOpenFullscreen:a}=i,c=s===void 0?!0:s,d=H.useRef(null),l=n.mediaUrl,u=n.thumbnailUrl??l,f=n.type==="video"||n.type==="final",m=n.type==="audio",h=n.type==="image",j=o&&(h||f);let y;e[0]!==n||e[1]!==a?(y=I=>{const k=I===void 0?"view":I;d.current?.pause(),a(n,k)},e[0]=n,e[1]=a,e[2]=y):y=e[2];const N=y;if(!u)return null;const b=`inspector-cell-preview${m?" inspector-cell-preview-audio":""}`;let v;e[3]!==r||e[4]!==n.thumbnailUrl||e[5]!==n.waveform||e[6]!==j||e[7]!==m||e[8]!==h||e[9]!==f||e[10]!==l||e[11]!==N||e[12]!==u?(v=f&&l?t.jsx("video",{ref:d,src:n.thumbnailUrl?l:`${l}#t=0.1`,poster:n.thumbnailUrl??void 0,controls:!0,controlsList:"nofullscreen nodownload noremoteplayback",disablePictureInPicture:!0,playsInline:!0,preload:"metadata"},l):m&&l?t.jsx(_s,{address:r,waveform:n.waveform??[],mediaUrl:l}):h&&j?t.jsx(Ds,{address:r,previewUrl:u,onOpen:()=>N("view"),onEdit:()=>N("edit")}):t.jsx("img",{src:u,alt:`@${r}`},u),e[3]=r,e[4]=n.thumbnailUrl,e[5]=n.waveform,e[6]=j,e[7]=m,e[8]=h,e[9]=f,e[10]=l,e[11]=N,e[12]=u,e[13]=v):v=e[13];let S;e[14]!==n.duration||e[15]!==n.height||e[16]!==n.type||e[17]!==n.width||e[18]!==m||e[19]!==f||e[20]!==c?(S=!m&&c&&t.jsx(ls,{className:"inspector-cell-metadata",width:n.width,height:n.height,durationSeconds:f?n.duration:null,fallbackLabel:n.type.toUpperCase()}),e[14]=n.duration,e[15]=n.height,e[16]=n.type,e[17]=n.width,e[18]=m,e[19]=f,e[20]=c,e[21]=S):S=e[21];let x;e[22]!==v||e[23]!==S?(x=t.jsxs("div",{className:"inspector-cell-media",children:[v,S]}),e[22]=v,e[23]=S,e[24]=x):x=e[24];let A;e[25]!==r||e[26]!==j||e[27]!==f||e[28]!==N?(A=j&&f&&t.jsx(Ls,{address:r,onOpen:()=>N("view")}),e[25]=r,e[26]=j,e[27]=f,e[28]=N,e[29]=A):A=e[29];let C;return e[30]!==b||e[31]!==x||e[32]!==A?(C=t.jsxs("section",{className:b,"aria-label":"Cell output media",children:[x,A]}),e[30]=b,e[31]=x,e[32]=A,e[33]=C):C=e[33],C}function Es(i,e,n){const r=new Map;for(const o of n??[])r.set(o.artifactId,o);for(const o of e?.values()??[])r.set(o.artifactId,o);return i&&r.set(i.artifactId,i),r}function mt(i){return i.type.replaceAll("_"," ")}function ft(i){const e=z.c(3),{cell:n,asset:r}=i;let o;return e[0]!==r||e[1]!==n.type?(o=t.jsx(gt,{asset:r,kindHint:n.type}),e[0]=r,e[1]=n.type,e[2]=o):o=e[2],o}function Gs(i){const e=z.c(73),{input:n,candidates:r,selectedCellId:o,cellAssets:s,busy:a,onSelect:c}=i,d=H.useRef(null);let l,u,f,m,h,j,y,N,b,v,S,x,A;if(e[0]!==a||e[1]!==r||e[2]!==s||e[3]!==n||e[4]!==c||e[5]!==o){let U;e[19]!==o?(U=O=>O.id===o,e[19]=o,e[20]=U):U=e[20];const _=r.find(U);let B;e[21]!==c||e[22]!==o?(B=O=>{d.current?.removeAttribute("open"),O!==o&&c(O)},e[21]=c,e[22]=o,e[23]=B):B=e[23],l=B,x=d,A="inspector-source-picker",f=Os,m=Fs,e[24]===Symbol.for("react.memo_cache_sentinel")?(h=O=>{O.key==="Escape"&&(O.preventDefault(),d.current?.removeAttribute("open"),d.current?.querySelector("summary")?.focus())},e[24]=h):h=e[24],u="preserve";let J;e[25]!==n?(J=n.replaceAll("_"," "),e[25]=n,e[26]=J):J=e[26],j=`${J} input`;let te;e[27]!==n?(te=n.replaceAll("_"," "),e[27]=n,e[28]=te):te=e[28],y=`${te} input`,N=a,b=a?-1:0,e[29]!==a?(v=O=>{a&&O.preventDefault()},e[29]=a,e[30]=v):v=e[30],S=_?t.jsxs(t.Fragment,{children:[t.jsx(ft,{cell:_,asset:s?.get(_.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(_.slot)}),t.jsx("small",{children:mt(_)})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(pt,{size:15})}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:"No source"}),t.jsx("small",{children:"Optional input"})]})]}),e[0]=a,e[1]=r,e[2]=s,e[3]=n,e[4]=c,e[5]=o,e[6]=l,e[7]=u,e[8]=f,e[9]=m,e[10]=h,e[11]=j,e[12]=y,e[13]=N,e[14]=b,e[15]=v,e[16]=S,e[17]=x,e[18]=A}else l=e[6],u=e[7],f=e[8],m=e[9],h=e[10],j=e[11],y=e[12],N=e[13],b=e[14],v=e[15],S=e[16],x=e[17],A=e[18];let C;e[31]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Xt,{className:"inspector-source-picker-chevron",size:15,"aria-hidden":"true"}),e[31]=C):C=e[31];let I;e[32]!==u||e[33]!==j||e[34]!==y||e[35]!==N||e[36]!==b||e[37]!==v||e[38]!==S?(I=t.jsxs("summary",{"data-composer-focus":u,"aria-label":j,title:y,"aria-disabled":N,tabIndex:b,onClick:v,children:[S,C]}),e[32]=u,e[33]=j,e[34]=y,e[35]=N,e[36]=b,e[37]=v,e[38]=S,e[39]=I):I=e[39];let k;e[40]!==n?(k=n.replaceAll("_"," "),e[40]=n,e[41]=k):k=e[41];const R=`${k} input options`,T=o===null;let $;e[42]!==l?($=()=>l(null),e[42]=l,e[43]=$):$=e[43];let g;e[44]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(pt,{size:15})}),e[44]=g):g=e[44];let L;e[45]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:"No source"}),t.jsx("small",{children:"Disconnect input"})]}),e[45]=L):L=e[45];let D;e[46]!==a||e[47]!==T||e[48]!==$?(D=t.jsxs("button",{type:"button",role:"option","aria-selected":T,disabled:a,onClick:$,children:[g,L]}),e[46]=a,e[47]=T,e[48]=$,e[49]=D):D=e[49];let G;if(e[50]!==a||e[51]!==r||e[52]!==s||e[53]!==l||e[54]!==o){let U;e[56]!==a||e[57]!==s||e[58]!==l||e[59]!==o?(U=_=>t.jsxs("button",{type:"button",role:"option","aria-selected":_.id===o,disabled:a,onClick:()=>l(_.id),children:[t.jsx(ft,{cell:_,asset:s?.get(_.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(_.slot)}),t.jsx("small",{children:mt(_)})]})]},_.id),e[56]=a,e[57]=s,e[58]=l,e[59]=o,e[60]=U):U=e[60],G=r.map(U),e[50]=a,e[51]=r,e[52]=s,e[53]=l,e[54]=o,e[55]=G}else G=e[55];let W;e[61]!==R||e[62]!==D||e[63]!==G?(W=t.jsxs("div",{className:"inspector-source-picker-options",role:"listbox","aria-label":R,children:[D,G]}),e[61]=R,e[62]=D,e[63]=G,e[64]=W):W=e[64];let F;return e[65]!==f||e[66]!==m||e[67]!==h||e[68]!==I||e[69]!==W||e[70]!==x||e[71]!==A?(F=t.jsxs("details",{ref:x,className:A,onToggle:f,onBlur:m,onKeyDown:h,children:[I,W]}),e[65]=f,e[66]=m,e[67]=h,e[68]=I,e[69]=W,e[70]=x,e[71]=A,e[72]=F):F=e[72],F}function Fs(i){i.currentTarget.contains(i.relatedTarget)||i.currentTarget.removeAttribute("open")}function Os(i){en(i.currentTarget)}function Ye(i){return i==="input"?"input":i==="first_frame"?"first frame input":i==="last_frame"?"last frame input":i==="replace_audio"?"replacement audio":`${i.replaceAll("_"," ")} input`}function Vs(i){const e=z.c(41),{attachments:n,cells:r,cellAssets:o,busy:s,onAttach:a}=i,c=H.useRef(null);let d,l,u,f,m,h,j,y,N,b;if(e[0]!==n||e[1]!==s||e[2]!==o||e[3]!==r||e[4]!==a){const x=new Map(r.map(Bs)),A=g=>{c.current?.removeAttribute("open"),a(g.targetInput,g.sourceCellId)};h=c,j="inspector-source-picker inspector-attach-source-picker",y=Us,N=zs,e[15]===Symbol.for("react.memo_cache_sentinel")?(b=g=>{g.key==="Escape"&&(g.preventDefault(),c.current?.removeAttribute("open"),c.current?.querySelector("summary")?.focus())},e[15]=b):b=e[15];const C=s?-1:0;let I;e[16]!==s?(I=g=>{s&&g.preventDefault()},e[16]=s,e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(ys,{size:15})}),e[18]=k):k=e[18];let R;e[19]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("strong",{children:"Attach media"}),e[19]=R):R=e[19];let T;e[20]!==n.length?(T=t.jsxs("span",{className:"inspector-source-picker-copy",children:[R,t.jsxs("small",{children:[n.length," available"]})]}),e[20]=n.length,e[21]=T):T=e[21];let $;e[22]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(Xt,{className:"inspector-source-picker-chevron",size:15,"aria-hidden":"true"}),e[22]=$):$=e[22],e[23]!==s||e[24]!==C||e[25]!==I||e[26]!==T?(l=t.jsxs("summary",{"data-composer-focus":"preserve","aria-label":"Attach media input",title:"Attach media input","aria-disabled":s,tabIndex:C,onClick:I,children:[k,T,$]}),e[23]=s,e[24]=C,e[25]=I,e[26]=T,e[27]=l):l=e[27],d="inspector-source-picker-options",u="listbox",f="Media input options",m=n.map(g=>{const L=x.get(g.sourceCellId);return L?t.jsxs("button",{type:"button",role:"option","aria-selected":"false",disabled:s,onClick:()=>A(g),children:[t.jsx(ft,{cell:L,asset:o?.get(L.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(L.slot)}),t.jsxs("small",{children:[mt(L)," · ",Ye(g.target)]})]})]},`${g.sourceCellId}:${g.target}`):null}),e[0]=n,e[1]=s,e[2]=o,e[3]=r,e[4]=a,e[5]=d,e[6]=l,e[7]=u,e[8]=f,e[9]=m,e[10]=h,e[11]=j,e[12]=y,e[13]=N,e[14]=b}else d=e[5],l=e[6],u=e[7],f=e[8],m=e[9],h=e[10],j=e[11],y=e[12],N=e[13],b=e[14];let v;e[28]!==d||e[29]!==u||e[30]!==f||e[31]!==m?(v=t.jsx("div",{className:d,role:u,"aria-label":f,children:m}),e[28]=d,e[29]=u,e[30]=f,e[31]=m,e[32]=v):v=e[32];let S;return e[33]!==l||e[34]!==v||e[35]!==h||e[36]!==j||e[37]!==y||e[38]!==N||e[39]!==b?(S=t.jsxs("details",{ref:h,className:j,onToggle:y,onBlur:N,onKeyDown:b,children:[l,v]}),e[33]=l,e[34]=v,e[35]=h,e[36]=j,e[37]=y,e[38]=N,e[39]=b,e[40]=S):S=e[40],S}function zs(i){i.currentTarget.contains(i.relatedTarget)||i.currentTarget.removeAttribute("open")}function Us(i){en(i.currentTarget)}function Bs(i){return[i.id,i]}function Js(i,e,n,r){const o=new Map(e.map(s=>[s.id,s]));return me(i,e,n,r).flatMap(s=>{const a=o.get(s.sourceCellId);return a?[{token:s.token,cell:a}]:[]})}function yt(i){const e=z.c(37),{cell:n,cells:r,edges:o,busy:s,cellAssets:a,attachments:c,onSetInput:d}=i;let l;e[0]!==c?(l=c===void 0?[]:c,e[0]=c,e[1]=l):l=e[1];const u=l;let f,m,h,j,y;if(e[2]!==u||e[3]!==s||e[4]!==n||e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==d){y=Symbol.for("react.early_return_sentinel");e:{const S=Ps(n,o);let x;e[14]!==n||e[15]!==r||e[16]!==o?(x=I=>{const k=o.find(g=>g.target===n.id&&g.targetInput===I),R=o.filter(g=>g.target!==n.id||g.targetInput!==I),T=k?r.find(g=>g.id===k.source):void 0,$=r.filter(g=>Rs(n,I,g)&&qn(r,R,g.id,n.id)!==null||g.id===k?.source).sort(Ks);return Ts(!!k,$.length)?[{input:I,edge:k,sourceCell:T,candidates:$,inputLabel:I==="input"?"input":`${I.replaceAll("_"," ")} input`}]:[]},e[14]=n,e[15]=r,e[16]=o,e[17]=x):x=e[17];const A=S.flatMap(x);if(A.length===0&&u.length===0){y=null;break e}h="inspector-input-sources",e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("h3",{children:"Inputs"}),e[18]=j):j=e[18],f="inspector-input-source-rows";let C;e[19]!==s||e[20]!==a||e[21]!==d?(C=I=>{const{input:k,edge:R,sourceCell:T,candidates:$,inputLabel:g}=I;return t.jsxs("div",{className:R?"inspector-input-source-row connected":"inspector-input-source-row",children:[t.jsx(Gs,{input:k,candidates:$,selectedCellId:R?.source??null,cellAssets:a,busy:s,onSelect:L=>d(k,L)}),R&&t.jsx("button",{type:"button",className:"inspector-input-remove-button","aria-label":`Remove ${T?Fe(T.slot):"source"} from ${g}`,title:"Remove input",disabled:s,onClick:()=>{d(k,null)},children:t.jsx(xs,{size:15,"aria-hidden":"true"})})]},k)},e[19]=s,e[20]=a,e[21]=d,e[22]=C):C=e[22],m=A.map(C)}e[2]=u,e[3]=s,e[4]=n,e[5]=a,e[6]=r,e[7]=o,e[8]=d,e[9]=f,e[10]=m,e[11]=h,e[12]=j,e[13]=y}else f=e[9],m=e[10],h=e[11],j=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let N;e[23]!==u||e[24]!==s||e[25]!==a||e[26]!==r||e[27]!==d?(N=u.length>0&&t.jsx("div",{className:"inspector-input-source-row",children:t.jsx(Vs,{attachments:u,cells:r,cellAssets:a,busy:s,onAttach:d})}),e[23]=u,e[24]=s,e[25]=a,e[26]=r,e[27]=d,e[28]=N):N=e[28];let b;e[29]!==f||e[30]!==m||e[31]!==N?(b=t.jsxs("div",{className:f,children:[m,N]}),e[29]=f,e[30]=m,e[31]=N,e[32]=b):b=e[32];let v;return e[33]!==h||e[34]!==j||e[35]!==b?(v=t.jsxs("section",{className:h,children:[j,b]}),e[33]=h,e[34]=j,e[35]=b,e[36]=v):v=e[36],v}function Ks(i,e){return i.slot.row-e.slot.row||i.slot.column-e.slot.column}function Hs(i){const e=z.c(10),{busy:n,deleting:r,onDelete:o}=i;let s;e[0]!==o?(s=()=>{o()},e[0]=o,e[1]=s):s=e[1];const a=n||r;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(pt,{size:13}),e[2]=c):c=e[2];const d=r?"Deleting…":"Delete cell";let l;e[3]!==d?(l=t.jsx("span",{children:d}),e[3]=d,e[4]=l):l=e[4];let u;return e[5]!==r||e[6]!==s||e[7]!==a||e[8]!==l?(u=t.jsxs("button",{type:"button",className:"danger-button inspector-delete-cell-button","aria-busy":r,title:"Delete cell",onClick:s,disabled:a,children:[c,l]}),e[5]=r,e[6]=s,e[7]=a,e[8]=l,e[9]=u):u=e[9],u}function xt(i){const e=z.c(4),{busy:n,deleting:r,onDelete:o}=i;let s;return e[0]!==n||e[1]!==r||e[2]!==o?(s=t.jsx("section",{className:"inspector-cell-actions inspector-compact-actions","aria-label":"Cell cleanup actions",children:t.jsx(Hs,{busy:n,deleting:r,onDelete:o})}),e[0]=n,e[1]=r,e[2]=o,e[3]=s):s=e[3],s}function tn(i){const e=z.c(23),{artifactIds:n,availableArtifactIds:r,currentArtifactId:o,selectedArtifactId:s,outputLabel:a,onSelect:c}=i,d=n.indexOf(s)+1,l=s===o,u=`${a} versions`;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("span",{className:"inspector-audio-version-label",children:[t.jsx(js,{size:13,"aria-hidden":"true"}),"Version"]}),e[0]=f):f=e[0];const m=`${a} version`;let h;e[1]!==c?(h=x=>c(x.target.value),e[1]=c,e[2]=h):h=e[2];let j;if(e[3]!==n||e[4]!==r||e[5]!==o){let x;e[7]!==n.length||e[8]!==r||e[9]!==o?(x=(A,C)=>t.jsxs("option",{value:A,disabled:!r.has(A),children:["Version ",C+1," of ",n.length,A===o?" · current":""]},A),e[7]=n.length,e[8]=r,e[9]=o,e[10]=x):x=e[10],j=n.map(x),e[3]=n,e[4]=r,e[5]=o,e[6]=j}else j=e[6];let y;e[11]!==s||e[12]!==m||e[13]!==h||e[14]!==j?(y=t.jsx("select",{value:s,"aria-label":m,onChange:h,children:j}),e[11]=s,e[12]=m,e[13]=h,e[14]=j,e[15]=y):y=e[15];const N=`inspector-audio-version-state${l?" current":""}`,b=l?"Current output":`Viewing version ${d}`;let v;e[16]!==N||e[17]!==b?(v=t.jsx("span",{className:N,"aria-live":"polite",children:b}),e[16]=N,e[17]=b,e[18]=v):v=e[18];let S;return e[19]!==u||e[20]!==y||e[21]!==v?(S=t.jsxs("section",{className:"inspector-audio-versions","aria-label":u,children:[f,y,v]}),e[19]=u,e[20]=y,e[21]=v,e[22]=S):S=e[22],S}function qs(i){const e=z.c(22),{bookId:n,assetTools:r,asset:o}=i,s=r??null;let a;e[0]!==o.artifactId||e[1]!==n?(a={bookId:n,assetId:o.artifactId},e[0]=o.artifactId,e[1]=n,e[2]=a):a=e[2];const c=o.tags??null;let d;e[3]!==s||e[4]!==a||e[5]!==c?(d={call:s,target:a,tags:c},e[3]=s,e[4]=a,e[5]=c,e[6]=d):d=e[6];const l=Qn(d);let u,f,m,h;e[7]!==l?(u=y=>{l.addTag(y)},f=y=>{l.removeTag(y)},m=y=>{l.restoreTag(y)},h=y=>{l.loadSuggestions(y)},e[7]=l,e[8]=u,e[9]=f,e[10]=m,e[11]=h):(u=e[8],f=e[9],m=e[10],h=e[11]);let j;return e[12]!==l.busy||e[13]!==l.canEdit||e[14]!==l.error||e[15]!==l.suggestions||e[16]!==l.tags||e[17]!==u||e[18]!==f||e[19]!==m||e[20]!==h?(j=t.jsx(ds,{tags:l.tags,busy:l.busy,error:l.error,canEdit:l.canEdit,suggestions:l.suggestions,onAdd:u,onRemove:f,onRestore:m,onQueryChange:h}),e[12]=l.busy,e[13]=l.canEdit,e[14]=l.error,e[15]=l.suggestions,e[16]=l.tags,e[17]=u,e[18]=f,e[19]=m,e[20]=h,e[21]=j):j=e[21],j}function Ws(i){const e=z.c(6),{asset:n}=i,r=n?.thumbnailUrl??n?.mediaUrl??null;if(n?.type!=="audio"&&r){let a;return e[0]!==r?(a=t.jsx("img",{src:r,alt:""}),e[0]=r,e[1]=a):a=e[1],a}let o;e[2]!==n?.waveform?(o=(n?.waveform?.length??0)>0&&t.jsx(Kt,{peaks:n?.waveform??[],progress:0}),e[2]=n?.waveform,e[3]=o):o=e[3];let s;return e[4]!==o?(s=t.jsx("span",{className:"inspector-media-version-blank",children:o}),e[4]=o,e[5]=s):s=e[5],s}function Qs(i){const e=z.c(20),{kind:n,artifactIds:r,assetsById:o,currentArtifactId:s,selectedArtifactId:a,onSelect:c}=i;let d;e[0]!==n?(d=Ut(n),e[0]=n,e[1]=d):d=e[1];const l=`${d} versions`;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"inspector-media-field-label",children:"Versions"}),e[2]=u):u=e[2];let f;if(e[3]!==r||e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a){let j;e[9]!==r.length||e[10]!==o||e[11]!==s||e[12]!==c||e[13]!==a?(j=(y,N)=>{const b=o.get(y),v=y===s,S=y===a;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:S?"inspector-media-version selected":"inspector-media-version",disabled:!b,"aria-current":S?"true":void 0,"aria-label":`Version ${N+1} of ${r.length}${v?", current output":""}`,onClick:()=>c(y),children:[t.jsx(Ws,{asset:b}),t.jsxs("span",{className:"inspector-media-version-label",children:["v",N+1,v&&t.jsx("span",{className:"inspector-media-version-now",children:"now"})]})]})},y)},e[9]=r.length,e[10]=o,e[11]=s,e[12]=c,e[13]=a,e[14]=j):j=e[14],f=r.map(j),e[3]=r,e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=f}else f=e[8];let m;e[15]!==f?(m=t.jsx("ul",{className:"inspector-media-version-list",children:f}),e[15]=f,e[16]=m):m=e[16];let h;return e[17]!==l||e[18]!==m?(h=t.jsxs("section",{className:"inspector-media-versions","aria-label":l,children:[u,m]}),e[17]=l,e[18]=m,e[19]=h):h=e[19],h}function Xs(i){const e=z.c(9),{kind:n,address:r,asset:o,inputs:s}=i;let a,c;if(e[0]!==r||e[1]!==o||e[2]!==s||e[3]!==n){const l=Un(n,r,o,s).filter(Zs);a="inspector-media-facts",c=l.map(Ys),e[0]=r,e[1]=o,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;return e[6]!==a||e[7]!==c?(d=t.jsx("dl",{className:a,children:c}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Ys(i){return t.jsxs("div",{children:[t.jsx("dt",{children:i.term}),t.jsx("dd",{children:i.value})]},i.key)}function Zs(i){return i.key!=="address"}function ei(i){const e=z.c(10),{kind:n,failed:r}=i;let o;e[0]!==n?(o=Bt(n,null),e[0]=n,e[1]=o):o=e[1];const s=String(o);let a;e[2]!==s?(a={"--media-aspect":s},e[2]=s,e[3]=a):a=e[3];const c=a,d=r?"inspector-media-placeholder failed":"inspector-media-placeholder",l=r?"Failed":"Generating…";let u;e[4]!==l?(u=t.jsx("span",{className:"inspector-media-placeholder-label",children:l}),e[4]=l,e[5]=u):u=e[5];let f;return e[6]!==c||e[7]!==d||e[8]!==u?(f=t.jsx("div",{className:d,style:c,children:u}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9],f}function nn(i){const e=z.c(15),{producer:n,onSelectSource:r}=i;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"inspector-media-field-label",children:"From"}),e[0]=o):o=e[0];let s;e[1]!==r||e[2]!==n.id?(s=()=>r?.(n.id),e[1]=r,e[2]=n.id,e[3]=s):s=e[3];let a;e[4]!==n.slot?(a=Fe(n.slot),e[4]=n.slot,e[5]=a):a=e[5];let c;e[6]!==a?(c=t.jsx("span",{className:"inspector-generation-from-tag",children:a}),e[6]=a,e[7]=c):c=e[7];const d=n.type==="generate_image"?"image":"video";let l;e[8]!==d?(l=t.jsxs("span",{children:["Generate ",d]}),e[8]=d,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(bs,{size:12,"aria-hidden":"true"}),e[10]=u):u=e[10];let f;return e[11]!==s||e[12]!==c||e[13]!==l?(f=t.jsxs("div",{className:"inspector-media-from",children:[o,t.jsxs("button",{type:"button",className:"inspector-generation-from-link",onClick:s,children:[c,l,u]})]}),e[11]=s,e[12]=c,e[13]=l,e[14]=f):f=e[14],f}function ti(i){if(!i)return null;const e=i.width&&i.height?`${i.width}×${i.height}`:null,n=i.duration?Je(i.duration):null;return[i.type,e,n].filter(Boolean).join(" · ")||null}function ni(i){const e=z.c(5),{asset:n,kindHint:r}=i,o=n?.thumbnailUrl??(n?.type==="image"?n.mediaUrl:null),s=!o&&n?.mediaUrl&&(n.type==="video"||n.type==="final")?n.mediaUrl:null;let a;return e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==s?(a=t.jsx("span",{className:"inspector-generation-input-thumb",children:o?t.jsx("img",{src:o,alt:"",loading:"lazy",decoding:"async"}):s?t.jsx("video",{src:`${s}#t=0.1`,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):t.jsx(gt,{asset:n,kindHint:r})}),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a):a=e[4],a}function si(i){const e=z.c(18),{producerId:n,cells:r,edges:o,cellAssets:s,onSelectSource:a}=i;let c,d,l,u,f;if(e[0]!==s||e[1]!==r||e[2]!==o||e[3]!==a||e[4]!==n){f=Symbol.for("react.early_return_sentinel");e:{const j=me(n,r,o);if(j.length===0){f=null;break e}const y=new Map(r.map(ii));l="inspector-media-generation-inputs",e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"inspector-media-field-label",children:"Inputs"}),e[10]=u):u=e[10],c="inspector-generation-input-cards",d=j.map(N=>{const b=y.get(N.sourceCellId),v=b?s?.get(b.id):void 0,S=ti(v);return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"inspector-generation-input-card",onClick:()=>b&&a?.(b.id),children:[t.jsx(ni,{asset:v,kindHint:b?.type}),t.jsxs("span",{className:"inspector-generation-input-text",children:[t.jsxs("span",{children:[t.jsxs("code",{children:["@",N.token]}),b&&t.jsxs("span",{className:"inspector-generation-input-source",children:[" ← ",Fe(b.slot)]})]}),S&&t.jsx("span",{className:"inspector-generating-muted",children:S})]})]})},N.token)})}e[0]=s,e[1]=r,e[2]=o,e[3]=a,e[4]=n,e[5]=c,e[6]=d,e[7]=l,e[8]=u,e[9]=f}else c=e[5],d=e[6],l=e[7],u=e[8],f=e[9];if(f!==Symbol.for("react.early_return_sentinel"))return f;let m;e[11]!==c||e[12]!==d?(m=t.jsx("ul",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=m):m=e[13];let h;return e[14]!==l||e[15]!==u||e[16]!==m?(h=t.jsxs("div",{className:l,children:[u,m]}),e[14]=l,e[15]=u,e[16]=m,e[17]=h):h=e[17],h}function ii(i){return[i.id,i]}function oi(i){const e=z.c(24),{state:n,model:r,elapsed:o,busy:s,deleting:a,producerCellId:c,cancelJobId:d,onRunProducer:l,onCancelJob:u,onDelete:f}=i,m=n.kind==="failed",h=m?"FAILED":n.kind==="queued"?"QUEUED":"GENERATING",j=r&&` · ${r}`;let y;e[0]!==o?(y=o!==null&&` · ${Je(o)} elapsed`,e[0]=o,e[1]=y):y=e[1];let N;e[2]!==h||e[3]!==j||e[4]!==y?(N=t.jsxs("span",{className:"inspector-media-generating-state",children:[h,j,y]}),e[2]=h,e[3]=j,e[4]=y,e[5]=N):N=e[5];let b;e[6]!==s||e[7]!==d||e[8]!==a||e[9]!==m||e[10]!==u||e[11]!==f||e[12]!==l||e[13]!==c?(b=m?t.jsxs("span",{className:"inspector-generating-actions",children:[t.jsxs("button",{type:"button",className:"inspector-generation-action",disabled:s||!c,onClick:()=>{c&&l(c)},children:[t.jsx(vs,{size:13,"aria-hidden":"true"}),"Retry"]}),t.jsxs("button",{type:"button",className:"inspector-generation-action danger",disabled:a,onClick:()=>{f()},children:[t.jsx(Ss,{size:13,"aria-hidden":"true"}),"Delete"]})]}):typeof u=="function"&&typeof d=="number"?t.jsxs("button",{type:"button",className:"inspector-generation-action danger",onClick:()=>u(d),children:[t.jsx(Ns,{size:13,"aria-hidden":"true"}),"Cancel run"]}):null,e[6]=s,e[7]=d,e[8]=a,e[9]=m,e[10]=u,e[11]=f,e[12]=l,e[13]=c,e[14]=b):b=e[14];let v;e[15]!==N||e[16]!==b?(v=t.jsxs("div",{className:"inspector-media-generating-status",children:[N,b]}),e[15]=N,e[16]=b,e[17]=v):v=e[17];let S;e[18]!==n.kind||e[19]!==n.message?(S=n.kind==="failed"&&t.jsxs("p",{className:"inspector-media-generating-error",role:"alert",children:[t.jsx(Ee,{size:13,"aria-hidden":"true"}),t.jsx("span",{children:n.message})]}),e[18]=n.kind,e[19]=n.message,e[20]=S):S=e[20];let x;return e[21]!==v||e[22]!==S?(x=t.jsxs(t.Fragment,{children:[v,S]}),e[21]=v,e[22]=S,e[23]=x):x=e[23],x}function ri(i){const e=z.c(51),{kind:n,address:r,artifactId:o,state:s,cells:a,edges:c,cellAssets:d,artifactAssets:l,busy:u,deleting:f,cancelJobId:m,onSelectSource:h,onRunProducer:j,onCancelJob:y,onDelete:N,onInspectGenerationRequest:b}=i,v=s.kind==="failed",S=s.kind==="failed"?null:s,x=Wn(S?.startedAt??null),A=s.producerCellId;let C;e[0]!==a||e[1]!==A?(C=A?a.find(de=>de.id===A)??null:null,e[0]=a,e[1]=A,e[2]=C):C=e[2];const I=C,k=I?.model??null,R=S?.startedAt??null,T=I?.provider??S?.provider??null,$=S?.runId??null,g=m??null,L=S?.providerArtifactId??o,D=I?.prompt??S?.prompt??null;let G;e[3]!==k||e[4]!==s.kind||e[5]!==R||e[6]!==T||e[7]!==$||e[8]!==g||e[9]!==L||e[10]!==D?(G={runKind:s.kind,startedAt:R,provider:T,model:k,runId:$,jobNumber:g,providerArtifactId:L,writtenPrompt:D},e[3]=k,e[4]=s.kind,e[5]=R,e[6]=T,e[7]=$,e[8]=g,e[9]=L,e[10]=D,e[11]=G):G=e[11];const W=G;let F;e[12]!==v||e[13]!==n?(F=t.jsx(ei,{kind:n,failed:v}),e[12]=v,e[13]=n,e[14]=F):F=e[14];let U;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==h||e[19]!==A?(U=A&&t.jsx(si,{producerId:A,cells:a,edges:c,cellAssets:d,onSelectSource:h}),e[15]=d,e[16]=a,e[17]=c,e[18]=h,e[19]=A,e[20]=U):U=e[20];let _;e[21]!==h||e[22]!==I?(_=I&&t.jsx(nn,{producer:I,onSelectSource:h}),e[21]=h,e[22]=I,e[23]=_):_=e[23];let B;e[24]!==U||e[25]!==_||e[26]!==F?(B=t.jsxs("div",{className:"inspector-media-generating-preview",children:[F,U,_]}),e[24]=U,e[25]=_,e[26]=F,e[27]=B):B=e[27];let J;e[28]!==u||e[29]!==m||e[30]!==f||e[31]!==x||e[32]!==k||e[33]!==y||e[34]!==N||e[35]!==j||e[36]!==A||e[37]!==s?(J=t.jsx(oi,{state:s,model:k,elapsed:x,busy:u,deleting:f,producerCellId:A,cancelJobId:m,onRunProducer:j,onCancelJob:y,onDelete:N}),e[28]=u,e[29]=m,e[30]=f,e[31]=x,e[32]=k,e[33]=y,e[34]=N,e[35]=j,e[36]=A,e[37]=s,e[38]=J):J=e[38];const te=`@${r} ${s.kind}`;let O;e[39]!==te?(O=t.jsx("span",{className:"sr-only",children:te}),e[39]=te,e[40]=O):O=e[40];let w;e[41]!==l||e[42]!==W||e[43]!==b||e[44]!==J||e[45]!==O?(w=t.jsx(ps,{facts:W,inspect:b,artifactAssets:l,header:J,footer:O}),e[41]=l,e[42]=W,e[43]=b,e[44]=J,e[45]=O,e[46]=w):w=e[46];let oe;return e[47]!==s.kind||e[48]!==B||e[49]!==w?(oe=t.jsxs("div",{className:"inspector-media-generating","data-generation":s.kind,children:[B,w]}),e[47]=s.kind,e[48]=B,e[49]=w,e[50]=oe):oe=e[50],oe}function ai(i){const e=z.c(103),{kind:n,cell:r,cells:o,edges:s,asset:a,cellAssets:c,versionAssets:d,busy:l,deleting:u,mediaInsightWork:f,generationState:m,cancelJobId:h,onSetInput:j,onRun:y,onCancelJob:N,onSelectSource:b,onDelete:v,onOpenFullscreen:S,onTranscribeAsset:x,onLoadTranscriptJson:A,onDownloadTranscriptSrt:C,bookId:I,assetTools:k,artifactAssets:R,onInspectGenerationRequest:T}=i;let $;e[0]!==r.slot?($=Xe(r.slot),e[0]=r.slot,e[1]=$):$=e[1];const g=$;let L;e[2]!==r||e[3]!==o||e[4]!==s?(L=Cn(r,o,s),e[2]=r,e[3]=o,e[4]=s,e[5]=L):L=e[5];const D=L,G=r.type==="audio"||(r.type==="image"||r.type==="video")&&r.inputs?.mediaRole!=="generate-image-output"&&r.inputs?.mediaRole!=="generate-video-output"?zt(r.inputs,r.outputArtifactId):[],W=G.join(":"),F=r.outputArtifactId??G.at(-1)??"",[U,_]=H.useState(null);if(m.kind!=="ready"){const le=r.outputArtifactId??null;let we;return e[6]!==g||e[7]!==R||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==o||e[12]!==u||e[13]!==s||e[14]!==m||e[15]!==n||e[16]!==N||e[17]!==v||e[18]!==T||e[19]!==y||e[20]!==b||e[21]!==le?(we=t.jsx("div",{className:"inspector-body inspector-media-body",children:t.jsx(ri,{kind:n,address:g,artifactId:le,state:m,cells:o,edges:s,cellAssets:c,busy:l,deleting:u,cancelJobId:h,artifactAssets:R,onSelectSource:b,onRunProducer:y,onCancelJob:N,onDelete:v,onInspectGenerationRequest:T})}),e[6]=g,e[7]=R,e[8]=l,e[9]=h,e[10]=c,e[11]=o,e[12]=u,e[13]=s,e[14]=m,e[15]=n,e[16]=N,e[17]=v,e[18]=T,e[19]=y,e[20]=b,e[21]=le,e[22]=we):we=e[22],we}const B=U?.cellId===r.id&&U.currentArtifactId===F&&U.versionKey===W?U.artifactId:F,J=new Map((d??[]).map(li));a&&J.set(a.artifactId,a);const te=J.has(B),O=G.includes(B)&&te?B:F,w=G.length>0?J.get(O)??a:a,oe=new Set(J.keys());let de;e[23]!==r.id||e[24]!==F||e[25]!==_||e[26]!==W?(de=le=>{_({artifactId:le,cellId:r.id,currentArtifactId:F,versionKey:W})},e[23]=r.id,e[24]=F,e[25]=_,e[26]=W,e[27]=de):de=e[27];const ye=de,re=w?f?.[w.artifactId]??Gt:Gt,X=n==="image"||n==="video",ae=G.length>1&&!!w;let Y;e[28]!==g||e[29]!==X||e[30]!==S||e[31]!==w?(Y=w?t.jsx(ut,{asset:w,address:g,allowFullscreen:X,overlayMetadata:!1,onOpenFullscreen:S}):t.jsxs("div",{className:"inspector-media-empty",children:[t.jsx("span",{children:"Output pending"}),t.jsx("p",{children:"Connect a source and rerun its producer to populate this preview."})]}),e[28]=g,e[29]=X,e[30]=S,e[31]=w,e[32]=Y):Y=e[32];const fe=Y,P=ae&&w?t.jsx(tn,{artifactIds:G,availableArtifactIds:oe,currentArtifactId:r.outputArtifactId,selectedArtifactId:O,outputLabel:Ut(n),onSelect:ye}):null;let Z;e[33]!==k||e[34]!==I||e[35]!==w?(Z=w?t.jsx(qs,{bookId:I,assetTools:k,asset:w}):null,e[33]=k,e[34]=I,e[35]=w,e[36]=Z):Z=e[36];const E=Z,q=!!(w?.transcript?.plain||w?.transcript?.elevenlabs);let ee;e[37]!==l||e[38]!==q||e[39]!==re||e[40]!==C||e[41]!==A||e[42]!==x||e[43]!==w?(ee=w&&kn(w.type)?q?t.jsx(ts,{artifactId:w.artifactId,transcript:w.transcript??null,busy:l,transcribing:re.transcribing,error:re.error,onTranscribe:x?()=>x(w.artifactId):void 0,onLoadTranscriptJson:A?le=>A(w.artifactId,le):void 0,onDownloadTranscriptSrt:C?()=>C(w.artifactId):void 0}):t.jsxs("div",{className:"inspector-media-insights",children:[x&&t.jsxs("button",{type:"button",className:"inspector-generation-action",disabled:l||re.transcribing,onClick:()=>x(w.artifactId),children:[t.jsx(ms,{size:13,"aria-hidden":"true"}),re.transcribing?"Transcribing…":"Transcribe"]}),re.error&&t.jsxs("p",{className:"inspector-insight-error",role:"alert",children:[t.jsx(Ee,{size:12,"aria-hidden":"true"}),t.jsx("span",{children:re.error})]})]}):null,e[37]=l,e[38]=q,e[39]=re,e[40]=C,e[41]=A,e[42]=x,e[43]=w,e[44]=ee):ee=e[44];const ie=ee;let ce;e[45]!==l||e[46]!==r||e[47]!==c||e[48]!==o||e[49]!==s||e[50]!==b||e[51]!==j||e[52]!==D?(ce=D?t.jsx(nn,{producer:D,onSelectSource:b}):t.jsx(yt,{cell:r,cells:o,edges:s,busy:l,cellAssets:c,onSetInput:j}),e[45]=l,e[46]=r,e[47]=c,e[48]=o,e[49]=s,e[50]=b,e[51]=j,e[52]=D,e[53]=ce):ce=e[53];const Q=ce,Ae=w??null;let $e;e[54]!==n||e[55]!==Ae?($e=Bt(n,Ae),e[54]=n,e[55]=Ae,e[56]=$e):$e=e[56];const Oe=String($e);let se;e[57]!==Oe?(se={"--media-aspect":Oe},e[57]=Oe,e[58]=se):se=e[58];const Pe=se,Te=`inspector-media-row-${n}`,Re=ae?"":"inspector-media-row-single-version";let Le;e[59]!==Te||e[60]!==Re?(Le=["inspector-media-content","inspector-compact-media-content","inspector-media-row-content",Te,Re].filter(Boolean),e[59]=Te,e[60]=Re,e[61]=Le):Le=e[61];const Ve=Le.join(" ");let pe;e[62]!==fe?(pe=t.jsx("div",{className:"inspector-media-row-track inspector-media-row-preview",children:fe}),e[62]=fe,e[63]=pe):pe=e[63];const Ce=ae&&t.jsx("div",{className:"inspector-media-row-track inspector-media-row-versions",children:t.jsx(Qs,{kind:n,artifactIds:G,assetsById:J,currentArtifactId:r.outputArtifactId,selectedArtifactId:O,onSelect:ye})});let xe;e[64]!==g||e[65]!==r.inputs||e[66]!==n||e[67]!==w?(xe=w&&t.jsx(Xs,{kind:n,address:g,asset:w,inputs:r.inputs}),e[64]=g,e[65]=r.inputs,e[66]=n,e[67]=w,e[68]=xe):xe=e[68];let ke;e[69]!==k||e[70]!==I||e[71]!==l||e[72]!==u||e[73]!==n||e[74]!==w?(ke=w&&t.jsx(ns,{bookId:I,artifactId:w.artifactId,kind:n,busy:l||u,call:k},`${I}:${w.artifactId}`),e[69]=k,e[70]=I,e[71]=l,e[72]=u,e[73]=n,e[74]=w,e[75]=ke):ke=e[75];let he;e[76]!==xe||e[77]!==ke?(he=t.jsxs("div",{className:"inspector-media-summary",children:[xe,ke]}),e[76]=xe,e[77]=ke,e[78]=he):he=e[78];let je;e[79]!==E||e[80]!==Q||e[81]!==P?(je=t.jsxs("div",{className:"inspector-media-row-track inspector-media-row-details",children:[P,E,Q]}),e[79]=E,e[80]=Q,e[81]=P,e[82]=je):je=e[82];let Se;e[83]!==r.inputs?(Se=t.jsx(ss,{inputs:r.inputs}),e[83]=r.inputs,e[84]=Se):Se=e[84];let Ne;e[85]!==ie||e[86]!==Se?(Ne=t.jsxs("div",{className:"inspector-media-row-track inspector-media-row-actions",children:[Se,ie]}),e[85]=ie,e[86]=Se,e[87]=Ne):Ne=e[87];let Ie;e[88]!==l||e[89]!==u||e[90]!==v?(Ie=t.jsx(xt,{busy:l,deleting:u,onDelete:v}),e[88]=l,e[89]=u,e[90]=v,e[91]=Ie):Ie=e[91];let be;e[92]!==he||e[93]!==je||e[94]!==Ne||e[95]!==Ie?(be=t.jsxs("div",{className:"inspector-media-row-meta",children:[he,je,Ne,Ie]}),e[92]=he,e[93]=je,e[94]=Ne,e[95]=Ie,e[96]=be):be=e[96];let ze;return e[97]!==Ve||e[98]!==pe||e[99]!==Ce||e[100]!==be||e[101]!==Pe?(ze=t.jsx("div",{className:"inspector-body inspector-media-body",children:t.jsxs("div",{className:Ve,style:Pe,children:[pe,Ce,be]})}),e[97]=Ve,e[98]=pe,e[99]=Ce,e[100]=be,e[101]=Pe,e[102]=ze):ze=e[102],ze}function li(i){return[i.artifactId,i]}function ht(i){const e=z.c(40),{label:n,summary:r,className:o,value:s,loadValue:a,ariaLabel:c,artifactAssets:d}=i,[l,u]=H.useState(!1),[f,m]=H.useState(s),[h,j]=H.useState(!1),[y,N]=H.useState(null);let b,v,S,x,A;if(e[0]!==c||e[1]!==d||e[2]!==o||e[3]!==n||e[4]!==a||e[5]!==h||e[6]!==l||e[7]!==f||e[8]!==r){const k=dt(f);let R;e[14]!==o?(R=["inspector-analysis-json-disclosure",o].filter(Boolean),e[14]=o,e[15]=R):R=e[15],b=R.join(" "),v=h,e[16]!==a||e[17]!==h||e[18]!==f?(S=L=>{const D=L.currentTarget.open;u(D),!(!D||f!==void 0||!a||h)&&(j(!0),N(null),a().then(G=>m(G)).catch(G=>{N(G instanceof Error?G.message:String(G))}).finally(()=>j(!1)))},e[16]=a,e[17]=h,e[18]=f,e[19]=S):S=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Wt,{size:12,"aria-hidden":"true"}),e[20]=T):T=e[20];let $;e[21]!==n?($=t.jsx("span",{children:n}),e[21]=n,e[22]=$):$=e[22];let g;e[23]!==r?(g=r&&t.jsx("code",{className:"inspector-json-summary",children:r}),e[23]=r,e[24]=g):g=e[24],e[25]!==$||e[26]!==g?(x=t.jsxs("summary",{children:[T,$,g]}),e[25]=$,e[26]=g,e[27]=x):x=e[27],A=l&&f!==void 0&&t.jsxs(t.Fragment,{children:[(k.promptLeaks.length>0||k.urlPlaceholders.length>0)&&t.jsxs("div",{className:"inspector-payload-mentions",children:[k.promptLeaks.map(di),k.urlPlaceholders.map(ci)]}),t.jsx("div",{className:"inspector-analysis-json-scroll",tabIndex:0,children:t.jsx(Zn,{value:f,ariaLabel:c,artifactAssets:d})})]}),e[0]=c,e[1]=d,e[2]=o,e[3]=n,e[4]=a,e[5]=h,e[6]=l,e[7]=f,e[8]=r,e[9]=b,e[10]=v,e[11]=S,e[12]=x,e[13]=A}else b=e[9],v=e[10],S=e[11],x=e[12],A=e[13];let C;e[28]!==y||e[29]!==h||e[30]!==l||e[31]!==f?(C=l&&f===void 0&&t.jsx("div",{className:"inspector-analysis-json-status",role:"status",children:h?"Loading complete JSON…":y??"Complete JSON is unavailable for this run."}),e[28]=y,e[29]=h,e[30]=l,e[31]=f,e[32]=C):C=e[32];let I;return e[33]!==b||e[34]!==v||e[35]!==S||e[36]!==x||e[37]!==A||e[38]!==C?(I=t.jsxs("details",{className:b,"aria-busy":v,onToggle:S,children:[x,A,C]}),e[33]=b,e[34]=v,e[35]=S,e[36]=x,e[37]=A,e[38]=C,e[39]=I):I=e[39],I}function ci(i){return t.jsxs("span",{className:"inspector-payload-mention placeholder",title:i.path,children:[t.jsx(qt,{size:11,"aria-hidden":"true"}),t.jsx("code",{children:i.reference}),"resolves at dispatch"]},`${i.path}:${i.url}`)}function di(i){return t.jsxs("span",{className:"inspector-payload-mention leak",title:i.message,children:[t.jsx(Ee,{size:11,"aria-hidden":"true"}),t.jsx("code",{children:i.token}),i.message]},`${i.token}:${i.code}`)}function pi(i){return i.replace(/^notebook_/,"").replace(/^legacy_/,"").replaceAll("_"," ")}function ui(i){return i.type==="json_schema"?i.strict?"Strict JSON schema":"JSON schema":i.type==="json_object"?"JSON object":i.type==="text"?"Text":i.type.replaceAll("_"," ")}function mi(i){const e=z.c(3),{analysisInfo:n}=i,r=Jt(n.outputJson),o=n.llmExchanges?.length?n.llmExchanges.map(gi):r,s=H.useRef(null),a=()=>{if(!n.outputUrl)return Promise.reject(new Error("Complete JSON is unavailable for this run."));if(!s.current){const m=fetch(n.outputUrl).then(hi).then(fi);s.current=m.catch(h=>{throw s.current=null,h})}return s.current},c=(m,h)=>async()=>{const y=(await a())[m];if(!y)throw new Error("The saved LLM exchange could not be found.");return y[h]};if(o.length===0)return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{children:"LLM exchange"}),e[0]=d):d=e[0];const l="inspector-analysis-llm-calls",u=o.map((m,h)=>{const j=pi(m.stage),y=String(h+1).padStart(2,"0");return t.jsxs("article",{className:"inspector-analysis-llm-call",children:[t.jsxs("header",{children:[t.jsx("span",{children:y}),t.jsx("strong",{children:j})]}),t.jsxs("dl",{className:"inspector-analysis-llm-meta",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Provider"}),t.jsx("dd",{children:m.provider})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Model"}),t.jsx("dd",{children:m.model})]}),m.responseFormat&&t.jsxs("div",{className:"inspector-analysis-llm-format",children:[t.jsx("dt",{children:"Response format"}),t.jsxs("dd",{children:[t.jsxs("span",{children:[t.jsx(Wt,{size:11,"aria-hidden":"true"}),ui(m.responseFormat)]}),m.responseFormat.name&&t.jsx("code",{children:m.responseFormat.name})]})]})]}),!m.complete&&t.jsx("p",{className:"inspector-analysis-llm-incomplete",children:"This older run retained summary payloads only. Re-run the Analyze cell to record the complete provider exchange."}),t.jsxs("div",{className:"inspector-analysis-json-disclosures",children:[t.jsx(ht,{label:"LLM input",value:m.input,loadValue:m.input===void 0?c(h,"input"):void 0,ariaLabel:`LLM input JSON for ${j}`}),t.jsx(ht,{label:"LLM response",value:m.response,loadValue:m.response===void 0?c(h,"response"):void 0,ariaLabel:`LLM response JSON for ${j}`})]})]},`${m.stage}-${h}`)});let f;return e[1]!==u?(f=t.jsx("div",{className:l,children:u}),e[1]=u,e[2]=f):f=e[2],t.jsxs("section",{className:"inspector-analysis-llm","aria-label":"LLM exchanges",children:[t.jsxs("header",{className:"inspector-analysis-llm-heading",children:[d,t.jsxs("code",{children:[o.length," ",o.length===1?"call":"calls"]})]}),f]})}function fi(i){const e=Jt(i);if(e.length===0)throw new Error("The saved analysis has no recorded LLM exchange.");return e}async function hi(i){if(!i.ok)throw new Error(`Unable to load complete JSON (${i.status})`);return i.json()}function gi(i){return{...i,complete:!0,input:void 0,response:void 0}}function yi(i){const e=z.c(16),{cell:n,cells:r,edges:o,asset:s,cellAssets:a,versionAssets:c,busy:d,deleting:l,onSetInput:u,onDelete:f}=i,m=zt(n.inputs,n.outputArtifactId),h=m.join(":"),j=n.outputArtifactId??m.at(-1)??"",[y,N]=H.useState(null),b=y?.cellId===n.id&&y.currentArtifactId===j&&y.versionKey===h?y.artifactId:j,v=new Map((c??[]).map(bi));s&&v.set(s.artifactId,s);const S=m.includes(b)&&v.has(b)?b:j,A=(v.get(S)??s)?.analysisInfo,C=A?.shots.slice().sort(ji)??[],I="inspector-body inspector-analysis-body",k="inspector-analysis-content",R=m.length>1&&t.jsx(tn,{artifactIds:m,availableArtifactIds:new Set(v.keys()),currentArtifactId:n.outputArtifactId,selectedArtifactId:S,outputLabel:"Analysis",onSelect:D=>{N({artifactId:D,cellId:n.id,currentArtifactId:j,versionKey:h})}}),T=A?t.jsxs(t.Fragment,{children:[t.jsx(mi,{analysisInfo:A},S),t.jsx("ol",{className:"inspector-analysis-shots",children:C.map(xi)})]}):t.jsxs("div",{className:"inspector-media-empty",children:[t.jsx("span",{children:"Analysis pending"}),t.jsx("p",{children:"Run the connected Analyze cell to populate normalized shots."})]});let $;e[0]!==d||e[1]!==n||e[2]!==a||e[3]!==r||e[4]!==o||e[5]!==u?($=t.jsx(yt,{cell:n,cells:r,edges:o,busy:d,cellAssets:a,onSetInput:u}),e[0]=d,e[1]=n,e[2]=a,e[3]=r,e[4]=o,e[5]=u,e[6]=$):$=e[6];let g;e[7]!==d||e[8]!==l||e[9]!==f?(g=t.jsx(xt,{busy:d,deleting:l,onDelete:f}),e[7]=d,e[8]=l,e[9]=f,e[10]=g):g=e[10];let L;return e[11]!==R||e[12]!==T||e[13]!==$||e[14]!==g?(L=t.jsx("div",{className:I,children:t.jsxs("div",{className:k,children:[R,T,$,g]})}),e[11]=R,e[12]=T,e[13]=$,e[14]=g,e[15]=L):L=e[15],L}function xi(i){return t.jsxs("li",{children:[t.jsx("span",{className:"inspector-analysis-shot-number",children:String(i.ordinal).padStart(2,"0")}),t.jsxs("div",{children:[t.jsx("strong",{children:i.label}),t.jsxs("time",{children:[Je(i.startSeconds)," – ",Je(i.endSeconds)," · ",Je(i.durationSeconds)]})]})]},i.ordinal)}function ji(i,e){return i.ordinal-e.ordinal}function bi(i){return[i.artifactId,i]}function vi({headerActionHost:i,notebookId:e,bookId:n,assetTools:r,sourceVisible:o,cell:s,cells:a,edges:c,asset:d,cellAssets:l,artifactAssets:u,status:f,error:m,busy:h,deleting:j,onUpdate:y,onSetInput:N,onRun:b,onDelete:v,onOpenFullscreen:S,onPreviewPayload:x,initialGenerationPreview:A,onSelectSource:C,generationActions:I=[],mentionAssets:k=[],voiceCatalog:R}){const T=H.useId(),$=H.useContext(is),[g,L]=H.useState(()=>{const p=ks(s,I,at(s.id,a,c));return!Ge(s.type)||p.generationMode!=="r2v"?p:{...p,prompt:He(p.prompt,me(s.id,a,c,"i2v"),me(s.id,a,c,p.generationMode))}}),[D,G]=H.useState(!1),W=()=>{R&&R.ensureLoaded().catch(()=>{})},[F,U]=H.useState(null),[_,B]=H.useState("idle"),J=H.useRef(null),te=H.useRef(null),O=H.useRef(0),[w,oe]=H.useState(g.prompt.length),[de,ye]=H.useState(0),[re,X]=H.useState(!1),[ae,Y]=H.useState({error:null,loading:!1,value:void 0}),fe=s.type==="prompt"||s.type==="analyze"||s.type==="generate_video"||s.type==="generate_image"||s.type==="generate_audio",P=s.type==="generate_video"||s.type==="generate_image"||s.type==="generate_audio",Z=Ge(s.type)?s.type:null,E={provider:g.provider,model:g.model,operation:g.operation,tool:g.tool},q=Z?at(s.id,a,c):[],ee=s.tool==="edit_image_subjects",ie=ee?I.filter(p=>p.tool===s.tool).map(p=>({...p,inputContract:{modes:p.inputContract.modes.filter(M=>M.id===s.inputs?.generationMode)}})):I,ce=Z?wn(ie,Z,q,ee):[],Q=Z?We(ie,Z,E):null,Ae=!!(Q&&Ft(Q,q)),$e=Q?Mn(Q,q):[],Oe=new Set($e.map(p=>p.id)),se=Q?Qe(Q,q,g.generationMode):"",Pe=!!(Q&&$n(Q,se,q)),Te=Q?.inputContract.modes??[],Re=Te.find(p=>p.id===se),Le=Re?Pn(Re,q):null,Ve=Q?Tn(Q,se,s.id,a,c):[],pe=Q?.controls??[],Ce=I.flatMap(p=>p.controls),xe=Ot(pe,g.generationSettings)??Rn(g.model,g.generationSettings,c.filter(p=>p.target===s.id).map(p=>({type:a.find(M=>M.id===p.source)?.type??"",targetInput:p.targetInput,asset:l?.get(p.source)??null}))),he=Ae&&Pe&&xe===null,je=Q&&!Ae&&!ce.some(p=>p.id===Q.id)?[Q,...ce]:ce,Se=Q?.id??g.tool,Ne=H.useMemo(()=>Ln(a,c,s.id),[s.id,a,c]),Ie=Js(s.id,a,c,se),be=g.prompt.slice(0,w),le=(P?Dn(Ie,k,be):_n(k,a,be,Ne)).map(p=>({type:"mention",value:p.value,label:p.label,description:p.description,caption:p.caption,thumbnailSrc:p.thumbnailUrl,mediaKind:p.mediaKind??void 0,empty:p.empty,colorScheme:"amber"})),we=re&&le.length>0,De=En(P?{...s,provider:g.provider,model:g.model,operation:g.operation,tool:g.tool}:s,f),on=s.type==="character"||P||s.type==="extract_audio",rn=Yt(s.type),_e=ws(s,g,pe),Me=Ms(s,g)&&(!P||he),et=P?"Generate":De?Gn(s.type,De.label):null,ge=(rn||P)&&!!et,Ue=m??"This action failed, but no error details were recorded.",vt=F?.error===Ue?F.state:"idle",an=vt==="copied"?"Copied":vt==="failed"?"Retry copy":"Copy",ln=_==="copied"?"Copied":_==="failed"?"Retry copy":"Copy",tt=(p,M=c)=>{const V=Z?We(ie,Z,p):null,K=at(s.id,a,M);return{prompt:p.prompt,provider:p.provider,model:p.model,operation:p.operation,tool:p.tool,inputs:Zt(s,{...p,generationMode:V?Qe(V,K,p.generationMode):p.generationMode,generationSettings:Jn(V?.controls??[],p.generationSettings)},Ce)}},St=(p,M=c)=>{const V=tt(p,M);return JSON.stringify([{...V,inputs:{generationMode:V.inputs.generationMode,generationSettings:V.inputs.generationSettings}},M.filter(K=>K.target===s.id).map(K=>[K.source,K.targetInput]).sort()])},Nt=St(g),[cn]=H.useState(Nt),Ke=ae.key!==void 0?ae:A??ae,It=(ae.key??cn)!==Nt,At=async(p=g,M=c)=>{if(!x)throw new Error("Payload preview is unavailable");const V=++O.current,K=St(p,M),ne=Z?We(I,Z,p):null,ue=Ot(ne?.controls??[],p.generationSettings);if(ue)throw O.current===V&&Y({key:K,error:ue,loading:!1,value:void 0}),new Error(ue);Y({key:K,error:null,loading:!0,value:void 0});try{const ve=await x(s.id,tt(p,M));return O.current===V&&Y({key:K,error:null,loading:!1,value:ve}),ve}catch(ve){throw O.current===V&&Y({key:K,error:ve instanceof Error?ve.message:String(ve),loading:!1,value:void 0}),ve}},nt=Fn((p=g,M=c)=>{P&&x&&At(p,M).catch(()=>{})},s.id),Be=nt.run,Ct=p=>{O.current+=1,Y(M=>({...M,loading:!1})),P&&x&&nt.schedule({...g,prompt:p})},st=(p,M)=>{B("idle"),L(V=>({...V,prompt:p})),oe(M),ye(0),X(!0),Ct(p)},dn=p=>{B("idle"),L(M=>({...M,prompt:p})),oe(p.length),X(!1),Ct(p)},kt=On({call:r,bookId:n,surface:P?Vn(s.type):null,prompt:g.prompt,onApply:dn}),wt=p=>{const V=g.prompt.slice(0,w).lastIndexOf("@");if(V<0)return;const K=g.prompt.slice(0,V),ne=g.prompt.slice(w),ue=!ne||/^\s/u.test(ne)?"":" ",ve=`${K}${p.value}${ue}${ne}`,rt=K.length+p.value.length+ue.length;st(ve,rt),X(!1),requestAnimationFrame(()=>{te.current?.focus({preventScroll:!0}),te.current?.setSelectionRange(rt,rt)})},it=(p,M)=>{L(V=>({...V,[p]:M}))},pn=p=>{const M=je.find(ne=>ne.id===p);if(!M)return;s.type==="generate_audio"&&M.controls.some(ne=>ne.name==="voice_id")&&W();const V=Qe(M,q,ee?g.generationMode:""),K={...g,...Hn(M),generationMode:V,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,c,V)),generationSettings:{}};L(K),Be(K)},un=(p,M)=>{const V={...g.generationSettings};M===void 0?delete V[p]:V[p]=M;const K={...g,generationSettings:V};L(K),Be(K)},mn=async()=>{try{await navigator.clipboard.writeText(Ue),U({error:Ue,state:"copied"})}catch{U({error:Ue,state:"failed"})}},fn=async()=>{try{await navigator.clipboard.writeText(g.prompt),B("copied")}catch{B("failed")}},hn=async()=>{if(!(!_e||!Me)){G(!0);try{await y(Vt(s,{...g,generationMode:se},pe,Ce))}finally{G(!1)}}},Mt=async()=>{if(!(!ge||h||D||De?.disabled||!Me||P&&ae.loading)){G(!0);try{if(P)try{nt.cancel();const p=await At();if(dt(p).promptLeaks.length>0)return}catch{return}await Kn({cellId:s.id,dirty:_e,valid:Me,patch:Vt(s,{...g,generationMode:se},pe,Ce),onUpdate:y,onRun:b})}finally{G(!1)}}},$t=c.filter(p=>p.target===s.id),gn=new Map(me(s.id,a,c,se).map(p=>[`${p.sourceCellId}:${p.targetInput}`,p.token])),Pt=(p,M,V=Ye(M),K)=>{const ne=a.find(ue=>ue.id===p);return ne?[{cellId:ne.id,address:Xe(ne.slot),type:ne.type,targetInput:M,targetLabel:V,...K?{mention:K}:{},asset:l?.get(ne.id)??null}]:[]},ot=$t.flatMap(p=>Pt(p.source,p.targetInput,Ye(zn(se,"image",p.targetInput)),gn.get(`${p.source}:${p.targetInput}`))),yn=Ve.flatMap(p=>Pt(p.sourceCellId,p.targetInput,Ye(p.target))),Tt=Q??{id:g.tool,tool:g.tool,provider:g.provider,providerLabel:g.provider,model:g.model,operation:g.operation,title:g.tool||"No compatible models",cellTypes:Z?[Z]:[],isDefault:!1,defaultPriority:0,controls:[],inputContract:{modes:[]}},Rt=je.map(p=>Ft(p,q)?p:{...p,providerLabel:`${p.providerLabel} · incompatible`});Q||Rt.unshift(Tt);const xn={action:Tt,cell:{...s,...tt(g)},connections:$t.map(p=>({sourceCellId:p.source,targetInput:p.targetInput})),sourceCellIds:ot.map(p=>p.cellId),sourceAddresses:ot.map(p=>p.address)},Lt=async(p,M)=>{const V=c.filter(ue=>ue.target!==s.id||ue.targetInput!==p),K=M?[...V,{id:p,source:M,target:s.id,targetInput:p}]:V,ne={...g,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,K,se))};await N(p,M),L(ne),Be(ne,K)},Dt=fe?t.jsxs("section",{className:"inspector-prompt-field",children:[t.jsxs("header",{className:"inspector-prompt-header",children:[t.jsx("h3",{children:"Prompt"}),P&&t.jsx(os,{history:kt,disabled:h||D}),t.jsxs("button",{type:"button",className:`inspector-prompt-copy${_==="copied"?" copied":""}`,"aria-label":_==="copied"?"Prompt copied":_==="failed"?"Retry copying prompt":"Copy prompt",title:_==="copied"?"Prompt copied":_==="failed"?"Retry copying prompt":"Copy prompt",disabled:!g.prompt,onClick:()=>{fn()},children:[_==="copied"?t.jsx(qt,{size:12}):t.jsx(fs,{size:12}),t.jsx("span",{"aria-live":"polite",children:ln})]})]}),t.jsxs("div",{className:"inspector-prompt-editor",ref:J,children:[we&&t.jsx(rs,{items:le,selectedIndex:de,onSelect:wt,onHover:ye,anchorRef:J,preferAbove:!1}),t.jsx("textarea",{ref:te,"aria-label":"Prompt",className:"inspector-prompt-textarea",value:g.prompt,disabled:P&&(h||D),"aria-invalid":P&&!It&&dt(Ke.value).promptLeaks.length>0,rows:P?3:8,onChange:p=>st(p.target.value,p.target.selectionStart),onClick:p=>oe(p.currentTarget.selectionStart),onSelect:p=>oe(p.currentTarget.selectionStart),onBlur:()=>X(!1),onKeyDown:p=>{if(!we){P&&kt.handlePromptKeyDown(p);return}if(p.key==="ArrowDown"){p.preventDefault(),ye(M=>(M+1)%le.length);return}if(p.key==="ArrowUp"){p.preventDefault(),ye(M=>(M-1+le.length)%le.length);return}if(p.key==="Enter"||p.key==="Tab"){p.preventDefault(),wt(le[de]);return}p.key==="Escape"&&(p.preventDefault(),X(!1))}})]})]}):null,_t=h||D||!!De?.disabled||!Me||P&&ae.loading||!ge&&_e,{onKeyDown:jn}=as({applyFormId:T,applyDisabled:_t,applyScopeSelector:".composer-notebook-dock",busy:h||D,enabled:P&&!!$,onCancel:()=>$?.hide()}),Et=et&&(De||P)?t.jsx("section",{className:P&&i?"confirm-sheet-actions inspector-generation-header-actions":"inspector-cell-actions","aria-label":"Primary cell action",children:t.jsxs("button",{type:"button",className:P&&i?"confirm-sheet-apply":"inspector-run-action","aria-busy":ge&&D,"aria-keyshortcuts":P?"Meta+Enter Control+Enter":void 0,title:De?.disabled?"A run is already in progress for this cell":P&&!he?"Check the generation type and required settings":!ge&&_e?"Save changes before running":P?"Generate (⌘Enter / Ctrl+Enter)":void 0,onClick:()=>{if(ge){Mt();return}b(s.id)},disabled:_t,children:[ge&&D?P?"Generating…":"Applying…":et,P&&!D&&t.jsx("kbd",{"aria-hidden":"true",children:"⌘↵"})]})}):null,bn=!P&&_e?t.jsxs("div",{className:`inspector-dirty-notice${Me?"":" invalid"}`,role:"status",children:[t.jsx(Ee,{size:14}),t.jsx("span",{children:Me?ge?"Changes apply when this action runs":"Unsaved changes":ge?"Check timing values before running":"Check timing values before saving"})]}):null;return t.jsxs("div",{className:P?"generation-cell-inspector":"inspector-body inspector-executable-body",onKeyDown:jn,children:[P&&i?vn.createPortal(Et,i):null,d&&on&&!P&&t.jsx(ut,{asset:d,address:Xe(s.slot),allowFullscreen:d.type==="image"||d.type==="video"||d.type==="final",onOpenFullscreen:S}),!P&&t.jsx(yt,{cell:s,cells:a,edges:c,busy:h,cellAssets:l,onSetInput:N}),t.jsxs("form",{id:T,className:P?"generation-cell-form":"inspector-cell-form","aria-busy":D,onSubmit:p=>{if(p.preventDefault(),ge){Mt();return}hn()},children:[P?t.jsx(us,{actions:Rt,busy:h||D,draft:xn,modes:Te,compatibleModeIds:Oe,sourceVisible:o,notebookId:e,doltArtifactAssets:u,preview:Ke.value,previewError:Ke.error,previewLoading:Ke.loading,previewStale:It,sources:ot,sourceOptions:yn,voiceCatalog:R,promptEditor:Dt,inputFooter:d?t.jsxs("div",{className:"generation-cell-output",children:[t.jsx("span",{className:"confirm-section-label",children:"Output"}),t.jsx(ut,{asset:d,address:Xe(s.slot),allowFullscreen:d.type==="image"||d.type==="video"||d.type==="final",onOpenFullscreen:S})]}):void 0,onActionChange:pn,onAddSource:(p,M)=>{M&&Lt(M,p)},onRemoveSource:(p,M)=>{M&&Lt(M,null)},onSelectSource:p=>C?.(p),onModeChange:p=>{const M={...g,generationMode:p,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,c,p))};L(M),Be(M)},onPromptChange:p=>st(p,p.length),onRefreshPreview:()=>Be(),onSettingChange:un}):Dt,s.type==="split_video"&&(s.operation==="split_at_points"||s.operation==="split_ranges")&&t.jsxs("div",{className:"inspector-field-pair",children:[t.jsxs("label",{children:["Cut points",t.jsx("input",{type:"text",value:Array.isArray(s.inputs?.cutPointsSeconds)?s.inputs.cutPointsSeconds.join(", "):"",readOnly:!0})]}),t.jsxs("label",{children:["Chunks",t.jsx("input",{type:"text",value:Array.isArray(s.inputs?.cutPointsSeconds)?String(s.inputs.cutPointsSeconds.length+1):"",readOnly:!0})]})]}),s.type==="split_video"&&s.operation!=="split_at_points"&&s.operation!=="split_ranges"&&t.jsxs("div",{className:"inspector-field-pair",children:[t.jsxs("label",{children:["Start seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.startSeconds,onChange:p=>it("startSeconds",p.target.value)})]}),t.jsxs("label",{children:["End seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.endSeconds,onChange:p=>it("endSeconds",p.target.value)})]})]}),s.type==="splice"&&g.operation==="splice_video"&&t.jsxs("label",{children:["Overlap seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.overlap,onChange:p=>it("overlap",p.target.value)})]}),P&&!g.tool&&!g.model&&t.jsx("span",{className:"workspace-notice",children:"No generation model matches the current inputs."}),P&&Se&&!he&&t.jsxs("div",{className:"inspector-generation-warning",role:"status",children:[t.jsx(Ee,{size:14}),t.jsx("span",{children:Q?Le??(Ae?Pe?xe??"Complete the required generation settings before running.":"This generation type does not match the current inputs. Choose a compatible type or change the connections.":"This model does not accept the current inputs. Choose a compatible model or change the connections."):"This saved action is unavailable. Choose a supported model."})]}),bn,!ge&&!P&&t.jsxs("button",{type:"submit",className:"inspector-save-button",disabled:h||D||!_e||!Me,children:[t.jsx(hs,{size:15}),t.jsx("span",{children:D?"Saving…":"Save changes"})]})]}),P&&i?null:Et,(f==="error"||m)&&t.jsxs("section",{className:"inspector-run-error",role:"alert","aria-label":"Cell run error",children:[t.jsx(Ee,{size:16,"aria-hidden":"true"}),t.jsxs("div",{className:"inspector-run-error-content",children:[t.jsxs("div",{className:"inspector-run-error-header",children:[t.jsx("strong",{children:"Run failed"}),t.jsx("button",{type:"button","aria-label":"Copy run error",title:"Copy run error",onClick:()=>{mn()},children:t.jsx("span",{"aria-live":"polite",children:an})})]}),t.jsx("p",{children:Ue})]})]}),!P&&t.jsx(xt,{busy:h,deleting:j,onDelete:v})]})}function jt(i){const e=typeof i=="number"?i:Date.parse(i);if(!Number.isFinite(e))return null;const n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<5)return"just now";if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const s=Math.floor(o/24);return s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function bt(i){const e=typeof i=="number"?i:Date.parse(i);return Number.isFinite(e)?new Date(e).toLocaleString():void 0}function Si(i){return i==="dispatched"||i==="awaiting_provider"}function Ni(i,e){if(!e||!In(e.status??""))return null;if(e.runId){const n=i.find(r=>r.runId===e.runId);if(n)return n.attemptId}return i.find(n=>Si(n.status))?.attemptId??null}function sn(i){const e=z.c(24),{revisions:n,loading:r,error:o}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{children:[t.jsx(Ht,{size:14,"aria-hidden":"true"}),"History"]}),e[0]=s):s=e[0];const a=n.length===1?"":"s";let c;e[1]!==n.length||e[2]!==a?(c=t.jsxs("header",{className:"inspector-source-meta",children:[s,t.jsxs("code",{children:[n.length," revision",a]})]}),e[1]=n.length,e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=r&&t.jsx("p",{className:"inspector-analysis-json-status",role:"status",children:"Loading asset history…"}),e[4]=r,e[5]=d):d=e[5];let l;e[6]!==o?(l=o&&t.jsx("p",{className:"inspector-run-error",role:"alert",children:o}),e[6]=o,e[7]=l):l=e[7];let u;e[8]!==o||e[9]!==r||e[10]!==n.length?(u=!r&&!o&&n.length===0&&t.jsx("p",{className:"inspector-analysis-json-status",children:"No revisions recorded for this asset."}),e[8]=o,e[9]=r,e[10]=n.length,e[11]=u):u=e[11];let f;if(e[12]!==n){let j;e[14]!==n.length?(j=(y,N)=>t.jsxs("li",{children:[t.jsx("span",{className:"inspector-history-index",children:n.length-N}),t.jsxs("div",{children:[t.jsxs("header",{children:[t.jsx("strong",{children:y.operation?.replaceAll("_"," ")??"Asset revision"}),t.jsx("code",{title:y.hash,children:y.hash.slice(0,8)})]}),t.jsx("p",{children:y.message}),t.jsxs("small",{children:[t.jsx("time",{dateTime:y.date,title:bt(y.date),children:jt(y.date)??y.date}),y.author?` · ${y.author}`:""]})]})]},y.hash),e[14]=n.length,e[15]=j):j=e[15],f=n.map(j),e[12]=n,e[13]=f}else f=e[13];let m;e[16]!==f?(m=t.jsx("ol",{className:"inspector-history",children:f}),e[16]=f,e[17]=m):m=e[17];let h;return e[18]!==c||e[19]!==d||e[20]!==l||e[21]!==u||e[22]!==m?(h=t.jsxs("section",{className:"inspector-generations","aria-label":"Asset history",children:[c,d,l,u,m]}),e[18]=c,e[19]=d,e[20]=l,e[21]=u,e[22]=m,e[23]=h):h=e[23],h}function Ii(i){const e=z.c(35),{attempts:n,currentExecution:r,loading:o,error:s,artifactAssets:a,onLoadPayload:c}=i;let d;e[0]!==n||e[1]!==r?(d=Ni(n,r),e[0]=n,e[1]=r,e[2]=d):d=e[2];const l=d;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("span",{children:[t.jsx(Ht,{size:14,"aria-hidden":"true"}),"Generations"]}),e[3]=u):u=e[3];const f=n.length===1?"":"s";let m;e[4]!==n.length||e[5]!==f?(m=t.jsxs("header",{className:"inspector-source-meta",children:[u,t.jsxs("code",{children:[n.length," attempt",f]})]}),e[4]=n.length,e[5]=f,e[6]=m):m=e[6];let h;e[7]!==o?(h=o&&t.jsx("p",{className:"inspector-analysis-json-status",role:"status",children:"Loading generation history…"}),e[7]=o,e[8]=h):h=e[8];let j;e[9]!==s?(j=s&&t.jsx("p",{className:"inspector-run-error",role:"alert",children:s}),e[9]=s,e[10]=j):j=e[10];let y;e[11]!==n.length||e[12]!==s||e[13]!==o?(y=!o&&!s&&n.length===0&&t.jsx("p",{className:"inspector-analysis-json-status",children:"No generation attempts recorded for this cell."}),e[11]=n.length,e[12]=s,e[13]=o,e[14]=y):y=e[14];let N;if(e[15]!==a||e[16]!==n||e[17]!==r?.status||e[18]!==l||e[19]!==c){let S;e[21]!==a||e[22]!==n.length||e[23]!==r?.status||e[24]!==l||e[25]!==c?(S=(x,A)=>{const C=n.length-A,I=x.artifactId?a.get(x.artifactId):void 0,k=I??(x.mediaUrl||x.thumbnailUrl?{type:x.mediaUrl&&!x.thumbnailUrl?"video":"image",mediaUrl:x.mediaUrl,thumbnailUrl:x.thumbnailUrl,duration:null}:null),R=x.transitions.at(-1),T=l===x.attemptId,$=x.artifactId??x.providerArtifactId;return t.jsxs("li",{className:["inspector-generation-attempt",T?"inspector-generation-attempt-live":""].filter(Boolean).join(" "),children:[t.jsxs("div",{className:"inspector-generation-attempt-head",children:[k?t.jsx("div",{className:"inspector-generation-thumb",children:t.jsx(Xn,{asset:k})}):t.jsx(gt,{asset:I,kindHint:"generate_image"}),t.jsxs("div",{className:"inspector-generation-facts",children:[t.jsxs("div",{className:"inspector-generation-attempt-title",children:[t.jsxs("strong",{children:["Attempt ",C]}),t.jsx("span",{className:`inspector-generation-status inspector-generation-status-${x.status}`,children:x.status}),T&&t.jsx("span",{className:"inspector-generation-live",role:"status",children:r?.status??"running"})]}),t.jsx("span",{className:"inspector-generation-meta",title:bt(x.createdAt),children:[An(x.tool),x.model,jt(x.createdAt)].filter(Boolean).join(" · ")}),R&&t.jsxs("code",{className:"inspector-generation-commit",title:R.commitHash,children:["commit ",R.commitHash.slice(0,8)]}),(x.resolvedPrompt||x.prompt)&&t.jsx("p",{title:x.resolvedPrompt??x.prompt??void 0,children:(x.resolvedPrompt??x.prompt??"").slice(0,160)}),x.transitions.length>0&&t.jsx("ol",{className:"inspector-generation-timeline","aria-label":`Attempt ${C} status timeline`,children:x.transitions.map(Ai)}),x.error&&t.jsx("p",{className:"inspector-generation-error",role:x.status==="failed"?"alert":void 0,children:x.error}),x.providerTask&&t.jsx(Yn,{task:x.providerTask})]})]}),(x.payload!==void 0||x.payloadAvailable&&c)&&t.jsx(ht,{label:"Payload",value:x.payload,loadValue:x.payload===void 0&&$&&c?()=>c($):void 0,ariaLabel:`Generation payload for attempt ${C}`,artifactAssets:a})]},x.attemptId)},e[21]=a,e[22]=n.length,e[23]=r?.status,e[24]=l,e[25]=c,e[26]=S):S=e[26],N=n.map(S),e[15]=a,e[16]=n,e[17]=r?.status,e[18]=l,e[19]=c,e[20]=N}else N=e[20];let b;e[27]!==N?(b=t.jsx("ol",{className:"inspector-generations-list",children:N}),e[27]=N,e[28]=b):b=e[28];let v;return e[29]!==m||e[30]!==h||e[31]!==j||e[32]!==y||e[33]!==b?(v=t.jsxs("section",{className:"inspector-generations","aria-label":"Generation attempts",children:[m,h,j,y,b]}),e[29]=m,e[30]=h,e[31]=j,e[32]=y,e[33]=b,e[34]=v):v=e[34],v}function Ai(i,e){return t.jsxs("li",{children:[t.jsx("span",{className:`inspector-generation-timeline-dot inspector-generation-timeline-dot-${i.status}`,"aria-hidden":"true"}),t.jsx("span",{children:i.status}),t.jsx("time",{dateTime:i.commitDate,title:bt(i.commitDate),children:jt(i.commitDate)})]},`${i.commitHash}:${e}`)}function Ci(i){const e=z.c(14),{notebookId:n,cell:r,artifactAssets:o,history:s}=i,a=!!r.outputArtifactId,c=a?"inspector-body inspector-source-body inspector-source-split":"inspector-body inspector-source-body";let d;e[0]!==r.id||e[1]!==s?.error||e[2]!==s?.loading||e[3]!==s?.revisions||e[4]!==a?(d=a&&t.jsx("div",{className:"inspector-source-pane inspector-source-history-pane",children:t.jsx(sn,{revisions:s?.revisions??[],loading:s?.loading??!1,error:s?.error??null},r.id)}),e[0]=r.id,e[1]=s?.error,e[2]=s?.loading,e[3]=s?.revisions,e[4]=a,e[5]=d):d=e[5];let l;e[6]!==o||e[7]!==r||e[8]!==n?(l=t.jsx("div",{className:"inspector-source-pane inspector-source-dolt-pane",children:t.jsx(es,{notebookId:n,cell:r,artifactAssets:o},r.id)}),e[6]=o,e[7]=r,e[8]=n,e[9]=l):l=e[9];let u;return e[10]!==c||e[11]!==d||e[12]!==l?(u=t.jsxs("div",{className:c,children:[d,l]}),e[10]=c,e[11]=d,e[12]=l,e[13]=u):u=e[13],u}function Ri(i){const e=z.c(106),{headerActionHost:n,notebookId:r,cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,status:u,error:f,busy:m,deleting:h,sourceVisible:j,historyVisible:y,generationsVisible:N,generationActions:b,mediaInsightWork:v,onUpdate:S,onSetInput:x,onRun:A,onDelete:C,onOpenFullscreen:I,onPreviewPayload:k,initialGenerationPreview:R,onSelectSource:T,onLoadGenerationPayload:$,onInspectGenerationRequest:g,onTranscribeAsset:L,onLoadTranscriptJson:D,onDownloadTranscriptSrt:G,generations:W,history:F,mentionAssets:U,voiceCatalog:_,bookId:B,assetTools:J,queuedCellIds:te,runErrors:O,jobs:w,onCancelJob:oe}=i,de=y===void 0?!1:y,ye=N===void 0?!1:N;let re;e[0]!==c||e[1]!==d||e[2]!==l?(re=Es(c,d,l),e[0]=c,e[1]=d,e[2]=l,e[3]=re):re=e[3];const X=re;let ae;e[4]!==o||e[5]!==s||e[6]!==a||e[7]!==f||e[8]!==w||e[9]!==te||e[10]!==O?(ae=Sn({cell:o,cells:s,edges:a,queuedCellIds:te,runErrors:O,error:f,jobs:w}),e[4]=o,e[5]=s,e[6]=a,e[7]=f,e[8]=w,e[9]=te,e[10]=O,e[11]=ae):ae=e[11];const Y=ae;if(j&&!Ge(o.type)){let E;return e[12]!==X||e[13]!==o||e[14]!==F||e[15]!==r?(E=t.jsx(Ci,{notebookId:r,cell:o,artifactAssets:X,history:F}),e[12]=X,e[13]=o,e[14]=F,e[15]=r,e[16]=E):E=e[16],E}if(de){let E;e[17]!==F?.revisions?(E=F?.revisions??[],e[17]=F?.revisions,e[18]=E):E=e[18];const q=F?.loading??!1,ee=F?.error??null;let ie;return e[19]!==o.id||e[20]!==E||e[21]!==q||e[22]!==ee?(ie=t.jsx("div",{className:"inspector-body inspector-source-body",children:t.jsx(sn,{revisions:E,loading:q,error:ee},o.id)}),e[19]=o.id,e[20]=E,e[21]=q,e[22]=ee,e[23]=ie):ie=e[23],ie}if(ye){let E;e[24]!==W?.attempts?(E=W?.attempts??[],e[24]=W?.attempts,e[25]=E):E=e[25];const q=W?.currentExecution??null,ee=W?.loading??!1,ie=W?.error??null;let ce;return e[26]!==X||e[27]!==o.id||e[28]!==$||e[29]!==E||e[30]!==q||e[31]!==ee||e[32]!==ie?(ce=t.jsx("div",{className:"inspector-body inspector-source-body",children:t.jsx(Ii,{attempts:E,currentExecution:q,loading:ee,error:ie,artifactAssets:X,onLoadPayload:$},o.id)}),e[26]=X,e[27]=o.id,e[28]=$,e[29]=E,e[30]=q,e[31]=ee,e[32]=ie,e[33]=ce):ce=e[33],ce}if(o.type==="analysis"){let E;return e[34]!==c||e[35]!==m||e[36]!==o||e[37]!==d||e[38]!==s||e[39]!==h||e[40]!==a||e[41]!==C||e[42]!==x||e[43]!==S||e[44]!==l?(E=t.jsx(yi,{cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,busy:m,deleting:h,onUpdate:S,onSetInput:x,onDelete:C}),e[34]=c,e[35]=m,e[36]=o,e[37]=d,e[38]=s,e[39]=h,e[40]=a,e[41]=C,e[42]=x,e[43]=S,e[44]=l,e[45]=E):E=e[45],E}let fe;e[46]!==o.type?(fe=Nn(o.type),e[46]=o.type,e[47]=fe):fe=e[47];const P=fe;if(P){let E;e[48]!==Y.jobId||e[49]!==Y.kind||e[50]!==w?(E=Y.kind==="queued"||Y.kind==="generating"?(w??[]).find(ee=>ee.operationId===Y.jobId&&typeof ee.id=="number")?.id:void 0,e[48]=Y.jobId,e[49]=Y.kind,e[50]=w,e[51]=E):E=e[51];let q;return e[52]!==X||e[53]!==c||e[54]!==J||e[55]!==B||e[56]!==m||e[57]!==o||e[58]!==d||e[59]!==s||e[60]!==h||e[61]!==P||e[62]!==a||e[63]!==Y||e[64]!==v||e[65]!==oe||e[66]!==C||e[67]!==G||e[68]!==g||e[69]!==D||e[70]!==I||e[71]!==A||e[72]!==T||e[73]!==x||e[74]!==L||e[75]!==S||e[76]!==E||e[77]!==l?(q=t.jsx(ai,{kind:P,cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,busy:m,deleting:h,mediaInsightWork:v,generationState:Y,cancelJobId:E,onUpdate:S,onSetInput:x,onRun:A,onCancelJob:oe,onSelectSource:T,onDelete:C,onOpenFullscreen:I,onTranscribeAsset:L,onLoadTranscriptJson:D,onDownloadTranscriptSrt:G,bookId:B,assetTools:J,artifactAssets:X,onInspectGenerationRequest:g}),e[52]=X,e[53]=c,e[54]=J,e[55]=B,e[56]=m,e[57]=o,e[58]=d,e[59]=s,e[60]=h,e[61]=P,e[62]=a,e[63]=Y,e[64]=v,e[65]=oe,e[66]=C,e[67]=G,e[68]=g,e[69]=D,e[70]=I,e[71]=A,e[72]=T,e[73]=x,e[74]=L,e[75]=S,e[76]=E,e[77]=l,e[78]=q):q=e[78],q}let Z;return e[79]!==X||e[80]!==c||e[81]!==J||e[82]!==B||e[83]!==m||e[84]!==o||e[85]!==d||e[86]!==s||e[87]!==h||e[88]!==a||e[89]!==f||e[90]!==b||e[91]!==n||e[92]!==R||e[93]!==U||e[94]!==r||e[95]!==C||e[96]!==I||e[97]!==k||e[98]!==A||e[99]!==T||e[100]!==x||e[101]!==S||e[102]!==j||e[103]!==u||e[104]!==_?(Z=t.jsx(vi,{headerActionHost:n,notebookId:r,bookId:B,assetTools:J,artifactAssets:X,sourceVisible:j,cell:o,cells:s,edges:a,asset:c,cellAssets:d,status:u,error:f,busy:m,deleting:h,onUpdate:S,onSetInput:x,onRun:A,onDelete:C,onOpenFullscreen:I,onPreviewPayload:k,initialGenerationPreview:R,onSelectSource:T,generationActions:b,mentionAssets:U,voiceCatalog:_}),e[79]=X,e[80]=c,e[81]=J,e[82]=B,e[83]=m,e[84]=o,e[85]=d,e[86]=s,e[87]=h,e[88]=a,e[89]=f,e[90]=b,e[91]=n,e[92]=R,e[93]=U,e[94]=r,e[95]=C,e[96]=I,e[97]=k,e[98]=A,e[99]=T,e[100]=x,e[101]=S,e[102]=j,e[103]=u,e[104]=_,e[105]=Z):Z=e[105],Z}export{Ri as N};
|
|
1
|
+
import{c as z,j as t,a as H,b as vn}from"./vendor-react-Dj7D1fD4.js";import{db as Sn,bE as Ge,dc as Nn,bP as In,bH as An,cm as dt,bQ as zt,dd as Cn,de as Gt,df as Ut,dg as kn,dh as Bt,di as at,dj as He,dk as me,dl as wn,dm as We,dn as Ft,dp as Mn,dq as Qe,dr as $n,ds as Pn,dt as Tn,an as Ot,am as Rn,du as Ln,dv as Dn,dw as _n,bB as En,dx as Gn,dy as Fn,dz as On,dA as Vn,dB as zn,dC as Jt,ad as Je,dD as Un,dE as Bn,dF as Jn,dG as Kn,dH as Hn,dI as qn,aj as Wn,dJ as Qn}from"./videobook-B5G0jMoi.js";import{M as Xn,A as gt,b as Yn,R as Zn,D as es,c as ts,d as ns,e as ss,C as is,a as os,f as rs,u as as,N as ls,g as Kt,h as cs,i as ds,j as ps}from"./ui-Cpr6zMTA.js";import{n as Xe,b as Fe}from"./vendor-yctIZ9Dz.js";import{G as us}from"./confirm-bodies-Bw818V9J.js";import{H as Ht,j as ms,i as Ee,c as qt,e as fs,an as hs,B as Wt,a4 as gs,$ as Qt,m as ys,C as Xt,X as xs,J as js,al as pt,ao as bs,R as vs,a3 as Ss,ad as Ns}from"./vendor-icons-CGqhCIXV.js";const Is=new Set(["extract_audio","split_video","prompt","analyze","concat","splice"]);function Yt(i){return Is.has(i)}const As=["prompt","provider","model","operation","tool","startSeconds","endSeconds","overlap","frameMode","timestampSeconds","generationMode"];function qe(i){return typeof i=="number"&&Number.isFinite(i)?String(i):"0"}function Cs(i,e=[]){const n=i.inputs?.generationSettings,r=!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(s=>{const a=s[1];return typeof a=="string"||typeof a=="number"||typeof a=="boolean"}));return{...Object.fromEntries(e.flatMap(s=>{const a=i.inputs?.[s.name];return typeof a=="string"||typeof a=="number"||typeof a=="boolean"?[[s.name,a]]:[]})),...r}}function Ze(i,e=[]){const n=i.inputs?.frameMode;return{prompt:i.prompt??"",provider:i.provider??"",model:i.model??"",operation:i.operation??"",tool:i.tool??"",startSeconds:qe(i.inputs?.startSeconds),endSeconds:qe(i.inputs?.endSeconds),overlap:qe(i.inputs?.overlap),frameMode:n==="time"||n==="last"?n:"first",timestampSeconds:qe(i.inputs?.timestampSeconds),generationMode:typeof i.inputs?.generationMode=="string"?i.inputs.generationMode:"",generationSettings:Cs(i,e)}}function ks(i,e,n=[]){const r=Bn(i,e,n);if(!r||!Ge(i.type))return Ze(i);const o=We(e,i.type,r),s=Ze(i,o?.controls);return{...s,...r,generationMode:o?Qe(o,n,s.generationMode):s.generationMode}}function ws(i,e,n=[]){const r=Ze(i,n);return As.some(o=>e[o]!==r[o])||JSON.stringify(e.generationSettings)!==JSON.stringify(r.generationSettings)}function lt(i){if(!i.trim())return!1;const e=Number(i);return Number.isFinite(e)&&e>=0}function Ms(i,e){return Ge(i.type)?!!(e.provider.trim()&&e.model.trim()&&e.operation.trim()&&e.tool.trim()):i.type==="split_video"?lt(e.startSeconds)&<(e.endSeconds):i.type==="splice"&&e.operation==="splice_video"?lt(e.overlap):!0}function Zt(i,e,n=[]){const r={...i.inputs??{}};delete r.generationMode,delete r.generationSettings;for(const o of n)delete r[o.name];return{...r,...e.generationMode?{generationMode:e.generationMode}:{},...Object.keys(e.generationSettings).length>0?{generationSettings:e.generationSettings}:{}}}function Vt(i,e,n=[],r=n){const o=Ze(i,n),s={};return e.prompt!==o.prompt&&(s.prompt=e.prompt),Yt(i.type)||(e.provider!==o.provider&&(s.provider=e.provider||void 0),e.model!==o.model&&(s.model=e.model||void 0),e.operation!==o.operation&&(s.operation=e.operation||void 0),e.tool!==o.tool&&(s.tool=e.tool||void 0)),Ge(i.type)&&(e.generationMode!==o.generationMode||JSON.stringify(e.generationSettings)!==JSON.stringify(o.generationSettings))&&(s.inputs=Zt(i,e,r)),i.type==="split_video"&&(e.startSeconds!==o.startSeconds||e.endSeconds!==o.endSeconds)&&(s.inputs={...i.inputs??{},startSeconds:Number(e.startSeconds),endSeconds:Number(e.endSeconds)}),i.type==="splice"&&e.operation==="splice_video"&&e.overlap!==o.overlap&&(s.inputs={...i.inputs??{},overlap:Number(e.overlap)}),s}function $s(i){return i.type==="extract_audio"?["video"]:i.type==="split_video"?["video","analysis"]:i.type==="analysis"?["result"]:i.type==="image"?["media","segment"]:i.type==="audio"||i.type==="video"?["media"]:[]}function Ps(i,e){const n=e.filter(r=>r.target===i.id).map(r=>r.targetInput);return[...new Set([...$s(i),...n])]}function ct(i){return i.type==="video"||i.type==="generate_video"||i.type==="concat"||i.type==="splice"}function Ts(i,e){return i||e>0}function en(i){if(i.classList.remove("inspector-source-picker-above"),!i.open)return;const e=i.querySelector("summary");e?.scrollIntoView({block:"nearest",inline:"nearest"});const n=i.querySelector(".inspector-source-picker-options"),r=i.closest(".inspector-media-content")??i.closest(".inspector-analysis-body")??i.closest(".inspector-body");if(!n||!r)return;const o=r.getBoundingClientRect(),s=(e??i).getBoundingClientRect(),a=o.bottom-s.bottom,c=s.top-o.top,d=Math.min(252,n.scrollHeight||160);a<d&&c>a&&i.classList.add("inspector-source-picker-above")}function Rs(i,e,n){return n.id===i.id?!1:i.type==="analysis"?e==="result"&&n.type==="analyze":i.type==="extract_audio"?e==="video"&&ct(n):i.type==="split_video"?e==="analysis"?n.type==="analysis":e==="video"?ct(n):!1:i.type==="prompt"&&e==="analysis"?n.type==="analysis":i.type==="audio"&&e==="media"?n.type==="extract_audio"||n.type==="generate_audio":i.type==="video"&&e==="media"?n.type==="split_video":i.type==="image"&&e==="media"?n.type==="generate_image":i.type==="image"&&e==="segment"?ct(n):!0}function Ls(i){const e=z.c(6),{address:n,onOpen:r}=i,o=`Open @${n} fullscreen`,s=`Open @${n} fullscreen`;let a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Qt,{size:14}),c=t.jsx("span",{children:"Fullscreen"}),e[0]=a,e[1]=c):(a=e[0],c=e[1]);let d;return e[2]!==r||e[3]!==o||e[4]!==s?(d=t.jsx("div",{className:"inspector-media-actions",role:"group","aria-label":"Video preview actions",children:t.jsx("span",{className:"inspector-media-action-slot",children:t.jsxs("button",{type:"button",className:"inspector-fullscreen-button","aria-label":o,title:s,onClick:r,children:[a,c]})})}),e[2]=r,e[3]=o,e[4]=s,e[5]=d):d=e[5],d}function Ds(i){const e=z.c(18),{address:n,previewUrl:r,onOpen:o,onEdit:s}=i,a=`Open @${n} fullscreen`,c=`@${n}`;let d;e[0]!==r||e[1]!==c?(d=t.jsx("img",{src:r,alt:c},r),e[0]=r,e[1]=c,e[2]=d):d=e[2];let l;e[3]!==o||e[4]!==a||e[5]!==d?(l=t.jsx("button",{type:"button",className:"inspector-cell-media-open","aria-label":a,onClick:o,children:d}),e[3]=o,e[4]=a,e[5]=d,e[6]=l):l=e[6];const u=`Edit @${n} image`,f=`Edit @${n} image`;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(gs,{size:13}),e[7]=m):m=e[7];let h;e[8]!==s||e[9]!==u||e[10]!==f?(h=t.jsxs("button",{type:"button",className:"inspector-edit-button","aria-label":u,title:f,onClick:s,children:[m,"Edit"]}),e[8]=s,e[9]=u,e[10]=f,e[11]=h):h=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("span",{className:"inspector-cell-media-zoom","aria-hidden":"true",children:[t.jsx(Qt,{size:13}),"Full"]}),e[12]=j):j=e[12];let y;e[13]!==h?(y=t.jsxs("span",{className:"inspector-cell-media-overlay",children:[h,j]}),e[13]=h,e[14]=y):y=e[14];let N;return e[15]!==y||e[16]!==l?(N=t.jsxs("div",{className:"inspector-cell-media-frame",children:[l,y]}),e[15]=y,e[16]=l,e[17]=N):N=e[17],N}function _s(i){const e=z.c(11),{address:n,waveform:r,mediaUrl:o}=i,[s,a]=H.useState(0);let c;e[0]!==s||e[1]!==r?(c=t.jsx("span",{className:"inspector-audio-waveform",children:r.length>0?t.jsx(Kt,{peaks:r,progress:s}):t.jsx(cs,{})}),e[0]=s,e[1]=r,e[2]=c):c=e[2];const d=`@${n} audio`;let l,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=h=>{const j=h.currentTarget;a(Number.isFinite(j.duration)&&j.duration>0?Math.min(1,Math.max(0,j.currentTime/j.duration)):0)},u=()=>a(0),e[3]=l,e[4]=u):(l=e[3],u=e[4]);let f;e[5]!==o||e[6]!==d?(f=t.jsx("audio",{src:o,"aria-label":d,controls:!0,preload:"metadata",onTimeUpdate:l,onEnded:u},o),e[5]=o,e[6]=d,e[7]=f):f=e[7];let m;return e[8]!==c||e[9]!==f?(m=t.jsxs("div",{className:"inspector-audio-stage",children:[c,f]}),e[8]=c,e[9]=f,e[10]=m):m=e[10],m}function ut(i){const e=z.c(34),{asset:n,address:r,allowFullscreen:o,overlayMetadata:s,onOpenFullscreen:a}=i,c=s===void 0?!0:s,d=H.useRef(null),l=n.mediaUrl,u=n.thumbnailUrl??l,f=n.type==="video"||n.type==="final",m=n.type==="audio",h=n.type==="image",j=o&&(h||f);let y;e[0]!==n||e[1]!==a?(y=I=>{const k=I===void 0?"view":I;d.current?.pause(),a(n,k)},e[0]=n,e[1]=a,e[2]=y):y=e[2];const N=y;if(!u)return null;const b=`inspector-cell-preview${m?" inspector-cell-preview-audio":""}`;let v;e[3]!==r||e[4]!==n.thumbnailUrl||e[5]!==n.waveform||e[6]!==j||e[7]!==m||e[8]!==h||e[9]!==f||e[10]!==l||e[11]!==N||e[12]!==u?(v=f&&l?t.jsx("video",{ref:d,src:n.thumbnailUrl?l:`${l}#t=0.1`,poster:n.thumbnailUrl??void 0,controls:!0,controlsList:"nofullscreen nodownload noremoteplayback",disablePictureInPicture:!0,playsInline:!0,preload:"metadata"},l):m&&l?t.jsx(_s,{address:r,waveform:n.waveform??[],mediaUrl:l}):h&&j?t.jsx(Ds,{address:r,previewUrl:u,onOpen:()=>N("view"),onEdit:()=>N("edit")}):t.jsx("img",{src:u,alt:`@${r}`},u),e[3]=r,e[4]=n.thumbnailUrl,e[5]=n.waveform,e[6]=j,e[7]=m,e[8]=h,e[9]=f,e[10]=l,e[11]=N,e[12]=u,e[13]=v):v=e[13];let S;e[14]!==n.duration||e[15]!==n.height||e[16]!==n.type||e[17]!==n.width||e[18]!==m||e[19]!==f||e[20]!==c?(S=!m&&c&&t.jsx(ls,{className:"inspector-cell-metadata",width:n.width,height:n.height,durationSeconds:f?n.duration:null,fallbackLabel:n.type.toUpperCase()}),e[14]=n.duration,e[15]=n.height,e[16]=n.type,e[17]=n.width,e[18]=m,e[19]=f,e[20]=c,e[21]=S):S=e[21];let x;e[22]!==v||e[23]!==S?(x=t.jsxs("div",{className:"inspector-cell-media",children:[v,S]}),e[22]=v,e[23]=S,e[24]=x):x=e[24];let A;e[25]!==r||e[26]!==j||e[27]!==f||e[28]!==N?(A=j&&f&&t.jsx(Ls,{address:r,onOpen:()=>N("view")}),e[25]=r,e[26]=j,e[27]=f,e[28]=N,e[29]=A):A=e[29];let C;return e[30]!==b||e[31]!==x||e[32]!==A?(C=t.jsxs("section",{className:b,"aria-label":"Cell output media",children:[x,A]}),e[30]=b,e[31]=x,e[32]=A,e[33]=C):C=e[33],C}function Es(i,e,n){const r=new Map;for(const o of n??[])r.set(o.artifactId,o);for(const o of e?.values()??[])r.set(o.artifactId,o);return i&&r.set(i.artifactId,i),r}function mt(i){return i.type.replaceAll("_"," ")}function ft(i){const e=z.c(3),{cell:n,asset:r}=i;let o;return e[0]!==r||e[1]!==n.type?(o=t.jsx(gt,{asset:r,kindHint:n.type}),e[0]=r,e[1]=n.type,e[2]=o):o=e[2],o}function Gs(i){const e=z.c(73),{input:n,candidates:r,selectedCellId:o,cellAssets:s,busy:a,onSelect:c}=i,d=H.useRef(null);let l,u,f,m,h,j,y,N,b,v,S,x,A;if(e[0]!==a||e[1]!==r||e[2]!==s||e[3]!==n||e[4]!==c||e[5]!==o){let U;e[19]!==o?(U=O=>O.id===o,e[19]=o,e[20]=U):U=e[20];const _=r.find(U);let B;e[21]!==c||e[22]!==o?(B=O=>{d.current?.removeAttribute("open"),O!==o&&c(O)},e[21]=c,e[22]=o,e[23]=B):B=e[23],l=B,x=d,A="inspector-source-picker",f=Os,m=Fs,e[24]===Symbol.for("react.memo_cache_sentinel")?(h=O=>{O.key==="Escape"&&(O.preventDefault(),d.current?.removeAttribute("open"),d.current?.querySelector("summary")?.focus())},e[24]=h):h=e[24],u="preserve";let J;e[25]!==n?(J=n.replaceAll("_"," "),e[25]=n,e[26]=J):J=e[26],j=`${J} input`;let te;e[27]!==n?(te=n.replaceAll("_"," "),e[27]=n,e[28]=te):te=e[28],y=`${te} input`,N=a,b=a?-1:0,e[29]!==a?(v=O=>{a&&O.preventDefault()},e[29]=a,e[30]=v):v=e[30],S=_?t.jsxs(t.Fragment,{children:[t.jsx(ft,{cell:_,asset:s?.get(_.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(_.slot)}),t.jsx("small",{children:mt(_)})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(pt,{size:15})}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:"No source"}),t.jsx("small",{children:"Optional input"})]})]}),e[0]=a,e[1]=r,e[2]=s,e[3]=n,e[4]=c,e[5]=o,e[6]=l,e[7]=u,e[8]=f,e[9]=m,e[10]=h,e[11]=j,e[12]=y,e[13]=N,e[14]=b,e[15]=v,e[16]=S,e[17]=x,e[18]=A}else l=e[6],u=e[7],f=e[8],m=e[9],h=e[10],j=e[11],y=e[12],N=e[13],b=e[14],v=e[15],S=e[16],x=e[17],A=e[18];let C;e[31]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Xt,{className:"inspector-source-picker-chevron",size:15,"aria-hidden":"true"}),e[31]=C):C=e[31];let I;e[32]!==u||e[33]!==j||e[34]!==y||e[35]!==N||e[36]!==b||e[37]!==v||e[38]!==S?(I=t.jsxs("summary",{"data-composer-focus":u,"aria-label":j,title:y,"aria-disabled":N,tabIndex:b,onClick:v,children:[S,C]}),e[32]=u,e[33]=j,e[34]=y,e[35]=N,e[36]=b,e[37]=v,e[38]=S,e[39]=I):I=e[39];let k;e[40]!==n?(k=n.replaceAll("_"," "),e[40]=n,e[41]=k):k=e[41];const R=`${k} input options`,T=o===null;let $;e[42]!==l?($=()=>l(null),e[42]=l,e[43]=$):$=e[43];let g;e[44]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(pt,{size:15})}),e[44]=g):g=e[44];let L;e[45]===Symbol.for("react.memo_cache_sentinel")?(L=t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:"No source"}),t.jsx("small",{children:"Disconnect input"})]}),e[45]=L):L=e[45];let D;e[46]!==a||e[47]!==T||e[48]!==$?(D=t.jsxs("button",{type:"button",role:"option","aria-selected":T,disabled:a,onClick:$,children:[g,L]}),e[46]=a,e[47]=T,e[48]=$,e[49]=D):D=e[49];let G;if(e[50]!==a||e[51]!==r||e[52]!==s||e[53]!==l||e[54]!==o){let U;e[56]!==a||e[57]!==s||e[58]!==l||e[59]!==o?(U=_=>t.jsxs("button",{type:"button",role:"option","aria-selected":_.id===o,disabled:a,onClick:()=>l(_.id),children:[t.jsx(ft,{cell:_,asset:s?.get(_.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(_.slot)}),t.jsx("small",{children:mt(_)})]})]},_.id),e[56]=a,e[57]=s,e[58]=l,e[59]=o,e[60]=U):U=e[60],G=r.map(U),e[50]=a,e[51]=r,e[52]=s,e[53]=l,e[54]=o,e[55]=G}else G=e[55];let W;e[61]!==R||e[62]!==D||e[63]!==G?(W=t.jsxs("div",{className:"inspector-source-picker-options",role:"listbox","aria-label":R,children:[D,G]}),e[61]=R,e[62]=D,e[63]=G,e[64]=W):W=e[64];let F;return e[65]!==f||e[66]!==m||e[67]!==h||e[68]!==I||e[69]!==W||e[70]!==x||e[71]!==A?(F=t.jsxs("details",{ref:x,className:A,onToggle:f,onBlur:m,onKeyDown:h,children:[I,W]}),e[65]=f,e[66]=m,e[67]=h,e[68]=I,e[69]=W,e[70]=x,e[71]=A,e[72]=F):F=e[72],F}function Fs(i){i.currentTarget.contains(i.relatedTarget)||i.currentTarget.removeAttribute("open")}function Os(i){en(i.currentTarget)}function Ye(i){return i==="input"?"input":i==="first_frame"?"first frame input":i==="last_frame"?"last frame input":i==="replace_audio"?"replacement audio":`${i.replaceAll("_"," ")} input`}function Vs(i){const e=z.c(41),{attachments:n,cells:r,cellAssets:o,busy:s,onAttach:a}=i,c=H.useRef(null);let d,l,u,f,m,h,j,y,N,b;if(e[0]!==n||e[1]!==s||e[2]!==o||e[3]!==r||e[4]!==a){const x=new Map(r.map(Bs)),A=g=>{c.current?.removeAttribute("open"),a(g.targetInput,g.sourceCellId)};h=c,j="inspector-source-picker inspector-attach-source-picker",y=Us,N=zs,e[15]===Symbol.for("react.memo_cache_sentinel")?(b=g=>{g.key==="Escape"&&(g.preventDefault(),c.current?.removeAttribute("open"),c.current?.querySelector("summary")?.focus())},e[15]=b):b=e[15];const C=s?-1:0;let I;e[16]!==s?(I=g=>{s&&g.preventDefault()},e[16]=s,e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"inspector-source-thumb inspector-source-thumb-empty","aria-hidden":"true",children:t.jsx(ys,{size:15})}),e[18]=k):k=e[18];let R;e[19]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("strong",{children:"Attach media"}),e[19]=R):R=e[19];let T;e[20]!==n.length?(T=t.jsxs("span",{className:"inspector-source-picker-copy",children:[R,t.jsxs("small",{children:[n.length," available"]})]}),e[20]=n.length,e[21]=T):T=e[21];let $;e[22]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(Xt,{className:"inspector-source-picker-chevron",size:15,"aria-hidden":"true"}),e[22]=$):$=e[22],e[23]!==s||e[24]!==C||e[25]!==I||e[26]!==T?(l=t.jsxs("summary",{"data-composer-focus":"preserve","aria-label":"Attach media input",title:"Attach media input","aria-disabled":s,tabIndex:C,onClick:I,children:[k,T,$]}),e[23]=s,e[24]=C,e[25]=I,e[26]=T,e[27]=l):l=e[27],d="inspector-source-picker-options",u="listbox",f="Media input options",m=n.map(g=>{const L=x.get(g.sourceCellId);return L?t.jsxs("button",{type:"button",role:"option","aria-selected":"false",disabled:s,onClick:()=>A(g),children:[t.jsx(ft,{cell:L,asset:o?.get(L.id)}),t.jsxs("span",{className:"inspector-source-picker-copy",children:[t.jsx("strong",{children:Fe(L.slot)}),t.jsxs("small",{children:[mt(L)," · ",Ye(g.target)]})]})]},`${g.sourceCellId}:${g.target}`):null}),e[0]=n,e[1]=s,e[2]=o,e[3]=r,e[4]=a,e[5]=d,e[6]=l,e[7]=u,e[8]=f,e[9]=m,e[10]=h,e[11]=j,e[12]=y,e[13]=N,e[14]=b}else d=e[5],l=e[6],u=e[7],f=e[8],m=e[9],h=e[10],j=e[11],y=e[12],N=e[13],b=e[14];let v;e[28]!==d||e[29]!==u||e[30]!==f||e[31]!==m?(v=t.jsx("div",{className:d,role:u,"aria-label":f,children:m}),e[28]=d,e[29]=u,e[30]=f,e[31]=m,e[32]=v):v=e[32];let S;return e[33]!==l||e[34]!==v||e[35]!==h||e[36]!==j||e[37]!==y||e[38]!==N||e[39]!==b?(S=t.jsxs("details",{ref:h,className:j,onToggle:y,onBlur:N,onKeyDown:b,children:[l,v]}),e[33]=l,e[34]=v,e[35]=h,e[36]=j,e[37]=y,e[38]=N,e[39]=b,e[40]=S):S=e[40],S}function zs(i){i.currentTarget.contains(i.relatedTarget)||i.currentTarget.removeAttribute("open")}function Us(i){en(i.currentTarget)}function Bs(i){return[i.id,i]}function Js(i,e,n,r){const o=new Map(e.map(s=>[s.id,s]));return me(i,e,n,r).flatMap(s=>{const a=o.get(s.sourceCellId);return a?[{token:s.token,cell:a}]:[]})}function yt(i){const e=z.c(37),{cell:n,cells:r,edges:o,busy:s,cellAssets:a,attachments:c,onSetInput:d}=i;let l;e[0]!==c?(l=c===void 0?[]:c,e[0]=c,e[1]=l):l=e[1];const u=l;let f,m,h,j,y;if(e[2]!==u||e[3]!==s||e[4]!==n||e[5]!==a||e[6]!==r||e[7]!==o||e[8]!==d){y=Symbol.for("react.early_return_sentinel");e:{const S=Ps(n,o);let x;e[14]!==n||e[15]!==r||e[16]!==o?(x=I=>{const k=o.find(g=>g.target===n.id&&g.targetInput===I),R=o.filter(g=>g.target!==n.id||g.targetInput!==I),T=k?r.find(g=>g.id===k.source):void 0,$=r.filter(g=>Rs(n,I,g)&&qn(r,R,g.id,n.id)!==null||g.id===k?.source).sort(Ks);return Ts(!!k,$.length)?[{input:I,edge:k,sourceCell:T,candidates:$,inputLabel:I==="input"?"input":`${I.replaceAll("_"," ")} input`}]:[]},e[14]=n,e[15]=r,e[16]=o,e[17]=x):x=e[17];const A=S.flatMap(x);if(A.length===0&&u.length===0){y=null;break e}h="inspector-input-sources",e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("h3",{children:"Inputs"}),e[18]=j):j=e[18],f="inspector-input-source-rows";let C;e[19]!==s||e[20]!==a||e[21]!==d?(C=I=>{const{input:k,edge:R,sourceCell:T,candidates:$,inputLabel:g}=I;return t.jsxs("div",{className:R?"inspector-input-source-row connected":"inspector-input-source-row",children:[t.jsx(Gs,{input:k,candidates:$,selectedCellId:R?.source??null,cellAssets:a,busy:s,onSelect:L=>d(k,L)}),R&&t.jsx("button",{type:"button",className:"inspector-input-remove-button","aria-label":`Remove ${T?Fe(T.slot):"source"} from ${g}`,title:"Remove input",disabled:s,onClick:()=>{d(k,null)},children:t.jsx(xs,{size:15,"aria-hidden":"true"})})]},k)},e[19]=s,e[20]=a,e[21]=d,e[22]=C):C=e[22],m=A.map(C)}e[2]=u,e[3]=s,e[4]=n,e[5]=a,e[6]=r,e[7]=o,e[8]=d,e[9]=f,e[10]=m,e[11]=h,e[12]=j,e[13]=y}else f=e[9],m=e[10],h=e[11],j=e[12],y=e[13];if(y!==Symbol.for("react.early_return_sentinel"))return y;let N;e[23]!==u||e[24]!==s||e[25]!==a||e[26]!==r||e[27]!==d?(N=u.length>0&&t.jsx("div",{className:"inspector-input-source-row",children:t.jsx(Vs,{attachments:u,cells:r,cellAssets:a,busy:s,onAttach:d})}),e[23]=u,e[24]=s,e[25]=a,e[26]=r,e[27]=d,e[28]=N):N=e[28];let b;e[29]!==f||e[30]!==m||e[31]!==N?(b=t.jsxs("div",{className:f,children:[m,N]}),e[29]=f,e[30]=m,e[31]=N,e[32]=b):b=e[32];let v;return e[33]!==h||e[34]!==j||e[35]!==b?(v=t.jsxs("section",{className:h,children:[j,b]}),e[33]=h,e[34]=j,e[35]=b,e[36]=v):v=e[36],v}function Ks(i,e){return i.slot.row-e.slot.row||i.slot.column-e.slot.column}function Hs(i){const e=z.c(10),{busy:n,deleting:r,onDelete:o}=i;let s;e[0]!==o?(s=()=>{o()},e[0]=o,e[1]=s):s=e[1];const a=n||r;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(pt,{size:13}),e[2]=c):c=e[2];const d=r?"Deleting…":"Delete cell";let l;e[3]!==d?(l=t.jsx("span",{children:d}),e[3]=d,e[4]=l):l=e[4];let u;return e[5]!==r||e[6]!==s||e[7]!==a||e[8]!==l?(u=t.jsxs("button",{type:"button",className:"danger-button inspector-delete-cell-button","aria-busy":r,title:"Delete cell",onClick:s,disabled:a,children:[c,l]}),e[5]=r,e[6]=s,e[7]=a,e[8]=l,e[9]=u):u=e[9],u}function xt(i){const e=z.c(4),{busy:n,deleting:r,onDelete:o}=i;let s;return e[0]!==n||e[1]!==r||e[2]!==o?(s=t.jsx("section",{className:"inspector-cell-actions inspector-compact-actions","aria-label":"Cell cleanup actions",children:t.jsx(Hs,{busy:n,deleting:r,onDelete:o})}),e[0]=n,e[1]=r,e[2]=o,e[3]=s):s=e[3],s}function tn(i){const e=z.c(23),{artifactIds:n,availableArtifactIds:r,currentArtifactId:o,selectedArtifactId:s,outputLabel:a,onSelect:c}=i,d=n.indexOf(s)+1,l=s===o,u=`${a} versions`;let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsxs("span",{className:"inspector-audio-version-label",children:[t.jsx(js,{size:13,"aria-hidden":"true"}),"Version"]}),e[0]=f):f=e[0];const m=`${a} version`;let h;e[1]!==c?(h=x=>c(x.target.value),e[1]=c,e[2]=h):h=e[2];let j;if(e[3]!==n||e[4]!==r||e[5]!==o){let x;e[7]!==n.length||e[8]!==r||e[9]!==o?(x=(A,C)=>t.jsxs("option",{value:A,disabled:!r.has(A),children:["Version ",C+1," of ",n.length,A===o?" · current":""]},A),e[7]=n.length,e[8]=r,e[9]=o,e[10]=x):x=e[10],j=n.map(x),e[3]=n,e[4]=r,e[5]=o,e[6]=j}else j=e[6];let y;e[11]!==s||e[12]!==m||e[13]!==h||e[14]!==j?(y=t.jsx("select",{value:s,"aria-label":m,onChange:h,children:j}),e[11]=s,e[12]=m,e[13]=h,e[14]=j,e[15]=y):y=e[15];const N=`inspector-audio-version-state${l?" current":""}`,b=l?"Current output":`Viewing version ${d}`;let v;e[16]!==N||e[17]!==b?(v=t.jsx("span",{className:N,"aria-live":"polite",children:b}),e[16]=N,e[17]=b,e[18]=v):v=e[18];let S;return e[19]!==u||e[20]!==y||e[21]!==v?(S=t.jsxs("section",{className:"inspector-audio-versions","aria-label":u,children:[f,y,v]}),e[19]=u,e[20]=y,e[21]=v,e[22]=S):S=e[22],S}function qs(i){const e=z.c(22),{bookId:n,assetTools:r,asset:o}=i,s=r??null;let a;e[0]!==o.artifactId||e[1]!==n?(a={bookId:n,assetId:o.artifactId},e[0]=o.artifactId,e[1]=n,e[2]=a):a=e[2];const c=o.tags??null;let d;e[3]!==s||e[4]!==a||e[5]!==c?(d={call:s,target:a,tags:c},e[3]=s,e[4]=a,e[5]=c,e[6]=d):d=e[6];const l=Qn(d);let u,f,m,h;e[7]!==l?(u=y=>{l.addTag(y)},f=y=>{l.removeTag(y)},m=y=>{l.restoreTag(y)},h=y=>{l.loadSuggestions(y)},e[7]=l,e[8]=u,e[9]=f,e[10]=m,e[11]=h):(u=e[8],f=e[9],m=e[10],h=e[11]);let j;return e[12]!==l.busy||e[13]!==l.canEdit||e[14]!==l.error||e[15]!==l.suggestions||e[16]!==l.tags||e[17]!==u||e[18]!==f||e[19]!==m||e[20]!==h?(j=t.jsx(ds,{tags:l.tags,busy:l.busy,error:l.error,canEdit:l.canEdit,suggestions:l.suggestions,onAdd:u,onRemove:f,onRestore:m,onQueryChange:h}),e[12]=l.busy,e[13]=l.canEdit,e[14]=l.error,e[15]=l.suggestions,e[16]=l.tags,e[17]=u,e[18]=f,e[19]=m,e[20]=h,e[21]=j):j=e[21],j}function Ws(i){const e=z.c(6),{asset:n}=i,r=n?.thumbnailUrl??n?.mediaUrl??null;if(n?.type!=="audio"&&r){let a;return e[0]!==r?(a=t.jsx("img",{src:r,alt:""}),e[0]=r,e[1]=a):a=e[1],a}let o;e[2]!==n?.waveform?(o=(n?.waveform?.length??0)>0&&t.jsx(Kt,{peaks:n?.waveform??[],progress:0}),e[2]=n?.waveform,e[3]=o):o=e[3];let s;return e[4]!==o?(s=t.jsx("span",{className:"inspector-media-version-blank",children:o}),e[4]=o,e[5]=s):s=e[5],s}function Qs(i){const e=z.c(20),{kind:n,artifactIds:r,assetsById:o,currentArtifactId:s,selectedArtifactId:a,onSelect:c}=i;let d;e[0]!==n?(d=Ut(n),e[0]=n,e[1]=d):d=e[1];const l=`${d} versions`;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"inspector-media-field-label",children:"Versions"}),e[2]=u):u=e[2];let f;if(e[3]!==r||e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a){let j;e[9]!==r.length||e[10]!==o||e[11]!==s||e[12]!==c||e[13]!==a?(j=(y,N)=>{const b=o.get(y),v=y===s,S=y===a;return t.jsx("li",{children:t.jsxs("button",{type:"button",className:S?"inspector-media-version selected":"inspector-media-version",disabled:!b,"aria-current":S?"true":void 0,"aria-label":`Version ${N+1} of ${r.length}${v?", current output":""}`,onClick:()=>c(y),children:[t.jsx(Ws,{asset:b}),t.jsxs("span",{className:"inspector-media-version-label",children:["v",N+1,v&&t.jsx("span",{className:"inspector-media-version-now",children:"now"})]})]})},y)},e[9]=r.length,e[10]=o,e[11]=s,e[12]=c,e[13]=a,e[14]=j):j=e[14],f=r.map(j),e[3]=r,e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=f}else f=e[8];let m;e[15]!==f?(m=t.jsx("ul",{className:"inspector-media-version-list",children:f}),e[15]=f,e[16]=m):m=e[16];let h;return e[17]!==l||e[18]!==m?(h=t.jsxs("section",{className:"inspector-media-versions","aria-label":l,children:[u,m]}),e[17]=l,e[18]=m,e[19]=h):h=e[19],h}function Xs(i){const e=z.c(9),{kind:n,address:r,asset:o,inputs:s}=i;let a,c;if(e[0]!==r||e[1]!==o||e[2]!==s||e[3]!==n){const l=Un(n,r,o,s).filter(Zs);a="inspector-media-facts",c=l.map(Ys),e[0]=r,e[1]=o,e[2]=s,e[3]=n,e[4]=a,e[5]=c}else a=e[4],c=e[5];let d;return e[6]!==a||e[7]!==c?(d=t.jsx("dl",{className:a,children:c}),e[6]=a,e[7]=c,e[8]=d):d=e[8],d}function Ys(i){return t.jsxs("div",{children:[t.jsx("dt",{children:i.term}),t.jsx("dd",{children:i.value})]},i.key)}function Zs(i){return i.key!=="address"}function ei(i){const e=z.c(10),{kind:n,failed:r}=i;let o;e[0]!==n?(o=Bt(n,null),e[0]=n,e[1]=o):o=e[1];const s=String(o);let a;e[2]!==s?(a={"--media-aspect":s},e[2]=s,e[3]=a):a=e[3];const c=a,d=r?"inspector-media-placeholder failed":"inspector-media-placeholder",l=r?"Failed":"Generating…";let u;e[4]!==l?(u=t.jsx("span",{className:"inspector-media-placeholder-label",children:l}),e[4]=l,e[5]=u):u=e[5];let f;return e[6]!==c||e[7]!==d||e[8]!==u?(f=t.jsx("div",{className:d,style:c,children:u}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9],f}function nn(i){const e=z.c(15),{producer:n,onSelectSource:r}=i;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"inspector-media-field-label",children:"From"}),e[0]=o):o=e[0];let s;e[1]!==r||e[2]!==n.id?(s=()=>r?.(n.id),e[1]=r,e[2]=n.id,e[3]=s):s=e[3];let a;e[4]!==n.slot?(a=Fe(n.slot),e[4]=n.slot,e[5]=a):a=e[5];let c;e[6]!==a?(c=t.jsx("span",{className:"inspector-generation-from-tag",children:a}),e[6]=a,e[7]=c):c=e[7];const d=n.type==="generate_image"?"image":"video";let l;e[8]!==d?(l=t.jsxs("span",{children:["Generate ",d]}),e[8]=d,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(bs,{size:12,"aria-hidden":"true"}),e[10]=u):u=e[10];let f;return e[11]!==s||e[12]!==c||e[13]!==l?(f=t.jsxs("div",{className:"inspector-media-from",children:[o,t.jsxs("button",{type:"button",className:"inspector-generation-from-link",onClick:s,children:[c,l,u]})]}),e[11]=s,e[12]=c,e[13]=l,e[14]=f):f=e[14],f}function ti(i){if(!i)return null;const e=i.width&&i.height?`${i.width}×${i.height}`:null,n=i.duration?Je(i.duration):null;return[i.type,e,n].filter(Boolean).join(" · ")||null}function ni(i){const e=z.c(5),{asset:n,kindHint:r}=i,o=n?.thumbnailUrl??(n?.type==="image"?n.mediaUrl:null),s=!o&&n?.mediaUrl&&(n.type==="video"||n.type==="final")?n.mediaUrl:null;let a;return e[0]!==n||e[1]!==o||e[2]!==r||e[3]!==s?(a=t.jsx("span",{className:"inspector-generation-input-thumb",children:o?t.jsx("img",{src:o,alt:"",loading:"lazy",decoding:"async"}):s?t.jsx("video",{src:`${s}#t=0.1`,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}):t.jsx(gt,{asset:n,kindHint:r})}),e[0]=n,e[1]=o,e[2]=r,e[3]=s,e[4]=a):a=e[4],a}function si(i){const e=z.c(18),{producerId:n,cells:r,edges:o,cellAssets:s,onSelectSource:a}=i;let c,d,l,u,f;if(e[0]!==s||e[1]!==r||e[2]!==o||e[3]!==a||e[4]!==n){f=Symbol.for("react.early_return_sentinel");e:{const j=me(n,r,o);if(j.length===0){f=null;break e}const y=new Map(r.map(ii));l="inspector-media-generation-inputs",e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"inspector-media-field-label",children:"Inputs"}),e[10]=u):u=e[10],c="inspector-generation-input-cards",d=j.map(N=>{const b=y.get(N.sourceCellId),v=b?s?.get(b.id):void 0,S=ti(v);return t.jsx("li",{children:t.jsxs("button",{type:"button",className:"inspector-generation-input-card",onClick:()=>b&&a?.(b.id),children:[t.jsx(ni,{asset:v,kindHint:b?.type}),t.jsxs("span",{className:"inspector-generation-input-text",children:[t.jsxs("span",{children:[t.jsxs("code",{children:["@",N.token]}),b&&t.jsxs("span",{className:"inspector-generation-input-source",children:[" ← ",Fe(b.slot)]})]}),S&&t.jsx("span",{className:"inspector-generating-muted",children:S})]})]})},N.token)})}e[0]=s,e[1]=r,e[2]=o,e[3]=a,e[4]=n,e[5]=c,e[6]=d,e[7]=l,e[8]=u,e[9]=f}else c=e[5],d=e[6],l=e[7],u=e[8],f=e[9];if(f!==Symbol.for("react.early_return_sentinel"))return f;let m;e[11]!==c||e[12]!==d?(m=t.jsx("ul",{className:c,children:d}),e[11]=c,e[12]=d,e[13]=m):m=e[13];let h;return e[14]!==l||e[15]!==u||e[16]!==m?(h=t.jsxs("div",{className:l,children:[u,m]}),e[14]=l,e[15]=u,e[16]=m,e[17]=h):h=e[17],h}function ii(i){return[i.id,i]}function oi(i){const e=z.c(24),{state:n,model:r,elapsed:o,busy:s,deleting:a,producerCellId:c,cancelJobId:d,onRunProducer:l,onCancelJob:u,onDelete:f}=i,m=n.kind==="failed",h=m?"FAILED":n.kind==="queued"?"QUEUED":"GENERATING",j=r&&` · ${r}`;let y;e[0]!==o?(y=o!==null&&` · ${Je(o)} elapsed`,e[0]=o,e[1]=y):y=e[1];let N;e[2]!==h||e[3]!==j||e[4]!==y?(N=t.jsxs("span",{className:"inspector-media-generating-state",children:[h,j,y]}),e[2]=h,e[3]=j,e[4]=y,e[5]=N):N=e[5];let b;e[6]!==s||e[7]!==d||e[8]!==a||e[9]!==m||e[10]!==u||e[11]!==f||e[12]!==l||e[13]!==c?(b=m?t.jsxs("span",{className:"inspector-generating-actions",children:[t.jsxs("button",{type:"button",className:"inspector-generation-action",disabled:s||!c,onClick:()=>{c&&l(c)},children:[t.jsx(vs,{size:13,"aria-hidden":"true"}),"Retry"]}),t.jsxs("button",{type:"button",className:"inspector-generation-action danger",disabled:a,onClick:()=>{f()},children:[t.jsx(Ss,{size:13,"aria-hidden":"true"}),"Delete"]})]}):typeof u=="function"&&typeof d=="number"?t.jsxs("button",{type:"button",className:"inspector-generation-action danger",onClick:()=>u(d),children:[t.jsx(Ns,{size:13,"aria-hidden":"true"}),"Cancel run"]}):null,e[6]=s,e[7]=d,e[8]=a,e[9]=m,e[10]=u,e[11]=f,e[12]=l,e[13]=c,e[14]=b):b=e[14];let v;e[15]!==N||e[16]!==b?(v=t.jsxs("div",{className:"inspector-media-generating-status",children:[N,b]}),e[15]=N,e[16]=b,e[17]=v):v=e[17];let S;e[18]!==n.kind||e[19]!==n.message?(S=n.kind==="failed"&&t.jsxs("p",{className:"inspector-media-generating-error",role:"alert",children:[t.jsx(Ee,{size:13,"aria-hidden":"true"}),t.jsx("span",{children:n.message})]}),e[18]=n.kind,e[19]=n.message,e[20]=S):S=e[20];let x;return e[21]!==v||e[22]!==S?(x=t.jsxs(t.Fragment,{children:[v,S]}),e[21]=v,e[22]=S,e[23]=x):x=e[23],x}function ri(i){const e=z.c(51),{kind:n,address:r,artifactId:o,state:s,cells:a,edges:c,cellAssets:d,artifactAssets:l,busy:u,deleting:f,cancelJobId:m,onSelectSource:h,onRunProducer:j,onCancelJob:y,onDelete:N,onInspectGenerationRequest:b}=i,v=s.kind==="failed",S=s.kind==="failed"?null:s,x=Wn(S?.startedAt??null),A=s.producerCellId;let C;e[0]!==a||e[1]!==A?(C=A?a.find(de=>de.id===A)??null:null,e[0]=a,e[1]=A,e[2]=C):C=e[2];const I=C,k=I?.model??null,R=S?.startedAt??null,T=I?.provider??S?.provider??null,$=S?.runId??null,g=m??null,L=S?.providerArtifactId??o,D=I?.prompt??S?.prompt??null;let G;e[3]!==k||e[4]!==s.kind||e[5]!==R||e[6]!==T||e[7]!==$||e[8]!==g||e[9]!==L||e[10]!==D?(G={runKind:s.kind,startedAt:R,provider:T,model:k,runId:$,jobNumber:g,providerArtifactId:L,writtenPrompt:D},e[3]=k,e[4]=s.kind,e[5]=R,e[6]=T,e[7]=$,e[8]=g,e[9]=L,e[10]=D,e[11]=G):G=e[11];const W=G;let F;e[12]!==v||e[13]!==n?(F=t.jsx(ei,{kind:n,failed:v}),e[12]=v,e[13]=n,e[14]=F):F=e[14];let U;e[15]!==d||e[16]!==a||e[17]!==c||e[18]!==h||e[19]!==A?(U=A&&t.jsx(si,{producerId:A,cells:a,edges:c,cellAssets:d,onSelectSource:h}),e[15]=d,e[16]=a,e[17]=c,e[18]=h,e[19]=A,e[20]=U):U=e[20];let _;e[21]!==h||e[22]!==I?(_=I&&t.jsx(nn,{producer:I,onSelectSource:h}),e[21]=h,e[22]=I,e[23]=_):_=e[23];let B;e[24]!==U||e[25]!==_||e[26]!==F?(B=t.jsxs("div",{className:"inspector-media-generating-preview",children:[F,U,_]}),e[24]=U,e[25]=_,e[26]=F,e[27]=B):B=e[27];let J;e[28]!==u||e[29]!==m||e[30]!==f||e[31]!==x||e[32]!==k||e[33]!==y||e[34]!==N||e[35]!==j||e[36]!==A||e[37]!==s?(J=t.jsx(oi,{state:s,model:k,elapsed:x,busy:u,deleting:f,producerCellId:A,cancelJobId:m,onRunProducer:j,onCancelJob:y,onDelete:N}),e[28]=u,e[29]=m,e[30]=f,e[31]=x,e[32]=k,e[33]=y,e[34]=N,e[35]=j,e[36]=A,e[37]=s,e[38]=J):J=e[38];const te=`@${r} ${s.kind}`;let O;e[39]!==te?(O=t.jsx("span",{className:"sr-only",children:te}),e[39]=te,e[40]=O):O=e[40];let w;e[41]!==l||e[42]!==W||e[43]!==b||e[44]!==J||e[45]!==O?(w=t.jsx(ps,{facts:W,inspect:b,artifactAssets:l,header:J,footer:O}),e[41]=l,e[42]=W,e[43]=b,e[44]=J,e[45]=O,e[46]=w):w=e[46];let oe;return e[47]!==s.kind||e[48]!==B||e[49]!==w?(oe=t.jsxs("div",{className:"inspector-media-generating","data-generation":s.kind,children:[B,w]}),e[47]=s.kind,e[48]=B,e[49]=w,e[50]=oe):oe=e[50],oe}function ai(i){const e=z.c(103),{kind:n,cell:r,cells:o,edges:s,asset:a,cellAssets:c,versionAssets:d,busy:l,deleting:u,mediaInsightWork:f,generationState:m,cancelJobId:h,onSetInput:j,onRun:y,onCancelJob:N,onSelectSource:b,onDelete:v,onOpenFullscreen:S,onTranscribeAsset:x,onLoadTranscriptJson:A,onDownloadTranscriptSrt:C,bookId:I,assetTools:k,artifactAssets:R,onInspectGenerationRequest:T}=i;let $;e[0]!==r.slot?($=Xe(r.slot),e[0]=r.slot,e[1]=$):$=e[1];const g=$;let L;e[2]!==r||e[3]!==o||e[4]!==s?(L=Cn(r,o,s),e[2]=r,e[3]=o,e[4]=s,e[5]=L):L=e[5];const D=L,G=r.type==="audio"||(r.type==="image"||r.type==="video")&&r.inputs?.mediaRole!=="generate-image-output"&&r.inputs?.mediaRole!=="generate-video-output"?zt(r.inputs,r.outputArtifactId):[],W=G.join(":"),F=r.outputArtifactId??G.at(-1)??"",[U,_]=H.useState(null);if(m.kind!=="ready"){const le=r.outputArtifactId??null;let we;return e[6]!==g||e[7]!==R||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==o||e[12]!==u||e[13]!==s||e[14]!==m||e[15]!==n||e[16]!==N||e[17]!==v||e[18]!==T||e[19]!==y||e[20]!==b||e[21]!==le?(we=t.jsx("div",{className:"inspector-body inspector-media-body",children:t.jsx(ri,{kind:n,address:g,artifactId:le,state:m,cells:o,edges:s,cellAssets:c,busy:l,deleting:u,cancelJobId:h,artifactAssets:R,onSelectSource:b,onRunProducer:y,onCancelJob:N,onDelete:v,onInspectGenerationRequest:T})}),e[6]=g,e[7]=R,e[8]=l,e[9]=h,e[10]=c,e[11]=o,e[12]=u,e[13]=s,e[14]=m,e[15]=n,e[16]=N,e[17]=v,e[18]=T,e[19]=y,e[20]=b,e[21]=le,e[22]=we):we=e[22],we}const B=U?.cellId===r.id&&U.currentArtifactId===F&&U.versionKey===W?U.artifactId:F,J=new Map((d??[]).map(li));a&&J.set(a.artifactId,a);const te=J.has(B),O=G.includes(B)&&te?B:F,w=G.length>0?J.get(O)??a:a,oe=new Set(J.keys());let de;e[23]!==r.id||e[24]!==F||e[25]!==_||e[26]!==W?(de=le=>{_({artifactId:le,cellId:r.id,currentArtifactId:F,versionKey:W})},e[23]=r.id,e[24]=F,e[25]=_,e[26]=W,e[27]=de):de=e[27];const ye=de,re=w?f?.[w.artifactId]??Gt:Gt,X=n==="image"||n==="video",ae=G.length>1&&!!w;let Y;e[28]!==g||e[29]!==X||e[30]!==S||e[31]!==w?(Y=w?t.jsx(ut,{asset:w,address:g,allowFullscreen:X,overlayMetadata:!1,onOpenFullscreen:S}):t.jsxs("div",{className:"inspector-media-empty",children:[t.jsx("span",{children:"Output pending"}),t.jsx("p",{children:"Connect a source and rerun its producer to populate this preview."})]}),e[28]=g,e[29]=X,e[30]=S,e[31]=w,e[32]=Y):Y=e[32];const fe=Y,P=ae&&w?t.jsx(tn,{artifactIds:G,availableArtifactIds:oe,currentArtifactId:r.outputArtifactId,selectedArtifactId:O,outputLabel:Ut(n),onSelect:ye}):null;let Z;e[33]!==k||e[34]!==I||e[35]!==w?(Z=w?t.jsx(qs,{bookId:I,assetTools:k,asset:w}):null,e[33]=k,e[34]=I,e[35]=w,e[36]=Z):Z=e[36];const E=Z,q=!!(w?.transcript?.plain||w?.transcript?.elevenlabs);let ee;e[37]!==l||e[38]!==q||e[39]!==re||e[40]!==C||e[41]!==A||e[42]!==x||e[43]!==w?(ee=w&&kn(w.type)?q?t.jsx(ts,{artifactId:w.artifactId,transcript:w.transcript??null,busy:l,transcribing:re.transcribing,error:re.error,onTranscribe:x?()=>x(w.artifactId):void 0,onLoadTranscriptJson:A?le=>A(w.artifactId,le):void 0,onDownloadTranscriptSrt:C?()=>C(w.artifactId):void 0}):t.jsxs("div",{className:"inspector-media-insights",children:[x&&t.jsxs("button",{type:"button",className:"inspector-generation-action",disabled:l||re.transcribing,onClick:()=>x(w.artifactId),children:[t.jsx(ms,{size:13,"aria-hidden":"true"}),re.transcribing?"Transcribing…":"Transcribe"]}),re.error&&t.jsxs("p",{className:"inspector-insight-error",role:"alert",children:[t.jsx(Ee,{size:12,"aria-hidden":"true"}),t.jsx("span",{children:re.error})]})]}):null,e[37]=l,e[38]=q,e[39]=re,e[40]=C,e[41]=A,e[42]=x,e[43]=w,e[44]=ee):ee=e[44];const ie=ee;let ce;e[45]!==l||e[46]!==r||e[47]!==c||e[48]!==o||e[49]!==s||e[50]!==b||e[51]!==j||e[52]!==D?(ce=D?t.jsx(nn,{producer:D,onSelectSource:b}):t.jsx(yt,{cell:r,cells:o,edges:s,busy:l,cellAssets:c,onSetInput:j}),e[45]=l,e[46]=r,e[47]=c,e[48]=o,e[49]=s,e[50]=b,e[51]=j,e[52]=D,e[53]=ce):ce=e[53];const Q=ce,Ae=w??null;let $e;e[54]!==n||e[55]!==Ae?($e=Bt(n,Ae),e[54]=n,e[55]=Ae,e[56]=$e):$e=e[56];const Oe=String($e);let se;e[57]!==Oe?(se={"--media-aspect":Oe},e[57]=Oe,e[58]=se):se=e[58];const Pe=se,Te=`inspector-media-row-${n}`,Re=ae?"":"inspector-media-row-single-version";let Le;e[59]!==Te||e[60]!==Re?(Le=["inspector-media-content","inspector-compact-media-content","inspector-media-row-content",Te,Re].filter(Boolean),e[59]=Te,e[60]=Re,e[61]=Le):Le=e[61];const Ve=Le.join(" ");let pe;e[62]!==fe?(pe=t.jsx("div",{className:"inspector-media-row-track inspector-media-row-preview",children:fe}),e[62]=fe,e[63]=pe):pe=e[63];const Ce=ae&&t.jsx("div",{className:"inspector-media-row-track inspector-media-row-versions",children:t.jsx(Qs,{kind:n,artifactIds:G,assetsById:J,currentArtifactId:r.outputArtifactId,selectedArtifactId:O,onSelect:ye})});let xe;e[64]!==g||e[65]!==r.inputs||e[66]!==n||e[67]!==w?(xe=w&&t.jsx(Xs,{kind:n,address:g,asset:w,inputs:r.inputs}),e[64]=g,e[65]=r.inputs,e[66]=n,e[67]=w,e[68]=xe):xe=e[68];let ke;e[69]!==k||e[70]!==I||e[71]!==l||e[72]!==u||e[73]!==n||e[74]!==w?(ke=w&&t.jsx(ns,{bookId:I,artifactId:w.artifactId,kind:n,busy:l||u,call:k},`${I}:${w.artifactId}`),e[69]=k,e[70]=I,e[71]=l,e[72]=u,e[73]=n,e[74]=w,e[75]=ke):ke=e[75];let he;e[76]!==xe||e[77]!==ke?(he=t.jsxs("div",{className:"inspector-media-summary",children:[xe,ke]}),e[76]=xe,e[77]=ke,e[78]=he):he=e[78];let je;e[79]!==E||e[80]!==Q||e[81]!==P?(je=t.jsxs("div",{className:"inspector-media-row-track inspector-media-row-details",children:[P,E,Q]}),e[79]=E,e[80]=Q,e[81]=P,e[82]=je):je=e[82];let Se;e[83]!==r.inputs?(Se=t.jsx(ss,{inputs:r.inputs}),e[83]=r.inputs,e[84]=Se):Se=e[84];let Ne;e[85]!==ie||e[86]!==Se?(Ne=t.jsxs("div",{className:"inspector-media-row-track inspector-media-row-actions",children:[Se,ie]}),e[85]=ie,e[86]=Se,e[87]=Ne):Ne=e[87];let Ie;e[88]!==l||e[89]!==u||e[90]!==v?(Ie=t.jsx(xt,{busy:l,deleting:u,onDelete:v}),e[88]=l,e[89]=u,e[90]=v,e[91]=Ie):Ie=e[91];let be;e[92]!==he||e[93]!==je||e[94]!==Ne||e[95]!==Ie?(be=t.jsxs("div",{className:"inspector-media-row-meta",children:[he,je,Ne,Ie]}),e[92]=he,e[93]=je,e[94]=Ne,e[95]=Ie,e[96]=be):be=e[96];let ze;return e[97]!==Ve||e[98]!==pe||e[99]!==Ce||e[100]!==be||e[101]!==Pe?(ze=t.jsx("div",{className:"inspector-body inspector-media-body",children:t.jsxs("div",{className:Ve,style:Pe,children:[pe,Ce,be]})}),e[97]=Ve,e[98]=pe,e[99]=Ce,e[100]=be,e[101]=Pe,e[102]=ze):ze=e[102],ze}function li(i){return[i.artifactId,i]}function ht(i){const e=z.c(40),{label:n,summary:r,className:o,value:s,loadValue:a,ariaLabel:c,artifactAssets:d}=i,[l,u]=H.useState(!1),[f,m]=H.useState(s),[h,j]=H.useState(!1),[y,N]=H.useState(null);let b,v,S,x,A;if(e[0]!==c||e[1]!==d||e[2]!==o||e[3]!==n||e[4]!==a||e[5]!==h||e[6]!==l||e[7]!==f||e[8]!==r){const k=dt(f);let R;e[14]!==o?(R=["inspector-analysis-json-disclosure",o].filter(Boolean),e[14]=o,e[15]=R):R=e[15],b=R.join(" "),v=h,e[16]!==a||e[17]!==h||e[18]!==f?(S=L=>{const D=L.currentTarget.open;u(D),!(!D||f!==void 0||!a||h)&&(j(!0),N(null),a().then(G=>m(G)).catch(G=>{N(G instanceof Error?G.message:String(G))}).finally(()=>j(!1)))},e[16]=a,e[17]=h,e[18]=f,e[19]=S):S=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(Wt,{size:12,"aria-hidden":"true"}),e[20]=T):T=e[20];let $;e[21]!==n?($=t.jsx("span",{children:n}),e[21]=n,e[22]=$):$=e[22];let g;e[23]!==r?(g=r&&t.jsx("code",{className:"inspector-json-summary",children:r}),e[23]=r,e[24]=g):g=e[24],e[25]!==$||e[26]!==g?(x=t.jsxs("summary",{children:[T,$,g]}),e[25]=$,e[26]=g,e[27]=x):x=e[27],A=l&&f!==void 0&&t.jsxs(t.Fragment,{children:[(k.promptLeaks.length>0||k.urlPlaceholders.length>0)&&t.jsxs("div",{className:"inspector-payload-mentions",children:[k.promptLeaks.map(di),k.urlPlaceholders.map(ci)]}),t.jsx("div",{className:"inspector-analysis-json-scroll",tabIndex:0,children:t.jsx(Zn,{value:f,ariaLabel:c,artifactAssets:d})})]}),e[0]=c,e[1]=d,e[2]=o,e[3]=n,e[4]=a,e[5]=h,e[6]=l,e[7]=f,e[8]=r,e[9]=b,e[10]=v,e[11]=S,e[12]=x,e[13]=A}else b=e[9],v=e[10],S=e[11],x=e[12],A=e[13];let C;e[28]!==y||e[29]!==h||e[30]!==l||e[31]!==f?(C=l&&f===void 0&&t.jsx("div",{className:"inspector-analysis-json-status",role:"status",children:h?"Loading complete JSON…":y??"Complete JSON is unavailable for this run."}),e[28]=y,e[29]=h,e[30]=l,e[31]=f,e[32]=C):C=e[32];let I;return e[33]!==b||e[34]!==v||e[35]!==S||e[36]!==x||e[37]!==A||e[38]!==C?(I=t.jsxs("details",{className:b,"aria-busy":v,onToggle:S,children:[x,A,C]}),e[33]=b,e[34]=v,e[35]=S,e[36]=x,e[37]=A,e[38]=C,e[39]=I):I=e[39],I}function ci(i){return t.jsxs("span",{className:"inspector-payload-mention placeholder",title:i.path,children:[t.jsx(qt,{size:11,"aria-hidden":"true"}),t.jsx("code",{children:i.reference}),"resolves at dispatch"]},`${i.path}:${i.url}`)}function di(i){return t.jsxs("span",{className:"inspector-payload-mention leak",title:i.message,children:[t.jsx(Ee,{size:11,"aria-hidden":"true"}),t.jsx("code",{children:i.token}),i.message]},`${i.token}:${i.code}`)}function pi(i){return i.replace(/^notebook_/,"").replace(/^legacy_/,"").replaceAll("_"," ")}function ui(i){return i.type==="json_schema"?i.strict?"Strict JSON schema":"JSON schema":i.type==="json_object"?"JSON object":i.type==="text"?"Text":i.type.replaceAll("_"," ")}function mi(i){const e=z.c(3),{analysisInfo:n}=i,r=Jt(n.outputJson),o=n.llmExchanges?.length?n.llmExchanges.map(gi):r,s=H.useRef(null),a=()=>{if(!n.outputUrl)return Promise.reject(new Error("Complete JSON is unavailable for this run."));if(!s.current){const m=fetch(n.outputUrl).then(hi).then(fi);s.current=m.catch(h=>{throw s.current=null,h})}return s.current},c=(m,h)=>async()=>{const y=(await a())[m];if(!y)throw new Error("The saved LLM exchange could not be found.");return y[h]};if(o.length===0)return null;let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("span",{children:"LLM exchange"}),e[0]=d):d=e[0];const l="inspector-analysis-llm-calls",u=o.map((m,h)=>{const j=pi(m.stage),y=String(h+1).padStart(2,"0");return t.jsxs("article",{className:"inspector-analysis-llm-call",children:[t.jsxs("header",{children:[t.jsx("span",{children:y}),t.jsx("strong",{children:j})]}),t.jsxs("dl",{className:"inspector-analysis-llm-meta",children:[t.jsxs("div",{children:[t.jsx("dt",{children:"Provider"}),t.jsx("dd",{children:m.provider})]}),t.jsxs("div",{children:[t.jsx("dt",{children:"Model"}),t.jsx("dd",{children:m.model})]}),m.responseFormat&&t.jsxs("div",{className:"inspector-analysis-llm-format",children:[t.jsx("dt",{children:"Response format"}),t.jsxs("dd",{children:[t.jsxs("span",{children:[t.jsx(Wt,{size:11,"aria-hidden":"true"}),ui(m.responseFormat)]}),m.responseFormat.name&&t.jsx("code",{children:m.responseFormat.name})]})]})]}),!m.complete&&t.jsx("p",{className:"inspector-analysis-llm-incomplete",children:"This older run retained summary payloads only. Re-run the Analyze cell to record the complete provider exchange."}),t.jsxs("div",{className:"inspector-analysis-json-disclosures",children:[t.jsx(ht,{label:"LLM input",value:m.input,loadValue:m.input===void 0?c(h,"input"):void 0,ariaLabel:`LLM input JSON for ${j}`}),t.jsx(ht,{label:"LLM response",value:m.response,loadValue:m.response===void 0?c(h,"response"):void 0,ariaLabel:`LLM response JSON for ${j}`})]})]},`${m.stage}-${h}`)});let f;return e[1]!==u?(f=t.jsx("div",{className:l,children:u}),e[1]=u,e[2]=f):f=e[2],t.jsxs("section",{className:"inspector-analysis-llm","aria-label":"LLM exchanges",children:[t.jsxs("header",{className:"inspector-analysis-llm-heading",children:[d,t.jsxs("code",{children:[o.length," ",o.length===1?"call":"calls"]})]}),f]})}function fi(i){const e=Jt(i);if(e.length===0)throw new Error("The saved analysis has no recorded LLM exchange.");return e}async function hi(i){if(!i.ok)throw new Error(`Unable to load complete JSON (${i.status})`);return i.json()}function gi(i){return{...i,complete:!0,input:void 0,response:void 0}}function yi(i){const e=z.c(16),{cell:n,cells:r,edges:o,asset:s,cellAssets:a,versionAssets:c,busy:d,deleting:l,onSetInput:u,onDelete:f}=i,m=zt(n.inputs,n.outputArtifactId),h=m.join(":"),j=n.outputArtifactId??m.at(-1)??"",[y,N]=H.useState(null),b=y?.cellId===n.id&&y.currentArtifactId===j&&y.versionKey===h?y.artifactId:j,v=new Map((c??[]).map(bi));s&&v.set(s.artifactId,s);const S=m.includes(b)&&v.has(b)?b:j,A=(v.get(S)??s)?.analysisInfo,C=A?.shots.slice().sort(ji)??[],I="inspector-body inspector-analysis-body",k="inspector-analysis-content",R=m.length>1&&t.jsx(tn,{artifactIds:m,availableArtifactIds:new Set(v.keys()),currentArtifactId:n.outputArtifactId,selectedArtifactId:S,outputLabel:"Analysis",onSelect:D=>{N({artifactId:D,cellId:n.id,currentArtifactId:j,versionKey:h})}}),T=A?t.jsxs(t.Fragment,{children:[t.jsx(mi,{analysisInfo:A},S),t.jsx("ol",{className:"inspector-analysis-shots",children:C.map(xi)})]}):t.jsxs("div",{className:"inspector-media-empty",children:[t.jsx("span",{children:"Analysis pending"}),t.jsx("p",{children:"Run the connected Analyze cell to populate normalized shots."})]});let $;e[0]!==d||e[1]!==n||e[2]!==a||e[3]!==r||e[4]!==o||e[5]!==u?($=t.jsx(yt,{cell:n,cells:r,edges:o,busy:d,cellAssets:a,onSetInput:u}),e[0]=d,e[1]=n,e[2]=a,e[3]=r,e[4]=o,e[5]=u,e[6]=$):$=e[6];let g;e[7]!==d||e[8]!==l||e[9]!==f?(g=t.jsx(xt,{busy:d,deleting:l,onDelete:f}),e[7]=d,e[8]=l,e[9]=f,e[10]=g):g=e[10];let L;return e[11]!==R||e[12]!==T||e[13]!==$||e[14]!==g?(L=t.jsx("div",{className:I,children:t.jsxs("div",{className:k,children:[R,T,$,g]})}),e[11]=R,e[12]=T,e[13]=$,e[14]=g,e[15]=L):L=e[15],L}function xi(i){return t.jsxs("li",{children:[t.jsx("span",{className:"inspector-analysis-shot-number",children:String(i.ordinal).padStart(2,"0")}),t.jsxs("div",{children:[t.jsx("strong",{children:i.label}),t.jsxs("time",{children:[Je(i.startSeconds)," – ",Je(i.endSeconds)," · ",Je(i.durationSeconds)]})]})]},i.ordinal)}function ji(i,e){return i.ordinal-e.ordinal}function bi(i){return[i.artifactId,i]}function vi({headerActionHost:i,notebookId:e,bookId:n,assetTools:r,sourceVisible:o,cell:s,cells:a,edges:c,asset:d,cellAssets:l,artifactAssets:u,status:f,error:m,busy:h,deleting:j,onUpdate:y,onSetInput:N,onRun:b,onDelete:v,onOpenFullscreen:S,onPreviewPayload:x,initialGenerationPreview:A,onSelectSource:C,generationActions:I=[],mentionAssets:k=[],voiceCatalog:R}){const T=H.useId(),$=H.useContext(is),[g,L]=H.useState(()=>{const p=ks(s,I,at(s.id,a,c));return!Ge(s.type)||p.generationMode!=="r2v"?p:{...p,prompt:He(p.prompt,me(s.id,a,c,"i2v"),me(s.id,a,c,p.generationMode))}}),[D,G]=H.useState(!1),W=()=>{R&&R.ensureLoaded().catch(()=>{})},[F,U]=H.useState(null),[_,B]=H.useState("idle"),J=H.useRef(null),te=H.useRef(null),O=H.useRef(0),[w,oe]=H.useState(g.prompt.length),[de,ye]=H.useState(0),[re,X]=H.useState(!1),[ae,Y]=H.useState({error:null,loading:!1,value:void 0}),fe=s.type==="prompt"||s.type==="analyze"||s.type==="generate_video"||s.type==="generate_image"||s.type==="generate_audio",P=s.type==="generate_video"||s.type==="generate_image"||s.type==="generate_audio",Z=Ge(s.type)?s.type:null,E={provider:g.provider,model:g.model,operation:g.operation,tool:g.tool},q=Z?at(s.id,a,c):[],ee=s.tool==="edit_image_subjects",ie=ee?I.filter(p=>p.tool===s.tool).map(p=>({...p,inputContract:{modes:p.inputContract.modes.filter(M=>M.id===s.inputs?.generationMode)}})):I,ce=Z?wn(ie,Z,q,ee):[],Q=Z?We(ie,Z,E):null,Ae=!!(Q&&Ft(Q,q)),$e=Q?Mn(Q,q):[],Oe=new Set($e.map(p=>p.id)),se=Q?Qe(Q,q,g.generationMode):"",Pe=!!(Q&&$n(Q,se,q)),Te=Q?.inputContract.modes??[],Re=Te.find(p=>p.id===se),Le=Re?Pn(Re,q):null,Ve=Q?Tn(Q,se,s.id,a,c):[],pe=Q?.controls??[],Ce=I.flatMap(p=>p.controls),xe=Ot(pe,g.generationSettings)??Rn(g.model,g.generationSettings,c.filter(p=>p.target===s.id).map(p=>({type:a.find(M=>M.id===p.source)?.type??"",targetInput:p.targetInput,asset:l?.get(p.source)??null}))),he=Ae&&Pe&&xe===null,je=Q&&!Ae&&!ce.some(p=>p.id===Q.id)?[Q,...ce]:ce,Se=Q?.id??g.tool,Ne=H.useMemo(()=>Ln(a,c,s.id),[s.id,a,c]),Ie=Js(s.id,a,c,se),be=g.prompt.slice(0,w),le=(P?Dn(Ie,k,be):_n(k,a,be,Ne)).map(p=>({type:"mention",value:p.value,label:p.label,description:p.description,caption:p.caption,thumbnailSrc:p.thumbnailUrl,mediaKind:p.mediaKind??void 0,empty:p.empty,colorScheme:"amber"})),we=re&&le.length>0,De=En(P?{...s,provider:g.provider,model:g.model,operation:g.operation,tool:g.tool}:s,f),on=s.type==="character"||P||s.type==="extract_audio",rn=Yt(s.type),_e=ws(s,g,pe),Me=Ms(s,g)&&(!P||he),et=P?"Generate":De?Gn(s.type,De.label):null,ge=(rn||P)&&!!et,Ue=m??"This action failed, but no error details were recorded.",vt=F?.error===Ue?F.state:"idle",an=vt==="copied"?"Copied":vt==="failed"?"Retry copy":"Copy",ln=_==="copied"?"Copied":_==="failed"?"Retry copy":"Copy",tt=(p,M=c)=>{const V=Z?We(ie,Z,p):null,K=at(s.id,a,M);return{prompt:p.prompt,provider:p.provider,model:p.model,operation:p.operation,tool:p.tool,inputs:Zt(s,{...p,generationMode:V?Qe(V,K,p.generationMode):p.generationMode,generationSettings:Jn(V?.controls??[],p.generationSettings)},Ce)}},St=(p,M=c)=>{const V=tt(p,M);return JSON.stringify([{...V,inputs:{generationMode:V.inputs.generationMode,generationSettings:V.inputs.generationSettings}},M.filter(K=>K.target===s.id).map(K=>[K.source,K.targetInput]).sort()])},Nt=St(g),[cn]=H.useState(Nt),Ke=ae.key!==void 0?ae:A??ae,It=(ae.key??cn)!==Nt,At=async(p=g,M=c)=>{if(!x)throw new Error("Payload preview is unavailable");const V=++O.current,K=St(p,M),ne=Z?We(I,Z,p):null,ue=Ot(ne?.controls??[],p.generationSettings);if(ue)throw O.current===V&&Y({key:K,error:ue,loading:!1,value:void 0}),new Error(ue);Y({key:K,error:null,loading:!0,value:void 0});try{const ve=await x(s.id,tt(p,M));return O.current===V&&Y({key:K,error:null,loading:!1,value:ve}),ve}catch(ve){throw O.current===V&&Y({key:K,error:ve instanceof Error?ve.message:String(ve),loading:!1,value:void 0}),ve}},nt=Fn((p=g,M=c)=>{P&&x&&At(p,M).catch(()=>{})},s.id),Be=nt.run,Ct=p=>{O.current+=1,Y(M=>({...M,loading:!1})),P&&x&&nt.schedule({...g,prompt:p})},st=(p,M)=>{B("idle"),L(V=>({...V,prompt:p})),oe(M),ye(0),X(!0),Ct(p)},dn=p=>{B("idle"),L(M=>({...M,prompt:p})),oe(p.length),X(!1),Ct(p)},kt=On({call:r,bookId:n,surface:P?Vn(s.type):null,prompt:g.prompt,onApply:dn}),wt=p=>{const V=g.prompt.slice(0,w).lastIndexOf("@");if(V<0)return;const K=g.prompt.slice(0,V),ne=g.prompt.slice(w),ue=!ne||/^\s/u.test(ne)?"":" ",ve=`${K}${p.value}${ue}${ne}`,rt=K.length+p.value.length+ue.length;st(ve,rt),X(!1),requestAnimationFrame(()=>{te.current?.focus({preventScroll:!0}),te.current?.setSelectionRange(rt,rt)})},it=(p,M)=>{L(V=>({...V,[p]:M}))},pn=p=>{const M=je.find(ne=>ne.id===p);if(!M)return;s.type==="generate_audio"&&M.controls.some(ne=>ne.name==="voice_id")&&W();const V=Qe(M,q,ee?g.generationMode:""),K={...g,...Hn(M),generationMode:V,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,c,V)),generationSettings:{}};L(K),Be(K)},un=(p,M)=>{const V={...g.generationSettings};M===void 0?delete V[p]:V[p]=M;const K={...g,generationSettings:V};L(K),Be(K)},mn=async()=>{try{await navigator.clipboard.writeText(Ue),U({error:Ue,state:"copied"})}catch{U({error:Ue,state:"failed"})}},fn=async()=>{try{await navigator.clipboard.writeText(g.prompt),B("copied")}catch{B("failed")}},hn=async()=>{if(!(!_e||!Me)){G(!0);try{await y(Vt(s,{...g,generationMode:se},pe,Ce))}finally{G(!1)}}},Mt=async()=>{if(!(!ge||h||D||De?.disabled||!Me||P&&ae.loading)){G(!0);try{if(P)try{nt.cancel();const p=await At();if(dt(p).promptLeaks.length>0)return}catch{return}await Kn({cellId:s.id,dirty:_e,valid:Me,patch:Vt(s,{...g,generationMode:se},pe,Ce),onUpdate:y,onRun:b})}finally{G(!1)}}},$t=c.filter(p=>p.target===s.id),gn=new Map(me(s.id,a,c,se).map(p=>[`${p.sourceCellId}:${p.targetInput}`,p.token])),Pt=(p,M,V=Ye(M),K)=>{const ne=a.find(ue=>ue.id===p);return ne?[{cellId:ne.id,address:Xe(ne.slot),type:ne.type,targetInput:M,targetLabel:V,...K?{mention:K}:{},asset:l?.get(ne.id)??null}]:[]},ot=$t.flatMap(p=>Pt(p.source,p.targetInput,Ye(zn(se,"image",p.targetInput)),gn.get(`${p.source}:${p.targetInput}`))),yn=Ve.flatMap(p=>Pt(p.sourceCellId,p.targetInput,Ye(p.target))),Tt=Q??{id:g.tool,tool:g.tool,provider:g.provider,providerLabel:g.provider,model:g.model,operation:g.operation,title:g.tool||"No compatible models",cellTypes:Z?[Z]:[],isDefault:!1,defaultPriority:0,controls:[],inputContract:{modes:[]}},Rt=je.map(p=>Ft(p,q)?p:{...p,providerLabel:`${p.providerLabel} · incompatible`});Q||Rt.unshift(Tt);const xn={action:Tt,cell:{...s,...tt(g)},connections:$t.map(p=>({sourceCellId:p.source,targetInput:p.targetInput})),sourceCellIds:ot.map(p=>p.cellId),sourceAddresses:ot.map(p=>p.address)},Lt=async(p,M)=>{const V=c.filter(ue=>ue.target!==s.id||ue.targetInput!==p),K=M?[...V,{id:p,source:M,target:s.id,targetInput:p}]:V,ne={...g,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,K,se))};await N(p,M),L(ne),Be(ne,K)},Dt=fe?t.jsxs("section",{className:"inspector-prompt-field",children:[t.jsxs("header",{className:"inspector-prompt-header",children:[t.jsx("h3",{children:"Prompt"}),P&&t.jsx(os,{history:kt,disabled:h||D}),t.jsxs("button",{type:"button",className:`inspector-prompt-copy${_==="copied"?" copied":""}`,"aria-label":_==="copied"?"Prompt copied":_==="failed"?"Retry copying prompt":"Copy prompt",title:_==="copied"?"Prompt copied":_==="failed"?"Retry copying prompt":"Copy prompt",disabled:!g.prompt,onClick:()=>{fn()},children:[_==="copied"?t.jsx(qt,{size:12}):t.jsx(fs,{size:12}),t.jsx("span",{"aria-live":"polite",children:ln})]})]}),t.jsxs("div",{className:"inspector-prompt-editor",ref:J,children:[we&&t.jsx(rs,{items:le,selectedIndex:de,onSelect:wt,onHover:ye,anchorRef:J,preferAbove:!1}),t.jsx("textarea",{ref:te,"aria-label":"Prompt",className:"inspector-prompt-textarea",value:g.prompt,disabled:P&&(h||D),"aria-invalid":P&&!It&&dt(Ke.value).promptLeaks.length>0,rows:P?3:8,onChange:p=>st(p.target.value,p.target.selectionStart),onClick:p=>oe(p.currentTarget.selectionStart),onSelect:p=>oe(p.currentTarget.selectionStart),onBlur:()=>X(!1),onKeyDown:p=>{if(!we){P&&kt.handlePromptKeyDown(p);return}if(p.key==="ArrowDown"){p.preventDefault(),ye(M=>(M+1)%le.length);return}if(p.key==="ArrowUp"){p.preventDefault(),ye(M=>(M-1+le.length)%le.length);return}if(p.key==="Enter"||p.key==="Tab"){p.preventDefault(),wt(le[de]);return}p.key==="Escape"&&(p.preventDefault(),X(!1))}})]})]}):null,_t=h||D||!!De?.disabled||!Me||P&&ae.loading||!ge&&_e,{onKeyDown:jn}=as({applyFormId:T,applyDisabled:_t,applyScopeSelector:".composer-notebook-dock",busy:h||D,enabled:P&&!!$,onCancel:()=>$?.hide()}),Et=et&&(De||P)?t.jsx("section",{className:P&&i?"confirm-sheet-actions inspector-generation-header-actions":"inspector-cell-actions","aria-label":"Primary cell action",children:t.jsxs("button",{type:"button",className:P&&i?"confirm-sheet-apply":"inspector-run-action","aria-busy":ge&&D,"aria-keyshortcuts":P?"Meta+Enter Control+Enter":void 0,title:De?.disabled?"A run is already in progress for this cell":P&&!he?"Check the generation type and required settings":!ge&&_e?"Save changes before running":P?"Generate (⌘Enter / Ctrl+Enter)":void 0,onClick:()=>{if(ge){Mt();return}b(s.id)},disabled:_t,children:[ge&&D?P?"Generating…":"Applying…":et,P&&!D&&t.jsx("kbd",{"aria-hidden":"true",children:"⌘↵"})]})}):null,bn=!P&&_e?t.jsxs("div",{className:`inspector-dirty-notice${Me?"":" invalid"}`,role:"status",children:[t.jsx(Ee,{size:14}),t.jsx("span",{children:Me?ge?"Changes apply when this action runs":"Unsaved changes":ge?"Check timing values before running":"Check timing values before saving"})]}):null;return t.jsxs("div",{className:P?"generation-cell-inspector":"inspector-body inspector-executable-body",onKeyDown:jn,children:[P&&i?vn.createPortal(Et,i):null,d&&on&&!P&&t.jsx(ut,{asset:d,address:Xe(s.slot),allowFullscreen:d.type==="image"||d.type==="video"||d.type==="final",onOpenFullscreen:S}),!P&&t.jsx(yt,{cell:s,cells:a,edges:c,busy:h,cellAssets:l,onSetInput:N}),t.jsxs("form",{id:T,className:P?"generation-cell-form":"inspector-cell-form","aria-busy":D,onSubmit:p=>{if(p.preventDefault(),ge){Mt();return}hn()},children:[P?t.jsx(us,{actions:Rt,busy:h||D,draft:xn,modes:Te,compatibleModeIds:Oe,sourceVisible:o,notebookId:e,doltArtifactAssets:u,preview:Ke.value,previewError:Ke.error,previewLoading:Ke.loading,previewStale:It,sources:ot,sourceOptions:yn,voiceCatalog:R,promptEditor:Dt,inputFooter:d?t.jsxs("div",{className:"generation-cell-output",children:[t.jsx("span",{className:"confirm-section-label",children:"Output"}),t.jsx(ut,{asset:d,address:Xe(s.slot),allowFullscreen:d.type==="image"||d.type==="video"||d.type==="final",onOpenFullscreen:S})]}):void 0,onActionChange:pn,onAddSource:(p,M)=>{M&&Lt(M,p)},onRemoveSource:(p,M)=>{M&&Lt(M,null)},onSelectSource:p=>C?.(p),onModeChange:p=>{const M={...g,generationMode:p,prompt:He(g.prompt,me(s.id,a,c,se),me(s.id,a,c,p))};L(M),Be(M)},onPromptChange:p=>st(p,p.length),onRefreshPreview:()=>Be(),onSettingChange:un}):Dt,s.type==="split_video"&&(s.operation==="split_at_points"||s.operation==="split_ranges")&&t.jsxs("div",{className:"inspector-field-pair",children:[t.jsxs("label",{children:["Cut points",t.jsx("input",{type:"text",value:Array.isArray(s.inputs?.cutPointsSeconds)?s.inputs.cutPointsSeconds.join(", "):"",readOnly:!0})]}),t.jsxs("label",{children:["Chunks",t.jsx("input",{type:"text",value:Array.isArray(s.inputs?.cutPointsSeconds)?String(s.inputs.cutPointsSeconds.length+1):"",readOnly:!0})]})]}),s.type==="split_video"&&s.operation!=="split_at_points"&&s.operation!=="split_ranges"&&t.jsxs("div",{className:"inspector-field-pair",children:[t.jsxs("label",{children:["Start seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.startSeconds,onChange:p=>it("startSeconds",p.target.value)})]}),t.jsxs("label",{children:["End seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.endSeconds,onChange:p=>it("endSeconds",p.target.value)})]})]}),s.type==="splice"&&g.operation==="splice_video"&&t.jsxs("label",{children:["Overlap seconds",t.jsx("input",{type:"number",min:"0",step:"0.01",value:g.overlap,onChange:p=>it("overlap",p.target.value)})]}),P&&!g.tool&&!g.model&&t.jsx("span",{className:"workspace-notice",children:"No generation model matches the current inputs."}),P&&Se&&!he&&t.jsxs("div",{className:"inspector-generation-warning",role:"status",children:[t.jsx(Ee,{size:14}),t.jsx("span",{children:Q?Le??(Ae?Pe?xe??"Complete the required generation settings before running.":"This generation type does not match the current inputs. Choose a compatible type or change the connections.":"This model does not accept the current inputs. Choose a compatible model or change the connections."):"This saved action is unavailable. Choose a supported model."})]}),bn,!ge&&!P&&t.jsxs("button",{type:"submit",className:"inspector-save-button",disabled:h||D||!_e||!Me,children:[t.jsx(hs,{size:15}),t.jsx("span",{children:D?"Saving…":"Save changes"})]})]}),P&&i?null:Et,(f==="error"||m)&&t.jsxs("section",{className:"inspector-run-error",role:"alert","aria-label":"Cell run error",children:[t.jsx(Ee,{size:16,"aria-hidden":"true"}),t.jsxs("div",{className:"inspector-run-error-content",children:[t.jsxs("div",{className:"inspector-run-error-header",children:[t.jsx("strong",{children:"Run failed"}),t.jsx("button",{type:"button","aria-label":"Copy run error",title:"Copy run error",onClick:()=>{mn()},children:t.jsx("span",{"aria-live":"polite",children:an})})]}),t.jsx("p",{children:Ue})]})]}),!P&&t.jsx(xt,{busy:h,deleting:j,onDelete:v})]})}function jt(i){const e=typeof i=="number"?i:Date.parse(i);if(!Number.isFinite(e))return null;const n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<5)return"just now";if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const s=Math.floor(o/24);return s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function bt(i){const e=typeof i=="number"?i:Date.parse(i);return Number.isFinite(e)?new Date(e).toLocaleString():void 0}function Si(i){return i==="dispatched"||i==="awaiting_provider"}function Ni(i,e){if(!e||!In(e.status??""))return null;if(e.runId){const n=i.find(r=>r.runId===e.runId);if(n)return n.attemptId}return i.find(n=>Si(n.status))?.attemptId??null}function sn(i){const e=z.c(24),{revisions:n,loading:r,error:o}=i;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("span",{children:[t.jsx(Ht,{size:14,"aria-hidden":"true"}),"History"]}),e[0]=s):s=e[0];const a=n.length===1?"":"s";let c;e[1]!==n.length||e[2]!==a?(c=t.jsxs("header",{className:"inspector-source-meta",children:[s,t.jsxs("code",{children:[n.length," revision",a]})]}),e[1]=n.length,e[2]=a,e[3]=c):c=e[3];let d;e[4]!==r?(d=r&&t.jsx("p",{className:"inspector-analysis-json-status",role:"status",children:"Loading asset history…"}),e[4]=r,e[5]=d):d=e[5];let l;e[6]!==o?(l=o&&t.jsx("p",{className:"inspector-run-error",role:"alert",children:o}),e[6]=o,e[7]=l):l=e[7];let u;e[8]!==o||e[9]!==r||e[10]!==n.length?(u=!r&&!o&&n.length===0&&t.jsx("p",{className:"inspector-analysis-json-status",children:"No revisions recorded for this asset."}),e[8]=o,e[9]=r,e[10]=n.length,e[11]=u):u=e[11];let f;if(e[12]!==n){let j;e[14]!==n.length?(j=(y,N)=>t.jsxs("li",{children:[t.jsx("span",{className:"inspector-history-index",children:n.length-N}),t.jsxs("div",{children:[t.jsxs("header",{children:[t.jsx("strong",{children:y.operation?.replaceAll("_"," ")??"Asset revision"}),t.jsx("code",{title:y.hash,children:y.hash.slice(0,8)})]}),t.jsx("p",{children:y.message}),t.jsxs("small",{children:[t.jsx("time",{dateTime:y.date,title:bt(y.date),children:jt(y.date)??y.date}),y.author?` · ${y.author}`:""]})]})]},y.hash),e[14]=n.length,e[15]=j):j=e[15],f=n.map(j),e[12]=n,e[13]=f}else f=e[13];let m;e[16]!==f?(m=t.jsx("ol",{className:"inspector-history",children:f}),e[16]=f,e[17]=m):m=e[17];let h;return e[18]!==c||e[19]!==d||e[20]!==l||e[21]!==u||e[22]!==m?(h=t.jsxs("section",{className:"inspector-generations","aria-label":"Asset history",children:[c,d,l,u,m]}),e[18]=c,e[19]=d,e[20]=l,e[21]=u,e[22]=m,e[23]=h):h=e[23],h}function Ii(i){const e=z.c(35),{attempts:n,currentExecution:r,loading:o,error:s,artifactAssets:a,onLoadPayload:c}=i;let d;e[0]!==n||e[1]!==r?(d=Ni(n,r),e[0]=n,e[1]=r,e[2]=d):d=e[2];const l=d;let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("span",{children:[t.jsx(Ht,{size:14,"aria-hidden":"true"}),"Generations"]}),e[3]=u):u=e[3];const f=n.length===1?"":"s";let m;e[4]!==n.length||e[5]!==f?(m=t.jsxs("header",{className:"inspector-source-meta",children:[u,t.jsxs("code",{children:[n.length," attempt",f]})]}),e[4]=n.length,e[5]=f,e[6]=m):m=e[6];let h;e[7]!==o?(h=o&&t.jsx("p",{className:"inspector-analysis-json-status",role:"status",children:"Loading generation history…"}),e[7]=o,e[8]=h):h=e[8];let j;e[9]!==s?(j=s&&t.jsx("p",{className:"inspector-run-error",role:"alert",children:s}),e[9]=s,e[10]=j):j=e[10];let y;e[11]!==n.length||e[12]!==s||e[13]!==o?(y=!o&&!s&&n.length===0&&t.jsx("p",{className:"inspector-analysis-json-status",children:"No generation attempts recorded for this cell."}),e[11]=n.length,e[12]=s,e[13]=o,e[14]=y):y=e[14];let N;if(e[15]!==a||e[16]!==n||e[17]!==r?.status||e[18]!==l||e[19]!==c){let S;e[21]!==a||e[22]!==n.length||e[23]!==r?.status||e[24]!==l||e[25]!==c?(S=(x,A)=>{const C=n.length-A,I=x.artifactId?a.get(x.artifactId):void 0,k=I??(x.mediaUrl||x.thumbnailUrl?{type:x.mediaUrl&&!x.thumbnailUrl?"video":"image",mediaUrl:x.mediaUrl,thumbnailUrl:x.thumbnailUrl,duration:null}:null),R=x.transitions.at(-1),T=l===x.attemptId,$=x.artifactId??x.providerArtifactId;return t.jsxs("li",{className:["inspector-generation-attempt",T?"inspector-generation-attempt-live":""].filter(Boolean).join(" "),children:[t.jsxs("div",{className:"inspector-generation-attempt-head",children:[k?t.jsx("div",{className:"inspector-generation-thumb",children:t.jsx(Xn,{asset:k})}):t.jsx(gt,{asset:I,kindHint:"generate_image"}),t.jsxs("div",{className:"inspector-generation-facts",children:[t.jsxs("div",{className:"inspector-generation-attempt-title",children:[t.jsxs("strong",{children:["Attempt ",C]}),t.jsx("span",{className:`inspector-generation-status inspector-generation-status-${x.status}`,children:x.status}),T&&t.jsx("span",{className:"inspector-generation-live",role:"status",children:r?.status??"running"})]}),t.jsx("span",{className:"inspector-generation-meta",title:bt(x.createdAt),children:[An(x.tool),x.model,jt(x.createdAt)].filter(Boolean).join(" · ")}),R&&t.jsxs("code",{className:"inspector-generation-commit",title:R.commitHash,children:["commit ",R.commitHash.slice(0,8)]}),(x.resolvedPrompt||x.prompt)&&t.jsx("p",{title:x.resolvedPrompt??x.prompt??void 0,children:(x.resolvedPrompt??x.prompt??"").slice(0,160)}),x.transitions.length>0&&t.jsx("ol",{className:"inspector-generation-timeline","aria-label":`Attempt ${C} status timeline`,children:x.transitions.map(Ai)}),x.error&&t.jsx("p",{className:"inspector-generation-error",role:x.status==="failed"?"alert":void 0,children:x.error}),x.providerTask&&t.jsx(Yn,{task:x.providerTask})]})]}),(x.payload!==void 0||x.payloadAvailable&&c)&&t.jsx(ht,{label:"Payload",value:x.payload,loadValue:x.payload===void 0&&$&&c?()=>c($):void 0,ariaLabel:`Generation payload for attempt ${C}`,artifactAssets:a})]},x.attemptId)},e[21]=a,e[22]=n.length,e[23]=r?.status,e[24]=l,e[25]=c,e[26]=S):S=e[26],N=n.map(S),e[15]=a,e[16]=n,e[17]=r?.status,e[18]=l,e[19]=c,e[20]=N}else N=e[20];let b;e[27]!==N?(b=t.jsx("ol",{className:"inspector-generations-list",children:N}),e[27]=N,e[28]=b):b=e[28];let v;return e[29]!==m||e[30]!==h||e[31]!==j||e[32]!==y||e[33]!==b?(v=t.jsxs("section",{className:"inspector-generations","aria-label":"Generation attempts",children:[m,h,j,y,b]}),e[29]=m,e[30]=h,e[31]=j,e[32]=y,e[33]=b,e[34]=v):v=e[34],v}function Ai(i,e){return t.jsxs("li",{children:[t.jsx("span",{className:`inspector-generation-timeline-dot inspector-generation-timeline-dot-${i.status}`,"aria-hidden":"true"}),t.jsx("span",{children:i.status}),t.jsx("time",{dateTime:i.commitDate,title:bt(i.commitDate),children:jt(i.commitDate)})]},`${i.commitHash}:${e}`)}function Ci(i){const e=z.c(14),{notebookId:n,cell:r,artifactAssets:o,history:s}=i,a=!!r.outputArtifactId,c=a?"inspector-body inspector-source-body inspector-source-split":"inspector-body inspector-source-body";let d;e[0]!==r.id||e[1]!==s?.error||e[2]!==s?.loading||e[3]!==s?.revisions||e[4]!==a?(d=a&&t.jsx("div",{className:"inspector-source-pane inspector-source-history-pane",children:t.jsx(sn,{revisions:s?.revisions??[],loading:s?.loading??!1,error:s?.error??null},r.id)}),e[0]=r.id,e[1]=s?.error,e[2]=s?.loading,e[3]=s?.revisions,e[4]=a,e[5]=d):d=e[5];let l;e[6]!==o||e[7]!==r||e[8]!==n?(l=t.jsx("div",{className:"inspector-source-pane inspector-source-dolt-pane",children:t.jsx(es,{notebookId:n,cell:r,artifactAssets:o},r.id)}),e[6]=o,e[7]=r,e[8]=n,e[9]=l):l=e[9];let u;return e[10]!==c||e[11]!==d||e[12]!==l?(u=t.jsxs("div",{className:c,children:[d,l]}),e[10]=c,e[11]=d,e[12]=l,e[13]=u):u=e[13],u}function Ri(i){const e=z.c(106),{headerActionHost:n,notebookId:r,cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,status:u,error:f,busy:m,deleting:h,sourceVisible:j,historyVisible:y,generationsVisible:N,generationActions:b,mediaInsightWork:v,onUpdate:S,onSetInput:x,onRun:A,onDelete:C,onOpenFullscreen:I,onPreviewPayload:k,initialGenerationPreview:R,onSelectSource:T,onLoadGenerationPayload:$,onInspectGenerationRequest:g,onTranscribeAsset:L,onLoadTranscriptJson:D,onDownloadTranscriptSrt:G,generations:W,history:F,mentionAssets:U,voiceCatalog:_,bookId:B,assetTools:J,queuedCellIds:te,runErrors:O,jobs:w,onCancelJob:oe}=i,de=y===void 0?!1:y,ye=N===void 0?!1:N;let re;e[0]!==c||e[1]!==d||e[2]!==l?(re=Es(c,d,l),e[0]=c,e[1]=d,e[2]=l,e[3]=re):re=e[3];const X=re;let ae;e[4]!==o||e[5]!==s||e[6]!==a||e[7]!==f||e[8]!==w||e[9]!==te||e[10]!==O?(ae=Sn({cell:o,cells:s,edges:a,queuedCellIds:te,runErrors:O,error:f,jobs:w}),e[4]=o,e[5]=s,e[6]=a,e[7]=f,e[8]=w,e[9]=te,e[10]=O,e[11]=ae):ae=e[11];const Y=ae;if(j&&!Ge(o.type)){let E;return e[12]!==X||e[13]!==o||e[14]!==F||e[15]!==r?(E=t.jsx(Ci,{notebookId:r,cell:o,artifactAssets:X,history:F}),e[12]=X,e[13]=o,e[14]=F,e[15]=r,e[16]=E):E=e[16],E}if(de){let E;e[17]!==F?.revisions?(E=F?.revisions??[],e[17]=F?.revisions,e[18]=E):E=e[18];const q=F?.loading??!1,ee=F?.error??null;let ie;return e[19]!==o.id||e[20]!==E||e[21]!==q||e[22]!==ee?(ie=t.jsx("div",{className:"inspector-body inspector-source-body",children:t.jsx(sn,{revisions:E,loading:q,error:ee},o.id)}),e[19]=o.id,e[20]=E,e[21]=q,e[22]=ee,e[23]=ie):ie=e[23],ie}if(ye){let E;e[24]!==W?.attempts?(E=W?.attempts??[],e[24]=W?.attempts,e[25]=E):E=e[25];const q=W?.currentExecution??null,ee=W?.loading??!1,ie=W?.error??null;let ce;return e[26]!==X||e[27]!==o.id||e[28]!==$||e[29]!==E||e[30]!==q||e[31]!==ee||e[32]!==ie?(ce=t.jsx("div",{className:"inspector-body inspector-source-body",children:t.jsx(Ii,{attempts:E,currentExecution:q,loading:ee,error:ie,artifactAssets:X,onLoadPayload:$},o.id)}),e[26]=X,e[27]=o.id,e[28]=$,e[29]=E,e[30]=q,e[31]=ee,e[32]=ie,e[33]=ce):ce=e[33],ce}if(o.type==="analysis"){let E;return e[34]!==c||e[35]!==m||e[36]!==o||e[37]!==d||e[38]!==s||e[39]!==h||e[40]!==a||e[41]!==C||e[42]!==x||e[43]!==S||e[44]!==l?(E=t.jsx(yi,{cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,busy:m,deleting:h,onUpdate:S,onSetInput:x,onDelete:C}),e[34]=c,e[35]=m,e[36]=o,e[37]=d,e[38]=s,e[39]=h,e[40]=a,e[41]=C,e[42]=x,e[43]=S,e[44]=l,e[45]=E):E=e[45],E}let fe;e[46]!==o.type?(fe=Nn(o.type),e[46]=o.type,e[47]=fe):fe=e[47];const P=fe;if(P){let E;e[48]!==Y.jobId||e[49]!==Y.kind||e[50]!==w?(E=Y.kind==="queued"||Y.kind==="generating"?(w??[]).find(ee=>ee.operationId===Y.jobId&&typeof ee.id=="number")?.id:void 0,e[48]=Y.jobId,e[49]=Y.kind,e[50]=w,e[51]=E):E=e[51];let q;return e[52]!==X||e[53]!==c||e[54]!==J||e[55]!==B||e[56]!==m||e[57]!==o||e[58]!==d||e[59]!==s||e[60]!==h||e[61]!==P||e[62]!==a||e[63]!==Y||e[64]!==v||e[65]!==oe||e[66]!==C||e[67]!==G||e[68]!==g||e[69]!==D||e[70]!==I||e[71]!==A||e[72]!==T||e[73]!==x||e[74]!==L||e[75]!==S||e[76]!==E||e[77]!==l?(q=t.jsx(ai,{kind:P,cell:o,cells:s,edges:a,asset:c,cellAssets:d,versionAssets:l,busy:m,deleting:h,mediaInsightWork:v,generationState:Y,cancelJobId:E,onUpdate:S,onSetInput:x,onRun:A,onCancelJob:oe,onSelectSource:T,onDelete:C,onOpenFullscreen:I,onTranscribeAsset:L,onLoadTranscriptJson:D,onDownloadTranscriptSrt:G,bookId:B,assetTools:J,artifactAssets:X,onInspectGenerationRequest:g}),e[52]=X,e[53]=c,e[54]=J,e[55]=B,e[56]=m,e[57]=o,e[58]=d,e[59]=s,e[60]=h,e[61]=P,e[62]=a,e[63]=Y,e[64]=v,e[65]=oe,e[66]=C,e[67]=G,e[68]=g,e[69]=D,e[70]=I,e[71]=A,e[72]=T,e[73]=x,e[74]=L,e[75]=S,e[76]=E,e[77]=l,e[78]=q):q=e[78],q}let Z;return e[79]!==X||e[80]!==c||e[81]!==J||e[82]!==B||e[83]!==m||e[84]!==o||e[85]!==d||e[86]!==s||e[87]!==h||e[88]!==a||e[89]!==f||e[90]!==b||e[91]!==n||e[92]!==R||e[93]!==U||e[94]!==r||e[95]!==C||e[96]!==I||e[97]!==k||e[98]!==A||e[99]!==T||e[100]!==x||e[101]!==S||e[102]!==j||e[103]!==u||e[104]!==_?(Z=t.jsx(vi,{headerActionHost:n,notebookId:r,bookId:B,assetTools:J,artifactAssets:X,sourceVisible:j,cell:o,cells:s,edges:a,asset:c,cellAssets:d,status:u,error:f,busy:m,deleting:h,onUpdate:S,onSetInput:x,onRun:A,onDelete:C,onOpenFullscreen:I,onPreviewPayload:k,initialGenerationPreview:R,onSelectSource:T,generationActions:b,mentionAssets:U,voiceCatalog:_}),e[79]=X,e[80]=c,e[81]=J,e[82]=B,e[83]=m,e[84]=o,e[85]=d,e[86]=s,e[87]=h,e[88]=a,e[89]=f,e[90]=b,e[91]=n,e[92]=R,e[93]=U,e[94]=r,e[95]=C,e[96]=I,e[97]=k,e[98]=A,e[99]=T,e[100]=x,e[101]=S,e[102]=j,e[103]=u,e[104]=_,e[105]=Z):Z=e[105],Z}export{Ri as N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as M,a as G,j as t}from"./vendor-react-Dj7D1fD4.js";import{b as se}from"./ui-OHFUngrc.js";import{d6 as te,d7 as le,d8 as oe,d9 as ne}from"./videobook-DZ58pKW5.js";import{b as ae,X as ie,ad as re,aj as ce,ak as de,L as je,al as be,i as he,k as me,am as ue,R as fe,C as pe}from"./vendor-icons-CGqhCIXV.js";const Z=10,xe={review:he,failed:be,running:je,queued:de,done:ce,cancelled:re,omitted:ie},ge={continue:"Continue",retry:"Retry",switch:"Switch model",omit:"Omit",cancel:"Cancel"},Ne={retry:fe,cancel:ue},we=new Set(["continue","retry"]),ve=[{id:"all",label:"All",count:null},{id:"attention",label:"Attention",count:"attention"},{id:"active",label:"Active",count:"active"},{id:"finished",label:"Finished",count:"finished"}];function ee(u){return new Date(u).toLocaleTimeString()}function ye(u){const e=M.c(14),{filter:s,active:j,count:a,onSelect:m}=u;let b;e[0]!==s.id||e[1]!==m?(b=()=>m(s.id),e[0]=s.id,e[1]=m,e[2]=b):b=e[2];let o;e[3]!==s.count||e[4]!==s.id?(o=s.count&&t.jsx("span",{className:`jobs-filter-dot jobs-filter-dot-${s.id}`,"aria-hidden":"true"}),e[3]=s.count,e[4]=s.id,e[5]=o):o=e[5];let l;e[6]!==a?(l=a!==null&&t.jsx("span",{className:"jobs-filter-count",children:a}),e[6]=a,e[7]=l):l=e[7];let n;return e[8]!==j||e[9]!==s.label||e[10]!==b||e[11]!==o||e[12]!==l?(n=t.jsxs("button",{type:"button",className:"jobs-filter","aria-pressed":j,onClick:b,children:[o,s.label,l]}),e[8]=j,e[9]=s.label,e[10]=b,e[11]=o,e[12]=l,e[13]=n):n=e[13],n}function Ce(u){const e=M.c(15),{band:s,hidden:j,showAll:a,onToggleShowAll:m}=u,b=s.rows.some(Se),o=`jobs-band-header jobs-band-header-${s.id}${b?" jobs-band-has-failed":""}`;let l;e[0]!==s.label?(l=t.jsx("span",{className:"jobs-band-label",children:s.label}),e[0]=s.label,e[1]=l):l=e[1];let n;e[2]!==s.rows.length?(n=t.jsx("span",{className:"jobs-band-count",children:s.rows.length}),e[2]=s.rows.length,e[3]=n):n=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"jobs-band-rule","aria-hidden":"true"}),e[4]=i):i=e[4];let r;e[5]!==s.rows.length||e[6]!==j||e[7]!==m||e[8]!==a?(r=(j>0||a)&&s.rows.length>Z&&t.jsx("button",{type:"button",className:"jobs-band-more",onClick:m,children:a?`showing all ${s.rows.length} · Show fewer`:`showing ${s.rows.length-j} of ${s.rows.length} · Show all`}),e[5]=s.rows.length,e[6]=j,e[7]=m,e[8]=a,e[9]=r):r=e[9];let c;return e[10]!==o||e[11]!==l||e[12]!==n||e[13]!==r?(c=t.jsxs("div",{className:o,children:[l,n,i,r]}),e[10]=o,e[11]=l,e[12]=n,e[13]=r,e[14]=c):c=e[14],c}function Se(u){return u.tone==="failed"}function ke(u){const e=M.c(17),{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}=u,o=s.tone==="failed"&&s.errorDetail!==null;let l;e[0]!==j||e[1]!==m||e[2]!==s?(l=s.actions.map(c=>{const p=Ne[c];return t.jsxs("button",{type:"button",className:we.has(c)?"jobs-action jobs-action-primary":"jobs-action",disabled:j,onClick:()=>m(s,c),children:[p&&t.jsx(p,{size:12,"aria-hidden":"true"}),ge[c]]},c)}),e[0]=j,e[1]=m,e[2]=s,e[3]=l):l=e[3];let n;e[4]!==a||e[5]!==o||e[6]!==b||e[7]!==s.key?(n=o&&t.jsxs("button",{type:"button",className:"jobs-action","aria-expanded":a,onClick:()=>b(s.key),children:["Details",t.jsx(pe,{size:12,"aria-hidden":"true"})]}),e[4]=a,e[5]=o,e[6]=b,e[7]=s.key,e[8]=n):n=e[8];let i;e[9]!==o||e[10]!==s.actions.length||e[11]!==s.duration?(i=s.actions.length===0&&!o&&s.duration&&t.jsx("span",{className:"jobs-duration",children:s.duration}),e[9]=o,e[10]=s.actions.length,e[11]=s.duration,e[12]=i):i=e[12];let r;return e[13]!==l||e[14]!==n||e[15]!==i?(r=t.jsxs("div",{className:"jobs-cell jobs-cell-actions",children:[l,n,i]}),e[13]=l,e[14]=n,e[15]=i,e[16]=r):r=e[16],r}function Ae(u){const e=M.c(67),{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}=u,o=xe[s.tone],l=`jobs-row jobs-row-${s.tone}`,n=s.tone==="running"?"jobs-spin":void 0;let i;e[0]!==o||e[1]!==n?(i=t.jsx(o,{size:14,className:n,"aria-hidden":"true"}),e[0]=o,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==s.statusLabel||e[4]!==i?(r=t.jsxs("div",{className:"jobs-cell jobs-cell-status",children:[i,s.statusLabel]}),e[3]=s.statusLabel,e[4]=i,e[5]=r):r=e[5];let c;e[6]!==s.title?(c=t.jsx("span",{children:s.title}),e[6]=s.title,e[7]=c):c=e[7];let p;e[8]!==s.detail?(p=s.detail&&t.jsx("code",{children:s.detail}),e[8]=s.detail,e[9]=p):p=e[9];let x;e[10]!==c||e[11]!==p?(x=t.jsxs("div",{className:"jobs-cell jobs-cell-job",children:[c,p]}),e[10]=c,e[11]=p,e[12]=x):x=e[12];const X=s.target.tag?"jobs-tag":"jobs-tag jobs-tag-book",I=s.target.tag??"BOOK";let D;e[13]!==X||e[14]!==I?(D=t.jsx("code",{className:X,children:I}),e[13]=X,e[14]=I,e[15]=D):D=e[15];let k;e[16]!==s.target.label?(k=s.target.label&&t.jsx("span",{children:s.target.label}),e[16]=s.target.label,e[17]=k):k=e[17];let _;e[18]!==D||e[19]!==k?(_=t.jsxs("div",{className:"jobs-cell jobs-cell-target",children:[D,k]}),e[18]=D,e[19]=k,e[20]=_):_=e[20];let N;e[21]!==s.errorCode?(N=s.errorCode&&t.jsx("code",{className:"jobs-error-code",children:s.errorCode}),e[21]=s.errorCode,e[22]=N):N=e[22];let g;e[23]!==s.note?(g=s.note&&t.jsxs("span",{className:"jobs-summary-note",children:[" · ",s.note]}),e[23]=s.note,e[24]=g):g=e[24];let w;e[25]!==s.summary||e[26]!==g?(w=t.jsxs("span",{className:"jobs-summary-text",children:[s.summary,g]}),e[25]=s.summary,e[26]=g,e[27]=w):w=e[27];let h;e[28]!==N||e[29]!==w?(h=t.jsxs("div",{className:"jobs-summary-line",children:[N,w]}),e[28]=N,e[29]=w,e[30]=h):h=e[30];let v;e[31]!==s.live?(v=s.live&&t.jsx("div",{className:"jobs-progress","aria-hidden":"true",children:t.jsx("span",{})}),e[31]=s.live,e[32]=v):v=e[32];let f;e[33]!==s.providerTask?(f=s.providerTask&&t.jsx(se,{task:s.providerTask}),e[33]=s.providerTask,e[34]=f):f=e[34];let y;e[35]!==h||e[36]!==v||e[37]!==f?(y=t.jsxs("div",{className:"jobs-cell jobs-cell-summary",children:[h,v,f]}),e[35]=h,e[36]=v,e[37]=f,e[38]=y):y=e[38];let A;e[39]!==s.attempt?(A=t.jsx("div",{className:"jobs-cell jobs-cell-attempt",children:s.attempt}),e[39]=s.attempt,e[40]=A):A=e[40];let C;e[41]!==s.timestamp?(C=new Date(s.timestamp).toISOString(),e[41]=s.timestamp,e[42]=C):C=e[42];let J;e[43]!==s.timestamp?(J=ee(s.timestamp),e[43]=s.timestamp,e[44]=J):J=e[44];let S;e[45]!==C||e[46]!==J?(S=t.jsx("div",{className:"jobs-cell jobs-cell-time",children:t.jsx("time",{dateTime:C,children:J})}),e[45]=C,e[46]=J,e[47]=S):S=e[47];let T;e[48]!==j||e[49]!==a||e[50]!==m||e[51]!==b||e[52]!==s?(T=t.jsx(ke,{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}),e[48]=j,e[49]=a,e[50]=m,e[51]=b,e[52]=s,e[53]=T):T=e[53];let E;e[54]!==a||e[55]!==s.errorDetail?(E=a&&s.errorDetail&&t.jsxs("div",{className:"jobs-row-error",children:[t.jsx("span",{children:"Error"}),t.jsx("pre",{children:s.errorDetail})]}),e[54]=a,e[55]=s.errorDetail,e[56]=E):E=e[56];let $;return e[57]!==l||e[58]!==_||e[59]!==y||e[60]!==A||e[61]!==S||e[62]!==T||e[63]!==E||e[64]!==r||e[65]!==x?($=t.jsxs("article",{className:l,children:[r,x,_,y,A,S,T,E]}),e[57]=l,e[58]=_,e[59]=y,e[60]=A,e[61]=S,e[62]=T,e[63]=E,e[64]=r,e[65]=x,e[66]=$):$=e[66],$}function Te(u,e){const s=new Set(u);return s.has(e)?s.delete(e):s.add(e),s}function $e(u){const e=M.c(56),{bookName:s,jobs:j,plans:a,assets:m,cells:b,now:o,busy:l,onRefresh:n,onCancelJob:i,onRetryJob:r,onContinuePlan:c,onRevisePlan:p}=u,[x,X]=G.useState("all"),[I,D]=G.useState(!1),[k,_]=G.useState(Ie);let N;e[0]!==m||e[1]!==b||e[2]!==j||e[3]!==o||e[4]!==a?(N=te(le({jobs:j,plans:a,cells:b,assets:m,now:o})),e[0]=m,e[1]=b,e[2]=j,e[3]=o,e[4]=a,e[5]=N):N=e[5];const g=N;let w;e[6]!==g?(w=oe(g),e[6]=g,e[7]=w):w=e[7];const h=w;let v;e[8]!==g||e[9]!==x?(v=ne(g,x),e[8]=g,e[9]=x,e[10]=v):v=e[10];const f=v;let y;e[11]!==i||e[12]!==c||e[13]!==r||e[14]!==p?(y=(d,R)=>{if(d.source.kind==="job"){R==="cancel"&&i(d.source.jobId),R==="retry"&&r(d.source.jobId);return}R==="continue"&&c(d.source.planId),(R==="retry"||R==="switch"||R==="omit")&&p(d.source.planId,R)},e[11]=i,e[12]=c,e[13]=r,e[14]=p,e[15]=y):y=e[15];const A=y;let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=d=>{_(R=>Te(R,d))},e[16]=C):C=e[16];const J=C;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("h1",{children:"Jobs"}),e[17]=S):S=e[17];const T=s??"No book selected",E=h.total,$=h.total===1?"job":"jobs";let O;e[18]!==o?(O=ee(o),e[18]=o,e[19]=O):O=e[19];let L;e[20]!==h.total||e[21]!==O||e[22]!==T||e[23]!==$?(L=t.jsxs("span",{className:"jobs-header-meta",children:[T," · ",E," ",$," · updated ",O]}),e[20]=h.total,e[21]=O,e[22]=T,e[23]=$,e[24]=L):L=e[24];let F;e[25]!==h||e[26]!==x?(F=ve.map(d=>t.jsx(ye,{filter:d,active:x===d.id,count:d.count?h[d.count]:null,onSelect:X},d.id)),e[25]=h,e[26]=x,e[27]=F):F=e[27];let B;e[28]!==F?(B=t.jsx("div",{className:"jobs-filters","aria-label":"Filter jobs",children:F}),e[28]=F,e[29]=B):B=e[29];let P;e[30]!==L||e[31]!==B?(P=t.jsxs("div",{className:"jobs-header-title",children:[S,L,B]}),e[30]=L,e[31]=B,e[32]=P):P=e[32];let U;e[33]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(me,{size:15}),e[33]=U):U=e[33];let z;e[34]!==l||e[35]!==n?(z=t.jsxs("button",{type:"button",className:"jobs-refresh",disabled:l,onClick:n,children:[U,"Refresh"]}),e[34]=l,e[35]=n,e[36]=z):z=e[36];let q;e[37]!==P||e[38]!==z?(q=t.jsxs("header",{children:[P,z]}),e[37]=P,e[38]=z,e[39]=q):q=e[39];let K;e[40]!==h.total?(K=h.total===0&&t.jsxs("div",{className:"jobs-empty",children:[t.jsx(ae,{size:16,"aria-hidden":"true"}),t.jsx("strong",{children:"No jobs recorded"}),t.jsx("span",{children:"Run a cell or a notebook to queue work."})]}),e[40]=h.total,e[41]=K):K=e[41];let H;e[42]!==h.total||e[43]!==f.length?(H=h.total>0&&f.length===0&&t.jsx("div",{className:"jobs-empty",children:t.jsx("span",{children:"No jobs match this filter."})}),e[42]=h.total,e[43]=f.length,e[44]=H):H=e[44];let V;e[45]!==l||e[46]!==k||e[47]!==A||e[48]!==I||e[49]!==f?(V=f.length>0&&t.jsx("div",{className:"jobs-list-scroll",children:t.jsxs("div",{className:"jobs-list",children:[t.jsxs("div",{className:"jobs-columns","aria-hidden":"true",children:[t.jsx("span",{children:"Status"}),t.jsx("span",{children:"Job"}),t.jsx("span",{children:"Target"}),t.jsx("span",{children:"Progress / result"}),t.jsx("span",{className:"jobs-columns-attempt",children:"Try"}),t.jsx("span",{children:"Enqueued"}),t.jsx("span",{children:"Actions"})]}),f.map(d=>{const Q=d.id==="finished"&&!I?d.rows.slice(0,Z):d.rows;return t.jsxs("div",{className:"jobs-band",children:[t.jsx(Ce,{band:d,hidden:d.rows.length-Q.length,showAll:d.id==="finished"&&I,onToggleShowAll:()=>D(Re)}),Q.map(Y=>t.jsx(Ae,{row:Y,busy:l,expanded:k.has(Y.key),onAction:A,onToggleDetails:J},Y.key))]},d.id)})]})}),e[45]=l,e[46]=k,e[47]=A,e[48]=I,e[49]=f,e[50]=V):V=e[50];let W;return e[51]!==q||e[52]!==K||e[53]!==H||e[54]!==V?(W=t.jsxs("section",{className:"workspace-screen jobs-screen",children:[q,K,H,V]}),e[51]=q,e[52]=K,e[53]=H,e[54]=V,e[55]=W):W=e[55],W}function Re(u){return!u}function Ie(){return new Set}export{$e as J};
|
|
1
|
+
import{c as M,a as G,j as t}from"./vendor-react-Dj7D1fD4.js";import{b as se}from"./ui-Cpr6zMTA.js";import{d7 as te,d8 as le,d9 as oe,da as ne}from"./videobook-B5G0jMoi.js";import{b as ae,X as ie,ad as re,aj as ce,ak as de,L as je,al as be,i as he,k as me,am as ue,R as fe,C as pe}from"./vendor-icons-CGqhCIXV.js";const Z=10,xe={review:he,failed:be,running:je,queued:de,done:ce,cancelled:re,omitted:ie},ge={continue:"Continue",retry:"Retry",switch:"Switch model",omit:"Omit",cancel:"Cancel"},Ne={retry:fe,cancel:ue},we=new Set(["continue","retry"]),ve=[{id:"all",label:"All",count:null},{id:"attention",label:"Attention",count:"attention"},{id:"active",label:"Active",count:"active"},{id:"finished",label:"Finished",count:"finished"}];function ee(u){return new Date(u).toLocaleTimeString()}function ye(u){const e=M.c(14),{filter:s,active:j,count:a,onSelect:m}=u;let b;e[0]!==s.id||e[1]!==m?(b=()=>m(s.id),e[0]=s.id,e[1]=m,e[2]=b):b=e[2];let o;e[3]!==s.count||e[4]!==s.id?(o=s.count&&t.jsx("span",{className:`jobs-filter-dot jobs-filter-dot-${s.id}`,"aria-hidden":"true"}),e[3]=s.count,e[4]=s.id,e[5]=o):o=e[5];let l;e[6]!==a?(l=a!==null&&t.jsx("span",{className:"jobs-filter-count",children:a}),e[6]=a,e[7]=l):l=e[7];let n;return e[8]!==j||e[9]!==s.label||e[10]!==b||e[11]!==o||e[12]!==l?(n=t.jsxs("button",{type:"button",className:"jobs-filter","aria-pressed":j,onClick:b,children:[o,s.label,l]}),e[8]=j,e[9]=s.label,e[10]=b,e[11]=o,e[12]=l,e[13]=n):n=e[13],n}function Ce(u){const e=M.c(15),{band:s,hidden:j,showAll:a,onToggleShowAll:m}=u,b=s.rows.some(Se),o=`jobs-band-header jobs-band-header-${s.id}${b?" jobs-band-has-failed":""}`;let l;e[0]!==s.label?(l=t.jsx("span",{className:"jobs-band-label",children:s.label}),e[0]=s.label,e[1]=l):l=e[1];let n;e[2]!==s.rows.length?(n=t.jsx("span",{className:"jobs-band-count",children:s.rows.length}),e[2]=s.rows.length,e[3]=n):n=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("span",{className:"jobs-band-rule","aria-hidden":"true"}),e[4]=i):i=e[4];let r;e[5]!==s.rows.length||e[6]!==j||e[7]!==m||e[8]!==a?(r=(j>0||a)&&s.rows.length>Z&&t.jsx("button",{type:"button",className:"jobs-band-more",onClick:m,children:a?`showing all ${s.rows.length} · Show fewer`:`showing ${s.rows.length-j} of ${s.rows.length} · Show all`}),e[5]=s.rows.length,e[6]=j,e[7]=m,e[8]=a,e[9]=r):r=e[9];let c;return e[10]!==o||e[11]!==l||e[12]!==n||e[13]!==r?(c=t.jsxs("div",{className:o,children:[l,n,i,r]}),e[10]=o,e[11]=l,e[12]=n,e[13]=r,e[14]=c):c=e[14],c}function Se(u){return u.tone==="failed"}function ke(u){const e=M.c(17),{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}=u,o=s.tone==="failed"&&s.errorDetail!==null;let l;e[0]!==j||e[1]!==m||e[2]!==s?(l=s.actions.map(c=>{const p=Ne[c];return t.jsxs("button",{type:"button",className:we.has(c)?"jobs-action jobs-action-primary":"jobs-action",disabled:j,onClick:()=>m(s,c),children:[p&&t.jsx(p,{size:12,"aria-hidden":"true"}),ge[c]]},c)}),e[0]=j,e[1]=m,e[2]=s,e[3]=l):l=e[3];let n;e[4]!==a||e[5]!==o||e[6]!==b||e[7]!==s.key?(n=o&&t.jsxs("button",{type:"button",className:"jobs-action","aria-expanded":a,onClick:()=>b(s.key),children:["Details",t.jsx(pe,{size:12,"aria-hidden":"true"})]}),e[4]=a,e[5]=o,e[6]=b,e[7]=s.key,e[8]=n):n=e[8];let i;e[9]!==o||e[10]!==s.actions.length||e[11]!==s.duration?(i=s.actions.length===0&&!o&&s.duration&&t.jsx("span",{className:"jobs-duration",children:s.duration}),e[9]=o,e[10]=s.actions.length,e[11]=s.duration,e[12]=i):i=e[12];let r;return e[13]!==l||e[14]!==n||e[15]!==i?(r=t.jsxs("div",{className:"jobs-cell jobs-cell-actions",children:[l,n,i]}),e[13]=l,e[14]=n,e[15]=i,e[16]=r):r=e[16],r}function Ae(u){const e=M.c(67),{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}=u,o=xe[s.tone],l=`jobs-row jobs-row-${s.tone}`,n=s.tone==="running"?"jobs-spin":void 0;let i;e[0]!==o||e[1]!==n?(i=t.jsx(o,{size:14,className:n,"aria-hidden":"true"}),e[0]=o,e[1]=n,e[2]=i):i=e[2];let r;e[3]!==s.statusLabel||e[4]!==i?(r=t.jsxs("div",{className:"jobs-cell jobs-cell-status",children:[i,s.statusLabel]}),e[3]=s.statusLabel,e[4]=i,e[5]=r):r=e[5];let c;e[6]!==s.title?(c=t.jsx("span",{children:s.title}),e[6]=s.title,e[7]=c):c=e[7];let p;e[8]!==s.detail?(p=s.detail&&t.jsx("code",{children:s.detail}),e[8]=s.detail,e[9]=p):p=e[9];let x;e[10]!==c||e[11]!==p?(x=t.jsxs("div",{className:"jobs-cell jobs-cell-job",children:[c,p]}),e[10]=c,e[11]=p,e[12]=x):x=e[12];const X=s.target.tag?"jobs-tag":"jobs-tag jobs-tag-book",I=s.target.tag??"BOOK";let D;e[13]!==X||e[14]!==I?(D=t.jsx("code",{className:X,children:I}),e[13]=X,e[14]=I,e[15]=D):D=e[15];let k;e[16]!==s.target.label?(k=s.target.label&&t.jsx("span",{children:s.target.label}),e[16]=s.target.label,e[17]=k):k=e[17];let _;e[18]!==D||e[19]!==k?(_=t.jsxs("div",{className:"jobs-cell jobs-cell-target",children:[D,k]}),e[18]=D,e[19]=k,e[20]=_):_=e[20];let N;e[21]!==s.errorCode?(N=s.errorCode&&t.jsx("code",{className:"jobs-error-code",children:s.errorCode}),e[21]=s.errorCode,e[22]=N):N=e[22];let g;e[23]!==s.note?(g=s.note&&t.jsxs("span",{className:"jobs-summary-note",children:[" · ",s.note]}),e[23]=s.note,e[24]=g):g=e[24];let w;e[25]!==s.summary||e[26]!==g?(w=t.jsxs("span",{className:"jobs-summary-text",children:[s.summary,g]}),e[25]=s.summary,e[26]=g,e[27]=w):w=e[27];let h;e[28]!==N||e[29]!==w?(h=t.jsxs("div",{className:"jobs-summary-line",children:[N,w]}),e[28]=N,e[29]=w,e[30]=h):h=e[30];let v;e[31]!==s.live?(v=s.live&&t.jsx("div",{className:"jobs-progress","aria-hidden":"true",children:t.jsx("span",{})}),e[31]=s.live,e[32]=v):v=e[32];let f;e[33]!==s.providerTask?(f=s.providerTask&&t.jsx(se,{task:s.providerTask}),e[33]=s.providerTask,e[34]=f):f=e[34];let y;e[35]!==h||e[36]!==v||e[37]!==f?(y=t.jsxs("div",{className:"jobs-cell jobs-cell-summary",children:[h,v,f]}),e[35]=h,e[36]=v,e[37]=f,e[38]=y):y=e[38];let A;e[39]!==s.attempt?(A=t.jsx("div",{className:"jobs-cell jobs-cell-attempt",children:s.attempt}),e[39]=s.attempt,e[40]=A):A=e[40];let C;e[41]!==s.timestamp?(C=new Date(s.timestamp).toISOString(),e[41]=s.timestamp,e[42]=C):C=e[42];let J;e[43]!==s.timestamp?(J=ee(s.timestamp),e[43]=s.timestamp,e[44]=J):J=e[44];let S;e[45]!==C||e[46]!==J?(S=t.jsx("div",{className:"jobs-cell jobs-cell-time",children:t.jsx("time",{dateTime:C,children:J})}),e[45]=C,e[46]=J,e[47]=S):S=e[47];let T;e[48]!==j||e[49]!==a||e[50]!==m||e[51]!==b||e[52]!==s?(T=t.jsx(ke,{row:s,busy:j,expanded:a,onAction:m,onToggleDetails:b}),e[48]=j,e[49]=a,e[50]=m,e[51]=b,e[52]=s,e[53]=T):T=e[53];let E;e[54]!==a||e[55]!==s.errorDetail?(E=a&&s.errorDetail&&t.jsxs("div",{className:"jobs-row-error",children:[t.jsx("span",{children:"Error"}),t.jsx("pre",{children:s.errorDetail})]}),e[54]=a,e[55]=s.errorDetail,e[56]=E):E=e[56];let $;return e[57]!==l||e[58]!==_||e[59]!==y||e[60]!==A||e[61]!==S||e[62]!==T||e[63]!==E||e[64]!==r||e[65]!==x?($=t.jsxs("article",{className:l,children:[r,x,_,y,A,S,T,E]}),e[57]=l,e[58]=_,e[59]=y,e[60]=A,e[61]=S,e[62]=T,e[63]=E,e[64]=r,e[65]=x,e[66]=$):$=e[66],$}function Te(u,e){const s=new Set(u);return s.has(e)?s.delete(e):s.add(e),s}function $e(u){const e=M.c(56),{bookName:s,jobs:j,plans:a,assets:m,cells:b,now:o,busy:l,onRefresh:n,onCancelJob:i,onRetryJob:r,onContinuePlan:c,onRevisePlan:p}=u,[x,X]=G.useState("all"),[I,D]=G.useState(!1),[k,_]=G.useState(Ie);let N;e[0]!==m||e[1]!==b||e[2]!==j||e[3]!==o||e[4]!==a?(N=te(le({jobs:j,plans:a,cells:b,assets:m,now:o})),e[0]=m,e[1]=b,e[2]=j,e[3]=o,e[4]=a,e[5]=N):N=e[5];const g=N;let w;e[6]!==g?(w=oe(g),e[6]=g,e[7]=w):w=e[7];const h=w;let v;e[8]!==g||e[9]!==x?(v=ne(g,x),e[8]=g,e[9]=x,e[10]=v):v=e[10];const f=v;let y;e[11]!==i||e[12]!==c||e[13]!==r||e[14]!==p?(y=(d,R)=>{if(d.source.kind==="job"){R==="cancel"&&i(d.source.jobId),R==="retry"&&r(d.source.jobId);return}R==="continue"&&c(d.source.planId),(R==="retry"||R==="switch"||R==="omit")&&p(d.source.planId,R)},e[11]=i,e[12]=c,e[13]=r,e[14]=p,e[15]=y):y=e[15];const A=y;let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=d=>{_(R=>Te(R,d))},e[16]=C):C=e[16];const J=C;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx("h1",{children:"Jobs"}),e[17]=S):S=e[17];const T=s??"No book selected",E=h.total,$=h.total===1?"job":"jobs";let O;e[18]!==o?(O=ee(o),e[18]=o,e[19]=O):O=e[19];let L;e[20]!==h.total||e[21]!==O||e[22]!==T||e[23]!==$?(L=t.jsxs("span",{className:"jobs-header-meta",children:[T," · ",E," ",$," · updated ",O]}),e[20]=h.total,e[21]=O,e[22]=T,e[23]=$,e[24]=L):L=e[24];let F;e[25]!==h||e[26]!==x?(F=ve.map(d=>t.jsx(ye,{filter:d,active:x===d.id,count:d.count?h[d.count]:null,onSelect:X},d.id)),e[25]=h,e[26]=x,e[27]=F):F=e[27];let B;e[28]!==F?(B=t.jsx("div",{className:"jobs-filters","aria-label":"Filter jobs",children:F}),e[28]=F,e[29]=B):B=e[29];let P;e[30]!==L||e[31]!==B?(P=t.jsxs("div",{className:"jobs-header-title",children:[S,L,B]}),e[30]=L,e[31]=B,e[32]=P):P=e[32];let U;e[33]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(me,{size:15}),e[33]=U):U=e[33];let z;e[34]!==l||e[35]!==n?(z=t.jsxs("button",{type:"button",className:"jobs-refresh",disabled:l,onClick:n,children:[U,"Refresh"]}),e[34]=l,e[35]=n,e[36]=z):z=e[36];let q;e[37]!==P||e[38]!==z?(q=t.jsxs("header",{children:[P,z]}),e[37]=P,e[38]=z,e[39]=q):q=e[39];let K;e[40]!==h.total?(K=h.total===0&&t.jsxs("div",{className:"jobs-empty",children:[t.jsx(ae,{size:16,"aria-hidden":"true"}),t.jsx("strong",{children:"No jobs recorded"}),t.jsx("span",{children:"Run a cell or a notebook to queue work."})]}),e[40]=h.total,e[41]=K):K=e[41];let H;e[42]!==h.total||e[43]!==f.length?(H=h.total>0&&f.length===0&&t.jsx("div",{className:"jobs-empty",children:t.jsx("span",{children:"No jobs match this filter."})}),e[42]=h.total,e[43]=f.length,e[44]=H):H=e[44];let V;e[45]!==l||e[46]!==k||e[47]!==A||e[48]!==I||e[49]!==f?(V=f.length>0&&t.jsx("div",{className:"jobs-list-scroll",children:t.jsxs("div",{className:"jobs-list",children:[t.jsxs("div",{className:"jobs-columns","aria-hidden":"true",children:[t.jsx("span",{children:"Status"}),t.jsx("span",{children:"Job"}),t.jsx("span",{children:"Target"}),t.jsx("span",{children:"Progress / result"}),t.jsx("span",{className:"jobs-columns-attempt",children:"Try"}),t.jsx("span",{children:"Enqueued"}),t.jsx("span",{children:"Actions"})]}),f.map(d=>{const Q=d.id==="finished"&&!I?d.rows.slice(0,Z):d.rows;return t.jsxs("div",{className:"jobs-band",children:[t.jsx(Ce,{band:d,hidden:d.rows.length-Q.length,showAll:d.id==="finished"&&I,onToggleShowAll:()=>D(Re)}),Q.map(Y=>t.jsx(Ae,{row:Y,busy:l,expanded:k.has(Y.key),onAction:A,onToggleDetails:J},Y.key))]},d.id)})]})}),e[45]=l,e[46]=k,e[47]=A,e[48]=I,e[49]=f,e[50]=V):V=e[50];let W;return e[51]!==q||e[52]!==K||e[53]!==H||e[54]!==V?(W=t.jsxs("section",{className:"workspace-screen jobs-screen",children:[q,K,H,V]}),e[51]=q,e[52]=K,e[53]=H,e[54]=V,e[55]=W):W=e[55],W}function Re(u){return!u}function Ie(){return new Set}export{$e as J};
|