@pipelex/mthds-ui 0.34.0 → 0.34.1
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/dist/graph/react/detail/DetailPanel.css +18 -0
- package/dist/graph/react/index.js +142 -134
- package/dist/graph/react/index.js.map +1 -1
- package/dist/graph/react/viewer/GraphToolbar.css +61 -0
- package/dist/standalone/graph-standalone.html +80 -1
- package/dist/standalone/graph-viewer.css +79 -0
- package/dist/standalone/graph-viewer.js +1 -1
- package/package.json +1 -1
|
@@ -255,7 +255,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
255
255
|
:where(*:last-child) { margin-bottom: 0; }
|
|
256
256
|
`}function RO(e){return/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:!doctype\b|html[\s>]|head[\s>])/i.test(e)}function ule(e,{styles:t,imgSrc:n,fontSrc:r}){let a=['<!doctype html><html><head><meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src ${n}; font-src ${r}; base-uri 'none'; form-action 'none'">`,`<style>${t}</style></head>`].join("");if(RO(e.innerHtml))return a+e.innerHtml;let i=e.cssClass?`<div class="${QDe(e.cssClass)}">${e.innerHtml}</div>`:e.innerHtml;return`${a}<body>${i}</body></html>`}function QDe(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}var NO=1e4,HDe="pipelex-storage:";function FO(e){return e.toLowerCase().includes("pipelex-storage")}function Kv(e){return e.trim().toLowerCase().startsWith(HDe)}function cle(e){if(typeof DOMParser>"u")return;let t=new DOMParser;if(RO(e)){let a=t.parseFromString(e,"text/html");return{root:a,serialize:()=>(a.doctype?`<!DOCTYPE ${a.doctype.name}>`:"")+a.documentElement.outerHTML}}let r=t.parseFromString("<!doctype html><body></body>","text/html").createElement("template");return r.innerHTML=e,{root:r.content,serialize:()=>r.innerHTML}}var Dse=/url\(\s*(['"]?)(.*?)\1\s*\)/gi;function GDe(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/[\s,]/.test(e[n]??"");)n+=1;if(n>=e.length)break;let r=n;for(;n<e.length&&!/\s/.test(e[n]??"");)n+=1;let a=e.slice(r,n);if(a.endsWith(",")){a=a.replace(/,+$/,""),t.push({url:a,descriptor:""});continue}let i=0,o=n;for(;n<e.length;){let s=e[n];if(s==="(")i+=1;else if(s===")")i=Math.max(0,i-1);else if(s===","&&i===0)break;n+=1}t.push({url:a,descriptor:e.slice(o,n).trim()})}return t}function zDe(e){return`url("${e.replace(/[\\"]/g,t=>`\\${t}`).replace(/[\n\r\f]/g," ")}")`}function Ex(e,t){return{refs:()=>{let n=e.getAttribute(t)??"";return Kv(n)?[n.trim()]:[]},rewrite:n=>{let r=e.getAttribute(t)??"";if(!Kv(r))return!1;let a=n(r.trim());return a===void 0?!1:(e.setAttribute(t,a),!0)}}}function qDe(e,t){let n=()=>GDe(e.getAttribute(t)??"");return{refs:()=>n().flatMap(({url:r})=>Kv(r)?[r]:[]),rewrite:r=>{let a=!1,i=n().map(o=>{if(!Kv(o.url))return o;let s=r(o.url);return s===void 0?o:(a=!0,{...o,url:s.replace(/,/g,"%2C").replace(/\s/g,"%20")})});return a&&e.setAttribute(t,i.map(({url:o,descriptor:s})=>s?`${o} ${s}`:o).join(", ")),a}}}function Mse(e,t){return{refs:()=>Array.from(e().matchAll(Dse),n=>(n[2]??"").trim()).filter(Kv),rewrite:n=>{let r=!1,a=e().replace(Dse,(i,o,s)=>{let l=s.trim();if(!Kv(l))return i;let u=n(l);return u===void 0?i:(r=!0,zDe(u))});return r&&t(a),r}}}function Ale(e){let t=[];for(let n of Array.from(e.querySelectorAll("*"))){let r=n.localName;(r==="img"||r==="source")&&t.push(Ex(n,"src"),qDe(n,"srcset")),r==="video"&&t.push(Ex(n,"poster")),r==="image"&&t.push(Ex(n,"href"),Ex(n,"xlink:href")),n.hasAttribute("background")&&t.push(Ex(n,"background")),n.hasAttribute("style")&&t.push(Mse(()=>n.getAttribute("style")??"",a=>n.setAttribute("style",a))),r==="style"&&t.push(Mse(()=>n.textContent??"",a=>{n.textContent=a}))}return t}function fle(e){if(!FO(e))return[];let t=cle(e);return t?Array.from(new Set(Ale(t.root).flatMap(n=>n.refs()))):[]}function dle(e,t){if(!FO(e))return e;let n=cle(e);if(!n)return e;let r=!1;for(let a of Ale(n.root))a.rewrite(t)&&(r=!0);return r?n.serialize():e}function VDe(e){if(e instanceof Map)return t=>{let n=e.get(t);return typeof n=="string"?n:void 0};if(e!==null&&typeof e=="object"){let t=e;return n=>{let r=Ma(t,n);return typeof r=="string"?r:void 0}}return()=>{}}async function ple(e,t){try{return VDe(await e(t))}catch{return()=>{}}}async function jDe(e,t,n=NO){let r,a=new Promise(o=>{r=setTimeout(()=>o(()=>{}),n)}),i=ple(e,t);try{return await Promise.race([i,a])}finally{clearTimeout(r)}}function hle(e,t){return n=>{let r=os(e?.(n));if(r!==void 0)return r;try{return os(t?.(n))}catch{return}}}async function kO(e,{resolveUrl:t,resolveUrls:n},{timeoutMs:r=NO}={}){if(!t&&!n)return e;try{let a=fle(e);if(a.length===0)return e;let i=n?await jDe(n,a,r):void 0;return dle(e,hle(i,t))}catch{return e}}function Qse(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}function KDe(e){return/^(text\/|application\/json)/.test(e)&&!/charset=/i.test(e)?`${e};charset=utf-8`:e}async function mle(e){let t=[];for(let n of e)try{if(n.text!==void 0){Qse(new Blob([n.text],{type:KDe(n.mimeType)}),n.name);continue}let r=await fetch(n.url);if(!r.ok)throw new Error(`HTTP ${r.status}`);Qse(await r.blob(),n.name)}catch(r){t.push({file:n,reason:r instanceof Error?r.message:String(r)})}return{failed:t}}var yl=(0,xt.createContext)({});function PO({resolveUrl:e,resolveUrls:t,resolveShareUrl:n,proseImages:r,tableColumns:a,tableLayout:i,saveFiles:o,downloads:s,children:l}){let u=(0,xt.useMemo)(()=>({resolveUrl:e,resolveUrls:t,resolveShareUrl:n,proseImages:r,tableColumns:a,tableLayout:i,saveFiles:o,downloads:s}),[e,t,n,r,a,i,o,s]);return(0,te.jsx)(yl,{value:u,children:l})}function $De({downloads:e,tableLayout:t,children:n}){let r=(0,xt.use)(yl),a=e?.result,i=e?.files,o=e?.pdf,s=e?.askFileName,l=(0,xt.useMemo)(()=>{let u=a!==void 0||i!==void 0||o!==void 0||s!==void 0;return!u&&t===void 0?r:{...r,...t===void 0?{}:{tableLayout:t},...u?{downloads:{result:a??r.downloads?.result,files:i??r.downloads?.files,pdf:o??r.downloads?.pdf,askFileName:s??r.downloads?.askFileName}}:{}}},[r,a,i,o,s,t]);return(0,te.jsx)(yl,{value:l,children:n})}function Rx(){return(0,xt.use)(yl).resolveUrl}function UO(){let{resolveUrl:e,resolveUrls:t}=(0,xt.use)(yl);return(0,xt.useMemo)(()=>({resolveUrl:e,resolveUrls:t}),[e,t])}function gle(){return(0,xt.use)(yl).resolveShareUrl}function OO(){let e=(0,xt.use)(yl).saveFiles??mle,t=UO();return(0,xt.useCallback)(n=>WDe(e,n,t),[e,t])}async function WDe(e,t,n){let r=await Promise.all(t.map(async a=>a.url!==void 0?{...a,url:ile(a.url)}:a.mimeType!=="text/html"?a:{...a,text:await kO(a.text,n)}));try{let a=await e(r);return Array.isArray(a?.failed)?{failed:a.failed}:{failed:r.map(i=>({file:i,reason:"The save function reported no result"}))}}catch(a){let i=a instanceof Error?a.message:String(a);return{failed:r.map(o=>({file:o,reason:i}))}}}function XDe(){return(0,xt.use)(yl).downloads?.result??!0}function DO(e){let t=(0,xt.use)(yl).downloads?.files??!0;return typeof t=="boolean"?t:t.includes(e)}function MO(){return(0,xt.use)(yl).downloads?.pdf??!0}function YDe(){return(0,xt.use)(yl).downloads?.askFileName??!1}function vle(){return(0,xt.use)(yl).proseImages??"link"}var ZDe=5;function JDe(){let e=(0,xt.use)(yl).tableColumns;return e===void 0||Number.isNaN(e)?ZDe:Math.max(1,Math.floor(e))}function eMe(){return(0,xt.use)(yl).tableLayout??"scroll"}var aI=(0,xt.createContext)(void 0);function sI(){return(0,xt.use)(aI)}function yle({baseName:e,path:t,children:n}){let r=t.join("\0"),a=(0,xt.useMemo)(()=>({baseName:e,path:r.split("\0")}),[e,r]);return(0,te.jsx)(aI,{value:a,children:n})}function Fm({segment:e,children:t}){let n=(0,xt.use)(aI),r=(0,xt.useMemo)(()=>n?{baseName:n.baseName,path:[...n.path,e]}:void 0,[n,e]);return(0,te.jsx)(aI,{value:r,children:t})}var tMe=UW,nMe=OW,rMe=DW,wle=Ra.forwardRef(({className:e,sideOffset:t=6,...n},r)=>(0,te.jsx)(MW,{children:(0,te.jsx)(Ak,{ref:r,sideOffset:t,className:Fn("z-50 max-w-xs rounded-md border border-border bg-popover px-2.5 py-1.5 text-[12px] leading-relaxed text-popover-foreground shadow-md","animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));wle.displayName=Ak.displayName;function QO(){let e=YDe(),[t,n]=(0,xt.useState)(null),r=(0,xt.useCallback)((i,o)=>e?new Promise(s=>{n({stem:i,extension:o,settle:l=>{n(null),s(l)}})}):Promise.resolve(`${i}${o}`),[e]),a=t?(0,te.jsx)(aMe,{stem:t.stem,extension:t.extension,onConfirm:i=>t.settle(`${uV(i,t.extension)||t.stem}${t.extension}`),onCancel:()=>t.settle(null)}):null;return{ask:r,dialog:a}}function aMe({stem:e,extension:t,onConfirm:n,onCancel:r}){let a=to(),i=(0,xt.useId)(),o=(0,xt.useId)(),[s,l]=(0,xt.useState)(e),u=(0,xt.useRef)(null),c=(0,xt.useRef)(null),A=(0,xt.useRef)(!1);return(0,xt.useEffect)(()=>{let f=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),c.current?.select(),()=>{f?.isConnected&&f.focus()}},[]),(0,te.jsx)("div",{"data-file-name-backdrop":!0,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onMouseDown:f=>{f.stopPropagation(),A.current=f.target===f.currentTarget},onClick:f=>{f.stopPropagation(),A.current&&f.target===f.currentTarget&&r(),A.current=!1},children:(0,te.jsxs)("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":i,onKeyDown:f=>{if(f.stopPropagation(),f.key==="Escape"){f.preventDefault(),r();return}if(f.key!=="Tab")return;let g=Array.from(u.current?.querySelectorAll("input, button")??[]),h=g[0],w=g[g.length-1];!h||!w||(f.shiftKey&&document.activeElement===h?(f.preventDefault(),w.focus()):!f.shiftKey&&document.activeElement===w&&(f.preventDefault(),h.focus()))},className:"w-full max-w-sm space-y-3 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-lg",children:[(0,te.jsx)("h2",{id:i,className:"text-[14px] font-medium",children:a.fileNameTitle}),(0,te.jsxs)("div",{className:"flex items-center rounded-md border border-border bg-input focus-within:outline-solid focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-ring",children:[(0,te.jsx)("input",{ref:c,type:"text",value:s,onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),n(s))},"aria-labelledby":i,...t?{"aria-describedby":o}:{},autoComplete:"off",spellCheck:!1,className:"min-w-0 flex-1 bg-transparent px-2 py-1.5 text-[13px] text-foreground outline-none"}),t?(0,te.jsx)("span",{id:o,className:"shrink-0 pr-2 text-[13px] text-muted-foreground",children:t}):null]}),(0,te.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,te.jsx)("button",{type:"button",onClick:r,className:"rounded-md border border-border px-3 py-1 text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:a.fileNameCancel}),(0,te.jsx)("button",{type:"button",onClick:()=>n(s),className:"rounded-md bg-primary px-3 py-1 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:a.fileNameConfirm})]})]})})}var _x="data-mthds-pdf-fixed",iMe=new Set(["IMG","SVG","CANVAS","VIDEO","IFRAME","OBJECT","EMBED","INPUT","TEXTAREA","SELECT","BUTTON","HR","PICTURE","svg"]),oMe=new Set(["H1","H2","H3","H4","H5","H6"]),J_=new Set(["page","always","left","right","recto","verso"]),eI=new Set(["avoid","avoid-page"]);function sMe(e){let t=e.defaultView,n=e.documentElement,r=n.getBoundingClientRect().top,a=S=>S-r,i=S=>{let b=S.getBoundingClientRect();return{top:a(b.top),bottom:a(b.bottom)}},o=[],s=[],l=[],u=[],c=[],A=[],d=[],f=S=>{let b=t.getComputedStyle(S);if(b.display==="none")return;if(b.position==="fixed"){c.push(S);return}let B=i(S),T=b.display;if((J_.has(b.breakBefore)||J_.has(b.getPropertyValue("page-break-before")))&&l.push(B.top),(J_.has(b.breakAfter)||J_.has(b.getPropertyValue("page-break-after")))&&l.push(B.bottom),(eI.has(b.breakAfter)||oMe.has(S.tagName))&&A.push(B),eI.has(b.breakBefore)&&d.push(B),iMe.has(S.tagName)||T.startsWith("inline-")){B.bottom>B.top&&o.push(B);return}(eI.has(b.breakInside)||eI.has(b.getPropertyValue("page-break-inside"))||T==="table-row")&&s.push(B),(T==="table"||T==="inline-table")&&u.push(g(S,B));for(let R of Array.from(S.childNodes))R.nodeType===1?f(R):R.nodeType===3&&/\S/.test(R.textContent??"")&&o.push(...lMe(e,R,a))},g=(S,b)=>{let B={...b};for(let T of Array.from(S.children)){let k=t.getComputedStyle(T).display;k==="table-header-group"&&!B.head&&(B.head=i(T)),k==="table-footer-group"&&!B.foot&&(B.foot=i(T))}return B};f(e.body??n),c.forEach(S=>S.setAttribute(_x,""));let h=[...o].sort((S,b)=>S.top-b.top),w=S=>h.find(b=>b.top>=S-.5),m=S=>[...h].reverse().find(b=>b.bottom<=S+.5);for(let S of A){let b=w(S.bottom);b&&s.push({top:S.top,bottom:b.bottom})}for(let S of d){let b=m(S.top),B=w(S.top);b&&B&&s.push({top:b.top,bottom:B.bottom})}for(let S of u){if(!S.head)continue;let b=w(S.head.bottom);b&&b.bottom<=(S.foot?.top??S.bottom)+.5&&s.push({top:S.top,bottom:b.bottom})}return{layout:{height:n.scrollHeight,hard:o,avoid:s,forced:l,tables:u},fixed:c}}function lMe(e,t,n){let r=e.createRange();r.selectNodeContents(t);let a=[];for(let i of Array.from(r.getClientRects())){if(i.height===0)continue;let o={top:n(i.top),bottom:n(i.bottom)},s=a.find(l=>o.top<l.bottom&&o.bottom>l.top);s?(s.top=Math.min(s.top,o.top),s.bottom=Math.max(s.bottom,o.bottom)):a.push(o)}return a}var vl=.5;function uMe(e,t){let n=[],r=e.height,a=Math.max(0,...e.hard.map(s=>s.bottom)),i=[...e.forced].sort((s,l)=>s-l),o=0;for(let s=0;o<r-vl&&s<1e4;s++){let l=Hse(e.tables,o).filter(f=>f.head&&o>=f.head.bottom-vl).map(f=>f.head),u=t-tI(l),c=i.find(f=>f>o+vl&&f<r-vl);if(r-o<=u+vl&&c===void 0){n.push({heads:l,body:{top:o,bottom:r},feet:[]});break}let A=[],d=o;for(let f=0;f<4;f++){let g=o+u-tI(A);d=c!==void 0&&c<=g+vl?c:cMe(e,o,g);let h=Hse(e.tables,d).filter(w=>w.foot).map(w=>w.foot).reverse();if(tI(h)<=tI(A)+vl){A=h;break}A=h}if(n.push({heads:l,body:{top:o,bottom:d},feet:A}),o=d,a<=d+vl)break}return n}function cMe(e,t,n){let r=n-t,a=e.hard.filter(l=>l.bottom-l.top<=r),i=e.avoid.filter(l=>l.bottom-l.top<=r),o=new Set([n]);for(let l of[...a,...i])o.add(l.top),o.add(l.bottom);for(let l of e.tables)o.add(l.top),o.add(l.bottom);let s=[...o].filter(l=>l>t+vl&&l<=n+vl).sort((l,u)=>u-l);for(let l of[[...a,...i],a]){let u=s.find(c=>!l.some(A=>AMe(A,c)));if(u!==void 0)return Math.min(u,n)}return n}function AMe(e,t){return t>e.top+vl&&t<e.bottom-vl}function Hse(e,t){return e.filter(n=>t>n.top+vl&&t<(n.foot?.top??n.bottom)-vl).sort((n,r)=>n.top-r.top)}function tI(e){return e.reduce((t,n)=>t+(n.bottom-n.top),0)}var bA=96/25.4,Gse={a3:[297,420],a4:[210,297],a5:[148,210],b4:[250,353],b5:[176,250],"jis-b4":[257,364],"jis-b5":[182,257],letter:[215.9,279.4],legal:[215.9,355.6],ledger:[279.4,431.8]},BO={width:210*bA,height:297*bA,margin:{top:10*bA,right:10*bA,bottom:10*bA,left:10*bA}};function fMe(e){for(let t of Array.from(e.styleSheets)){t.media.length>0&&Cle(t.media);let n;try{n=t.cssRules}catch{continue}ble(n)}}function ble(e){for(let t of Array.from(e))xle(t)&&Cle(t.media),"cssRules"in t&&ble(t.cssRules)}function xle(e){return e.constructor.name==="CSSMediaRule"||e.type===4}function Cle(e){let t=Array.from({length:e.length},(r,a)=>e.item(a)??""),n=t.map(pMe);n.every((r,a)=>r===t[a])||(e.mediaText=n.join(", "))}var dMe=/^\s*(not\s+|only\s+)?([a-z][a-z-]*)(\s+and\s+[\s\S]*)?\s*$/i;function pMe(e){let t=dMe.exec(e);if(!t)return e;let[,n="",r="",a=""]=t,i=/^not/i.test(n),o=["print","all"].includes(r.toLowerCase());return i?o?`not all${a}`:"all":o?`all${a}`:"not all"}function hMe(e){let t="",n={},r=s=>{for(let l of Array.from(s))if(l.constructor.name==="CSSPageRule"||l.type===6){let u=l;if(u.selectorText.trim()!=="")continue;t=u.style.getPropertyValue("size")||t;for(let c of["top","right","bottom","left"]){let A=u.style.getPropertyValue(`margin-${c}`);A&&(n[c]=A)}}else xle(l)?e.defaultView?.matchMedia(l.media.mediaText).matches!==!1&&r(l.cssRules):"cssRules"in l&&r(l.cssRules)};for(let s of Array.from(e.styleSheets))try{r(s.cssRules)}catch{}let[a,i]=mMe(t),o=s=>{let l=n[s];return(l===void 0?void 0:Sle(l))??BO.margin[s]};return{width:a,height:i,margin:{top:o("top"),right:o("right"),bottom:o("bottom"),left:o("left")}}}function mMe(e){let t=e.trim().toLowerCase().split(/\s+/).filter(Boolean),n=t.includes("landscape"),r=t.find(s=>s in Gse),a=t.map(Sle).filter(s=>s!==void 0),i=BO.width,o=BO.height;return r?[i,o]=Gse[r].map(s=>s*bA):a.length===2?[i,o]=a:a.length===1&&(i=o=a[0]),n&&i<o&&([i,o]=[o,i]),[i,o]}var gMe={px:1,in:96,cm:10*bA,mm:bA,q:bA/4,pt:96/72,pc:16};function Sle(e){let t=/^(-?\d*\.?\d+)([a-z]*)$/i.exec(e.trim());if(!t)return;let n=Number(t[1]),r=(t[2]||"px").toLowerCase();if(n===0)return 0;let a=gMe[r];return a===void 0?void 0:n*a}var vMe=1e4,Vv=72/96;async function Ble(e,{imgSrc:t=ole,fontSrc:n,fontFamily:r="system-ui, sans-serif",title:a,scale:i=3,quality:o=.92}={}){let s=Promise.all([Promise.resolve().then(()=>(MX(),DX)),Promise.resolve().then(()=>(Use(),Pse))]),l=await CMe(e,{imgSrc:t,fontSrc:n??t,fontFamily:r});try{let{doc:u}=l;fMe(u);let c=hMe(u),A={width:c.width-c.margin.left-c.margin.right,height:c.height-c.margin.top-c.margin.bottom};l.frame.style.width=`${A.width}px`,l.frame.style.height=`${A.height}px`,await SMe(),await Ele(u);let{layout:d,fixed:f}=sMe(u),g=uMe(d,A.height),[{domToForeignObjectSvg:h},{jsPDF:w}]=await s,m=u.documentElement,S=R=>R.nodeType!==1||!R.id.startsWith("__SANDBOX__"),b=await h(m,{width:A.width,height:d.height,filter:R=>S(R)&&!yMe(R)}),B=f.length>0?await wMe(u,f,A,h,S):void 0,T=c.width>c.height,k=new w({unit:"pt",format:[c.width*Vv,c.height*Vv],orientation:T?"landscape":"portrait",compress:!0});a&&k.setProperties({title:a});for(let[R,F]of g.entries()){let N=await xMe(F,c,A,i,o,b,B);R>0&&k.addPage([c.width*Vv,c.height*Vv],T?"landscape":"portrait"),k.addImage(N,"JPEG",0,0,c.width*Vv,c.height*Vv,void 0,"NONE")}return{blob:k.output("blob"),pageCount:g.length,page:c}}finally{l.frame.remove()}}function yMe(e){return e.nodeType===1&&e.hasAttribute(_x)}async function wMe(e,t,n,r,a){let i=e.documentElement,o=new Set;for(let u of t)for(let c=u;c;c=c.parentNode)o.add(c);let s=new Map(t.map((u,c)=>[String(c),u.getBoundingClientRect()]));t.forEach((u,c)=>u.setAttribute(_x,String(c)));let l=i.style.getPropertyValue("visibility");i.style.setProperty("visibility","hidden","important"),t.forEach(u=>u.style.setProperty("visibility","visible","important"));try{return await r(i,{width:n.width,height:n.height,filter:u=>a(u)&&(o.has(u)||bMe(u,t)),onCloneNode:u=>{let c=u;c.style.setProperty("position","relative");for(let A of Array.from(c.querySelectorAll(`[${_x}]`))){let d=s.get(A.getAttribute(_x)??"");d&&Object.assign(A.style,{position:"absolute",top:`${d.top}px`,left:`${d.left}px`,width:`${d.width}px`,height:`${d.height}px`,right:"auto",bottom:"auto",margin:"0"})}}})}finally{l?i.style.setProperty("visibility",l):i.style.removeProperty("visibility"),t.forEach(u=>u.style.removeProperty("visibility"))}}function bMe(e,t){return t.some(n=>n.contains(e))}async function xMe(e,t,n,r,a,i,o){let s=document.createElement("canvas");s.width=Math.round(t.width*r),s.height=Math.round(t.height*r);let l=s.getContext("2d");if(!l)throw new Error("No 2D canvas to paint the PDF page on");l.fillStyle="#fff",l.fillRect(0,0,s.width,s.height);let u=t.margin.top;for(let A of[...e.heads,e.body,...e.feet]){let d=A.bottom-A.top;if(d<=0)continue;let f=await zse(i,{top:A.top,width:n.width,height:d},r);l.drawImage(f,t.margin.left*r,u*r,n.width*r,d*r),u+=d}if(o){let A=await zse(o,{top:0,...n},r);l.drawImage(A,t.margin.left*r,t.margin.top*r,n.width*r,n.height*r)}let c=await new Promise(A=>s.toBlob(A,"image/jpeg",a));if(!c)throw new Error("The PDF page could not be encoded");return new Uint8Array(await c.arrayBuffer())}async function zse(e,{top:t,width:n,height:r},a){let i=e.cloneNode(!1);i.setAttribute("viewBox",`0 ${t} ${n} ${r}`),i.setAttribute("width",String(Math.max(1,Math.round(n*a)))),i.setAttribute("height",String(Math.max(1,Math.round(r*a)))),i.setAttribute("preserveAspectRatio","none");for(let u of Array.from(e.childNodes))i.appendChild(u.cloneNode(!0));let o=Array.from(i.children).find(u=>u.localName==="foreignObject");o?.setAttribute("width",e.getAttribute("width")??String(n)),o?.setAttribute("height",e.getAttribute("height")??String(t+r));let s=new XMLSerializer().serializeToString(i).replace(/[\u0000-\u0008\v\f\u000E-\u001F]/g,""),l=new Image;return l.decoding="sync",l.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`,await l.decode(),l}async function CMe(e,{imgSrc:t,fontSrc:n,fontFamily:r}){let a=document.createElement("iframe");a.setAttribute("sandbox","allow-same-origin"),a.setAttribute("aria-hidden","true"),a.setAttribute("data-mthds-pdf-copy",""),a.tabIndex=-1,a.title="PDF",Object.assign(a.style,{position:"fixed",left:"-10000px",top:"0",width:"794px",height:"1123px",border:"0",opacity:"0",pointerEvents:"none"}),a.srcdoc=ule(e,{styles:lle(sle(r)),imgSrc:t,fontSrc:n});let i=new Promise(o=>a.addEventListener("load",()=>o(),{once:!0}));document.body.append(a);try{await i;let o=a.contentDocument;if(!o?.defaultView)throw new Error("The PDF copy could not be opened");return await Ele(o),{frame:a,doc:o}}catch(o){throw a.remove(),o}}async function Ele(e){let t=Array.from(e.images,a=>(a.loading="eager",a.complete?Promise.resolve():new Promise(i=>{a.addEventListener("load",()=>i(),{once:!0}),a.addEventListener("error",()=>i(),{once:!0})}))),n=e.fonts?[...Array.from(e.fonts,a=>a.load().then(nI,nI)),e.fonts.ready.then(nI,nI)]:[],r;await Promise.race([Promise.all([...t,...n]),new Promise(a=>{r=setTimeout(a,vMe)})]),clearTimeout(r)}function SMe(){return new Promise(e=>{let t=setTimeout(e,100);requestAnimationFrame(()=>{clearTimeout(t),e()})})}function nI(){}function lI({content:e,fileName:t,path:n="page",imgSrc:r,fontSrc:a,primary:i=!1,className:o}){let s=to(),l=OO(),u=UO(),c=(0,xt.useRef)(null),A=(0,xt.useId)(),[d,f]=(0,xt.useState)("idle"),g=d==="failed",{ask:h,dialog:w}=QO(),m=`${rI(t)||"page"}.pdf`,S=async()=>{let b=await h(rI(t)||"page",".pdf");if(b===null)return;let B=rI(b===m?t:b);f("busy");try{let T=c.current?getComputedStyle(c.current).fontFamily:void 0,k=await kO(e.innerHtml,u),R=k===e.innerHtml?e:{...e,innerHtml:k},{blob:F}=await Ble(R,{...B?{title:B}:{},...r===void 0?{}:{imgSrc:r},...a===void 0?{}:{fontSrc:a},...T?{fontFamily:T}:{}}),{failed:N}=await l([{name:b,mimeType:"application/pdf",kind:"markup",path:n,url:await BMe(F)}]);f(N.length>0?"failed":"idle")}catch{f("failed")}};return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsxs)("button",{ref:c,type:"button","data-pdf-download":!0,onClick:()=>{S()},disabled:d==="busy","aria-busy":d==="busy",title:g?s.downloadPdfFailed:m,...g?{"aria-describedby":A}:{},className:Fn("inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-70",i?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-border text-muted-foreground hover:text-foreground",g&&(i?"bg-destructive text-white hover:bg-destructive/90":"text-destructive"),o),children:[d==="busy"?(0,te.jsx)(Ru,{"aria-hidden":!0,className:"size-3.5 animate-spin"}):g?(0,te.jsx)(bf,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(Ew,{"aria-hidden":!0,className:"size-3.5"}),d==="busy"?s.downloadPdfBusy:s.downloadPdf]}),(0,te.jsx)("span",{id:A,role:"status",className:"sr-only",children:g?s.downloadPdfFailed:""}),w]})}function rI(e){return(e??"").trim().replace(/\.pdf$/i,"").trim()}function BMe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??new Error("The PDF could not be read")),r.readAsDataURL(e)})}var EMe=typeof window>"u"?xt.useEffect:xt.useLayoutEffect,_Me=1400,IMe=320;function uI({content:e,maxHeight:t,imgSrc:n=ole,fontSrc:r,downloadPdf:a,pdfFileName:i,bare:o=!1,fill:s=!1}){let l=(0,xt.useRef)(null),u=(0,xt.useRef)(null),c=to(),[A,d]=(0,xt.useState)(null),[f,g]=(0,xt.useState)(0),h=LMe(e.innerHtml),w=(0,xt.useMemo)(()=>h===void 0?void 0:h===e.innerHtml?e:{...e,innerHtml:h},[e,h]),m=RO(e.innerHtml),S=MO(),b=a??S,B=t??(m?void 0:_Me),T=m&&s;EMe(()=>{let N=l.current;if(!N||!w)return;let V=getComputedStyle(N),P=m?sle(V.fontFamily):{color:V.color,mutedColor:V.getPropertyValue("--muted-foreground").trim()||V.color,borderColor:V.borderColor||V.color,font:V.fontFamily};d(ule(w,{styles:lle(P),imgSrc:n,fontSrc:r??n}))},[w,n,r,m]);let k=()=>{let N=u.current?.contentDocument,V=N?.body;!N||!V||g(Math.max(V.scrollHeight,N.documentElement.scrollHeight))},R=()=>{k(),u.current?.contentDocument?.fonts?.ready.then(k,()=>{})};(0,xt.useEffect)(()=>{if(!A||!l.current||typeof ResizeObserver>"u")return;let N=new ResizeObserver(k);return N.observe(l.current),()=>N.disconnect()},[A]);let F=(0,te.jsx)("div",{ref:l,...m?{"data-html-page":""}:{},className:Fn(m?o?"overflow-hidden bg-white text-[13px] text-black":"overflow-hidden rounded-lg border border-border bg-white text-[13px] text-black":"overflow-hidden rounded-lg border border-border bg-card/40 px-3.5 py-3 text-[13px] text-foreground",T&&"flex min-h-0 flex-col"),children:w===void 0?(0,te.jsxs)("div",{role:"status","data-html-resolving":!0,className:"flex min-h-24 items-center justify-center gap-2 text-[12px] text-muted-foreground",children:[(0,te.jsx)(Ru,{"aria-hidden":!0,className:"size-4 animate-spin"}),(0,te.jsx)("span",{children:c.pageLoading})]}):A===null?null:(0,te.jsx)("iframe",{ref:u,title:e.cssClass?`HTML result (${e.cssClass})`:"HTML result",srcDoc:A,onLoad:R,sandbox:"allow-same-origin",style:{display:"block",width:"100%",border:0,height:f===0?void 0:B===void 0?f:Math.min(f,B),...B===void 0?{}:{maxHeight:B},...T&&f>0?{flex:"0 1 auto",minHeight:Math.min(f,IMe)}:{}}})});return b?(0,te.jsxs)("div",{className:"space-y-1.5",children:[(0,te.jsx)("div",{className:"flex justify-end",children:(0,te.jsx)(lI,{content:e,imgSrc:n,...r===void 0?{}:{fontSrc:r},...i===void 0?{}:{fileName:i}})}),F]}):F}function LMe(e){let t=UO(),n=(t.resolveUrl!==void 0||t.resolveUrls!==void 0)&&FO(e),[r,a]=(0,xt.useState)(null);return(0,xt.useEffect)(()=>{if(!n)return;let i=!0,o=u=>{if(!i)return;let c=e;try{c=dle(e,hle(u,t.resolveUrl))}catch{}a({source:e,html:c})},s=[];try{s=fle(e)}catch{s=[]}if(s.length===0||!t.resolveUrls)return o(),()=>{i=!1};let l=setTimeout(()=>o(),NO);return ple(t.resolveUrls,s).then(u=>{clearTimeout(l),o(u)}),()=>{i=!1,clearTimeout(l)}},[n,e,t]),n?r?.source===e?r.html:void 0:e}var TMe={gfm:!0,breaks:!0};function iI({text:e,className:t,proseImages:n}){let r=Ra.useMemo(()=>Hr.lexer(e,TMe),[e]),a=vle();return(0,te.jsx)(_le,{value:n??a,children:(0,te.jsx)("div",{className:Fn("space-y-2 text-[13px] leading-relaxed text-foreground",t),children:(0,te.jsx)(EO,{tokens:r})})})}var _le=Ra.createContext("link"),RMe={1:"text-[16px] font-semibold",2:"text-[14.5px] font-semibold",3:"text-[13.5px] font-semibold",4:"text-[13px] font-semibold",5:"text-[13px] font-semibold",6:"text-[13px] font-semibold"};function EO({tokens:e}){return(0,te.jsx)(te.Fragment,{children:e.map((t,n)=>(0,te.jsx)(NMe,{token:t},n))})}function NMe({token:e}){switch(e.type){case"space":return null;case"heading":{let t=e,n=Math.min(Math.max(t.depth,1),6),r=`h${n}`;return(0,te.jsx)(r,{className:Fn("mt-3 first:mt-0",RMe[n]),children:(0,te.jsx)(Nc,{tokens:t.tokens})})}case"paragraph":return(0,te.jsx)("p",{children:(0,te.jsx)(Nc,{tokens:e.tokens})});case"text":return(0,te.jsx)(Nc,{tokens:e.tokens??[e]});case"list":{let t=e,n=t.ordered?"ol":"ul";return(0,te.jsx)(n,{className:Fn("space-y-1 ps-5",t.ordered?"list-decimal":"list-disc"),...t.ordered&&t.start!==1?{start:Number(t.start)}:{},children:t.items.map((r,a)=>(0,te.jsxs)("li",{className:"marker:text-muted-foreground",children:[r.task?(0,te.jsx)("input",{type:"checkbox",checked:r.checked??!1,disabled:!0,readOnly:!0,className:"me-1.5 align-middle"}):null,(0,te.jsx)(EO,{tokens:r.tokens})]},a))})}case"code":return(0,te.jsx)("pre",{className:"whitespace-pre-wrap wrap-break-word rounded-md border border-border bg-card/40 p-2.5 text-[12px]",children:(0,te.jsx)("code",{children:e.text})});case"blockquote":return(0,te.jsx)("blockquote",{className:"border-s-2 border-border ps-3 text-muted-foreground",children:(0,te.jsx)(EO,{tokens:e.tokens})});case"hr":return(0,te.jsx)("hr",{className:"border-border"});case"table":{let t=e;return(0,te.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,te.jsxs)("table",{className:"min-w-full border-collapse text-[12.5px]",children:[(0,te.jsx)("thead",{children:(0,te.jsx)("tr",{className:"border-b border-border bg-card/40",children:t.header.map((n,r)=>(0,te.jsx)("th",{scope:"col",className:"px-2.5 py-1.5 text-start font-semibold",style:qse(t.align[r]),children:(0,te.jsx)(Nc,{tokens:n.tokens})},r))})}),(0,te.jsx)("tbody",{children:t.rows.map((n,r)=>(0,te.jsx)("tr",{className:"border-b border-border/60 last:border-b-0",children:n.map((a,i)=>(0,te.jsx)("td",{className:"px-2.5 py-1.5 align-top",style:qse(t.align[i]),children:(0,te.jsx)(Nc,{tokens:a.tokens})},i))},r))})]})})}default:return(0,te.jsx)("p",{className:"whitespace-pre-wrap",children:Lle(e)})}}function Nc({tokens:e}){return e?(0,te.jsx)(te.Fragment,{children:e.map((t,n)=>(0,te.jsx)(FMe,{token:t},n))}):null}function FMe({token:e}){switch(e.type){case"text":{let t=e;return t.tokens?(0,te.jsx)(Nc,{tokens:t.tokens}):(0,te.jsx)(te.Fragment,{children:Vse(t.text)})}case"escape":return(0,te.jsx)(te.Fragment,{children:e.text});case"strong":return(0,te.jsx)("strong",{className:"font-semibold",children:(0,te.jsx)(Nc,{tokens:e.tokens})});case"em":return(0,te.jsx)("em",{className:"italic",children:(0,te.jsx)(Nc,{tokens:e.tokens})});case"del":return(0,te.jsx)("del",{className:"line-through",children:(0,te.jsx)(Nc,{tokens:e.tokens})});case"codespan":return(0,te.jsx)("code",{className:"rounded border border-border bg-card/40 px-1 py-0.5 text-[0.92em]",children:Vse(e.text)});case"br":return(0,te.jsx)("br",{});case"link":{let t=e,n=UMe(t.href);return n?(0,te.jsx)(Ile,{value:!0,children:(0,te.jsx)("a",{href:n,target:"_blank",rel:"noreferrer noopener",className:"underline underline-offset-2",children:(0,te.jsx)(Nc,{tokens:t.tokens})})}):(0,te.jsx)(Nc,{tokens:t.tokens})}case"image":return(0,te.jsx)(kMe,{token:e});default:return(0,te.jsx)(te.Fragment,{children:Lle(e)})}}function kMe({token:e}){let t=Ra.use(_le),n=Ra.use(Ile),r=PMe(e.href);return r?t==="load"?(0,te.jsx)("img",{src:r,alt:e.text,referrerPolicy:"no-referrer",className:"max-w-full rounded-md"}):n?(0,te.jsx)(te.Fragment,{children:e.text||r}):(0,te.jsx)("a",{href:r,target:"_blank",rel:"noreferrer noopener",className:"underline underline-offset-2",children:e.text||r}):(0,te.jsx)(te.Fragment,{children:e.text})}var Ile=Ra.createContext(!1);function PMe(e){let t=os(e);return t&&/^https?:/.test(t)?t:void 0}function UMe(e){let t=e.trim();if(/^(https?:|mailto:)/i.test(t)||t.startsWith("#"))return t;if(t.startsWith("/"))return os(t)}function qse(e){return e?{textAlign:e}:void 0}function Lle(e){return"raw"in e&&typeof e.raw=="string"?e.raw:""}var OMe={"&":"&","<":"<",">":">",""":'"',"'":"'","'":"'"};function Vse(e){return e.replace(/&(?:amp|lt|gt|quot|#39|#x27);/g,t=>OMe[t]??t)}function Tle(e,t){if(!e.contentKey||typeof t!="object"||t===null||Array.isArray(t))return t;let n=Ma(t,e.contentKey);return n===void 0?t:n}function _O({description:e,children:t}){return e?(0,te.jsx)(tMe,{delayDuration:200,children:(0,te.jsxs)(nMe,{children:[(0,te.jsx)(rMe,{asChild:!0,children:(0,te.jsx)("span",{tabIndex:0,className:"-mx-1 cursor-help rounded px-1 outline-hidden transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:t})}),(0,te.jsx)(wle,{children:e})]})}):(0,te.jsx)(te.Fragment,{children:t})}function DMe({field:e}){return(0,te.jsx)(IO,{field:e,describe:!0})}function IO({field:e,describe:t=!1}){let n=Tx(),r=n==="app",a=SO(e.title,e.name,n);return a.trim()===""?(0,te.jsx)(CO,{conceptRef:e.conceptRef,category:xN(e)}):(0,te.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,te.jsx)(_O,{description:t?e.description:void 0,children:(0,te.jsx)("span",{className:Fn("text-[13px] font-semibold text-foreground",r?"text-[13.5px]":"font-mono"),children:a})}),!r&&(0,te.jsx)(CO,{conceptRef:e.conceptRef,category:xN(e)})]})}function ru(){let e=to();return(0,te.jsxs)("span",{className:"text-[13px] text-muted-foreground",children:[(0,te.jsx)("span",{"aria-hidden":!0,children:e.resultAbsent}),(0,te.jsx)("span",{className:"sr-only",children:e.resultAbsentDescription})]})}function Rle(e){try{let t=JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r);return t===void 0||t==="{}"||t==="[]"?void 0:JSON.stringify(JSON.parse(t),null,2)}catch{let t=Array.isArray(e)?[]:Object.keys(e);return t.length>0?`{ ${t.join(", ")} }`:void 0}}function Nle({value:e,compact:t}){let n=Rle(e);return n===void 0?(0,te.jsx)(ru,{}):t?(0,te.jsx)("span",{title:n,className:"truncate font-mono text-[12px] text-foreground",children:n}):(0,te.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap wrap-break-word rounded-md border border-border bg-card/40 px-2.5 py-1.5 font-mono text-[12px] leading-relaxed text-foreground",children:n})}function Nm({value:e,compact:t=!1}){return e==null||e===""?(0,te.jsx)(ru,{}):typeof e=="object"?(0,te.jsx)(Nle,{value:e,compact:t}):(0,te.jsx)("span",{className:Fn("text-[13px] leading-relaxed text-foreground",t?"whitespace-nowrap":"whitespace-pre-wrap"),children:String(e)})}function MMe({value:e,compact:t=!1}){let n=to();return e==null||e===""?(0,te.jsx)(ru,{}):typeof e!="boolean"?(0,te.jsx)(Nm,{value:e,compact:t}):(0,te.jsx)("span",{className:"text-[13px] text-foreground",children:e?n.yes:n.no})}function HO({value:e}){let t=AN(e);return t?(0,te.jsx)("span",{className:"text-[13px] text-foreground",children:fN(t)}):(0,te.jsx)(ru,{})}function QMe({field:e,value:t,compact:n}){let r=Tx(),a=typeof t=="string"?Wse(e.options,r)(t):t;return(0,te.jsx)(Nm,{value:a,compact:n})}function HMe(e,t,n){return e.kind==="enum"&&typeof t=="string"?Wse(e.options,n)(t):String(t)}function Fle(e,t,n){if(t)return t;let r=ele(e,n);return r!==void 0?r:kle(e)}function kle(e){let n=(e.split(/[?#]/)[0]??e).split("/").filter(Boolean).pop();return n&&n.length>0?n:e}function Ple({value:e,provide:t,label:n,title:r}){let[a,i]=(0,xt.useState)(!1);return(0,xt.useEffect)(()=>{if(!a)return;let o=window.setTimeout(()=>i(!1),1500);return()=>window.clearTimeout(o)},[a]),typeof navigator>"u"||!navigator.clipboard?null:(0,te.jsx)("button",{type:"button",onClick:()=>{let o=()=>i(!0);if(!t){navigator.clipboard.writeText(e??"").then(o);return}let s=t();if(typeof ClipboardItem=="function"&&"write"in navigator.clipboard){navigator.clipboard.write([new ClipboardItem({"text/plain":s.then(l=>new Blob([l],{type:"text/plain"}))})]).then(o,()=>{s.then(l=>navigator.clipboard.writeText(l)).then(o)});return}s.then(l=>navigator.clipboard.writeText(l)).then(o)},...r?{title:r}:{},"aria-label":n,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:a?(0,te.jsx)(Yd,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(P0,{"aria-hidden":!0,className:"size-3.5"})})}function GMe({url:e,storageUrl:t}){let n=to(),r=gle();return(0,te.jsx)(Ple,{provide:async()=>{if(r&&t){let i=await r(t);if(i)return i}return ile(e)},label:n.copyUrl,title:e})}function Ix({url:e,storageUrl:t,mimeType:n,filename:r,file:a}){let i=to(),o=ele(e,i),s=r||(o??kle(e)),l=o??e,u=n?`${l} \xB7 ${n}`:l,c=os(e);return(0,te.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[c?(0,te.jsx)("a",{href:c,target:"_blank",rel:"noreferrer",title:u,className:"min-w-0 truncate font-mono text-[12px] text-foreground underline underline-offset-2",children:s}):(0,te.jsx)("span",{title:u,className:"min-w-0 truncate font-mono text-[12px] text-muted-foreground",children:s}),(0,te.jsx)(Ule,{copy:{url:e,...t?{storageUrl:t}:{}},file:a})]})}function Ule({copy:e,file:t}){return(0,te.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5",children:[e&&(0,te.jsx)(GMe,{url:e.url,...e.storageUrl?{storageUrl:e.storageUrl}:{}}),t&&(0,te.jsx)(zMe,{file:t})]})}function Ole(e,t){let n=sI();return n?F0(e,t,n.path.join(".")):void 0}function zMe({file:e}){let t=to(),n=sI(),r=Rx(),a=OO(),i=DO(e.kind),{ask:o,dialog:s}=QO(),l=(0,xt.useId)(),[u,c]=(0,xt.useState)(null);if((0,xt.useEffect)(()=>{if(u?.state!=="saved")return;let w=window.setTimeout(()=>c(m=>m===u?null:m),1500);return()=>window.clearTimeout(w)},[u]),!i||!n)return null;let A=gw(e,{baseName:n.baseName,...r?{resolveUrl:r}:{}});if(!A)return null;let d=`${A.name}
|
|
257
257
|
${A.url??A.text}`,f=u?.identity===d?u.state:"idle",g=f==="failed",h=t.downloadFile(A.name);return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)("button",{type:"button",onClick:async()=>{let{stem:w,extension:m}=SB(A.name),S=await o(w,m);if(S===null)return;let b={identity:d,state:"saving"};c(b);let T=(await a([S===A.name?A:{...A,name:S}])).failed.length>0?"failed":"saved";c(k=>k===b?{identity:d,state:T}:k)},disabled:f==="saving","aria-label":h,title:g?t.downloadFileFailed:h,...g?{"aria-describedby":l}:{},className:Fn("shrink-0 rounded p-0.5 hover:bg-card focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-60",g?"text-destructive":"text-muted-foreground hover:text-foreground"),children:f==="saving"?(0,te.jsx)(Ru,{"aria-hidden":!0,className:"size-3.5 animate-spin"}):f==="saved"?(0,te.jsx)(Yd,{"aria-hidden":!0,className:"size-3.5"}):g?(0,te.jsx)(bf,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(U0,{"aria-hidden":!0,className:"size-3.5"})}),(0,te.jsx)("span",{id:l,role:"status",className:"sr-only",children:g?t.downloadFileFailed:""}),s]})}function Dle(e,t){let n=os(t?.(e.url));if(n)return{url:n,fromResolver:!0};let r=os(e.publicUrl)??os(e.url);return r?{url:r,fromResolver:!1}:void 0}function Mle(e,t){return Dle(e,t)?.url}var qMe=/\.(pdf|png|jpe?g|gif|webp|avif|svg)(\?|#|$)/i,VMe=/^(application\/pdf|image\/)/i;function jMe(e){if(e)return/^https?:/.test(e.url)||e.fromResolver&&e.url.startsWith("/")?e.url:void 0}function KMe(e,t){let n=jMe(Dle(e,t));if(!n)return;let r=e.filename??n;return(e.mimeType?VMe.test(e.mimeType):qMe.test(r))?n:void 0}function $Me({url:e,name:t}){return(0,te.jsx)("iframe",{src:e,title:t,loading:"lazy",referrerPolicy:"no-referrer",className:"h-112 w-full rounded-lg border border-border bg-card/40"})}function Qle({value:e}){let t=to(),n=Rx(),[r,a]=(0,xt.useState)(!1),i=Ole("document",e),o=pw(e);if(!o)return(0,te.jsx)(ru,{});let s=o.title??o.filename??Fle(o.url,o.filename,t),l=KMe(o,n);return(0,te.jsxs)("div",{className:"space-y-2",children:[(0,te.jsxs)("div",{className:"flex min-w-0 items-start gap-2.5",children:[(0,te.jsx)(O0,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,te.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[s&&(0,te.jsx)("span",{className:"block truncate text-[13px] text-foreground",children:s}),(0,te.jsx)(Ix,{url:Mle(o,n)??o.url,storageUrl:o.url,mimeType:o.mimeType,...o.filename?{filename:o.filename}:{},file:i}),o.snippet&&(0,te.jsx)("p",{className:"line-clamp-2 text-[12px] leading-relaxed text-muted-foreground",children:o.snippet})]}),l&&(0,te.jsxs)("button",{type:"button",onClick:()=>a(u=>!u),"aria-expanded":r,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:[r?(0,te.jsx)(Sw,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(Bw,{"aria-hidden":!0,className:"size-3.5"}),t.preview]})]}),l&&r&&(0,te.jsx)($Me,{url:l,name:s})]})}function GO({value:e,inGallery:t=!1,inRow:n=!1,compact:r=!1}){let a=to(),i=Rx(),o=Ole("image",e),s=hw(e);if(!s)return(0,te.jsx)(ru,{});let l=Mle(s,i);return(0,te.jsxs)("div",{className:t?"space-y-1":"space-y-1.5",children:[l?(0,te.jsx)("a",{href:l,target:"_blank",rel:"noreferrer",title:s.url,className:t||r?"inline-block":"block w-full",children:(0,te.jsx)(XMe,{src:l,alt:s.caption??a.preview,className:Fn(t&&"block aspect-square w-full object-cover",r&&"h-10 w-auto rounded border border-border object-cover",!t&&!r&&"max-h-176 w-full rounded-lg border border-border object-contain")})}):n?(0,te.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,te.jsx)(D0,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),(0,te.jsx)("div",{className:"min-w-0 flex-1",children:(0,te.jsx)(Ix,{url:s.url,mimeType:s.mimeType,...s.filename?{filename:s.filename}:{},file:o})})]}):t?(0,te.jsxs)("div",{className:"flex aspect-square w-full flex-col items-center justify-center gap-1.5 px-2 text-center",children:[(0,te.jsx)(D0,{"aria-hidden":!0,className:"size-5 text-muted-foreground"}),(0,te.jsx)("span",{title:s.url,className:"w-full truncate font-mono text-[10.5px] text-muted-foreground",children:Fle(s.url,s.filename,a)})]}):(0,te.jsx)(Ix,{url:s.url,mimeType:s.mimeType,...s.filename?{filename:s.filename}:{},file:o}),l&&!r&&(0,te.jsx)("div",{className:t?"px-2.5":void 0,children:(0,te.jsx)(Ix,{url:l,storageUrl:s.url,mimeType:s.mimeType,...s.filename?{filename:s.filename}:{},file:o})}),s.caption&&(0,te.jsx)("p",{className:Fn("text-[12px] leading-relaxed text-muted-foreground",t&&"px-2.5 pb-1.5"),children:s.caption})]})}var oI=new Set(["text","number","boolean","date","enum"]);function $v({field:e,value:t,compact:n=!1}){let r=Tle(e,t);switch(e.kind){case"list":{let a=Array.isArray(r)?r:[];return oI.has(e.item.kind)?(0,te.jsx)(Hle,{field:e.item,items:a}):(0,te.jsx)(YMe,{count:a.length})}case"prose":return n?(0,te.jsx)(Nm,{value:r,compact:!0}):typeof r=="string"&&r!==""?(0,te.jsx)(iI,{text:r}):(0,te.jsx)(Nm,{value:r});case"boolean":return(0,te.jsx)(MMe,{value:r,compact:n});case"date":return(0,te.jsx)(HO,{value:r});case"document":return(0,te.jsx)(Qle,{value:r});case"image":return(0,te.jsx)(GO,{value:r,compact:n});case"object":return n?(0,te.jsx)(WMe,{field:e,value:r}):(0,te.jsx)(Nm,{value:r});case"enum":return(0,te.jsx)(QMe,{field:e,value:r,compact:n});default:return(0,te.jsx)(Nm,{value:r,compact:n})}}function WMe({field:e,value:t}){let n=to();if(mw(e))return(0,te.jsx)(HO,{value:t});if(!LO(t)||Object.keys(t).length===0)return(0,te.jsx)(ru,{});let r=Th(e)?void 0:qle(e.fields)??e.fields.find(a=>a.kind==="prose");return r===void 0?(0,te.jsx)("span",{className:"whitespace-nowrap text-[12.5px] text-muted-foreground",children:n.fieldsCount(e.fields.length)}):(0,te.jsx)($v,{field:r,value:Ma(t,r.name),compact:!0})}function XMe({src:e,alt:t,className:n}){let[r,a]=(0,xt.useState)("loading"),[i,o]=(0,xt.useState)(e);return i!==e&&(o(e),a("loading")),(0,te.jsxs)("span",{className:"relative block",children:[r==="loading"&&(0,te.jsx)("span",{role:"status","aria-label":t,className:"absolute inset-0 flex items-center justify-center rounded-lg border border-border bg-card/40",children:(0,te.jsx)(Ru,{"aria-hidden":!0,className:"size-4 animate-spin text-muted-foreground"})}),(0,te.jsx)("img",{src:e,alt:t,referrerPolicy:"no-referrer",onLoad:()=>a("done"),onError:()=>a("done"),className:Fn(n,r==="loading"&&"min-h-40 opacity-0")})]})}function Hle({field:e,items:t}){return(0,te.jsx)("div",{"data-chips":!0,className:"flex flex-wrap gap-1.5",children:t.map((n,r)=>(0,te.jsx)("span",{className:"rounded-md border border-border bg-card/40 px-2 py-0.5 text-[12.5px] text-foreground",children:(0,te.jsx)($v,{field:e,value:n})},r))})}function YMe({count:e}){let t=to();return(0,te.jsx)("span",{className:"whitespace-nowrap text-[12.5px] text-muted-foreground",children:t.itemsCount(e)})}function cI(e){return e.kind==="list"?oI.has(e.item.kind):oI.has(e.kind)}var ZMe=80,jse="2rem",JMe=3,eQe=6;function tQe(e){return e<=JMe?"never":e>eQe?"always":"narrow"}var nQe={narrow:{table:"@max-[640px]:block",head:"@max-[640px]:hidden",body:"@max-[640px]:block",row:"@max-[640px]:relative @max-[640px]:block @max-[640px]:px-3 @max-[640px]:py-2",rowWithToggle:"@max-[640px]:pl-8",toggle:"@max-[640px]:absolute @max-[640px]:top-2 @max-[640px]:left-1 @max-[640px]:p-0",cell:"@max-[640px]:grid @max-[640px]:grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] @max-[640px]:items-baseline @max-[640px]:gap-x-3 @max-[640px]:px-0 @max-[640px]:py-0.5",label:"@max-[640px]:block",detail:"@max-[640px]:block",detailInner:"@max-[640px]:px-0 @max-[640px]:py-1"},always:{table:"block",head:"hidden",body:"block",row:"relative block px-3 py-2",rowWithToggle:"pl-8",toggle:"absolute top-2 left-1 p-0",cell:"grid grid-cols-[minmax(0,min(40%,10rem))_minmax(0,1fr)] items-baseline gap-x-3 px-0 py-0.5",label:"block",detail:"block",detailInner:"px-0 py-1"}},rQe="min-w-[min(8ch,14cqw)] wrap-anywhere [&>span]:whitespace-normal",aQe="min-w-[min(16ch,28cqw)] wrap-anywhere [&>span]:whitespace-normal";function iQe(e,t){return e===t||AI(e)?!1:e.kind!=="list"&&e.kind!=="document"&&e.kind!=="image"}function AI(e){switch(e.kind){case"boolean":case"date":case"number":case"enum":return!0;case"text":return e.maxLength!==void 0&&e.maxLength<=ZMe;case"object":return mw(e);case"list":return cI(e)&&AI(e.item);default:return!1}}function oQe({columns:e,element:t,items:n,label:r}){let a=to(),i=Tx(),o=JDe(),s=eMe(),l=(0,xt.useRef)(null),[u,c]=(0,xt.useState)(()=>new Set),[A,d]=(0,xt.useState)(),{shown:f,hidden:g,name:h}=fQe(e,o),w=g>0||f.some(T=>T!==h&&!AI(T)),m=s==="stack",S=m?tQe(f.length):"never",b=S==="never"?void 0:nQe[S];(0,xt.useEffect)(()=>{let T=l.current;if(!T||m)return;let k=()=>d(T.clientWidth);if(k(),typeof ResizeObserver>"u")return;let R=new ResizeObserver(k);return R.observe(T),()=>R.disconnect()},[m]);let B=T=>c(k=>{let R=new Set(k);return R.delete(T)||R.add(T),R});return(0,te.jsx)("div",{ref:l,role:"group","aria-label":r,...m?{}:{tabIndex:0},className:Fn("overflow-x-auto rounded-lg border border-border",m&&"@container"),children:(0,te.jsxs)("table",{className:Fn("w-full min-w-full border-collapse text-[13px]",b?.table),children:[(0,te.jsx)("thead",{className:b?.head,children:(0,te.jsxs)("tr",{className:"border-b border-border bg-muted text-left",children:[w&&(0,te.jsx)("th",{scope:"col",style:{width:jse},className:"px-1",children:(0,te.jsx)("span",{className:"sr-only",children:a.rowDetailsColumn})}),f.map(T=>(0,te.jsx)("th",{scope:"col",className:Fn(m?"wrap-anywhere":"whitespace-nowrap","px-3 py-2 text-[12px] font-semibold text-foreground",i==="app"?void 0:"font-mono"),children:(0,te.jsx)(_O,{description:T.description,children:SO(T.title,T.name,i)})},T.name))]})}),(0,te.jsx)("tbody",{className:b?.body,children:n.map((T,k)=>{let R=w&&u.has(k);return(0,te.jsx)(Fm,{segment:String(k),children:(0,te.jsxs)("tr",{className:Fn("border-b border-border/60 last:border-b-0",b?.row,w&&b?.rowWithToggle),children:[w&&(0,te.jsx)("td",{className:Fn("px-1 pt-px align-top",b?.toggle),children:(0,te.jsx)("button",{type:"button",onClick:()=>B(k),"aria-expanded":R,"aria-label":a.toggleRowDetails(k+1),className:"mt-0.5 flex size-6 items-center justify-center rounded text-muted-foreground hover:bg-card hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:R?(0,te.jsx)(Fh,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(xw,{"aria-hidden":!0,className:"size-3.5"})})}),R?(0,te.jsx)("td",{colSpan:f.length,className:Fn("bg-card/40 p-0",b?.detail),children:(0,te.jsx)("div",{className:Fn(!m&&"sticky left-0","px-3.5 py-3",b?.detailInner),...A&&!m?{style:{width:w?`calc(${A}px - ${jse})`:A}}:{},children:(0,te.jsx)(jv,{field:t,value:T,hideLabel:!0})})}):f.map(F=>{let N=typeof T=="object"&&T!==null?Ma(T,F.name):void 0,V=SO(F.title,F.name,i);return(0,te.jsxs)("td",{className:Fn("px-3 py-1.5 align-top",b?.cell),children:[b&&(0,te.jsx)("span",{className:Fn("hidden text-[12px] text-muted-foreground wrap-anywhere",i==="app"?void 0:"font-mono",b.label),children:w?V:(0,te.jsx)(_O,{description:F.description,children:V})}),(0,te.jsx)("div",{className:m?F===h?aQe:Fn(rQe,iQe(F,h)&&"line-clamp-3"):Fn("max-w-[44ch]",F===h?"max-w-none min-w-[16ch] wrap-anywhere [&>span]:whitespace-normal":F.kind==="list"&&cI(F)?"min-w-[16ch]":"truncate"),...typeof N=="string"||typeof N=="number"?{title:HMe(F,N,i)}:{},children:(0,te.jsx)(Fm,{segment:F.name,children:(0,te.jsx)($v,{field:F,value:N,compact:!0})})})]},F.name)})]})},k)})})]})})}function sQe({members:e}){return(0,te.jsx)("div",{className:"space-y-3",children:e.map(t=>(0,te.jsxs)("div",{className:"space-y-1",children:[(0,te.jsx)("span",{className:"font-mono text-[12px] font-semibold text-foreground",children:t.name}),(0,te.jsx)(Gle,{value:t.value})]},t.name))})}function Gle({value:e}){if(e==null||e==="")return(0,te.jsx)(ru,{});let t=N0(e);if(t)return(0,te.jsx)(uI,{content:t,downloadPdf:!1});let n=AN(e);if(n)return(0,te.jsx)("span",{className:"text-[13px] text-foreground",children:fN(n)});let r=pw(e);if(r?.url!==void 0)return(0,te.jsx)(Ix,{url:r.url,...r.mimeType!==void 0?{mimeType:r.mimeType}:{},...r.filename!==void 0?{filename:r.filename}:{}});if(LO(e)&&Array.isArray(e.items)){let a=e.items;return a.length===0?(0,te.jsx)(ru,{}):(0,te.jsx)("div",{className:"divide-y divide-border/60 overflow-hidden rounded-lg border border-border",children:a.map((i,o)=>(0,te.jsx)("div",{className:"bg-card/40 px-3 py-1.5",children:(0,te.jsx)(Gle,{value:i})},o))})}if(LO(e)){let a=e.text;if(typeof a=="string")return a===""?(0,te.jsx)(ru,{}):(0,te.jsx)(iI,{text:a})}return typeof e=="string"?(0,te.jsx)(iI,{text:e}):typeof e!="object"?(0,te.jsx)(Nm,{value:e}):(0,te.jsx)(Nle,{value:e,compact:!1})}function LO(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function lQe({field:e,items:t}){return(0,te.jsx)("div",{className:"divide-y divide-border/60 overflow-hidden rounded-lg border border-border",children:t.map((n,r)=>(0,te.jsx)("div",{className:"bg-card/40 px-3 py-1.5",children:(0,te.jsx)($v,{field:e,value:n})},r))})}function uQe({items:e}){return e.some(n=>{let r=hw(n);return r?!!(os(r.publicUrl)??os(r.url)):!1})?(0,te.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2",children:e.map((n,r)=>(0,te.jsx)("div",{className:"overflow-hidden rounded-lg border border-border bg-card/40",children:(0,te.jsx)(Fm,{segment:String(r),children:(0,te.jsx)(GO,{value:n,inGallery:!0})})},r))}):(0,te.jsx)(zle,{items:e,kind:"image"})}function zle({items:e,kind:t}){return(0,te.jsx)("div",{className:"divide-y divide-border overflow-hidden rounded-lg border border-border",children:e.map((n,r)=>(0,te.jsx)("div",{className:"bg-card/40 px-3.5 py-2",children:(0,te.jsx)(Fm,{segment:String(r),children:t==="document"?(0,te.jsx)(Qle,{value:n}):(0,te.jsx)(GO,{value:n,inRow:!0})})},r))})}function cQe(e){if(!(e.kind!=="object"||e.fields.length===0))return e.fields}function qle(e){return e.find(t=>t.kind==="text")}function AQe(e,t){return e===t?1:e.kind!=="list"&&AI(e)?2:e.kind==="text"||e.kind==="list"&&cI(e)?3:4}function fQe(e,t){let n=qle(e);if(e.length<=t)return{shown:e,hidden:0,...n?{name:n}:{}};let r=new Set(e.map((a,i)=>({field:a,index:i,tier:AQe(a,n)})).sort((a,i)=>a.tier-i.tier||a.index-i.index).slice(0,t).map(({field:a})=>a));return{shown:e.filter(a=>r.has(a)),hidden:e.length-r.size,...n?{name:n}:{}}}function jv(e){return sI()?(0,te.jsx)(Kse,{...e}):(0,te.jsx)(yle,{baseName:e.field.name,path:[e.field.name],children:(0,te.jsx)(Kse,{...e})})}function Kse({field:e,value:t,depth:n=0,hideLabel:r=!1}){let a=to(),i=Tle(e,t),o=DO("markup"),s=MO(),l=sI(),u=r?null:(0,te.jsx)(IO,{field:e,describe:!0}),c=(e.kind==="text"||e.kind==="prose")&&typeof i=="string"&&i!==""?i:void 0;if(mw(e))return(0,te.jsxs)("div",{className:"space-y-0.5",children:[u,(0,te.jsx)(HO,{value:i})]});if(Th(e)){let A=N0(i),d=l?.path.join("."),f=d===void 0?void 0:F0("markup",i,d),g=o?f:void 0,h=s&&A&&f&&l?dQe(gw(f,{baseName:l.baseName})?.name):void 0;return(0,te.jsxs)("div",{className:"space-y-2",children:[g||h!==void 0?(0,te.jsxs)("div",{className:"flex items-start gap-2",children:[(0,te.jsx)("div",{className:"min-w-0 flex-1",children:u}),A&&h!==void 0?(0,te.jsx)(lI,{content:A,...d===void 0?{}:{path:d},...h?{fileName:h}:{}}):null,(0,te.jsx)(Ule,{file:g})]}):u,A?(0,te.jsx)(uI,{content:A,downloadPdf:!1}):(0,te.jsx)(ru,{})]})}if(uN(e)){let A=rV(i);return(0,te.jsxs)("div",{className:"space-y-2",children:[u,A&&A.length>0?(0,te.jsx)(sQe,{members:A}):(0,te.jsx)(ru,{})]})}switch(e.kind){case"object":{let A=d=>typeof i=="object"&&i!==null?Ma(i,d.name):void 0;return(0,te.jsxs)("div",{className:"space-y-2",children:[u,(0,te.jsx)("div",{className:Fn("grid grid-cols-[minmax(min-content,40%)_minmax(0,1fr)] items-baseline gap-x-3 gap-y-1.5",!r&&"rounded-lg border border-border bg-card/40 px-3.5 py-3"),children:e.fields.map(d=>cI(d)?(0,te.jsxs)(xt.Fragment,{children:[(0,te.jsx)("div",{className:"min-w-0",children:(0,te.jsx)(IO,{field:d,describe:!0})}),(0,te.jsx)("div",{className:"flex min-w-0 justify-end **:data-chips:justify-end",children:(0,te.jsx)("div",{className:"min-w-0 text-left wrap-break-word",children:(0,te.jsx)($v,{field:d,value:A(d)})})})]},d.name):(0,te.jsx)("div",{className:"col-span-2 min-w-0",children:(0,te.jsx)(Fm,{segment:d.name,children:(0,te.jsx)(jv,{field:d,value:A(d),depth:n+1})})},d.name))})]})}case"list":{let A=Array.isArray(i)?i:[],d=cQe(e.item);return(0,te.jsxs)("div",{className:"space-y-2",children:[(0,te.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[u,(0,te.jsx)("span",{className:"font-mono text-[10.5px] text-muted-foreground",children:a.itemsCount(A.length)})]}),A.length===0?(0,te.jsx)("p",{className:"text-[13px] italic text-muted-foreground",children:a.noItemsYet}):aV(e.item)?(0,te.jsx)("div",{className:"divide-y divide-border/60 overflow-hidden rounded-lg border border-border",children:A.map((f,g)=>(0,te.jsx)("div",{className:"bg-card/40 px-3 py-1.5",children:(0,te.jsx)(Fm,{segment:String(g),children:(0,te.jsx)(jv,{field:e.item,value:f,depth:n+1,hideLabel:!0})})},g))}):d?(0,te.jsx)(oQe,{columns:d,element:e.item,items:A,label:e.title??Lx(e.name)}):oI.has(e.item.kind)?(0,te.jsx)(Hle,{field:e.item,items:A}):e.item.kind==="prose"||e.item.kind==="unknown"?(0,te.jsx)(lQe,{field:e.item,items:A}):e.item.kind==="image"?(0,te.jsx)(uQe,{items:A}):e.item.kind==="document"?(0,te.jsx)(zle,{items:A,kind:"document"}):(0,te.jsx)("div",{className:"space-y-2",children:A.map((f,g)=>(0,te.jsxs)("div",{className:"space-y-2 rounded-lg border border-border bg-card/40 px-3.5 py-3",children:[(0,te.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:g+1}),(0,te.jsx)(Fm,{segment:String(g),children:(0,te.jsx)(jv,{field:e.item,value:f,depth:n+1,hideLabel:!0})})]},g))})]})}case"boolean":case"date":case"document":case"image":case"text":case"prose":case"number":case"enum":case"unknown":return(0,te.jsxs)("div",{className:e.kind==="image"?"space-y-1.5":"space-y-0.5",children:[c===void 0?u:(0,te.jsxs)("div",{className:"flex items-start gap-2",children:[(0,te.jsx)("div",{className:"min-w-0 flex-1",children:u}),(0,te.jsx)(Ple,{value:c,label:a.copyText})]}),(0,te.jsx)($v,{field:e,value:t})]})}return null}function dQe(e){return e===void 0?"":e.replace(/\.[^.]+$/,"")}var pQe=["rendered","json"],hQe=["rendered"],mQe=/("(?:\\.|[^"\\])*"\s*:)|("(?:\\.|[^"\\])*")|(\b(?:true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function gQe(e){let t=[],n=0;for(let r of e.matchAll(mQe)){let[a,i,o,s]=r,l=r.index;l>n&&t.push((0,te.jsx)("span",{className:"text-muted-foreground",children:e.slice(n,l)},`p${n}`)),t.push((0,te.jsx)("span",{className:i?"text-muted-foreground":o?"text-foreground":"font-semibold text-foreground",children:a},l)),n=l+a.length}return n<e.length&&t.push((0,te.jsx)("span",{className:"text-muted-foreground",children:e.slice(n)},"tail")),t}function fI({value:e}){let t=to(),[n,r]=(0,xt.useState)(!1);(0,xt.useEffect)(()=>{if(!n)return;let i=window.setTimeout(()=>r(!1),1500);return()=>window.clearTimeout(i)},[n]);let a=e==null?void 0:typeof e=="object"?Rle(e):JSON.stringify(e);return a===void 0?(0,te.jsx)(ru,{}):(0,te.jsxs)("div",{className:"relative",children:[typeof navigator<"u"&&navigator.clipboard&&(0,te.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(a).then(()=>r(!0))},"aria-label":t.copyJson,className:"absolute right-2 top-2 rounded border border-border bg-card p-1 text-muted-foreground hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",children:n?(0,te.jsx)(Yd,{"aria-hidden":!0,className:"size-3.5"}):(0,te.jsx)(P0,{"aria-hidden":!0,className:"size-3.5"})}),(0,te.jsx)("pre",{className:"overflow-x-auto rounded-lg border border-border bg-card/40 px-3.5 py-3 pr-12 font-mono text-[12px] leading-relaxed",children:gQe(a)})]})}function $se(e,t,n,r){return e.field===t&&e.baseName===n&&e.value===r?!0:e.key!==void 0&&e.key===Vle(t,n,r)}function Vle(e,t,n){try{return JSON.stringify([t,e,n],(r,a)=>typeof a=="bigint"?`${a}n`:a)}catch{return}}function zO({downloads:e,tableLayout:t,...n}){return(0,te.jsx)($De,{downloads:e,tableLayout:t,children:(0,te.jsx)(vQe,{...n})})}function vQe({field:e,value:t,name:n,views:r,defaultView:a="rendered",downloadBaseName:i,className:o}){let s=to(),l=Tx(),u=r&&r.length>0?r:r||l==="app"?hQe:pQe,c=n?{...e,name:n}:e,A=i??c.name??"result",[d,f]=(0,xt.useState)(a),g=u.includes(d)?d:u[0]??"rendered",[h,w]=(0,xt.useState)(null),[m,S]=(0,xt.useState)(null),b=(0,xt.useRef)(null),B=h!==null&&$se(h,e,A,t),T=m&&$se(m.attempt,e,A,t)?m.names:[],k=Rx(),R=OO(),F=XDe(),N=DO("markup"),V=MO(),{ask:P,dialog:D}=QO(),z=Th(e)?N0(t):void 0,O=F||z!==void 0&&N,H=(0,xt.useCallback)(async()=>{let Z=k?{resolveUrl:k}:{},oe=mN(e,t,{baseName:A,...Z}),ve=oe.files.length===1?oe.files[0]:void 0,M=oe.files.length>1?oe.files[oe.files.length-1]:void 0;if(ve){let{stem:J,extension:ie}=SB(ve.name),pe=await P(J,ie);if(pe===null)return;pe!==ve.name&&(oe={...oe,files:[{...ve,name:pe}]})}else if(M){let{stem:J}=SB(M.name),ie=await P(J,"");if(ie===null)return;ie!==J&&(oe=mN(e,t,{baseName:ie,...Z}))}let W={field:e,baseName:A,value:t,key:Vle(e,A,t)};b.current=W,w(W),S(null);try{let{failed:J}=await R(oe.files);if(b.current!==W)return;S({attempt:W,names:[...oe.unavailable.map(ie=>ie.name),...J.map(ie=>ie.file.name)]})}finally{w(J=>J===W?null:J)}},[e,t,A,k,R,P]),K={rendered:s.viewRendered,json:s.viewJson},X=z&&V?yQe(e,t,A):void 0;return(0,te.jsxs)("div",{className:Fn(z!==void 0&&g!=="json"?"flex min-h-0 flex-col gap-2":"space-y-2",o),children:[(0,te.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-x-4 gap-y-1",children:[z&&l==="app"?(0,te.jsx)("div",{}):(0,te.jsx)("div",{className:"min-w-0 space-y-1",children:(0,te.jsx)(DMe,{field:c})}),(0,te.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[z&&X!==void 0&&(0,te.jsx)(lI,{content:z,path:e.name,primary:!0,...X?{fileName:X}:{}}),O&&(0,te.jsxs)("button",{type:"button",onClick:()=>{H()},disabled:B,"aria-label":z?s.downloadHtml:s.download,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 disabled:opacity-60",children:[B?(0,te.jsx)(Ru,{className:"h-3.5 w-3.5 animate-spin"}):(0,te.jsx)(U0,{className:"h-3.5 w-3.5"}),B?s.downloading:z?s.downloadHtml:s.download]}),D,u.length>1&&(0,te.jsx)("div",{role:"group","aria-label":s.resultViewGroup,className:"flex rounded-md border border-border p-0.5",children:u.map(Z=>(0,te.jsx)("button",{type:"button",onClick:()=>f(Z),"aria-pressed":g===Z,className:Fn("rounded px-2 py-0.5 text-[12px] focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1",g===Z?"bg-card font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:K[Z]},Z))})]})]}),O&&(0,te.jsx)("p",{role:"status",className:Fn("shrink-0 text-[12px] text-destructive",T.length===0&&"sr-only"),children:T.length>0?s.downloadIncomplete(T):""}),g==="json"?(0,te.jsx)(fI,{value:t}):z?(0,te.jsx)(uI,{content:z,downloadPdf:!1,bare:!0,fill:!0}):(0,te.jsx)(yle,{baseName:A,path:[e.name],children:(0,te.jsx)(jv,{field:e,value:t,hideLabel:!0})})]})}function yQe(e,t,n){let r=F0("markup",t,e.name),a=r?gw(r,{baseName:n})?.name:void 0;return a===void 0?"":a.replace(/\.[^.]+$/,"")}var Bp=Ue(St(),1);function Kle({pipeIoContracts:e,outputForm:t,inputForm:n,stuff:r,producerPipeRef:a,consumer:i,resolveUrl:o,resolveShareUrl:s,saveFiles:l,downloads:u}){let c=jle.useMemo(()=>bQe(e,t,a)??xQe(e,n,i),[e,t,n,a,i]);if(c){let A=(0,Bp.jsx)(zO,{field:c,value:r.data,name:r.name});return o||s||l||u?(0,Bp.jsx)(PO,{resolveUrl:o,resolveShareUrl:s,saveFiles:l,downloads:u,children:A}):A}return r.data===void 0||r.data===null?null:(0,Bp.jsx)(wQe,{value:r.data})}function wQe({value:e}){let t=to();return(0,Bp.jsxs)("div",{className:"space-y-2",children:[(0,Bp.jsx)("p",{className:"text-[12px] text-muted-foreground",children:t.resultUndescribed}),(0,Bp.jsx)(fI,{value:e})]})}function bQe(e,t,n){if(!n)return null;let r=cw(n);if(!r?.domainPath)return null;let a=bN(t,r.domainPath,r.pipeCode),i=BB(e,r.domainPath,r.pipeCode);return!a||!i?null:_B(a,i.output.json_schema)}function xQe(e,t,n){if(!t||!n)return null;let r=cw(n.pipeRef);if(!r?.domainPath)return null;let a=wN(t,r.domainPath,r.pipeCode),i=BB(e,r.domainPath,r.pipeCode);if(!a||!i)return null;let o=i.inputs[n.slotName];if(!o||o.multiplicity!=="single")return null;let s=a.fields.find(l=>l.name===n.slotName);return s?_B({field:s},o.json_schema):null}function $le(e){let t=e?.pipeIoContracts,n=e?.outputForm;if(!t||!n)return null;let r=e?.inputForm;return r?{pipeIoContracts:t,outputForm:n,inputForm:r}:{pipeIoContracts:t,outputForm:n}}var Wle=Ue(Ht(),1),km=Ue(St(),1);function Xle({isOpen:e,onClose:t,children:n,width:r,isDragging:a,onResizeHandleMouseDown:i,closeOnEscape:o=!0}){Wle.default.useEffect(()=>{if(!e||!o)return;let l=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,o,t]);let s=["detail-panel",!e&&"detail-panel--closed",a&&"detail-panel--dragging"].filter(Boolean).join(" ");return(0,km.jsxs)("div",{className:s,style:r?{width:`${r}px`}:void 0,children:[i&&(0,km.jsx)("div",{className:"detail-panel-resize-handle",onMouseDown:i,role:"separator","aria-orientation":"vertical","aria-label":"Resize panel"}),(0,km.jsxs)("div",{className:"detail-panel-content",children:[(0,km.jsx)("div",{className:"detail-panel-close-row",children:(0,km.jsx)("button",{className:"detail-panel-close",onClick:t,"aria-label":"Close panel",children:"x"})}),n]})]})}var Pm=Ue(Ht(),1),CQe=.6;function Yle({defaultWidth:e,minWidth:t,maxWidth:n,containerRef:r}){let[a,i]=Pm.default.useState(e),[o,s]=Pm.default.useState(!1),l=Pm.default.useRef({startX:0,startWidth:0,maxAllowed:n}),u=Pm.default.useRef(null),c=Pm.default.useCallback(A=>{A.preventDefault(),A.stopPropagation();let d=r?.current?.getBoundingClientRect().width,f=d?Math.min(n,d*CQe):n;l.current={startX:A.clientX,startWidth:a,maxAllowed:f},s(!0),document.body.style.userSelect="none",document.body.style.cursor="col-resize"},[a,n,r]);return Pm.default.useEffect(()=>{if(!o)return;let A=f=>{u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{let{startX:g,startWidth:h,maxAllowed:w}=l.current,m=g-f.clientX,S=Math.max(t,Math.min(w,h+m));i(S),u.current=null})},d=()=>{s(!1),document.body.style.userSelect="",document.body.style.cursor="",u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",d),document.body.style.userSelect="",document.body.style.cursor="",u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[o,t]),{width:a,isDragging:o,handleMouseDown:c}}var uD=Ue(Ht(),1);var dI=Ue(Ht(),1),Rr=Ue(St(),1);function qO(e){return e<1?`${(e*1e3).toFixed(0)}ms`:`${e.toFixed(2)}s`}function Bt({label:e,value:t}){return t==null?null:(0,Rr.jsxs)("div",{className:"detail-kv-row",children:[(0,Rr.jsx)("span",{className:"detail-kv-key",children:e}),(0,Rr.jsx)("span",{className:"detail-kv-value",children:String(t)})]})}function VO({label:e,text:t}){return t?(0,Rr.jsxs)("div",{children:[(0,Rr.jsx)("div",{className:"detail-section-label",children:e}),(0,Rr.jsx)("div",{className:"detail-prompt-block",children:t})]}):null}var SQe=(0,Rr.jsx)("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"currentColor",children:(0,Rr.jsx)("path",{d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})}),BQe=(0,Rr.jsx)("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"currentColor",children:(0,Rr.jsx)("path",{d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),EQe=(0,Rr.jsx)("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"currentColor",children:(0,Rr.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"})}),_Qe=(0,Rr.jsx)("svg",{viewBox:"0 0 24 24",width:"10",height:"10",fill:"currentColor",children:(0,Rr.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}),Zle={all:"unset",cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:9,color:"#64748b",padding:"2px 6px",borderRadius:3,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.06)",transition:"color 0.15s"};function js({label:e,templateText:t,renderedText:n}){let[r,a]=(0,dI.useState)(!1),[i,o]=(0,dI.useState)(!1),[s,l]=(0,dI.useState)(!1),u=!!t,c=!!n;if(!u&&!c)return null;let A=u&&c,d=A?r?t:n:t||n;function f(){!d||!navigator.clipboard||navigator.clipboard.writeText(d).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})}return(0,Rr.jsxs)("div",{children:[(0,Rr.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[(0,Rr.jsx)("div",{className:"detail-section-label",style:{marginBottom:0},children:e}),(0,Rr.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Rr.jsx)("button",{onClick:()=>l(g=>!g),title:s?"Collapse prompt":"Expand prompt","aria-label":s?"Collapse prompt":"Expand prompt",className:"detail-prompt-expand-btn",children:s?BQe:SQe}),(0,Rr.jsx)("button",{onClick:f,title:"Copy prompt","aria-label":"Copy prompt",style:{...Zle,color:i?"#10b981":"#64748b"},children:i?_Qe:EQe}),A&&(0,Rr.jsxs)("button",{onClick:()=>a(g=>!g),style:Zle,children:[(0,Rr.jsx)("span",{style:{width:22,height:12,borderRadius:6,background:r?"rgba(255,255,255,0.12)":"#50FA7B33",position:"relative",display:"inline-block",transition:"background 0.15s"},children:(0,Rr.jsx)("span",{style:{position:"absolute",top:2,left:r?2:12,width:8,height:8,borderRadius:"50%",background:r?"#94a3b8":"#50FA7B",transition:"left 0.15s, background 0.15s"}})}),r?"template":"rendered"]})]})]}),(0,Rr.jsx)("div",{className:`detail-prompt-block ${s?"detail-prompt-block--expanded":"detail-prompt-block--collapsed"}`,style:{marginTop:6},children:d})]})}function au({modelsRan:e,authored:t,handle:n,label:r="Model"}){let a=e??[],i=new Map;for(let c of a)i.set(c.inference_model_name,(i.get(c.inference_model_name)??0)+1);let o=a.map((c,A)=>{let d=(i.get(c.inference_model_name)??0)>1?`${c.inference_model_name} \xB7 ${LQe(c.model_type)}`:c.inference_model_name;return{key:`ran-${A}`,text:a.length>1?`${d} (${c.inference_calls})`:d}}),s=[],l=[{key:"authored",text:t??""},{key:"handle",text:n??""}];for(let c of l)c.text&&c.text!==s[s.length-1]?.text&&s.push(c);o.length>0&&s[s.length-1]?.text===o[0].text&&s.pop();let u=[...s,...o];return u.length===0?null:(0,Rr.jsxs)("div",{className:"detail-kv-row",children:[(0,Rr.jsx)("span",{className:"detail-kv-key",children:r}),(0,Rr.jsx)("span",{className:"detail-kv-value detail-model-value",children:u.map((c,A)=>(0,Rr.jsx)("span",{className:A===0?void 0:"detail-model-resolved",children:c.text},c.key))})]})}var IQe={llm:"LLM",extract:"extraction",img_gen:"image generation",search:"search",judgment:"judgment"};function LQe(e){return IQe[e]??e.replaceAll("_"," ")}function pI(e,t){return t==="subtree"?{scope:t,inferenceCalls:e.subtree_inference_calls,ratedInferenceCalls:e.subtree_rated_inference_calls,nbTokensByCategory:e.subtree_nb_tokens_by_category,totalTokens:e.subtree_total_tokens,cost:e.subtree_cost,costInput:e.subtree_cost_input,costOutput:e.subtree_cost_output,models:e.subtree_by_model}:{scope:t,inferenceCalls:e.inference_calls,ratedInferenceCalls:e.rated_inference_calls,nbTokensByCategory:e.nb_tokens_by_category,totalTokens:e.total_tokens,cost:e.cost,costInput:e.cost_input,costOutput:e.cost_output,models:e.by_model}}function jO(e){return e.inferenceCalls===0?"ran-nothing":e.cost===null?"unrated":e.ratedInferenceCalls<e.inferenceCalls?"partial":"rated"}function Nx(e){return e>0&&e<1e-4?"<$0.0001":`$${e.toFixed(4)}`}var TQe=new Set(["llm","judgment"]);function Jle(e){return e.models.length>0&&e.models.every(t=>TQe.has(t.model_type))}var vi=Ue(St(),1);function RQe(e,t){return pI(e,t?"subtree":"own")}function NQe(e){let t=jO(e);if(t==="ran-nothing"||t==="unrated")return null;let n=Nx(e.cost??0);return t==="partial"?`\u2265 ${n}`:n}function FQe(e,t){let n=t?"This pipe and everything below it":"This pipe";return jO(e)==="partial"?`${n}: only ${e.ratedInferenceCalls} of ${e.inferenceCalls} calls were priced, so this is a lower bound. Click for details.`:`${n}: ${e.inferenceCalls} inference call(s). Click for the breakdown.`}function kQe({open:e}){return(0,vi.jsx)("svg",{className:`detail-usage-chevron ${e?"detail-usage-chevron--open":""}`,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,vi.jsx)("polyline",{points:"6 9 12 15 18 9"})})}function KO({usage:e,isController:t,expanded:n,onToggle:r}){let a=RQe(e,t),i=NQe(a);return i===null?null:(0,vi.jsxs)("button",{type:"button",className:"detail-usage-inline","aria-expanded":n,onClick:r,title:FQe(a,t),children:[(0,vi.jsx)("span",{className:"detail-usage-value",children:i}),(0,vi.jsx)(kQe,{open:n})]})}var PQe=new Set(["input","output"]);function UQe(e){return Object.entries(e).filter(([t,n])=>!PQe.has(t)&&n>0).sort(([t],[n])=>t.localeCompare(n))}function eue({scoped:e,label:t}){let n=Jle(e),r=e.cost!==null,a=e.nbTokensByCategory.input??0,i=e.nbTokensByCategory.output??0;return(0,vi.jsxs)("div",{children:[(0,vi.jsx)("div",{className:"detail-section-label",children:t}),(0,vi.jsx)(Bt,{label:"inference calls",value:e.inferenceCalls}),(0,vi.jsx)(Bt,{label:"priced calls",value:e.ratedInferenceCalls}),n&&(0,vi.jsx)(Bt,{label:"input tokens",value:a.toLocaleString()}),r&&e.costInput!==null&&(0,vi.jsx)(Bt,{label:"input cost",value:Nx(e.costInput)}),n&&(0,vi.jsx)(Bt,{label:"output tokens",value:i.toLocaleString()}),r&&e.costOutput!==null&&(0,vi.jsx)(Bt,{label:"output cost",value:Nx(e.costOutput)}),n&&(0,vi.jsx)(Bt,{label:"total tokens",value:e.totalTokens.toLocaleString()}),(0,vi.jsx)(Bt,{label:"total cost",value:r?Nx(e.cost??0):"not priced"}),n&&UQe(e.nbTokensByCategory).map(([o,s])=>(0,vi.jsx)(Bt,{label:`tokens \xB7 ${o}`,value:s.toLocaleString()},o))]})}function $O({usage:e,isController:t}){let n=pI(e,"own"),r=pI(e,"subtree"),a=t||r.inferenceCalls!==n.inferenceCalls;return(0,vi.jsxs)("div",{className:"detail-usage-details",children:[(0,vi.jsx)(eue,{scoped:n,label:t?"This pipe itself":"Usage"}),a&&(0,vi.jsx)(eue,{scoped:r,label:"This pipe and everything below it"})]})}var zo=Ue(St(),1);function WO({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=e.llm_prompt_spec,i=a.user_image_references&&a.user_image_references.length>0,o=a.user_document_references&&a.user_document_references.length>0,s=a.system_image_references&&a.system_image_references.length>0,l=a.system_document_references&&a.system_document_references.length>0,u=r?.resolved_model,c=r?.resolved_model_for_object,A=t?.rendered_system_prompt,d=t?.rendered_user_prompt,f=t?.structuring_path,g=t?.is_multiple_output,h=e.llm_choices?.for_text,w=e.llm_choices?.for_object;return(0,zo.jsxs)(zo.Fragment,{children:[(0,zo.jsx)(au,{modelsRan:n,authored:h,handle:u}),!!(w&&w!==h)&&(0,zo.jsx)(au,{authored:w,handle:c,label:"Model (object)"}),(0,zo.jsx)(Bt,{label:"Structuring",value:f||e.structuring_method}),(0,zo.jsx)(Bt,{label:"Multiple Output",value:g}),(0,zo.jsx)(Bt,{label:"Output Multiplicity",value:e.output_multiplicity}),(0,zo.jsx)(Bt,{label:"Prompt Category",value:a.prompt_blueprint?.category}),i&&(0,zo.jsx)(Bt,{label:"User Image Refs",value:`${a.user_image_references.length} references`}),o&&(0,zo.jsx)(Bt,{label:"User Document Refs",value:`${a.user_document_references.length} references`}),s&&(0,zo.jsx)(Bt,{label:"System Image Refs",value:`${a.system_image_references.length} references`}),l&&(0,zo.jsx)(Bt,{label:"System Document Refs",value:`${a.system_document_references.length} references`}),(0,zo.jsx)(js,{label:"System Prompt",templateText:a.system_prompt_blueprint?.template,renderedText:A}),(0,zo.jsx)(js,{label:"Prompt",templateText:a.prompt_blueprint?.template,renderedText:d})]})}var wl=Ue(St(),1);function XO({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=e.img_gen_prompt_blueprint,i=r?.resolved_model,o=t?.rendered_prompt,s=t?.rendered_negative_prompt;return(0,wl.jsxs)(wl.Fragment,{children:[(0,wl.jsx)(au,{modelsRan:n,authored:e.img_gen_choice,handle:i}),(0,wl.jsx)(js,{label:"Prompt",templateText:a.prompt_blueprint?.template,renderedText:o}),(0,wl.jsx)(js,{label:"Negative Prompt",templateText:a.negative_prompt_blueprint?.template,renderedText:s}),(0,wl.jsx)(Bt,{label:"Aspect Ratio",value:e.aspect_ratio}),(0,wl.jsx)(Bt,{label:"Output Format",value:e.output_format}),(0,wl.jsx)(Bt,{label:"Background",value:e.background}),(0,wl.jsx)(Bt,{label:"Is Raw",value:e.is_raw}),(0,wl.jsx)(Bt,{label:"Seed",value:e.seed}),(0,wl.jsx)(Bt,{label:"Images",value:t?.nb_images??e.output_multiplicity})]})}var bl=Ue(St(),1);function YO({blueprint:e,modelsRan:t,modelHandles:n}){let r=n?.resolved_model;return(0,bl.jsxs)(bl.Fragment,{children:[(0,bl.jsx)(au,{modelsRan:t,authored:e.extract_choice,handle:r}),(0,bl.jsx)(Bt,{label:"Document Variable",value:e.document_stuff_name}),(0,bl.jsx)(Bt,{label:"Caption Images",value:e.should_caption_images}),(0,bl.jsx)(Bt,{label:"Max Page Images",value:e.max_page_images}),(0,bl.jsx)(Bt,{label:"Include Page Views",value:e.should_include_page_views}),(0,bl.jsx)(Bt,{label:"Page Views DPI",value:e.page_views_dpi}),(0,bl.jsx)(Bt,{label:"Render JS",value:e.render_js}),(0,bl.jsx)(Bt,{label:"Include Raw HTML",value:e.include_raw_html}),(0,bl.jsx)(Bt,{label:"Image Variable",value:e.image_stuff_name})]})}var xl=Ue(St(),1);function ZO({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=r?.resolved_model,i=t?.rendered_query;return(0,xl.jsxs)(xl.Fragment,{children:[(0,xl.jsx)(au,{modelsRan:n,authored:e.search_choice,handle:a}),(0,xl.jsx)(js,{label:"Search Query",templateText:e.prompt_blueprint.template,renderedText:i}),(0,xl.jsx)(Bt,{label:"Max Results",value:e.max_results_override}),(0,xl.jsx)(Bt,{label:"Include Images",value:e.include_images_override}),(0,xl.jsx)(Bt,{label:"Structured Output",value:e.is_structured_output}),(0,xl.jsx)(Bt,{label:"From Date",value:e.from_date}),(0,xl.jsx)(Bt,{label:"To Date",value:e.to_date}),e.include_domains&&e.include_domains.length>0&&(0,xl.jsx)(Bt,{label:"Include Domains",value:e.include_domains.join(", ")}),e.exclude_domains&&e.exclude_domains.length>0&&(0,xl.jsx)(Bt,{label:"Exclude Domains",value:e.exclude_domains.join(", ")})]})}var OQe=["model","llm_handle","handle","llm_name","name"];function tue(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function hI(e){if(typeof e=="string")return tue(e);if(e&&typeof e=="object")for(let t of OQe){let n=tue(e[t]);if(n)return n}}var xA=Ue(St(),1);function JO({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=r?.resolved_model,i=t?.is_multiple_output,o=t?.rendered_user_prompt,s=hI(e.llm_choice);return(0,xA.jsxs)(xA.Fragment,{children:[(0,xA.jsx)(au,{modelsRan:n,authored:s,handle:a}),(0,xA.jsx)(Bt,{label:"Text Variable",value:e.text_input_name}),(0,xA.jsx)(Bt,{label:"Multiple Output",value:i}),(0,xA.jsx)(Bt,{label:"Output Multiplicity",value:e.output_multiplicity}),(0,xA.jsx)(js,{label:"Prompt",templateText:void 0,renderedText:o})]})}var Gr=Ue(St(),1);function DQe(e){switch(e.method){case"from_var":{let t=`\u2190 ${e.from_path??"?"}`;return e.list_to_dict_keyed_by?`${t} (keyed by ${e.list_to_dict_keyed_by})`:t}case"fixed":return`= ${JSON.stringify(e.fixed_value)}`;case"nested":return"(nested construct)";case"template":return e.template??"(empty template)"}}var MQe=60;function QQe(e){return e.length>MQe||e.includes(`
|
|
258
|
-
`)}function HQe({label:e,value:t}){return(0,Gr.jsxs)("div",{className:"detail-field-block",children:[(0,Gr.jsx)("div",{className:"detail-field-block-label",children:e}),(0,Gr.jsx)("div",{className:"detail-field-block-value",children:t})]})}function nue({blueprint:e,depth:t,fieldResolutions:n}){let r=[],a=[],i=[];for(let[s,l]of Object.entries(e.fields))l.method==="template"?i.push([s,l]):l.method==="nested"?a.push([s,l]):r.push([s,l]);let o=t>0?{paddingLeft:t*12}:void 0;return(0,Gr.jsxs)(Gr.Fragment,{children:[r.map(([s,l])=>{let u=DQe(l);return QQe(u)?(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(HQe,{label:s,value:u})},s):(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(Bt,{label:s,value:u})},s)}),i.map(([s,l])=>{let u=n?.[s]?.rendered;return(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(js,{label:`Template \u2014 ${s}`,templateText:l.template??null,renderedText:u})},s)}),a.map(([s,l])=>l.nested?(0,Gr.jsxs)("div",{children:[(0,Gr.jsxs)("div",{className:"detail-nested-header",style:t>0?{paddingLeft:t*12}:void 0,children:[(0,Gr.jsx)("span",{className:"detail-nested-header-name",children:s}),(0,Gr.jsxs)("span",{className:"detail-nested-header-meta",children:["nested \xB7 ",Object.keys(l.nested.fields).length," field",Object.keys(l.nested.fields).length===1?"":"s"]})]}),(0,Gr.jsx)(nue,{blueprint:l.nested,depth:t+1,fieldResolutions:null})]},s):null)]})}function eD({blueprint:e,executionData:t}){let n=t?.rendered_text,r=t?.compose_mode,a=t?.fields??null,i=e.construct_blueprint,o=i!=null&&Object.keys(i.fields).length>0;return(0,Gr.jsxs)(Gr.Fragment,{children:[(0,Gr.jsx)(Bt,{label:"Mode",value:r||(o?"construct":"template")}),(0,Gr.jsx)(Bt,{label:"Category",value:e.category}),(0,Gr.jsx)(Bt,{label:"Templating Style",value:e.templating_style}),e.template&&(0,Gr.jsx)(js,{label:"Template",templateText:e.template,renderedText:n}),o&&(0,Gr.jsxs)(Gr.Fragment,{children:[(0,Gr.jsx)("div",{className:"detail-section-label",children:"FIELDS"}),(0,Gr.jsx)(nue,{blueprint:i,depth:0,fieldResolutions:a})]})]})}var iu=Ue(St(),1),GQe={layout:"auto-layout",html:"HTML template",template_file:"template file"};function zQe(e){return e.template==null&&e.template_file==null?"layout":e.template!=null||e.doc_gen_format==="pdf"?"html":"template_file"}function mI(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function tD({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=mI(e.doc_gen_format),i=hI(e.doc_gen_choice),o=mI(r?.resolved_model),s=!!i||!!o||(n?.length??0)>0,l=mI(r?.source)??zQe(e),u=mI(t?.filename);return(0,iu.jsxs)(iu.Fragment,{children:[(0,iu.jsx)(Bt,{label:"Format",value:a?.toUpperCase()}),s?(0,iu.jsx)(au,{label:"Engine",modelsRan:n,authored:i,handle:o}):(0,iu.jsx)(Bt,{label:"Engine",value:"deck default"}),(0,iu.jsx)(Bt,{label:"Source",value:GQe[l]??l}),(0,iu.jsx)(Bt,{label:"Template File",value:e.template_file}),(0,iu.jsx)(Bt,{label:"File Name",value:e.filename}),u&&u!==e.filename&&(0,iu.jsx)(Bt,{label:"Stored As",value:u}),e.template&&(0,iu.jsx)(js,{label:"Template",templateText:e.template,renderedText:null})]})}var vs=Ue(St(),1);function nD({blueprint:e,executionData:t}){let n=t?.evaluated_expression,r=t?.selected_outcome;return(0,vs.jsxs)(vs.Fragment,{children:[(0,vs.jsx)(VO,{label:"Expression",text:e.expression}),n&&(0,vs.jsx)(Bt,{label:"Expression Result",value:n}),(0,vs.jsxs)("div",{children:[(0,vs.jsx)("div",{className:"detail-section-label",children:"Outcomes"}),Object.entries(e.outcome_map).map(([a,i])=>(0,vs.jsxs)("div",{className:"detail-kv-row",style:r===i?{background:"rgba(80,250,123,0.08)"}:void 0,children:[(0,vs.jsx)("span",{className:"detail-kv-key",children:a}),(0,vs.jsx)("span",{className:"detail-kv-value",style:r===i?{color:"#50FA7B"}:void 0,children:i})]},a)),(0,vs.jsxs)("div",{className:"detail-kv-row",children:[(0,vs.jsx)("span",{className:"detail-kv-key",children:"default"}),(0,vs.jsx)("span",{className:"detail-kv-value",children:e.default_outcome})]})]}),(0,vs.jsx)(Bt,{label:"Alias Expression To",value:e.add_alias_from_expression_to})]})}var CA=Ue(St(),1);function rD({blueprint:e}){return(0,CA.jsxs)("div",{children:[(0,CA.jsx)("div",{className:"detail-section-label",children:"Steps"}),(0,CA.jsx)("div",{className:"detail-steps-list",children:e.sequential_sub_pipes.map((t,n)=>(0,CA.jsxs)("div",{className:"detail-step-item",children:[(0,CA.jsx)("span",{className:"detail-step-index",children:n+1}),uw(t)?(0,CA.jsxs)("span",{className:"detail-step-code",title:"Binding step",children:["from ",t.from_path]}):(0,CA.jsx)("span",{className:"detail-step-code",children:t.pipe_code}),t.output_name&&(0,CA.jsxs)("span",{className:"detail-io-concept",children:["-> ",t.output_name]})]},n))})]})}var ou=Ue(St(),1);function aD({blueprint:e}){return(0,ou.jsxs)(ou.Fragment,{children:[(0,ou.jsxs)("div",{children:[(0,ou.jsx)("div",{className:"detail-section-label",children:"Branches"}),(0,ou.jsx)("div",{className:"detail-steps-list",children:e.parallel_sub_pipes.map((t,n)=>(0,ou.jsxs)("div",{className:"detail-step-item",children:[(0,ou.jsx)("span",{className:"detail-step-code",children:t.pipe_code}),t.output_name&&(0,ou.jsxs)("span",{className:"detail-io-concept",children:["-> ",t.output_name]})]},n))})]}),(0,ou.jsx)(Bt,{label:"Add Each Output",value:e.add_each_output}),(0,ou.jsx)(Bt,{label:"Combined Output",value:e.combined_output})]})}var Df=Ue(St(),1);function iD({blueprint:e,executionData:t}){let n=t?.item_count;return(0,Df.jsxs)(Df.Fragment,{children:[(0,Df.jsx)(Bt,{label:"Branch Pipe",value:e.branch_pipe_code}),(0,Df.jsx)(Bt,{label:"Input List Variable",value:e.batch_params.input_list_stuff_name}),(0,Df.jsx)(Bt,{label:"Input Item Variable",value:e.batch_params.input_item_stuff_name}),n!=null&&(0,Df.jsx)(Bt,{label:"Items Processed",value:n})]})}var Wv=Ue(St(),1);function oD({node:e}){let t=e.execution_data??{},n=typeof t.from=="string"?t.from:e.pipe_code,r=typeof t.result=="string"?t.result:e.io.outputs[0]?.name;return(0,Wv.jsxs)("div",{children:[(0,Wv.jsx)("div",{className:"detail-section-label",children:"Binding"}),(0,Wv.jsx)(Bt,{label:"From",value:n}),(0,Wv.jsx)(Bt,{label:"Result",value:r})]})}var rue=new Set(["PipeLLM","PipeImgGen","PipeExtract","PipeSearch","PipeStructure","PipeCompose","PipeDocGen","PipeSequence","PipeParallel","PipeCondition","PipeBatch"]),qQe={PipeDocGen:new Set(["url"])};function sD(e,t){return rue.has(e)?!t:!0}function lD(e,t){let n=qQe[e],r=Object.entries(t);return n?r.filter(([a])=>!n.has(a)):r}var tn=Ue(St(),1),VQe={PipeLLM:"LLM",PipeExtract:"Extract",PipeCompose:"Compose",PipeImgGen:"ImgGen",PipeSearch:"Search",PipeFunc:"Func",PipeStructure:"Structure",PipeJudge:"Judge",PipeDocGen:"DocGen",PipeSignature:"Signature",PipeSequence:"Seq",PipeParallel:"Par",PipeCondition:"Cond",PipeBatch:"Batch",BindingStep:"Binding"},jQe=new Set(["PipeSequence","PipeParallel","PipeCondition","PipeBatch"]),KQe={succeeded:"#50FA7B",failed:"#FF5555",running:"#8BE9FD",scheduled:"#6272a4",skipped:"#6272a4",canceled:"#6272a4"};function aue({node:e,spec:t,onConceptClick:n}){let r=e.pipe_type,a=jQe.has(r),i=sc(e),o=L9(t),s=!o&&!T9(t),l=VQe[r],u=e.status,c=KQe[u]??"#6272a4",A=uD.default.useMemo(()=>L0(t,e),[t,e]),[d,f]=uD.default.useState(!1),g=e.io?.inputs??[],h=e.io?.outputs??[],w=A?.description??e.description;return(0,tn.jsxs)(tn.Fragment,{children:[(0,tn.jsxs)("div",{className:"detail-sticky-header",children:[(0,tn.jsxs)("div",{className:"detail-header",children:[(0,tn.jsx)("span",{className:`detail-badge ${a?"detail-badge--controller":"detail-badge--operator"}`,children:l}),(0,tn.jsx)("span",{className:`detail-pipe-code ${a?"detail-pipe-code--controller":""}`,children:e.pipe_code})]}),!o&&(0,tn.jsxs)("div",{className:"detail-status",children:[(0,tn.jsx)("span",{className:"detail-status-dot",style:{background:c}}),(0,tn.jsx)("span",{className:"detail-status-label",style:{color:c},children:u}),e.timing?.duration!=null&&(0,tn.jsx)("span",{className:"detail-duration",children:qO(e.timing.duration)}),s&&e.usage&&(0,tn.jsx)(KO,{usage:e.usage,isController:a,expanded:d,onToggle:()=>f(m=>!m)})]}),s&&e.usage&&d&&(0,tn.jsx)($O,{usage:e.usage,isController:a}),w&&(0,tn.jsx)("div",{className:"detail-description",children:w}),g.length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Inputs"}),(0,tn.jsx)("div",{className:"detail-io-list",children:g.map((m,S)=>(0,tn.jsxs)("div",{className:"detail-io-pill",style:{cursor:m.concept&&n?"pointer":void 0},onClick:()=>m.concept&&n?.(m.concept),children:[(0,tn.jsx)("span",{className:"detail-io-name",children:m.name}),m.concept&&(0,tn.jsx)("span",{className:"detail-io-concept",children:m.concept+vf(m.multiplicity)})]},S))})]}),h.length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Output"}),(0,tn.jsx)("div",{className:"detail-io-list",children:h.map((m,S)=>(0,tn.jsxs)("div",{className:"detail-io-pill",style:{cursor:m.concept&&n?"pointer":void 0},onClick:()=>m.concept&&n?.(m.concept),children:[(0,tn.jsx)("span",{className:"detail-io-name",children:m.name}),m.concept&&(0,tn.jsx)("span",{className:"detail-io-concept",children:m.concept+vf(m.multiplicity)})]},S))})]}),(g.length>0||h.length>0)&&(0,tn.jsx)("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)",margin:"4px 0"}})]}),i&&(0,tn.jsx)(oD,{node:e}),A&&(0,tn.jsx)($Qe,{blueprint:A,executionData:s?e.execution_data:void 0,modelsRan:s?e.usage?.by_model:void 0,modelHandles:e.execution_data}),s&&!i&&e.execution_data&&Object.keys(e.execution_data).length>0&&(0,tn.jsx)(WQe,{executionData:e.execution_data,pipeType:r,hasBlueprint:!!A}),e.error&&(0,tn.jsxs)("div",{className:"detail-error",children:[(0,tn.jsx)("div",{className:"detail-error-type",children:e.error.error_type}),(0,tn.jsx)("div",{className:"detail-error-message",children:e.error.message}),e.error.stack&&(0,tn.jsx)("div",{className:"detail-error-stack",children:e.error.stack})]}),s&&e.metrics&&Object.keys(e.metrics).length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Metrics"}),Object.entries(e.metrics).map(([m,S])=>(0,tn.jsx)(Bt,{label:m,value:typeof S=="number"?S.toLocaleString():String(S)},m))]}),e.tags&&Object.keys(e.tags).length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Tags"}),(0,tn.jsx)("div",{className:"detail-tags",children:Object.entries(e.tags).map(([m,S])=>(0,tn.jsxs)("span",{className:"detail-tag",children:[(0,tn.jsxs)("span",{className:"detail-tag-key",children:[m,": "]}),(0,tn.jsx)("span",{className:"detail-tag-value",children:S})]},m))})]}),!A&&!i&&(0,tn.jsx)("div",{className:"detail-not-available",children:"Blueprint not available"})]})}function $Qe({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){switch(e.type){case"PipeLLM":return(0,tn.jsx)(WO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeImgGen":return(0,tn.jsx)(XO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeCompose":return(0,tn.jsx)(eD,{blueprint:e,executionData:t});case"PipeDocGen":return(0,tn.jsx)(tD,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeExtract":return(0,tn.jsx)(YO,{blueprint:e,modelsRan:n,modelHandles:r});case"PipeSearch":return(0,tn.jsx)(ZO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeStructure":return(0,tn.jsx)(JO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeSequence":return(0,tn.jsx)(rD,{blueprint:e,executionData:t});case"PipeParallel":return(0,tn.jsx)(aD,{blueprint:e,executionData:t});case"PipeCondition":return(0,tn.jsx)(nD,{blueprint:e,executionData:t});case"PipeBatch":return(0,tn.jsx)(iD,{blueprint:e,executionData:t});case"PipeFunc":return null;case"PipeJudge":return null;case"PipeSignature":return(0,tn.jsx)("div",{className:"detail-not-available",children:"Signature stub \u2014 declared but not yet implemented."});default:{let a=e;return null}}}function WQe({executionData:e,pipeType:t,hasBlueprint:n}){return sD(t,n)?(0,tn.jsx)(XQe,{entries:lD(t,e)}):null}function XQe({entries:e}){return e.length===0?null:(0,tn.jsxs)(tn.Fragment,{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Execution"}),e.map(([t,n])=>(0,tn.jsx)(Bt,{label:t,value:String(n)},t))]})}var cD=Ue(Ht(),1);var $n=Ue(St(),1);function AD({concept:e,ioData:t,isDryRun:n,renderData:r,instanceKey:a}){let i=t?.multiplicity;return(0,$n.jsxs)($n.Fragment,{children:[(0,$n.jsxs)("div",{className:"detail-header",children:[(0,$n.jsx)("span",{className:"detail-concept-code",children:e.code+vf(i)}),(0,$n.jsx)("span",{className:"detail-concept-domain",children:e.domain_code})]}),nA(i)&&(0,$n.jsx)("div",{className:"detail-multiplicity",children:i===!0?`A variable-length list of ${e.code} items`:`A fixed-length list of exactly ${i} ${e.code} items`}),e.description&&(0,$n.jsx)("div",{className:"detail-description",children:e.description}),e.refines&&(0,$n.jsxs)("div",{className:"detail-refines",children:["refines ",(0,$n.jsx)("span",{className:"detail-refines-code",children:e.refines})]}),(0,$n.jsx)(YQe,{concept:e,ioData:t,isDryRun:n,renderData:r},a??`${e.code}:${t&&"digest"in t?t.digest:t?.name??""}`)]})}function YQe({concept:e,ioData:t,isDryRun:n,renderData:r}){let a=t&&!n?r?.():void 0,i=!!a,[o,s]=cD.default.useState(i?"data":"structure"),l=cD.default.useId(),u=g=>`${l}-tab-${g}`,c=g=>`${l}-tabpanel-${g}`,A=e.json_schema?(0,$n.jsxs)("div",{children:[(0,$n.jsx)("div",{className:"detail-section-label",children:"Structure"}),(0,$n.jsx)(ZQe,{schema:e.json_schema})]}):(0,$n.jsx)("div",{className:"detail-not-available",children:"Schema not available"});if(!i)return A;let d=g=>{let h;switch(g.key){case"ArrowLeft":case"ArrowRight":h=o==="data"?"structure":"data";break;case"Home":h="data";break;case"End":h="structure";break;default:return}g.preventDefault(),s(h),document.getElementById(u(h))?.focus()},f=(g,h)=>(0,$n.jsx)("button",{type:"button",role:"tab",id:u(g),"aria-selected":o===g,"aria-controls":c(g),tabIndex:o===g?0:-1,className:`detail-tab ${o===g?"detail-tab--active":""}`,onClick:()=>s(g),onKeyDown:d,children:h});return(0,$n.jsxs)($n.Fragment,{children:[(0,$n.jsxs)("div",{className:"detail-tabs",role:"tablist","aria-label":"Concept views",children:[f("data","Data"),f("structure","Structure")]}),(0,$n.jsx)("div",{role:"tabpanel",id:c(o),"aria-labelledby":u(o),children:o==="data"?a:A})]})}function ZQe({schema:e}){let t=e.properties,n=new Set(e.required??[]);if(!t||Object.keys(t).length===0)return(0,$n.jsx)("div",{className:"detail-not-available",children:"No fields defined"});let r=Object.entries(t);return(0,$n.jsxs)("table",{className:"detail-schema-table",children:[(0,$n.jsx)("thead",{children:(0,$n.jsxs)("tr",{children:[(0,$n.jsx)("th",{children:"Field"}),(0,$n.jsx)("th",{children:"Type"}),(0,$n.jsx)("th",{}),(0,$n.jsx)("th",{children:"Description"})]})}),(0,$n.jsx)("tbody",{children:r.map(([a,i])=>(0,$n.jsxs)("tr",{children:[(0,$n.jsx)("td",{className:"detail-schema-field",children:a}),(0,$n.jsx)("td",{className:"detail-schema-type",children:JQe(i)}),(0,$n.jsx)("td",{children:n.has(a)&&(0,$n.jsx)("span",{className:"detail-schema-required",children:"req"})}),(0,$n.jsx)("td",{children:i.description??""})]},a))})]})}function JQe(e){return typeof e.type=="string"?e.type:Array.isArray(e.type)?e.type.join(" | "):e.anyOf?"union":e.allOf?"all":typeof e.$ref=="string"?e.$ref.split("/").pop()??"(unresolved type)":"(unresolved type)"}function iue(e){return e.map(t=>({id:t.id,type:t.type,data:t.data,position:t.position,style:t.style,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,parentId:t.parentId,extent:t.extent,selected:t.selected}))}function Xv(e){return e.map(t=>({id:t.id,source:t.source,target:t.target,type:t.type,animated:t.animated,label:t.label,labelStyle:t.labelStyle,labelBgStyle:t.labelBgStyle,labelBgPadding:t.labelBgPadding,labelBgBorderRadius:t.labelBgBorderRadius,style:t.style,markerEnd:t.markerEnd,...t.route?{data:{route:t.route}}:{}}))}var e6e=7,t6e=48,n6e=140;function r6e(e,t,n){let r=[],a=[],i=Iu(e),o=new Set;for(let c of e.edges)c.kind==="parallel_combine"&&c.target_stuff_digest&&o.add(c.target_stuff_digest);let s=new Set;for(let c of Object.values(t.stuffProducers))for(let A of c)s.add(A);for(let c of Object.values(t.stuffConsumers))for(let A of c)s.add(A);for(let c of e.nodes){if(!s.has(c.id)&&!sc(c))continue;let A=V9(c,`nodes[${c.id}]`),d=A.status==="failed",f=A.pipe_code,g=wB(A,i,L0(e,A));r.push({id:A.id,type:Kd,data:{labelDescriptor:{kind:"pipe",label:f,isFailed:d},nodeData:A,isPipe:!0,isStuff:!1,labelText:f,pipeCode:g.pipeCode,pipeType:A.pipe_type,graphMode:i,pipeCardData:g},position:{x:0,y:0}})}for(let[c,A]of Object.entries(t.stuffRegistry)){let d=Us(c),f=A.name,g=A.concept?A.concept+vf(A.multiplicity):"",h=Math.max(f.length,g.length)*e6e+t6e,w=Math.max(n6e,h),m=o.has(c),S=!t.stuffProducers[c]?.length&&!m,b=!S&&!m&&!t.stuffConsumers[c]?.length,B=m?"combined":S?"input":b?"output":void 0,T=S?"var(--color-stuff-input-border, #50FA7B)":b?"var(--color-stuff-output-border, #a78bfa)":m?"var(--color-parallel-combine)":"var(--color-stuff-border)";r.push({id:d,type:_9,data:{labelDescriptor:{kind:"stuff",label:f,concept:g},isStuff:!0,isPipe:!1,labelText:f,stuffRole:B,stuffDigest:c},position:{x:0,y:0},style:{background:"var(--color-stuff-bg)",border:`2px solid ${T}`,borderRadius:"999px",padding:"0",width:w+"px",boxShadow:"var(--shadow-md)"}})}let l=0;for(let[c,A]of Object.entries(t.stuffProducers)){let d=Us(c);for(let f of A)a.push({id:"edge_"+l++,source:f,target:d,type:n,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:2},markerEnd:{type:yf,color:"var(--color-edge)"}})}for(let[c,A]of Object.entries(t.stuffConsumers)){let d=Us(c);for(let f of A)a.push({id:"edge_"+l++,source:d,target:f,type:n,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:2},markerEnd:{type:yf,color:"var(--color-edge)"}})}for(let c of e.edges){if(c.kind!=="parallel_combine"||!c.source_stuff_digest||!c.target_stuff_digest||!t.stuffRegistry[c.source_stuff_digest]||!t.stuffRegistry[c.target_stuff_digest])continue;let A=Us(c.source_stuff_digest),d=Us(c.target_stuff_digest);a.push({id:c.id,source:A,target:d,type:"smoothstep",animated:!1,style:{stroke:"var(--color-parallel-combine)",strokeWidth:2,strokeDasharray:"5,5"},markerEnd:{type:yf,color:"var(--color-parallel-combine)"}})}for(let c of e.edges){if(c.kind!=="batch_item"&&c.kind!=="batch_aggregate"||!c.source_stuff_digest||!c.target_stuff_digest||!t.stuffRegistry[c.source_stuff_digest]||!t.stuffRegistry[c.target_stuff_digest])continue;let A=Us(c.source_stuff_digest),d=Us(c.target_stuff_digest),f=c.kind==="batch_item";a.push({id:c.id,source:A,target:d,type:n,animated:!1,_batchEdge:!0,label:c.label||"",labelStyle:{fontSize:"10px",fontFamily:"var(--font-mono)",fill:f?"var(--color-batch-item)":"var(--color-batch-aggregate)"},labelBgStyle:{fill:"var(--color-bg)",fillOpacity:.9},style:{stroke:f?"var(--color-batch-item)":"var(--color-batch-aggregate)",strokeWidth:2,strokeDasharray:"5,5"},markerEnd:{type:yf,color:f?"var(--color-batch-item)":"var(--color-batch-aggregate)"}})}let u=Lu(e,t);for(let c of a){let A=u[c.source]||null,d=u[c.target]||null;A&&d&&A!==d&&(c._crossGroup=!0,c.style={...c.style,strokeWidth:1.5,opacity:.65})}for(let c of a)c._batchEdge&&(c.style={...c.style,opacity:.7});return{nodes:r,edges:a}}function oue(e,t){if(e){let n=O9(e);if(n&&(Object.keys(n.stuffProducers).length>0||Object.keys(n.stuffConsumers).length>0||e.nodes.some(sc)))return{graphData:r6e(e,n,t),analysis:n}}return{graphData:{nodes:[],edges:[]},analysis:null}}var a6e=window.ELK,sue=a6e;function i6e(e){switch(e){case"LR":return"RIGHT";case"RL":return"LEFT";case"BT":return"UP";default:return"DOWN"}}var o6e="_in",s6e="_out";function fue(e){return e+o6e}function due(e){return e+s6e}function l6e(e,t,n){let r={LR:{inSide:"WEST",outSide:"EAST"},RL:{inSide:"EAST",outSide:"WEST"},TB:{inSide:"NORTH",outSide:"SOUTH"},BT:{inSide:"SOUTH",outSide:"NORTH"}},{inSide:a,outSide:i}=r[n],o=n==="LR"||n==="RL",s=o?n==="LR"?0:t.width:t.width/2,l=o?t.height/2:n==="TB"?0:t.height,u=o?n==="LR"?t.width:0:t.width/2,c=o?t.height/2:n==="TB"?t.height:0;return[{id:fue(e),x:s,y:l,width:1,height:1,layoutOptions:{"elk.port.side":a}},{id:due(e),x:u,y:c,width:1,height:1,layoutOptions:{"elk.port.side":i}}]}var u6e=320,pue=28,c6e=24,fD=8,A6e=22,f6e=50,d6e=16,p6e=3,lue=38,uue=30,gI=22,h6e=140,m6e=100,g6e=17,v6e=58,y6e=5.5,w6e=5,b6e=4.5,x6e=4;function C6e(e,t,n){if(!e)return 0;if(!t)return 1;let r=n-pue,a=Math.max(1,Math.floor(r/y6e)),i=Math.ceil(e.length/a);return Math.min(p6e,Math.max(1,i))}function S6e(e,t){let n=Math.min(h6e,Math.ceil(e.length*w6e)),r=Math.min(m6e,Math.ceil(t.length*b6e));return n+r+g6e}function cue(e,t){if(e.length===0)return 0;let n=t-pue-v6e,r=1,a=0;for(let i of e){let o=S6e(i.name,i.concept);if(a===0){a=o;continue}a+o<=n?a+=o:(r+=1,a=o)}return r}function Yv(e,t){let n=e.data||{};if(n.layoutSize)return{...n.layoutSize};let r=n.isStuff,a=n.labelText||"",i=e.type===Kd,o=t?180:280,s=t?240:400,l=Math.max(180,Math.min(s,a.length*8+60)),u;r?u=Math.max(180,l):i&&n.pipeCardData?u=s:u=Math.max(i?o:200,l);let c;if(r)c=60;else if(i&&n.pipeCardData){let A=n.pipeCardData,d=A.inputs??[],f=A.outputs??[],g=A.description||n.nodeData?.description||"",h=c6e+(t?f6e:A6e),w=C6e(g,t,u);w>0&&(h+=fD+w*d6e);let m=d.slice(0,x6e);if(m.length>0)if(h+=fD,t)h+=lue+(m.length-1)*gI;else{let S=cue(m,u);h+=uue+(S-1)*gI}if(f.length>0)if(h+=fD,t)h+=lue+(f.length-1)*gI;else{let S=cue(f,u);h+=uue+(S-1)*gI}c=Math.min(u6e,h)}else c=i?120:70;return{width:u,height:c}}function B6e(e,t){let n={},r=new Set;function a(i){if(n[i]!==void 0)return n[i];if(r.has(i))return 0;r.add(i);let o=t[i]||[],s=-1;for(let l of o)e.has(l)&&(s=Math.max(s,a(l)));return r.delete(i),n[i]=s+1,n[i]}for(let i of e)a(i);return n}function vI(e,t,n){return{id:e,width:t.width,height:t.height,ports:l6e(e,t,n),layoutOptions:{"elk.portConstraints":"FIXED_POS"}}}function Aue(e,t){let n={id:e.id,sources:[due(e.source)],targets:[fue(e.target)]};return t&&e.label&&e.labelSize&&(n.labels=[{id:`${e.id}_label`,text:e.label,width:e.labelSize.width,height:e.labelSize.height}]),n}function hue(e,t,n,r,a,i){let o=a==="LR"||a==="RL",s=i?.nodesep??80,l=i?.ranksep??70,u=i?.routeEdges??!1,c=i?.groupPadding??{x:mB,top:gB,bottom:vB},A=i6e(a),d="30",f={"elk.algorithm":"layered","elk.direction":A,"elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":String(s),"elk.layered.spacing.nodeNodeBetweenLayers":String(l),"elk.spacing.edgeNode":d,"elk.spacing.edgeEdge":"20","elk.layered.spacing.edgeNodeBetweenLayers":d,"elk.layered.spacing.edgeEdgeBetweenLayers":"15","elk.layered.nodePlacement.favorStraightEdges":"true"};if(u&&(f["elk.json.edgeCoords"]="ROOT"),!n||!r||r.controllerNodeIds.size===0){let R={},F=e.map(V=>{let P=Yv(V,o);return R[V.id]=P,vI(V.id,P,a)}),N=t.map(V=>Aue(V,u));return{elkGraph:{id:"root",layoutOptions:f,children:F,edges:N},dimensionMap:R}}let g=Lu(n,r),h=B6e(r.controllerNodeIds,r.containmentTree),w={},m=new Map;for(let R of e)m.set(R.id,R);let S={},b=Array.from(r.controllerNodeIds);b.sort((R,F)=>(h[R]??0)-(h[F]??0));for(let R of b){let N=1+(h[R]??0)*.15,V=Math.round(c.x*N),P=Math.round(c.top*N),D=Math.round(c.bottom*N),z={"elk.padding":`[top=${P},left=${V},bottom=${D},right=${V}]`,"elk.spacing.nodeNode":String(s),"elk.layered.spacing.nodeNodeBetweenLayers":String(l),"elk.spacing.edgeNode":d,"elk.layered.spacing.edgeNodeBetweenLayers":d},O=[],H=r.containmentTree[R]||[];for(let K of H)if(r.controllerNodeIds.has(K)){let X=S[K];X&&O.push(X)}else{let X=m.get(K);if(X){let j=Yv(X,o);w[K]=j,O.push(vI(K,j,a))}}for(let K of e)if(K.data.isStuff&&g[K.id]===R&&!O.some(X=>X.id===K.id)){let X=Yv(K,o);w[K.id]=X,O.push(vI(K.id,X,a))}S[R]={id:R,layoutOptions:z,children:O}}let B=[];for(let R of b)if(!g[R]){let F=S[R];F&&B.push(F)}for(let R of e)if(!g[R.id]&&!r.controllerNodeIds.has(R.id)){let F=Yv(R,o);w[R.id]=F,B.push(vI(R.id,F,a))}let T=new Set(e.map(R=>R.id)),k=t.filter(R=>T.has(R.source)&&T.has(R.target)).map(R=>Aue(R,u));return{elkGraph:{id:"root",layoutOptions:f,children:B,edges:k},dimensionMap:w}}function mue(e){let t={};function n(r,a,i){let o=a+(r.x??0),s=i+(r.y??0);r.id!=="root"&&(t[r.id]={x:o,y:s,width:r.width??0,height:r.height??0});for(let l of r.children??[])n(l,o,s)}return n(e,0,0),t}function gue(e){let t={};function n(r){for(let a of r.edges??[]){let i=[];for(let l of a.sections??[])for(let u of[l.startPoint,...l.bendPoints??[],l.endPoint]){let c=i[i.length-1];(!c||c.x!==u.x||c.y!==u.y)&&i.push({x:u.x,y:u.y})}if(i.length<2)continue;let o={points:i},s=a.labels?.[0];s&&s.x!==void 0&&s.y!==void 0&&(o.label={x:s.x,y:s.y,width:s.width??0,height:s.height??0}),t[a.id]=o}for(let a of r.children??[])n(a)}return n(e),t}var dD=null;function E6e(){return dD||(dD=new sue),dD}async function yI(e,t,n,r,a,i){if(e.length===0)return{nodes:[],edges:t,controllerPositions:{}};let o=n==="LR"||n==="RL",{elkGraph:s,dimensionMap:l}=hue(e,t,a??null,i??null,n,r),u=await E6e().layout(s),c=mue(u),A={};if(i)for(let h of i.controllerNodeIds)c[h]&&(A[h]=c[h]);let d=e.map(h=>{let w=c[h.id],m=l[h.id]??Yv(h,o),S=m.width,b=m.height,B=h.data.pipeCardData,k=B?{...B,direction:o?"LR":"TB"}:void 0;return{...h,data:{...h.data,_estimatedWidth:S,_estimatedHeight:b,pipeCardData:k},style:{...h.style,width:S+"px",height:b+"px"},position:{x:w?w.x:0,y:w?w.y:0},sourcePosition:o?n==="LR"?"right":"left":n==="TB"?"bottom":"top",targetPosition:o?n==="LR"?"left":"right":n==="TB"?"top":"bottom"}});if(!r?.routeEdges)return{nodes:d,edges:t,controllerPositions:A};let f=gue(u),g=t.map(h=>{let w=f[h.id];return w?{...h,route:w}:h});return{nodes:d,edges:g,controllerPositions:A}}var vue={"--font-sans":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"--font-mono":'"JetBrains Mono", "Monaco", "Menlo", monospace'},_6e={...vue,"--surface-page":"#0a0a0a","--surface-panel":"#111118","--surface-overlay":"rgba(17, 17, 24, 0.8)","--surface-overlay-hover":"rgba(30, 30, 40, 0.9)","--surface-overlay-disabled":"rgba(17, 17, 24, 0.6)","--surface-elevated":"rgba(255, 255, 255, 0.06)","--surface-elevated-hover":"rgba(255, 255, 255, 0.1)","--surface-sunken":"rgba(255, 255, 255, 0.03)","--surface-pill":"rgba(255, 255, 255, 0.06)","--surface-pill-border":"rgba(255, 255, 255, 0.08)","--border-subtle":"rgba(255, 255, 255, 0.06)","--border-default":"rgba(255, 255, 255, 0.1)","--border-strong":"rgba(255, 255, 255, 0.18)","--border-dashed":"rgba(255, 255, 255, 0.15)","--text-primary":"#f8fafc","--text-default":"#e2e8f0","--text-secondary":"#cbd5e1","--text-muted":"#94a3b8","--text-dim":"#64748b","--text-on-accent":"#0e0e0e","--shadow-sm":"0 2px 8px rgba(0, 0, 0, 0.4)","--shadow-md":"0 4px 16px rgba(0, 0, 0, 0.6)","--shadow-lg":"0 8px 24px rgba(0, 0, 0, 0.5)","--focus-ring":"rgba(59, 130, 246, 0.6)","--color-pipe":"#ff6b6b","--color-pipe-bg":"rgba(224,108,117,0.18)","--color-pipe-text":"#ffffff","--color-stuff":"#4ECDC4","--color-stuff-bg":"rgba(78,205,196,0.12)","--color-stuff-border":"#9ddcfd","--color-stuff-text":"#98FB98","--color-stuff-text-dim":"#9ddcfd","--color-edge":"#FFFACD","--color-batch-item":"#bd93f9","--color-batch-aggregate":"#50fa7b","--color-parallel-combine":"#d6a4ff","--color-success":"#50FA7B","--color-success-bg":"rgba(80,250,123,0.15)","--color-error":"#FF5555","--color-error-bg":"rgba(255,85,85,0.15)","--color-error-border":"rgba(255,85,85,0.2)","--color-accent":"#8BE9FD","--color-accent-strong":"#3b82f6","--color-warning":"#FFB86C","--ctrl-sequence-border":"rgba(148, 163, 184, 0.25)","--ctrl-sequence-bg":"rgba(148, 163, 184, 0.03)","--ctrl-sequence-text":"#94a3b8","--ctrl-parallel-border":"rgba(139, 233, 253, 0.35)","--ctrl-parallel-bg":"rgba(139, 233, 253, 0.03)","--ctrl-parallel-text":"#8be9fd","--ctrl-condition-border":"rgba(251, 191, 36, 0.35)","--ctrl-condition-bg":"rgba(251, 191, 36, 0.03)","--ctrl-condition-text":"#fbbf24","--ctrl-batch-border":"rgba(167, 139, 250, 0.35)","--ctrl-batch-bg":"rgba(167, 139, 250, 0.03)","--ctrl-batch-text":"#a78bfa","--ctrl-folded-bg":"rgba(148, 163, 184, 0.25)","--ctrl-folded-border":"rgba(148, 163, 184, 0.4)","--color-bg":"#0a0a0a","--color-bg-dots":"rgba(255, 255, 255, 0.35)","--color-text-muted":"#94a3b8","--color-controller-text":"#94a3b8"},I6e={...vue,"--surface-page":"#f8fafc","--surface-panel":"#ffffff","--surface-overlay":"rgba(255, 255, 255, 0.92)","--surface-overlay-hover":"rgba(241, 245, 249, 0.96)","--surface-overlay-disabled":"rgba(255, 255, 255, 0.7)","--surface-elevated":"rgba(15, 23, 42, 0.05)","--surface-elevated-hover":"rgba(15, 23, 42, 0.09)","--surface-sunken":"rgba(15, 23, 42, 0.03)","--surface-pill":"rgba(15, 23, 42, 0.05)","--surface-pill-border":"rgba(15, 23, 42, 0.1)","--border-subtle":"rgba(15, 23, 42, 0.08)","--border-default":"rgba(15, 23, 42, 0.12)","--border-strong":"rgba(15, 23, 42, 0.22)","--border-dashed":"rgba(15, 23, 42, 0.18)","--text-primary":"#020617","--text-default":"#0f172a","--text-secondary":"#1e293b","--text-muted":"#475569","--text-dim":"#64748b","--text-on-accent":"#ffffff","--shadow-sm":"0 2px 8px rgba(15, 23, 42, 0.08)","--shadow-md":"0 4px 16px rgba(15, 23, 42, 0.14)","--shadow-lg":"0 8px 24px rgba(15, 23, 42, 0.15)","--focus-ring":"rgba(2, 132, 199, 0.5)","--color-pipe":"#dc2626","--color-pipe-bg":"rgba(220, 38, 38, 0.1)","--color-pipe-text":"#ffffff","--color-stuff":"#0891b2","--color-stuff-bg":"rgba(8, 145, 178, 0.08)","--color-stuff-border":"#0e7490","--color-stuff-text":"#0f172a","--color-stuff-text-dim":"#475569","--color-edge":"#64748b","--color-batch-item":"#7c3aed","--color-batch-aggregate":"#15803d","--color-parallel-combine":"#6d28d9","--color-success":"#15803d","--color-success-bg":"rgba(21, 128, 61, 0.12)","--color-error":"#dc2626","--color-error-bg":"rgba(220, 38, 38, 0.1)","--color-error-border":"rgba(220, 38, 38, 0.25)","--color-accent":"#0284c7","--color-accent-strong":"#0284c7","--color-warning":"#d97706","--ctrl-sequence-border":"rgba(71, 85, 105, 0.3)","--ctrl-sequence-bg":"rgba(71, 85, 105, 0.04)","--ctrl-sequence-text":"#475569","--ctrl-parallel-border":"rgba(8, 145, 178, 0.4)","--ctrl-parallel-bg":"rgba(8, 145, 178, 0.05)","--ctrl-parallel-text":"#0e7490","--ctrl-condition-border":"rgba(217, 119, 6, 0.4)","--ctrl-condition-bg":"rgba(217, 119, 6, 0.05)","--ctrl-condition-text":"#b45309","--ctrl-batch-border":"rgba(124, 58, 237, 0.4)","--ctrl-batch-bg":"rgba(124, 58, 237, 0.05)","--ctrl-batch-text":"#6d28d9","--ctrl-folded-bg":"rgba(71, 85, 105, 0.18)","--ctrl-folded-border":"rgba(71, 85, 105, 0.35)","--color-bg":"#f8fafc","--color-bg-dots":"rgba(15, 23, 42, 0.18)","--color-text-muted":"#475569","--color-controller-text":"#475569"};function wI(e){return e===Ih.LIGHT?I6e:_6e}var Mf={direction:"LR",showControllers:!1,foldMode:lc.EXPANDED,theme:Wi.SYSTEM,toolbarPosition:Da.TOP_RIGHT,graphStyle:Os.DETAILED,nodesep:50,ranksep:100,edgeType:hB.DEFAULT,initialZoom:null,panToTop:!0};var SA={[Os.DETAILED]:{id:Os.DETAILED,name:"Detailed",description:"Every pipe with its inputs, outputs and settings",capabilities:{controllerFrameToggle:!0,foldAll:!0}},[Os.SIMPLE]:{id:Os.SIMPLE,name:"Simple",description:"The method's steps in plain words",capabilities:{controllerFrameToggle:!1,foldAll:!0},layout:{nodesep:28,ranksep:44,routeEdges:!0,groupPadding:{x:20,top:40,bottom:16}}}},L6e=[Os.DETAILED,Os.SIMPLE];function pD(e){return typeof e=="string"&&Object.hasOwn(SA,e)}function yue(e,t){return pD(e)?e:pD(t)?t:Mf.graphStyle}function wue(e){if(e===void 0||e===!1)return[];let t=e===!0?L6e:e,n=[];for(let r of t)pD(r)&&!n.includes(r)&&n.push(r);return n.length>=2?n:[]}var Fx=5;function T6e(e,t,n){let r=new Set,a=[e];for(;a.length>0;){let i=a.pop();for(let o of t[i]||[])r.add(o),n.has(o)&&a.push(o)}return r}function hD(e,t,n,r){let a={},i=Iu(e);for(let h of n)a[h.id]=h;let o={};for(let h of e.nodes)t.controllerNodeIds.has(h.id)&&(o[h.id]=T0(h,`nodes[${h.id}]`));let s={},l=new Set;function u(h){if(s[h]!==void 0)return s[h];if(l.has(h))throw new Error(`Cycle detected in containment tree: controller "${h}" is part of a containment cycle`);l.add(h);let w=t.containmentTree[h]||[],m=-1;for(let S of w)t.controllerNodeIds.has(S)&&(m=Math.max(m,u(S)));return l.delete(h),s[h]=m+1,s[h]}let c=Lu(e,t),A={};for(let[h,w]of Object.entries(c))I0(h)&&a[h]&&(A[w]||(A[w]=[]),A[w].push(h));let d=Array.from(t.controllerNodeIds);for(let h of d)u(h);d.sort((h,w)=>s[h]-s[w]);let f=[],g={};for(let h of d){let m=(t.containmentTree[h]||[]).filter(D=>a[D]),S=A[h]||[],b=[...m,...S];if(b.length===0)continue;let B,T,k,R,F=r?.[h];if(F)B=F.x,T=F.y,k=F.width,R=F.height;else{let D=1/0,z=1/0,O=-1/0,H=-1/0;for(let ve of b){let M=a[ve],W=M.position,J=F9(M),ie=k9(M);D=Math.min(D,W.x),z=Math.min(z,W.y),O=Math.max(O,W.x+J),H=Math.max(H,W.y+ie)}let X=1+(s[h]??0)*.15,j=Math.round(mB*X),Z=Math.round(gB*X),oe=Math.round(vB*X);B=D-j,T=z-Z,k=O-D+2*j,R=H-z+Z+oe}let N=o[h];if(!N)throw new fw(`nodes[${h}]`,`controller "${h}" is referenced by a "contains" edge but has no corresponding node in graphspec.nodes`);let V=N.pipe_code,P={id:h,type:I9,data:{label:V,pipeType:N.pipe_type,isController:!0,isPipe:!1,isStuff:!1,pipeCode:V,labelText:V,graphMode:i},position:{x:B,y:T},style:{width:k+"px",height:R+"px",padding:"0"}};f.push(P),a[h]=P;for(let D of b)g[D]=h}for(let[h,w]of Object.entries(g)){let m=a[h],S=a[w];!m||!S||(m.position={x:m.position.x-S.position.x,y:m.position.y-S.position.y},m.parentId=w,m.extent="parent")}return f}function bue(e,t,n,r,a,i,o,s,l){if(!a||!r||!n)return{nodes:e,edges:t};let u={},c=new Set,A={};for(let h of n.nodes)r.controllerNodeIds.has(h.id)&&(A[h.id]=T0(h,`nodes[${h.id}]`).pipe_type);for(let h of r.controllerNodeIds){let w=r.containmentTree[h]||[];u[h]=w.length;let m=A[h];(m==="PipeParallel"||m==="PipeBatch")&&w.length>Fx&&!i?.has(h)&&c.add(h)}let d=e,f=t;if(c.size>0){let h=new Set;for(let m of c){let b=(r.containmentTree[m]||[]).slice(Fx);for(let B of b)if(h.add(B),r.controllerNodeIds.has(B))for(let T of T6e(B,r.containmentTree,r.controllerNodeIds))h.add(T)}let w=Lu(n,r);for(let m of e){if(!I0(m.id)||h.has(m.id))continue;let S=w[m.id];if(!S||!c.has(S)&&!h.has(S))continue;let b=t.filter(B=>{if(B.source!==m.id&&B.target!==m.id)return!1;let T=B.source===m.id?B.target:B.source;return!I0(T)});(b.length===0||b.every(B=>{let T=B.source===m.id?B.target:B.source;return h.has(T)}))&&h.add(m.id)}d=e.filter(m=>!h.has(m.id)),f=t.filter(m=>!h.has(m.source)&&!h.has(m.target))}let g=hD(n,r,d,s);if(g.length===0)return{nodes:d,edges:f};for(let h of g){let w=u[h.id]??0,m=c.has(h.id);if(h.data.childCount=w,h.data.isCollapsed=m,o){let S=h.id;h.data.onToggleCollapse=()=>o(S)}if(l){let S=h.id;h.data.onToggleFold=b=>l(S,b)}}return{nodes:mD([...g,...d]),edges:f}}function mD(e){let t={};for(let i of e)t[i.id]=i;let n={},r=new Set;function a(i){if(n[i]!==void 0)return n[i];if(r.has(i))throw new Error(`Cycle detected in node parent chain: node "${i}" references itself as an ancestor`);r.add(i);let o=t[i];return n[i]=o&&o.parentId?1+a(o.parentId):0,r.delete(i),n[i]}for(let i of e)a(i.id);return[...e].sort((i,o)=>n[i.id]-n[o.id])}var R6e=new Set(["ai","api","faq","iban","id","io","ip","json","kpi","ocr","roi","seo","ui","uri","url","uuid","ux"]),N6e=/[aeiouy]/,xue=new Set(["cfg","cm","cnt","ctx","dr","dst","fn","ft","hmm","hr","kg","km","lb","mg","ml","mm","mr","mrs","ms","msg","nd","nth","pkg","pt","rd","src","st","th","tmp","vs"]),F6e=new Set(["cms","css","dns","gps","rss","sms"]),k6e={Html:"HTML",JSON:"JSON",TextAndImages:"Text and images",YesNo:"Yes or no",SearchResult:"Search result",Composite:"Combined results",Dynamic:"Data"},P6e=new Set(["Anything","Dynamic","Composite"]);function Cue(e){return e.length<2||!/^[a-z]+$/.test(e)||xue.has(e)||e.endsWith("s")&&xue.has(e.slice(0,-1))?!1:!N6e.test(e)||R6e.has(e)}function U6e(e,t){return/^\d+$/.test(e)?e:t&&e.length>=2?e.toUpperCase():e.endsWith("s")&&!F6e.has(e)&&Cue(e.slice(0,-1))?e.slice(0,-1).toUpperCase()+"s":Cue(e)?e.toUpperCase():e}function O6e(e){return e.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([A-Za-z])(\d)/g,"$1 $2").split(/[\s_\-.]+/).filter(n=>n.length>0).map(n=>({word:n.toLowerCase(),wasAllCaps:n.length>=2&&n===n.toUpperCase()&&/[A-Z]/.test(n)}))}function Sue(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function kx(e){let t=e.lastIndexOf(".");return t===-1?e:e.slice(t+1)}function Ep(e){let t=O6e(kx(e.trim()));return t.length===0?"":Sue(t.map(n=>U6e(n.word,n.wasAllCaps)).join(" "))}function gD(e){let t=kx(e.trim());return k6e[t]??Ep(t)}function Bue(e){return P6e.has(kx(e.trim()))}function vD(e){let t=e.replace(/\s+/g," ").trim(),n=t.endsWith(".")&&!t.endsWith("..")?t.slice(0,-1):t;return Sue(n)}var D6e={true:"Yes",false:"No",default:"Otherwise"};function bI(e){return e.split("|").map(r=>r.trim()).filter(r=>r.length>0).map((r,a)=>{let i=D6e[r.toLowerCase()]??Ep(r);return a===0?i:i.charAt(0).toLowerCase()+i.slice(1)}).join(" or ")}var M6e=[[.28,"il .,'"],[.33,"fjt:;!()"],[.35,"/"],[.39,"I"],[.44,"r-"],[.51,"1z"],[.56,'7aceksvxyJ"'],[.59,"25"],[.6,"8"],[.61,"369bdghnopquF?"],[.64,"04"],[.67,"ELPSTZ"],[.72,"ABCDNRUVXY"],[.78,"GHKOQ"],[.8,"w"],[.83,"&"],[.89,"m"],[.94,"M"],[1,"W%"]],Q6e=new Map(M6e.flatMap(([e,t])=>[...t].map(n=>[n,e]))),H6e=.62,G6e=.78;function z6e(e){let t=Q6e.get(e);return t!==void 0?t:e!==e.toLowerCase()?G6e:H6e}function Px(e,t){let n=0;for(let r of e)n+=z6e(r);return n*t}function Ux(e,t,n,r){let a=e.split(/\s+/).filter(u=>u.length>0),i=Px(" ",n),o=a.length===0?0:1,s=0;for(let u of a){let c=Px(u,n);if(c>t){s>0&&(o+=1),s=0;for(let d of u){let f=Px(d,n);s>0&&s+f>t&&(o+=1,s=0),s+=f}continue}let A=s===0?c:s+i+c;A<=t?s=A:(o+=1,s=c)}let l=Math.min(o,r);return{lines:o,drawnLines:l,clamped:o>r}}var Eue="native",yD=160,q6e=200,V6e=12,j6e=10,kue=1.5,K6e=16,wD=6,bD=[{boxWidth:yD,fontPx:15,lineHeightPx:20,maxLines:3},{boxWidth:q6e,fontPx:15,lineHeightPx:20,maxLines:3},{boxWidth:yD,fontPx:13,lineHeightPx:17,maxLines:5},{boxWidth:yD,fontPx:12,lineHeightPx:16,maxLines:7}],$6e=18,W6e=22,Pue=11,X6e=13,Uue=[5,3],Oue=124,Y6e=12,Z6e=10,J6e=16,eHe=13,tHe=17,nHe=2,rHe=17,aHe=52,_ue=[188,220,252,284],Iue=13,iHe=16,Lue=3,oHe=.56,sHe=.4,lHe=84,xD=2;function uHe(e){return e-2*(V6e+kue)-xD}var cHe=Oue-2*Y6e-xD;function Tue(e){return Math.floor(e*oHe)-xD}var AHe=3,fHe={PipeLLM:as.AI,PipeStructure:as.AI,PipeJudge:as.JUDGE,PipeExtract:as.EXTRACT,PipeImgGen:as.IMAGE,PipeSearch:as.SEARCH,PipeFunc:as.CODE,PipeCompose:as.TEMPLATE,PipeDocGen:as.DOCUMENT,PipeSignature:as.PLANNED,PipeSequence:as.STEPS,PipeParallel:as.PARALLEL,PipeCondition:as.DECISION,PipeBatch:as.REPEAT,BindingStep:as.PICK},Due={ai:"AI",extract:"Extract",image:"Image",search:"Search",code:"Code",template:"Template",document:"Document",judge:"Judge",planned:"To build",steps:"Steps",parallel:"Side by side",decision:"Decision",repeat:"For each",pick:"Pick"};function Mue(e){for(let n of bD){let r=Rue(e,n);if(!r.clamped)return{fit:n,wrap:r}}let t=bD[bD.length-1];return{fit:t,wrap:Rue(e,t)}}function dHe(e,t={}){let{fit:n,wrap:r}=Mue(e),a=2*j6e+K6e+wD+Math.max(1,r.drawnLines)*n.lineHeightPx;return t.forEach&&(a+=wD+$6e),t.innerSteps&&(a+=wD+W6e),{width:n.boxWidth,height:Math.ceil(a+2*kue)}}function pHe(e,t){let n=Ux(e,cHe,eHe,nHe),r=Z6e+Math.max(1,n.drawnLines)*tHe+(t?rHe:0)+J6e;return{width:Oue,height:Math.max(aHe,r)}}function hHe(e){let t=_ue[0],n=Ux(e,Tue(t),Iue,Lue);for(let i of _ue.slice(1)){if(!n.clamped)break;t=i,n=Ux(e,Tue(t),Iue,Lue)}let r=Math.max(1,n.drawnLines)*iHe,a=Math.max(lHe,Math.ceil(r/sHe));return{width:t,height:a}}function Rue(e,t){return Ux(e,uHe(t.boxWidth),t.fontPx,t.maxLines)}var mHe=["failed","running","scheduled","canceled","skipped","succeeded"];function Nue(e){for(let t of mHe)if(e.includes(t))return t}function Que(e){let t={};for(let[n,r]of Object.entries(e))for(let a of r)t[a]=n;return t}function gHe(e){return[...new Set(e)]}function vHe(e,t,n){let r=new Map(e.nodes.map(l=>[l.id,l])),a=new Map,i=new Map,o=[];function s(l,u,c){let A=new Map;for(let d of l){let f=r.get(d),g=f?yHe(f):d,h=A.get(g)??0;A.set(g,h+1);let w=`${u}/${g}#${c?"*":h}`,m=a.get(w);m?m.push(d):a.set(w,[d]),o.push(d),s(t.containmentTree[d]??[],w,f?.pipe_type==="PipeBatch")}}s(e.nodes.filter(l=>!t.childNodeIds.has(l.id)).map(l=>l.id),"",!1);for(let l of a.values()){if(l.length<2)continue;let u=Math.max(...l.map(n)),c=l.find(A=>n(A)===u)??l[0];for(let A of l)A!==c&&i.set(A,c)}return{representativeOf:i,order:o}}function yHe(e){let t=e.domain_code&&e.pipe_code?Wl(e.domain_code,e.pipe_code):e.pipe_code??e.pipe_type;return`${e.kind}:${t}`}function Fue(e){let t=Ep(e),n=t.split(" ")[0]??"";return`For each ${n.length>=2&&n===n.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}`}function Hue(e){let{graphspec:t,nodes:n,analysis:r,rawAnalysis:a}=e,i=Iu(t),o=new Map(t.nodes.map(re=>[re.id,re])),s=new Map;for(let re of n)re.type===Kd&&s.set(re.id,re);let l=r.controllerNodeIds,u=re=>o.get(re)?.pipe_type,{representativeOf:c,order:A}=vHe(t,a,re=>{if(l.has(re))return 2;let me=s.get(re);return me?me.data.isController!==!0&&o.get(re)?.kind==="controller"?1:2:0}),d=re=>c.get(re)??re,f={};for(let[re,me]of Object.entries(Que(a.containmentTree)))f[re]=d(me);let g=new Map;for(let re of A)for(let me=f[re];me;me=f[me])if(s.get(me)?.data.isController===!0){g.set(re,me);break}let h=re=>g.get(re)??d(re),w=new Set([...c.keys(),...g.keys()]),m={};for(let re of A){let me=f[re];me&&!w.has(re)&&(m[me]??(m[me]=[])).push(re)}function S(re,me){let Re=f[re];for(;Re;){if(Re===me)return!0;Re=f[Re]}return!1}let b={};for(let re of l){if(w.has(re)||u(re)!=="PipeBatch")continue;let me=r.containmentTree[re]?.[0];me&&(b[re]=d(me))}let B=[...l].filter(re=>!w.has(re)&&u(re)==="PipeCondition"),T=new Set(B),k=new Set(Object.entries(b).filter(([re,me])=>!w.has(re)&&l.has(me)).map(([re])=>re)),R={};for(let[re,me]of Object.entries(b))!w.has(re)&&s.has(me)&&(R[me]=re);let F=new Map;for(let re of t.nodes){let me=d(re.id),Re=F.get(me);Re?Re.push(re.status):F.set(me,[re.status])}function N(re){return Nue(F.get(re.id)??[])??re.status}let V=[...s.values()].filter(re=>!w.has(re.id)&&(re.data.pipeType!==Do||Nue(F.get(re.id)??[])==="failed")),P=new Set(V.map(re=>re.id)),D=t.nodes.filter(re=>!a.childNodeIds.has(re.id)&&(re.kind==="controller"||re.kind==="operator")),z=new Set(D.flatMap(re=>re.io.inputs.map(me=>me.digest))),O=new Set(D.flatMap(re=>re.io.outputs.map(me=>me.digest))),H=new Map,K=new Map;for(let re of D)for(let me of re.io.inputs)!me.digest||H.has(me.digest)||O.has(me.digest)||H.set(me.digest,me);for(let re of D)for(let me of re.io.outputs)!me.digest||H.has(me.digest)||K.has(me.digest)||z.has(me.digest)||K.set(me.digest,me);let X=new Map;for(let re of t.edges){let me=re.source_stuff_digest,Re=re.target_stuff_digest;if(!me||!Re||me===Re||re.kind!=="parallel_combine"&&re.kind!=="batch_aggregate"&&re.kind!=="batch_item")continue;let We=X.get(Re);We?We.push(me):X.set(Re,[me])}let j=new Map;function Z(re,me=new Set){let Re=j.get(re);if(Re)return Re;if(H.has(re))return[Us(re)];if(me.has(re))return[];me.add(re);let We=[],He=r.stuffProducers[re]??[];for(let Ye of He){let zt=s.get(h(Ye));if(zt)if(zt.data.pipeType===Do&&!P.has(zt.id))for(let It of o.get(Ye)?.io.inputs??[])It.digest&&We.push(...Z(It.digest,me));else We.push(zt.id)}if(He.length===0)for(let Ye of X.get(re)??[])We.push(...Z(Ye,me));me.delete(re);let et=gHe(We);return j.set(re,et),et}function oe(re,me){let Re=me;for(;f[Re]&&f[Re]!==re;)Re=f[Re];return Re}function ve(re,me){let Re=o.get(me),We=Re?.tags?.outcome;if(We)return bI(We);let He=t.edges.find(Dt=>Dt.kind==="contains"&&d(Dt.source)===re&&Dt.target===me&&Dt.label);if(He?.label)return bI(He.label);let et=o.get(re);if(!et?.domain_code||!et.pipe_code||!Re?.pipe_code)return;let Ye=aN(t,Wl(et.domain_code,et.pipe_code));if(Ye?.type!=="PipeCondition")return;let zt=et.domain_code,It=Re.pipe_code;function ut(Dt){let wt=cw(Dt);if(!wt)return kx(Dt)===It;if(wt.pipeCode!==It)return!1;let An=wt.domainPath??zt;return Re?.domain_code===void 0||Re.domain_code===An}let Ct=Object.entries(Ye.outcome_map).filter(([,Dt])=>ut(Dt)).map(([Dt])=>Dt);return Ye.default_outcome&&ut(Ye.default_outcome)&&Ct.push("default"),Ct.length>0?bI(Ct.join("|")):void 0}function M(re){let me=[],Re=f[re];for(;Re;)T.has(Re)&&me.unshift(Re),Re=f[Re];return me}let W=new Map,J=0;function ie(re,me){if(re===me)return;let Re=`${re}->${me}`;if(W.has(Re))return;let We=T.has(re)?ve(re,oe(re,me)):void 0;W.set(Re,bHe(`simple_edge_${J++}`,re,me,We))}function pe(re,me){let Re=[...re];for(let We of M(me)){let He=Re.filter(et=>!S(et,We));if(He.length!==0){for(let et of He)ie(et,We);Re=[We,...Re.filter(et=>S(et,We))]}}for(let We of Re)ie(We,me)}let ge=new Map;function he(re){let me=Z(re);if(me.length>0)return me;let Re=r.stuffRegistry[re];return Re?(ge.set(re,{name:Re.name,digest:re,...Re.concept!==void 0?{concept:Re.concept}:{},...Re.multiplicity!==void 0?{multiplicity:Re.multiplicity}:{}}),[Us(re)]):[]}function ye(re,me){let Re=h(me);pe(Re===me?he(re):Z(re),Re)}for(let[re,me]of Object.entries(r.stuffConsumers))for(let Re of me)P.has(h(Re))&&ye(re,Re);for(let re of l)if(T.has(h(re)))for(let me of o.get(re)?.io.inputs??[])me.digest&&ye(me.digest,re);for(let re of K.keys())for(let me of Z(re))ie(me,Us(re));for(let[re,me]of[...W]){if(!T.has(me.source))continue;let Re=oe(me.source,me.target);[...W.values()].some(He=>He.target===me.target&&He.source!==me.source&&S(He.source,Re))&&W.delete(re)}function Ce(re){if(P.has(re)||T.has(re))return re;for(let me of m[re]??[]){let Re=Ce(me);if(Re)return Re}}for(let re of B)for(let me of m[re]??[]){let We=[...W.values()].some(He=>He.source===re&&(He.target===me||S(He.target,me)))?void 0:Ce(me);We&&ie(re,We)}let Be=[];function Fe(re){let me=Aw(t,re);return me?me.domain_code===Eue:re.startsWith(`${Eue}.`)||Bue(re)}function Pe(re,me){let Re=re.digest,We=re.concept,He=nA(re.multiplicity),et,Ye;if(me==="output"&&We&&!Fe(We))et=gD(We);else{et=Ep(re.name);let It=We?gD(We):void 0;Ye=It&&It.toLowerCase()!==et.toLowerCase()?It:void 0}let zt={kind:me,title:et,isList:He,...Ye?{subtitle:Ye}:{}};return{id:Us(Re),type:fB,data:{isPipe:!1,isStuff:!0,labelText:et,stuffRole:me,stuffDigest:Re,graphMode:i,simple:zt,layoutSize:pHe(et,Ye!==void 0)},position:{x:0,y:0}}}for(let re of[...H.values(),...ge.values()])Be.push(Pe(re,"input"));function Qe(re){let me=o.get(re);if(me?.domain_code&&me.pipe_code){let ut=aN(t,Wl(me.domain_code,me.pipe_code));if(ut?.type==="PipeBatch"&&ut.batch_params.input_item_stuff_name)return ut.batch_params.input_item_stuff_name}let Re=new Set([re]);for(let[ut,Ct]of c)Ct===re&&Re.add(ut);let We=t.edges.filter(ut=>ut.kind==="batch_item"&&Re.has(ut.source)&&ut.target_stuff_digest),He=new Set(We.map(ut=>ut.target_stuff_digest)),et=b[re]??a.containmentTree[re]?.[0],zt=(et?o.get(et):void 0)?.io.inputs.find(ut=>He.has(ut.digest));if(zt?.name)return zt.name;let It=We.find(ut=>ut.source===re)??We[0];return It?.target_stuff_digest&&r.stuffRegistry[It.target_stuff_digest]?.name||void 0}function ne(re){let me=o.get(re),Re=a.containmentTree[re]??[];return Re.length===0?me&&me.kind==="operator"?1:0:(me?.pipe_type==="PipeBatch"?Re.slice(0,1):Re).reduce((He,et)=>He+ne(et),0)}function De(re,me){if(re.pipe_type===Do)return Ep(re.pipe_code?.split(".").pop()??"");let Re=re;if(me&&re.pipe_type==="PipeBatch"){let He=o.get(a.containmentTree[re.id]?.[0]??"");He&&(Re=He)}return vD(Re.description??"")||Ep(Re.pipe_code??"")}let bt=new Map(V.map(re=>[re.id,re]));for(let re of t.nodes){let me=bt.get(re.id);if(me){let Re=me.data.isController===!0,We=re.pipe_type,He=De(re,Re),et=R[re.id]??(Re&&We==="PipeBatch"?re.id:void 0),Ye=et?Qe(et):void 0,zt=et?Fue(Ye||"item"):void 0,It=Re?ne(re.id):void 0,ut=me.data.pipeCardData?.onExpand,Ct={kind:"step",title:He,titleFit:Mue(He).fit,category:fHe[We],status:N(re),...i!==void 0?{graphMode:i}:{},...zt?{forEach:zt}:{},...It!==void 0?{innerStepCount:It}:{},...ut?{onExpand:ut}:{}};Be.push({id:re.id,type:AB,data:{nodeData:re,isPipe:!Re,isStuff:!1,isController:Re,labelText:He,pipeCode:re.pipe_code,pipeType:re.pipe_type,graphMode:i,simple:Ct,layoutSize:dHe(He,{forEach:zt!==void 0,innerSteps:It!==void 0})},position:{x:0,y:0}});continue}if(T.has(re.id)){let Re=vD(re.description??"")||Ep(re.pipe_code??"");Be.push({id:re.id,type:dB,data:{nodeData:re,isPipe:!1,isStuff:!1,isController:!0,labelText:Re,pipeCode:re.pipe_code,pipeType:re.pipe_type,graphMode:i,simple:{kind:"decision",title:Re,status:N(re),...i!==void 0?{graphMode:i}:{}},layoutSize:hHe(Re)},position:{x:0,y:0}})}}for(let re of K.values())Be.push(Pe(re,"output"));let ct=re=>{let me=f[re];for(;me;){if(k.has(me))return me;me=f[me]}},Me={};for(let re of k)Me[re]=[];for(let re of Be){let me=re.data.isStuff?void 0:ct(re.id);me&&Me[me].push(re.id)}for(let re of k){let me=ct(re);me&&Me[me].push(re)}let yt=new Set(Object.values(Me).flat());for(let re of k){let me=o.get(re);if(!me)continue;let Re=Fue(Qe(re)||"item");Be.push({id:re,type:_0,data:{nodeData:me,isPipe:!1,isStuff:!1,isController:!0,labelText:Re,pipeCode:me.pipe_code,pipeType:me.pipe_type,graphMode:i,simple:{kind:"frame",title:Re,status:N(me),...i!==void 0?{graphMode:i}:{}}},position:{x:0,y:0}})}let nt=new Set(Be.map(re=>re.id)),gt=new Map,vt=new Set;function Ut(re){if(nt.has(re))return re;if(gt.has(re))return gt.get(re);if(vt.has(re))return;vt.add(re);let me,Re=g.get(re)??c.get(re),We=b[re];if(Re)me=Ut(Re);else if(We&&R[We]===re)me=Ut(We);else if(u(re)===Do){for(let et of o.get(re)?.io.outputs??[])if(et.digest){for(let Ye of a.stuffConsumers[et.digest]??[])me??(me=Ut(Ye));if(!me&&nt.has(Us(et.digest))&&(me=Us(et.digest)),me)break}let He=f[re];!me&&He&&(me=Ut(He))}else for(let He of m[re]??[])if(me=Ut(He),me)break;return vt.delete(re),me&>.set(re,me),me}for(let re of t.nodes)Ut(re.id);return{nodes:Be,edges:[...W.values()],standIns:gt,analysis:{stuffRegistry:r.stuffRegistry,stuffProducers:{},stuffConsumers:{},controllerNodeIds:k,childNodeIds:yt,containmentTree:Me}}}function wHe(e){let[t,n]=Uue;return{width:Math.ceil(Px(e,Pue))+2*t,height:X6e+2*n}}function bHe(e,t,n,r){let a={id:e,source:t,target:n,type:pB,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:1.5},markerEnd:{type:yf,color:"var(--color-edge)"}};return r&&(a.label=r,a.labelStyle={fontSize:`${Pue}px`,fontFamily:"var(--font-sans)",fontWeight:600,fill:"var(--ctrl-condition-text)"},a.labelBgStyle={fill:"var(--simple-edge-label-bg, var(--color-bg))",fillOpacity:.92},a.labelBgPadding=[...Uue],a.labelBgBorderRadius=4,a.labelSize=wHe(r)),a}function Gue(e,t){let n=Que(t.containmentTree),r=new Set(e.nodes.filter(i=>i.pipe_type==="PipeSequence").map(i=>i.id)),a=new Set;for(let i of t.controllerNodeIds){let o=0,s=n[i];for(;s;)o+=1,s=n[s];o>=AHe&&r.has(i)&&a.add(i)}return a}function zue(e){let{nodes:t,edges:n,graphspec:r,analysis:a,controllerPositions:i,onToggleFold:o}=e,s=new Map,l=[];for(let A of t)A.type===_0?s.set(A.id,A):l.push(A);if(a.controllerNodeIds.size===0)return{nodes:l,edges:n};let c=hD(r,a,l,i).map(A=>{let d=s.get(A.id),f=A.id,g=d?.data.simple,h=g?.kind==="frame"&&o?{...g,onFold:w=>o(f,w)}:g;return{...A,type:_0,data:{...d?.data??A.data,simple:h}}});return{nodes:mD([...c,...l]),edges:n}}var xI={[Os.DETAILED]:{defaultFolds:()=>new Set,project:({nodes:e,edges:t,analysis:n})=>({nodes:e,edges:t,analysis:n}),frame:e=>bue(e.nodes,e.edges,e.graphspec,e.analysis,e.showControllers,e.expandedControllers,e.onToggleCollapse,e.controllerPositions,e.onToggleFold)},[Os.SIMPLE]:{defaultFolds:Gue,project:({graphspec:e,nodes:t,analysis:n,rawAnalysis:r})=>n&&r?Hue({graphspec:e,nodes:t,analysis:n,rawAnalysis:r}):{nodes:[],edges:[],analysis:null},frame:e=>e.graphspec&&e.analysis?zue({nodes:e.nodes,edges:e.edges,graphspec:e.graphspec,analysis:e.analysis,controllerPositions:e.controllerPositions,onToggleFold:e.onToggleFold}):{nodes:e.nodes,edges:e.edges}}};var Um=Ue(St(),1);function xHe(e){return e.kind==="pipe"?(0,Um.jsx)("div",{style:{padding:"10px 14px",display:"flex",flexDirection:"column",gap:"2px",textAlign:"center",width:"100%",boxSizing:"border-box",minWidth:0},title:e.label,children:(0,Um.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:"13px",fontWeight:600,color:"var(--color-pipe-text)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label})}):(0,Um.jsxs)("div",{style:{padding:"8px 24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px",textAlign:"center",width:"100%",boxSizing:"border-box",minWidth:0},title:e.concept?`${e.label}: ${e.concept}`:e.label,children:[(0,Um.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:"12px",fontWeight:600,color:"var(--color-stuff-text)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),e.concept&&(0,Um.jsx)("span",{style:{fontSize:"14px",color:"var(--color-stuff-text-dim)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.concept})]})}function que(e){return e.map(t=>t.data.labelDescriptor?{...t,data:{...t.data,label:xHe(t.data.labelDescriptor)}}:t)}var Ox=Ue(Ht(),1);var su=Ue(St(),1);function CI(e,t){let n=t===1?"1 issue":`${t} issues`;switch(e){case Xi.VALIDATING:return t>0?`Validating method\u2026 \u2014 ${n}`:"Validating method\u2026";case Xi.VALID:return t>0?`Method is valid \u2014 ${n}`:"Method is valid";case Xi.INVALID:return`Method is invalid \u2014 ${n}`;case Xi.ERROR:return"Validation could not run";case Xi.UNVALIDATED:return t>0?`Not validated \u2014 ${n} found reading the source`:"Not validated";default:return e}}function CD(e){switch(e){case Da.TOP_LEFT:case Da.TOP_CENTER:return"down-start";case Da.TOP_RIGHT:return"down-end";case Da.BOTTOM_LEFT:case Da.BOTTOM_CENTER:return"up-start";case Da.BOTTOM_RIGHT:return"up-end";case Da.CENTER_LEFT:return"side-end";case Da.CENTER_RIGHT:return"side-start";default:return e}}function CHe(e){switch(e){case Xi.VALIDATING:return"Validating\u2026";case Xi.VALID:return"No issues found.";case Xi.INVALID:return"No details available.";case Xi.ERROR:return"Validation could not run.";case Xi.UNVALIDATED:return"Nothing found reading the source. The method has not been validated.";default:return e}}function Vue({state:e,issues:t,onIssueClick:n,placement:r,id:a}){return(0,su.jsxs)("div",{id:a,className:`graph-validation-panel graph-validation-panel--${r}`,role:"region","aria-label":"Validation issues",children:[(0,su.jsx)("div",{className:"graph-validation-panel-header",children:CI(e,t.length)}),t.length===0?(0,su.jsx)("div",{className:"graph-validation-empty",children:CHe(e)}):(0,su.jsx)("ul",{className:"graph-validation-issues",role:"list",children:t.map((i,o)=>{let s=n!==void 0,l=(i.context||i.file)&&(0,su.jsxs)("div",{className:"graph-validation-issue-meta",children:[i.context&&(0,su.jsx)("span",{className:"graph-validation-issue-context",children:i.context}),i.file&&(0,su.jsx)("span",{className:"graph-validation-issue-file",children:i.file})]});return(0,su.jsx)("li",{className:`graph-validation-issue graph-validation-issue--${i.severity}`+(s?" graph-validation-issue--clickable":""),children:(0,su.jsxs)("div",{className:"graph-validation-issue-body",role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s?()=>n(o,i):void 0,onKeyDown:s?u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(o,i))}:void 0,children:[l,(0,su.jsx)("div",{className:"graph-validation-issue-message",children:i.message}),i.suggestedFix&&(0,su.jsx)("div",{className:"graph-validation-issue-fix",children:i.suggestedFix})]})},o)})})]})}var _p=Ue(Ht(),1);var SD=Ue(Ht(),1);function SI(e,t,n){let r=SD.default.useRef(n);r.current=n,SD.default.useEffect(()=>{if(!e)return;let a=o=>{let s=t.current;s&&o.target instanceof Node&&!s.contains(o.target)&&r.current("outside")},i=o=>{o.key==="Escape"&&r.current("escape")};return document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",i),()=>{document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",i)}},[e,t])}var Na=Ue(St(),1),BD={viewBox:"0 0 24 24",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},SHe={[Os.DETAILED]:(0,Na.jsxs)("svg",{...BD,children:[(0,Na.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,Na.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,Na.jsx)("line",{x1:"14",y1:"4",x2:"21",y2:"4"}),(0,Na.jsx)("line",{x1:"14",y1:"9",x2:"21",y2:"9"}),(0,Na.jsx)("line",{x1:"14",y1:"15",x2:"21",y2:"15"}),(0,Na.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"})]}),[Os.SIMPLE]:(0,Na.jsxs)("svg",{...BD,children:[(0,Na.jsx)("rect",{x:"3",y:"3",width:"8",height:"8",rx:"2"}),(0,Na.jsx)("path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}),(0,Na.jsx)("rect",{x:"13",y:"13",width:"8",height:"8",rx:"2"})]})},BHe=(0,Na.jsx)("svg",{...BD,children:(0,Na.jsx)("polyline",{points:"20 6 9 17 4 12"})});function jue(e){return SHe[e]}function EHe(e){return`Graph style: ${SA[e].name} \u2014 choose how the graph is drawn`}function Kue({value:e,options:t,onChange:n,placement:r}){let[a,i]=_p.default.useState(!1),[o,s]=_p.default.useState(0),l=_p.default.useRef(null),u=_p.default.useRef(null),c=_p.default.useRef([]),A=_p.default.useId();SI(a,l,w=>{i(!1),w==="escape"&&u.current?.focus()}),_p.default.useEffect(()=>{if(!a)return;let w=Math.max(0,t.indexOf(e));s(w),c.current[w]?.focus()},[a]);let d=w=>{let m=t.length,S=(w%m+m)%m;s(S),c.current[S]?.focus()},f=w=>{switch(w.key){case"ArrowDown":w.preventDefault(),d(o+1);break;case"ArrowUp":w.preventDefault(),d(o-1);break;case"Home":w.preventDefault(),d(0);break;case"End":w.preventDefault(),d(t.length-1);break;case"Tab":i(!1);break;default:break}},g=w=>{i(!1),u.current?.focus(),w!==e&&n(w)},h=EHe(e);return(0,Na.jsxs)("div",{className:"graph-toolbar-style",ref:l,children:[(0,Na.jsx)("button",{ref:u,type:"button",className:`graph-toolbar-btn${a?" graph-toolbar-btn--open":""}`,onClick:()=>i(!a),onKeyDown:w=>{(w.key==="ArrowDown"||w.key==="ArrowUp")&&(w.preventDefault(),i(!0))},title:h,"aria-label":h,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?A:void 0,children:jue(e)}),a&&(0,Na.jsx)("div",{id:A,role:"menu","aria-label":"Graph style",className:`graph-style-menu graph-style-menu--${r}`,onKeyDown:f,children:t.map((w,m)=>{let S=SA[w],b=w===e;return(0,Na.jsxs)("button",{ref:B=>{c.current[m]=B},type:"button",role:"menuitemradio","aria-checked":b,tabIndex:m===o?0:-1,className:`graph-style-menu-item${b?" graph-style-menu-item--checked":""}`,onClick:()=>g(w),children:[(0,Na.jsx)("span",{className:"graph-style-menu-icon","aria-hidden":"true",children:jue(w)}),(0,Na.jsxs)("span",{className:"graph-style-menu-text",children:[(0,Na.jsx)("span",{className:"graph-style-menu-name",children:S.name}),(0,Na.jsx)("span",{className:"graph-style-menu-description",children:S.description})]}),(0,Na.jsx)("span",{className:"graph-style-menu-check","aria-hidden":"true",children:b?BHe:null})]},w)})})]})}var ot=Ue(St(),1),_He=15;var IHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,ot.jsx)("polyline",{points:"12 5 19 12 12 19"})]}),LHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,ot.jsx)("polyline",{points:"19 12 12 19 5 12"})]}),THe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})}),RHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),NHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,ot.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,ot.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),(0,ot.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),FHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"}),(0,ot.jsx)("path",{d:"m7 16.5-4.74-2.85"}),(0,ot.jsx)("path",{d:"m7 16.5 5-3"}),(0,ot.jsx)("path",{d:"M7 16.5v5.17"}),(0,ot.jsx)("path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"}),(0,ot.jsx)("path",{d:"m17 16.5-5-3"}),(0,ot.jsx)("path",{d:"m17 16.5 4.74-2.85"}),(0,ot.jsx)("path",{d:"M17 16.5v5.17"}),(0,ot.jsx)("path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"}),(0,ot.jsx)("path",{d:"M12 8 7.26 5.15"}),(0,ot.jsx)("path",{d:"m12 8 4.74-2.85"}),(0,ot.jsx)("path",{d:"M12 13.5V8"})]}),kHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),(0,ot.jsx)("polyline",{points:"2 2 6 6 2 6"}),(0,ot.jsx)("polyline",{points:"22 2 18 6 22 6"}),(0,ot.jsx)("polyline",{points:"2 22 6 18 2 18"}),(0,ot.jsx)("polyline",{points:"22 22 18 18 22 18"})]}),PHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}),(0,ot.jsx)("polyline",{points:"3 3 7 7 3 7"}),(0,ot.jsx)("polyline",{points:"21 3 17 7 21 7"}),(0,ot.jsx)("polyline",{points:"3 21 7 17 3 17"}),(0,ot.jsx)("polyline",{points:"21 21 17 17 21 17"})]}),UHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,ot.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"4"}),(0,ot.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"22"}),(0,ot.jsx)("line",{x1:"4.93",y1:"4.93",x2:"6.34",y2:"6.34"}),(0,ot.jsx)("line",{x1:"17.66",y1:"17.66",x2:"19.07",y2:"19.07"}),(0,ot.jsx)("line",{x1:"2",y1:"12",x2:"4",y2:"12"}),(0,ot.jsx)("line",{x1:"20",y1:"12",x2:"22",y2:"12"}),(0,ot.jsx)("line",{x1:"4.93",y1:"19.07",x2:"6.34",y2:"17.66"}),(0,ot.jsx)("line",{x1:"17.66",y1:"6.34",x2:"19.07",y2:"4.93"})]}),OHe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),DHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),(0,ot.jsx)("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),(0,ot.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),MHe=(0,ot.jsx)("svg",{className:"graph-toolbar-validation-spin",viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),QHe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("polyline",{points:"20 6 9 17 4 12"})}),HHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,ot.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,ot.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),GHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),(0,ot.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,ot.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),zHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,ot.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,ot.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]});function qHe(e){switch(e){case Xi.VALIDATING:return MHe;case Xi.VALID:return QHe;case Xi.INVALID:return HHe;case Xi.ERROR:return GHe;case Xi.UNVALIDATED:return zHe;default:return e}}var ED=[Wi.SYSTEM,Wi.LIGHT,Wi.DARK];function Wue(e){let t=ED.indexOf(e);return ED[(t+1)%ED.length]}function VHe(e){return e===Wi.LIGHT?UHe:e===Wi.DARK?OHe:DHe}function $ue(e){let t={[Wi.SYSTEM]:"system",[Wi.LIGHT]:"light",[Wi.DARK]:"dark"},n=Wue(e);return`Theme: ${t[e]} \u2014 switch to ${t[n]}`}function Xue({direction:e,onDirectionChange:t,showControllers:n,onShowControllersChange:r,graphStyle:a,styleMenuOptions:i=[],onGraphStyleChange:o,onZoomIn:s,onZoomOut:l,onFitView:u,onFoldAll:c,onExpandAll:A,foldAllDisabled:d=!1,expandAllDisabled:f=!1,themeMode:g,onThemeModeChange:h,rightOffset:w=0,position:m,validationState:S,validationIssues:b=[],onValidationIssueClick:B,validationOpen:T=!1,onValidationOpenChange:k}){let R=g!==void 0&&h!==void 0,F=R9(m),N=k??(()=>{}),V=Ox.default.useRef(N);V.current=N;let P=Ox.default.useRef(null),D=Ox.default.useId();Ox.default.useEffect(()=>{S===void 0&&V.current(!1)},[S]),SI(T,P,()=>V.current(!1));let z=a!==void 0&&o!==void 0&&i.length>=2,H=N9(m)==="right"&&w>0?{marginRight:_He+w}:void 0,K=e===$l.TB||e===$l.BT,X=K?"Switch to horizontal layout":"Switch to vertical layout",j=n?"Hide pipe controllers":"Show pipe controllers \u2014 groups pipes by their controlling pipe",Z=c||A,oe=d?"Fold all controllers (nothing to fold)":"Fold all controllers",ve=f?"Expand all controllers (nothing to expand)":"Expand all controllers";return(0,ot.jsx)(B0,{position:m,className:"graph-toolbar-panel",style:H,children:(0,ot.jsxs)("div",{className:`graph-toolbar graph-toolbar--${F}`,children:[S!==void 0&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsxs)("div",{className:"graph-toolbar-validation",ref:P,children:[(0,ot.jsxs)("button",{type:"button",className:`graph-toolbar-btn graph-toolbar-validation-btn graph-toolbar-validation-btn--${S}`,onClick:()=>N(!T),title:CI(S,b.length),"aria-label":CI(S,b.length),"aria-expanded":T,"aria-haspopup":"true","aria-controls":D,children:[qHe(S),b.length>0&&(0,ot.jsx)("span",{className:"graph-toolbar-validation-badge",children:b.length>99?"99+":b.length})]}),T&&(0,ot.jsx)(Vue,{id:D,state:S,issues:b,onIssueClick:B,placement:CD(m)})]}),(0,ot.jsx)("div",{className:"graph-toolbar-separator"})]}),z&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)(Kue,{value:a,options:i,onChange:o,placement:CD(m)}),(0,ot.jsx)("div",{className:"graph-toolbar-separator"})]}),c&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:c,disabled:d,title:oe,"aria-label":oe,children:kHe}),A&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:A,disabled:f,title:ve,"aria-label":ve,children:PHe}),Z&&(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),r&&(0,ot.jsx)("button",{type:"button",className:`graph-toolbar-btn${n?" graph-toolbar-btn--active":""}`,onClick:()=>r(!n),title:j,"aria-label":j,children:FHe}),(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:()=>t(K?$l.LR:$l.TB),title:X,"aria-label":X,children:K?IHe:LHe}),(l||s||u)&&(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),l&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:l,title:"Zoom out","aria-label":"Zoom out",children:THe}),s&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:s,title:"Zoom in","aria-label":"Zoom in",children:RHe}),u&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:u,title:"Fit view","aria-label":"Fit view",children:NHe}),R&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:()=>h(Wue(g)),title:$ue(g),"aria-label":$ue(g),children:VHe(g)})]})]})})}var Jue=Ue(Ht(),1);function Yue(e,t){let n=e.x,r=e.y,a=e.x+e.width,i=e.y+e.height,o=(s,l)=>{!Number.isFinite(s)||!Number.isFinite(l)||(n=Math.min(n,s),r=Math.min(r,l),a=Math.max(a,s),i=Math.max(i,l))};for(let s of t)if(s){for(let l of s.points)o(l.x,l.y);s.label&&(o(s.label.x,s.label.y),o(s.label.x+s.label.width,s.label.y+s.label.height))}return{x:n,y:r,width:a-n,height:i-r}}function Zue(e,t,n=16){if(!(t>0)||!(e.width>0)||!(e.height>0))return null;let r=Math.max(t-2*n,1),a=Math.min(1,r/e.width);return{x:(t-e.width*a)/2-e.x*a,y:n-e.y*a,zoom:a,height:Math.ceil(e.height*a+2*n)}}function ece({onHeight:e}){let t=Hn(s=>s.width),n=x9(),r=v9(),a=y9(),{getNodesBounds:i,setViewport:o}=ow();return Jue.default.useLayoutEffect(()=>{if(!n||r.length===0)return;let s=Yue(i(r),a.map(u=>u.data?.route)),l=Zue(s,t);l&&(o({x:l.x,y:l.y,zoom:l.zoom}),e(l.height))},[n,r,a,t,i,o,e]),null}var _D=Ue(St(),1);function Zv({validation:e,onClick:t}){let n=`${e.count} validation ${e.count===1?"issue":"issues"}`,r=e.lines.join(`
|
|
258
|
+
`)}function HQe({label:e,value:t}){return(0,Gr.jsxs)("div",{className:"detail-field-block",children:[(0,Gr.jsx)("div",{className:"detail-field-block-label",children:e}),(0,Gr.jsx)("div",{className:"detail-field-block-value",children:t})]})}function nue({blueprint:e,depth:t,fieldResolutions:n}){let r=[],a=[],i=[];for(let[s,l]of Object.entries(e.fields))l.method==="template"?i.push([s,l]):l.method==="nested"?a.push([s,l]):r.push([s,l]);let o=t>0?{paddingLeft:t*12}:void 0;return(0,Gr.jsxs)(Gr.Fragment,{children:[r.map(([s,l])=>{let u=DQe(l);return QQe(u)?(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(HQe,{label:s,value:u})},s):(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(Bt,{label:s,value:u})},s)}),i.map(([s,l])=>{let u=n?.[s]?.rendered;return(0,Gr.jsx)("div",{style:o,children:(0,Gr.jsx)(js,{label:`Template \u2014 ${s}`,templateText:l.template??null,renderedText:u})},s)}),a.map(([s,l])=>l.nested?(0,Gr.jsxs)("div",{children:[(0,Gr.jsxs)("div",{className:"detail-nested-header",style:t>0?{paddingLeft:t*12}:void 0,children:[(0,Gr.jsx)("span",{className:"detail-nested-header-name",children:s}),(0,Gr.jsxs)("span",{className:"detail-nested-header-meta",children:["nested \xB7 ",Object.keys(l.nested.fields).length," field",Object.keys(l.nested.fields).length===1?"":"s"]})]}),(0,Gr.jsx)(nue,{blueprint:l.nested,depth:t+1,fieldResolutions:null})]},s):null)]})}function eD({blueprint:e,executionData:t}){let n=t?.rendered_text,r=t?.compose_mode,a=t?.fields??null,i=e.construct_blueprint,o=i!=null&&Object.keys(i.fields).length>0;return(0,Gr.jsxs)(Gr.Fragment,{children:[(0,Gr.jsx)(Bt,{label:"Mode",value:r||(o?"construct":"template")}),(0,Gr.jsx)(Bt,{label:"Category",value:e.category}),(0,Gr.jsx)(Bt,{label:"Templating Style",value:e.templating_style}),e.template&&(0,Gr.jsx)(js,{label:"Template",templateText:e.template,renderedText:n}),o&&(0,Gr.jsxs)(Gr.Fragment,{children:[(0,Gr.jsx)("div",{className:"detail-section-label",children:"FIELDS"}),(0,Gr.jsx)(nue,{blueprint:i,depth:0,fieldResolutions:a})]})]})}var iu=Ue(St(),1),GQe={layout:"auto-layout",html:"HTML template",template_file:"template file"};function zQe(e){return e.template==null&&e.template_file==null?"layout":e.template!=null||e.doc_gen_format==="pdf"?"html":"template_file"}function mI(e){return typeof e=="string"&&e.trim()!==""?e:void 0}function tD({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){let a=mI(e.doc_gen_format),i=hI(e.doc_gen_choice),o=mI(r?.resolved_model),s=!!i||!!o||(n?.length??0)>0,l=mI(r?.source)??zQe(e),u=mI(t?.filename);return(0,iu.jsxs)(iu.Fragment,{children:[(0,iu.jsx)(Bt,{label:"Format",value:a?.toUpperCase()}),s?(0,iu.jsx)(au,{label:"Engine",modelsRan:n,authored:i,handle:o}):(0,iu.jsx)(Bt,{label:"Engine",value:"deck default"}),(0,iu.jsx)(Bt,{label:"Source",value:GQe[l]??l}),(0,iu.jsx)(Bt,{label:"Template File",value:e.template_file}),(0,iu.jsx)(Bt,{label:"File Name",value:e.filename}),u&&u!==e.filename&&(0,iu.jsx)(Bt,{label:"Stored As",value:u}),e.template&&(0,iu.jsx)(js,{label:"Template",templateText:e.template,renderedText:null})]})}var vs=Ue(St(),1);function nD({blueprint:e,executionData:t}){let n=t?.evaluated_expression,r=t?.selected_outcome;return(0,vs.jsxs)(vs.Fragment,{children:[(0,vs.jsx)(VO,{label:"Expression",text:e.expression}),n&&(0,vs.jsx)(Bt,{label:"Expression Result",value:n}),(0,vs.jsxs)("div",{children:[(0,vs.jsx)("div",{className:"detail-section-label",children:"Outcomes"}),Object.entries(e.outcome_map).map(([a,i])=>(0,vs.jsxs)("div",{className:"detail-kv-row",style:r===i?{background:"rgba(80,250,123,0.08)"}:void 0,children:[(0,vs.jsx)("span",{className:"detail-kv-key",children:a}),(0,vs.jsx)("span",{className:"detail-kv-value",style:r===i?{color:"#50FA7B"}:void 0,children:i})]},a)),(0,vs.jsxs)("div",{className:"detail-kv-row",children:[(0,vs.jsx)("span",{className:"detail-kv-key",children:"default"}),(0,vs.jsx)("span",{className:"detail-kv-value",children:e.default_outcome})]})]}),(0,vs.jsx)(Bt,{label:"Alias Expression To",value:e.add_alias_from_expression_to})]})}var CA=Ue(St(),1);function rD({blueprint:e}){return(0,CA.jsxs)("div",{children:[(0,CA.jsx)("div",{className:"detail-section-label",children:"Steps"}),(0,CA.jsx)("div",{className:"detail-steps-list",children:e.sequential_sub_pipes.map((t,n)=>(0,CA.jsxs)("div",{className:"detail-step-item",children:[(0,CA.jsx)("span",{className:"detail-step-index",children:n+1}),uw(t)?(0,CA.jsxs)("span",{className:"detail-step-code",title:"Binding step",children:["from ",t.from_path]}):(0,CA.jsx)("span",{className:"detail-step-code",children:t.pipe_code}),t.output_name&&(0,CA.jsxs)("span",{className:"detail-io-concept",children:["-> ",t.output_name]})]},n))})]})}var ou=Ue(St(),1);function aD({blueprint:e}){return(0,ou.jsxs)(ou.Fragment,{children:[(0,ou.jsxs)("div",{children:[(0,ou.jsx)("div",{className:"detail-section-label",children:"Branches"}),(0,ou.jsx)("div",{className:"detail-steps-list",children:e.parallel_sub_pipes.map((t,n)=>(0,ou.jsxs)("div",{className:"detail-step-item",children:[(0,ou.jsx)("span",{className:"detail-step-code",children:t.pipe_code}),t.output_name&&(0,ou.jsxs)("span",{className:"detail-io-concept",children:["-> ",t.output_name]})]},n))})]}),(0,ou.jsx)(Bt,{label:"Add Each Output",value:e.add_each_output}),(0,ou.jsx)(Bt,{label:"Combined Output",value:e.combined_output})]})}var Df=Ue(St(),1);function iD({blueprint:e,executionData:t}){let n=t?.item_count;return(0,Df.jsxs)(Df.Fragment,{children:[(0,Df.jsx)(Bt,{label:"Branch Pipe",value:e.branch_pipe_code}),(0,Df.jsx)(Bt,{label:"Input List Variable",value:e.batch_params.input_list_stuff_name}),(0,Df.jsx)(Bt,{label:"Input Item Variable",value:e.batch_params.input_item_stuff_name}),n!=null&&(0,Df.jsx)(Bt,{label:"Items Processed",value:n})]})}var Wv=Ue(St(),1);function oD({node:e}){let t=e.execution_data??{},n=typeof t.from=="string"?t.from:e.pipe_code,r=typeof t.result=="string"?t.result:e.io.outputs[0]?.name;return(0,Wv.jsxs)("div",{children:[(0,Wv.jsx)("div",{className:"detail-section-label",children:"Binding"}),(0,Wv.jsx)(Bt,{label:"From",value:n}),(0,Wv.jsx)(Bt,{label:"Result",value:r})]})}var rue=new Set(["PipeLLM","PipeImgGen","PipeExtract","PipeSearch","PipeStructure","PipeCompose","PipeDocGen","PipeSequence","PipeParallel","PipeCondition","PipeBatch"]),qQe={PipeDocGen:new Set(["url"])};function sD(e,t){return rue.has(e)?!t:!0}function lD(e,t){let n=qQe[e],r=Object.entries(t);return n?r.filter(([a])=>!n.has(a)):r}var tn=Ue(St(),1),VQe={PipeLLM:"LLM",PipeExtract:"Extract",PipeCompose:"Compose",PipeImgGen:"ImgGen",PipeSearch:"Search",PipeFunc:"Func",PipeStructure:"Structure",PipeJudge:"Judge",PipeDocGen:"DocGen",PipeSignature:"Signature",PipeSequence:"Seq",PipeParallel:"Par",PipeCondition:"Cond",PipeBatch:"Batch",BindingStep:"Binding"},jQe=new Set(["PipeSequence","PipeParallel","PipeCondition","PipeBatch"]),KQe={succeeded:"#50FA7B",failed:"#FF5555",running:"#8BE9FD",scheduled:"#6272a4",skipped:"#6272a4",canceled:"#6272a4"};function aue({node:e,spec:t,onConceptClick:n}){let r=e.pipe_type,a=jQe.has(r),i=sc(e),o=L9(t),s=!o&&!T9(t),l=VQe[r],u=e.status,c=KQe[u]??"#6272a4",A=uD.default.useMemo(()=>L0(t,e),[t,e]),[d,f]=uD.default.useState(!1),g=e.io?.inputs??[],h=e.io?.outputs??[],w=A?.description??e.description;return(0,tn.jsxs)(tn.Fragment,{children:[(0,tn.jsxs)("div",{className:"detail-sticky-header",children:[(0,tn.jsxs)("div",{className:"detail-header",children:[(0,tn.jsx)("span",{className:`detail-badge ${a?"detail-badge--controller":"detail-badge--operator"}`,children:l}),(0,tn.jsx)("span",{className:`detail-pipe-code ${a?"detail-pipe-code--controller":""}`,children:e.pipe_code})]}),!o&&(0,tn.jsxs)("div",{className:"detail-status",children:[(0,tn.jsx)("span",{className:"detail-status-dot",style:{background:c}}),(0,tn.jsx)("span",{className:"detail-status-label",style:{color:c},children:u}),e.timing?.duration!=null&&(0,tn.jsx)("span",{className:"detail-duration",children:qO(e.timing.duration)}),s&&e.usage&&(0,tn.jsx)(KO,{usage:e.usage,isController:a,expanded:d,onToggle:()=>f(m=>!m)})]}),s&&e.usage&&d&&(0,tn.jsx)($O,{usage:e.usage,isController:a}),w&&(0,tn.jsx)("div",{className:"detail-description",children:w}),g.length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Inputs"}),(0,tn.jsx)("div",{className:"detail-io-list",children:g.map((m,S)=>(0,tn.jsxs)("div",{className:"detail-io-pill",style:{cursor:m.concept&&n?"pointer":void 0},onClick:()=>m.concept&&n?.(m.concept),children:[(0,tn.jsx)("span",{className:"detail-io-name",children:m.name}),m.concept&&(0,tn.jsx)("span",{className:"detail-io-concept",children:m.concept+vf(m.multiplicity)})]},S))})]}),h.length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Output"}),(0,tn.jsx)("div",{className:"detail-io-list",children:h.map((m,S)=>(0,tn.jsxs)("div",{className:"detail-io-pill",style:{cursor:m.concept&&n?"pointer":void 0},onClick:()=>m.concept&&n?.(m.concept),children:[(0,tn.jsx)("span",{className:"detail-io-name",children:m.name}),m.concept&&(0,tn.jsx)("span",{className:"detail-io-concept",children:m.concept+vf(m.multiplicity)})]},S))})]}),(g.length>0||h.length>0)&&(0,tn.jsx)("div",{style:{borderTop:"1px solid rgba(255,255,255,0.06)",margin:"4px 0"}})]}),i&&(0,tn.jsx)(oD,{node:e}),A&&(0,tn.jsx)($Qe,{blueprint:A,executionData:s?e.execution_data:void 0,modelsRan:s?e.usage?.by_model:void 0,modelHandles:e.execution_data}),s&&!i&&e.execution_data&&Object.keys(e.execution_data).length>0&&(0,tn.jsx)(WQe,{executionData:e.execution_data,pipeType:r,hasBlueprint:!!A}),e.error&&(0,tn.jsxs)("div",{className:"detail-error",children:[(0,tn.jsx)("div",{className:"detail-error-type",children:e.error.error_type}),(0,tn.jsx)("div",{className:"detail-error-message",children:e.error.message}),e.error.stack&&(0,tn.jsx)("div",{className:"detail-error-stack",children:e.error.stack})]}),s&&e.metrics&&Object.keys(e.metrics).length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Metrics"}),Object.entries(e.metrics).map(([m,S])=>(0,tn.jsx)(Bt,{label:m,value:typeof S=="number"?S.toLocaleString():String(S)},m))]}),e.tags&&Object.keys(e.tags).length>0&&(0,tn.jsxs)("div",{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Tags"}),(0,tn.jsx)("div",{className:"detail-tags",children:Object.entries(e.tags).map(([m,S])=>(0,tn.jsxs)("span",{className:"detail-tag",children:[(0,tn.jsxs)("span",{className:"detail-tag-key",children:[m,": "]}),(0,tn.jsx)("span",{className:"detail-tag-value",children:S})]},m))})]}),!A&&!i&&(0,tn.jsx)("div",{className:"detail-not-available",children:"Blueprint not available"})]})}function $Qe({blueprint:e,executionData:t,modelsRan:n,modelHandles:r}){switch(e.type){case"PipeLLM":return(0,tn.jsx)(WO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeImgGen":return(0,tn.jsx)(XO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeCompose":return(0,tn.jsx)(eD,{blueprint:e,executionData:t});case"PipeDocGen":return(0,tn.jsx)(tD,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeExtract":return(0,tn.jsx)(YO,{blueprint:e,modelsRan:n,modelHandles:r});case"PipeSearch":return(0,tn.jsx)(ZO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeStructure":return(0,tn.jsx)(JO,{blueprint:e,executionData:t,modelsRan:n,modelHandles:r});case"PipeSequence":return(0,tn.jsx)(rD,{blueprint:e,executionData:t});case"PipeParallel":return(0,tn.jsx)(aD,{blueprint:e,executionData:t});case"PipeCondition":return(0,tn.jsx)(nD,{blueprint:e,executionData:t});case"PipeBatch":return(0,tn.jsx)(iD,{blueprint:e,executionData:t});case"PipeFunc":return null;case"PipeJudge":return null;case"PipeSignature":return(0,tn.jsx)("div",{className:"detail-not-available",children:"Signature stub \u2014 declared but not yet implemented."});default:{let a=e;return null}}}function WQe({executionData:e,pipeType:t,hasBlueprint:n}){return sD(t,n)?(0,tn.jsx)(XQe,{entries:lD(t,e)}):null}function XQe({entries:e}){return e.length===0?null:(0,tn.jsxs)(tn.Fragment,{children:[(0,tn.jsx)("div",{className:"detail-section-label",children:"Execution"}),e.map(([t,n])=>(0,tn.jsx)(Bt,{label:t,value:String(n)},t))]})}var cD=Ue(Ht(),1);var $n=Ue(St(),1);function AD({concept:e,ioData:t,isDryRun:n,renderData:r,instanceKey:a}){let i=t?.multiplicity;return(0,$n.jsxs)($n.Fragment,{children:[(0,$n.jsxs)("div",{className:"detail-header",children:[(0,$n.jsx)("span",{className:"detail-concept-code",children:e.code+vf(i)}),(0,$n.jsx)("span",{className:"detail-concept-domain",children:e.domain_code})]}),nA(i)&&(0,$n.jsx)("div",{className:"detail-multiplicity",children:i===!0?`A variable-length list of ${e.code} items`:`A fixed-length list of exactly ${i} ${e.code} items`}),e.description&&(0,$n.jsx)("div",{className:"detail-description",children:e.description}),e.refines&&(0,$n.jsxs)("div",{className:"detail-refines",children:["refines ",(0,$n.jsx)("span",{className:"detail-refines-code",children:e.refines})]}),(0,$n.jsx)(YQe,{concept:e,ioData:t,isDryRun:n,renderData:r},a??`${e.code}:${t&&"digest"in t?t.digest:t?.name??""}`)]})}function YQe({concept:e,ioData:t,isDryRun:n,renderData:r}){let a=t&&!n?r?.():void 0,i=!!a,[o,s]=cD.default.useState(i?"data":"structure"),l=cD.default.useId(),u=g=>`${l}-tab-${g}`,c=g=>`${l}-tabpanel-${g}`,A=e.json_schema?(0,$n.jsxs)("div",{children:[(0,$n.jsx)("div",{className:"detail-section-label",children:"Structure"}),(0,$n.jsx)(ZQe,{schema:e.json_schema})]}):(0,$n.jsx)("div",{className:"detail-not-available",children:"Schema not available"});if(!i)return A;let d=g=>{let h;switch(g.key){case"ArrowLeft":case"ArrowRight":h=o==="data"?"structure":"data";break;case"Home":h="data";break;case"End":h="structure";break;default:return}g.preventDefault(),s(h),document.getElementById(u(h))?.focus()},f=(g,h)=>(0,$n.jsx)("button",{type:"button",role:"tab",id:u(g),"aria-selected":o===g,"aria-controls":c(g),tabIndex:o===g?0:-1,className:`detail-tab ${o===g?"detail-tab--active":""}`,onClick:()=>s(g),onKeyDown:d,children:h});return(0,$n.jsxs)($n.Fragment,{children:[(0,$n.jsxs)("div",{className:"detail-tabs",role:"tablist","aria-label":"Concept views",children:[f("data","Data"),f("structure","Structure")]}),(0,$n.jsx)("div",{role:"tabpanel",id:c(o),"aria-labelledby":u(o),children:o==="data"?a:A})]})}function ZQe({schema:e}){let t=e.properties,n=new Set(e.required??[]);if(!t||Object.keys(t).length===0)return(0,$n.jsx)("div",{className:"detail-not-available",children:"No fields defined"});let r=Object.entries(t);return(0,$n.jsxs)("table",{className:"detail-schema-table",children:[(0,$n.jsx)("thead",{children:(0,$n.jsxs)("tr",{children:[(0,$n.jsx)("th",{children:"Field"}),(0,$n.jsx)("th",{children:"Type"}),(0,$n.jsx)("th",{}),(0,$n.jsx)("th",{children:"Description"})]})}),(0,$n.jsx)("tbody",{children:r.map(([a,i])=>(0,$n.jsxs)("tr",{children:[(0,$n.jsx)("td",{className:"detail-schema-field",children:a}),(0,$n.jsx)("td",{className:"detail-schema-type",children:JQe(i)}),(0,$n.jsx)("td",{children:n.has(a)&&(0,$n.jsx)("span",{className:"detail-schema-required",children:"req"})}),(0,$n.jsx)("td",{children:i.description??""})]},a))})]})}function JQe(e){return typeof e.type=="string"?e.type:Array.isArray(e.type)?e.type.join(" | "):e.anyOf?"union":e.allOf?"all":typeof e.$ref=="string"?e.$ref.split("/").pop()??"(unresolved type)":"(unresolved type)"}function iue(e){return e.map(t=>({id:t.id,type:t.type,data:t.data,position:t.position,style:t.style,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,parentId:t.parentId,extent:t.extent,selected:t.selected}))}function Xv(e){return e.map(t=>({id:t.id,source:t.source,target:t.target,type:t.type,animated:t.animated,label:t.label,labelStyle:t.labelStyle,labelBgStyle:t.labelBgStyle,labelBgPadding:t.labelBgPadding,labelBgBorderRadius:t.labelBgBorderRadius,style:t.style,markerEnd:t.markerEnd,...t.route?{data:{route:t.route}}:{}}))}var e6e=7,t6e=48,n6e=140;function r6e(e,t,n){let r=[],a=[],i=Iu(e),o=new Set;for(let c of e.edges)c.kind==="parallel_combine"&&c.target_stuff_digest&&o.add(c.target_stuff_digest);let s=new Set;for(let c of Object.values(t.stuffProducers))for(let A of c)s.add(A);for(let c of Object.values(t.stuffConsumers))for(let A of c)s.add(A);for(let c of e.nodes){if(!s.has(c.id)&&!sc(c))continue;let A=V9(c,`nodes[${c.id}]`),d=A.status==="failed",f=A.pipe_code,g=wB(A,i,L0(e,A));r.push({id:A.id,type:Kd,data:{labelDescriptor:{kind:"pipe",label:f,isFailed:d},nodeData:A,isPipe:!0,isStuff:!1,labelText:f,pipeCode:g.pipeCode,pipeType:A.pipe_type,graphMode:i,pipeCardData:g},position:{x:0,y:0}})}for(let[c,A]of Object.entries(t.stuffRegistry)){let d=Us(c),f=A.name,g=A.concept?A.concept+vf(A.multiplicity):"",h=Math.max(f.length,g.length)*e6e+t6e,w=Math.max(n6e,h),m=o.has(c),S=!t.stuffProducers[c]?.length&&!m,b=!S&&!m&&!t.stuffConsumers[c]?.length,B=m?"combined":S?"input":b?"output":void 0,T=S?"var(--color-stuff-input-border, #50FA7B)":b?"var(--color-stuff-output-border, #a78bfa)":m?"var(--color-parallel-combine)":"var(--color-stuff-border)";r.push({id:d,type:_9,data:{labelDescriptor:{kind:"stuff",label:f,concept:g},isStuff:!0,isPipe:!1,labelText:f,stuffRole:B,stuffDigest:c},position:{x:0,y:0},style:{background:"var(--color-stuff-bg)",border:`2px solid ${T}`,borderRadius:"999px",padding:"0",width:w+"px",boxShadow:"var(--shadow-md)"}})}let l=0;for(let[c,A]of Object.entries(t.stuffProducers)){let d=Us(c);for(let f of A)a.push({id:"edge_"+l++,source:f,target:d,type:n,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:2},markerEnd:{type:yf,color:"var(--color-edge)"}})}for(let[c,A]of Object.entries(t.stuffConsumers)){let d=Us(c);for(let f of A)a.push({id:"edge_"+l++,source:d,target:f,type:n,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:2},markerEnd:{type:yf,color:"var(--color-edge)"}})}for(let c of e.edges){if(c.kind!=="parallel_combine"||!c.source_stuff_digest||!c.target_stuff_digest||!t.stuffRegistry[c.source_stuff_digest]||!t.stuffRegistry[c.target_stuff_digest])continue;let A=Us(c.source_stuff_digest),d=Us(c.target_stuff_digest);a.push({id:c.id,source:A,target:d,type:"smoothstep",animated:!1,style:{stroke:"var(--color-parallel-combine)",strokeWidth:2,strokeDasharray:"5,5"},markerEnd:{type:yf,color:"var(--color-parallel-combine)"}})}for(let c of e.edges){if(c.kind!=="batch_item"&&c.kind!=="batch_aggregate"||!c.source_stuff_digest||!c.target_stuff_digest||!t.stuffRegistry[c.source_stuff_digest]||!t.stuffRegistry[c.target_stuff_digest])continue;let A=Us(c.source_stuff_digest),d=Us(c.target_stuff_digest),f=c.kind==="batch_item";a.push({id:c.id,source:A,target:d,type:n,animated:!1,_batchEdge:!0,label:c.label||"",labelStyle:{fontSize:"10px",fontFamily:"var(--font-mono)",fill:f?"var(--color-batch-item)":"var(--color-batch-aggregate)"},labelBgStyle:{fill:"var(--color-bg)",fillOpacity:.9},style:{stroke:f?"var(--color-batch-item)":"var(--color-batch-aggregate)",strokeWidth:2,strokeDasharray:"5,5"},markerEnd:{type:yf,color:f?"var(--color-batch-item)":"var(--color-batch-aggregate)"}})}let u=Lu(e,t);for(let c of a){let A=u[c.source]||null,d=u[c.target]||null;A&&d&&A!==d&&(c._crossGroup=!0,c.style={...c.style,strokeWidth:1.5,opacity:.65})}for(let c of a)c._batchEdge&&(c.style={...c.style,opacity:.7});return{nodes:r,edges:a}}function oue(e,t){if(e){let n=O9(e);if(n&&(Object.keys(n.stuffProducers).length>0||Object.keys(n.stuffConsumers).length>0||e.nodes.some(sc)))return{graphData:r6e(e,n,t),analysis:n}}return{graphData:{nodes:[],edges:[]},analysis:null}}var a6e=window.ELK,sue=a6e;function i6e(e){switch(e){case"LR":return"RIGHT";case"RL":return"LEFT";case"BT":return"UP";default:return"DOWN"}}var o6e="_in",s6e="_out";function fue(e){return e+o6e}function due(e){return e+s6e}function l6e(e,t,n){let r={LR:{inSide:"WEST",outSide:"EAST"},RL:{inSide:"EAST",outSide:"WEST"},TB:{inSide:"NORTH",outSide:"SOUTH"},BT:{inSide:"SOUTH",outSide:"NORTH"}},{inSide:a,outSide:i}=r[n],o=n==="LR"||n==="RL",s=o?n==="LR"?0:t.width:t.width/2,l=o?t.height/2:n==="TB"?0:t.height,u=o?n==="LR"?t.width:0:t.width/2,c=o?t.height/2:n==="TB"?t.height:0;return[{id:fue(e),x:s,y:l,width:1,height:1,layoutOptions:{"elk.port.side":a}},{id:due(e),x:u,y:c,width:1,height:1,layoutOptions:{"elk.port.side":i}}]}var u6e=320,pue=28,c6e=24,fD=8,A6e=22,f6e=50,d6e=16,p6e=3,lue=38,uue=30,gI=22,h6e=140,m6e=100,g6e=17,v6e=58,y6e=5.5,w6e=5,b6e=4.5,x6e=4;function C6e(e,t,n){if(!e)return 0;if(!t)return 1;let r=n-pue,a=Math.max(1,Math.floor(r/y6e)),i=Math.ceil(e.length/a);return Math.min(p6e,Math.max(1,i))}function S6e(e,t){let n=Math.min(h6e,Math.ceil(e.length*w6e)),r=Math.min(m6e,Math.ceil(t.length*b6e));return n+r+g6e}function cue(e,t){if(e.length===0)return 0;let n=t-pue-v6e,r=1,a=0;for(let i of e){let o=S6e(i.name,i.concept);if(a===0){a=o;continue}a+o<=n?a+=o:(r+=1,a=o)}return r}function Yv(e,t){let n=e.data||{};if(n.layoutSize)return{...n.layoutSize};let r=n.isStuff,a=n.labelText||"",i=e.type===Kd,o=t?180:280,s=t?240:400,l=Math.max(180,Math.min(s,a.length*8+60)),u;r?u=Math.max(180,l):i&&n.pipeCardData?u=s:u=Math.max(i?o:200,l);let c;if(r)c=60;else if(i&&n.pipeCardData){let A=n.pipeCardData,d=A.inputs??[],f=A.outputs??[],g=A.description||n.nodeData?.description||"",h=c6e+(t?f6e:A6e),w=C6e(g,t,u);w>0&&(h+=fD+w*d6e);let m=d.slice(0,x6e);if(m.length>0)if(h+=fD,t)h+=lue+(m.length-1)*gI;else{let S=cue(m,u);h+=uue+(S-1)*gI}if(f.length>0)if(h+=fD,t)h+=lue+(f.length-1)*gI;else{let S=cue(f,u);h+=uue+(S-1)*gI}c=Math.min(u6e,h)}else c=i?120:70;return{width:u,height:c}}function B6e(e,t){let n={},r=new Set;function a(i){if(n[i]!==void 0)return n[i];if(r.has(i))return 0;r.add(i);let o=t[i]||[],s=-1;for(let l of o)e.has(l)&&(s=Math.max(s,a(l)));return r.delete(i),n[i]=s+1,n[i]}for(let i of e)a(i);return n}function vI(e,t,n){return{id:e,width:t.width,height:t.height,ports:l6e(e,t,n),layoutOptions:{"elk.portConstraints":"FIXED_POS"}}}function Aue(e,t){let n={id:e.id,sources:[due(e.source)],targets:[fue(e.target)]};return t&&e.label&&e.labelSize&&(n.labels=[{id:`${e.id}_label`,text:e.label,width:e.labelSize.width,height:e.labelSize.height}]),n}function hue(e,t,n,r,a,i){let o=a==="LR"||a==="RL",s=i?.nodesep??80,l=i?.ranksep??70,u=i?.routeEdges??!1,c=i?.groupPadding??{x:mB,top:gB,bottom:vB},A=i6e(a),d="30",f={"elk.algorithm":"layered","elk.direction":A,"elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.spacing.nodeNode":String(s),"elk.layered.spacing.nodeNodeBetweenLayers":String(l),"elk.spacing.edgeNode":d,"elk.spacing.edgeEdge":"20","elk.layered.spacing.edgeNodeBetweenLayers":d,"elk.layered.spacing.edgeEdgeBetweenLayers":"15","elk.layered.nodePlacement.favorStraightEdges":"true"};if(u&&(f["elk.json.edgeCoords"]="ROOT"),!n||!r||r.controllerNodeIds.size===0){let R={},F=e.map(V=>{let P=Yv(V,o);return R[V.id]=P,vI(V.id,P,a)}),N=t.map(V=>Aue(V,u));return{elkGraph:{id:"root",layoutOptions:f,children:F,edges:N},dimensionMap:R}}let g=Lu(n,r),h=B6e(r.controllerNodeIds,r.containmentTree),w={},m=new Map;for(let R of e)m.set(R.id,R);let S={},b=Array.from(r.controllerNodeIds);b.sort((R,F)=>(h[R]??0)-(h[F]??0));for(let R of b){let N=1+(h[R]??0)*.15,V=Math.round(c.x*N),P=Math.round(c.top*N),D=Math.round(c.bottom*N),z={"elk.padding":`[top=${P},left=${V},bottom=${D},right=${V}]`,"elk.spacing.nodeNode":String(s),"elk.layered.spacing.nodeNodeBetweenLayers":String(l),"elk.spacing.edgeNode":d,"elk.layered.spacing.edgeNodeBetweenLayers":d},O=[],H=r.containmentTree[R]||[];for(let K of H)if(r.controllerNodeIds.has(K)){let X=S[K];X&&O.push(X)}else{let X=m.get(K);if(X){let j=Yv(X,o);w[K]=j,O.push(vI(K,j,a))}}for(let K of e)if(K.data.isStuff&&g[K.id]===R&&!O.some(X=>X.id===K.id)){let X=Yv(K,o);w[K.id]=X,O.push(vI(K.id,X,a))}S[R]={id:R,layoutOptions:z,children:O}}let B=[];for(let R of b)if(!g[R]){let F=S[R];F&&B.push(F)}for(let R of e)if(!g[R.id]&&!r.controllerNodeIds.has(R.id)){let F=Yv(R,o);w[R.id]=F,B.push(vI(R.id,F,a))}let T=new Set(e.map(R=>R.id)),k=t.filter(R=>T.has(R.source)&&T.has(R.target)).map(R=>Aue(R,u));return{elkGraph:{id:"root",layoutOptions:f,children:B,edges:k},dimensionMap:w}}function mue(e){let t={};function n(r,a,i){let o=a+(r.x??0),s=i+(r.y??0);r.id!=="root"&&(t[r.id]={x:o,y:s,width:r.width??0,height:r.height??0});for(let l of r.children??[])n(l,o,s)}return n(e,0,0),t}function gue(e){let t={};function n(r){for(let a of r.edges??[]){let i=[];for(let l of a.sections??[])for(let u of[l.startPoint,...l.bendPoints??[],l.endPoint]){let c=i[i.length-1];(!c||c.x!==u.x||c.y!==u.y)&&i.push({x:u.x,y:u.y})}if(i.length<2)continue;let o={points:i},s=a.labels?.[0];s&&s.x!==void 0&&s.y!==void 0&&(o.label={x:s.x,y:s.y,width:s.width??0,height:s.height??0}),t[a.id]=o}for(let a of r.children??[])n(a)}return n(e),t}var dD=null;function E6e(){return dD||(dD=new sue),dD}async function yI(e,t,n,r,a,i){if(e.length===0)return{nodes:[],edges:t,controllerPositions:{}};let o=n==="LR"||n==="RL",{elkGraph:s,dimensionMap:l}=hue(e,t,a??null,i??null,n,r),u=await E6e().layout(s),c=mue(u),A={};if(i)for(let h of i.controllerNodeIds)c[h]&&(A[h]=c[h]);let d=e.map(h=>{let w=c[h.id],m=l[h.id]??Yv(h,o),S=m.width,b=m.height,B=h.data.pipeCardData,k=B?{...B,direction:o?"LR":"TB"}:void 0;return{...h,data:{...h.data,_estimatedWidth:S,_estimatedHeight:b,pipeCardData:k},style:{...h.style,width:S+"px",height:b+"px"},position:{x:w?w.x:0,y:w?w.y:0},sourcePosition:o?n==="LR"?"right":"left":n==="TB"?"bottom":"top",targetPosition:o?n==="LR"?"left":"right":n==="TB"?"top":"bottom"}});if(!r?.routeEdges)return{nodes:d,edges:t,controllerPositions:A};let f=gue(u),g=t.map(h=>{let w=f[h.id];return w?{...h,route:w}:h});return{nodes:d,edges:g,controllerPositions:A}}var vue={"--font-sans":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',"--font-mono":'"JetBrains Mono", "Monaco", "Menlo", monospace'},_6e={...vue,"--surface-page":"#0a0a0a","--surface-panel":"#111118","--surface-overlay":"rgba(17, 17, 24, 0.8)","--surface-overlay-hover":"rgba(30, 30, 40, 0.9)","--surface-overlay-disabled":"rgba(17, 17, 24, 0.6)","--surface-elevated":"rgba(255, 255, 255, 0.06)","--surface-elevated-hover":"rgba(255, 255, 255, 0.1)","--surface-sunken":"rgba(255, 255, 255, 0.03)","--surface-pill":"rgba(255, 255, 255, 0.06)","--surface-pill-border":"rgba(255, 255, 255, 0.08)","--border-subtle":"rgba(255, 255, 255, 0.06)","--border-default":"rgba(255, 255, 255, 0.1)","--border-strong":"rgba(255, 255, 255, 0.18)","--border-dashed":"rgba(255, 255, 255, 0.15)","--text-primary":"#f8fafc","--text-default":"#e2e8f0","--text-secondary":"#cbd5e1","--text-muted":"#94a3b8","--text-dim":"#64748b","--text-on-accent":"#0e0e0e","--shadow-sm":"0 2px 8px rgba(0, 0, 0, 0.4)","--shadow-md":"0 4px 16px rgba(0, 0, 0, 0.6)","--shadow-lg":"0 8px 24px rgba(0, 0, 0, 0.5)","--focus-ring":"rgba(59, 130, 246, 0.6)","--color-pipe":"#ff6b6b","--color-pipe-bg":"rgba(224,108,117,0.18)","--color-pipe-text":"#ffffff","--color-stuff":"#4ECDC4","--color-stuff-bg":"rgba(78,205,196,0.12)","--color-stuff-border":"#9ddcfd","--color-stuff-text":"#98FB98","--color-stuff-text-dim":"#9ddcfd","--color-edge":"#FFFACD","--color-batch-item":"#bd93f9","--color-batch-aggregate":"#50fa7b","--color-parallel-combine":"#d6a4ff","--color-success":"#50FA7B","--color-success-bg":"rgba(80,250,123,0.15)","--color-error":"#FF5555","--color-error-bg":"rgba(255,85,85,0.15)","--color-error-border":"rgba(255,85,85,0.2)","--color-accent":"#8BE9FD","--color-accent-strong":"#3b82f6","--color-warning":"#FFB86C","--ctrl-sequence-border":"rgba(148, 163, 184, 0.25)","--ctrl-sequence-bg":"rgba(148, 163, 184, 0.03)","--ctrl-sequence-text":"#94a3b8","--ctrl-parallel-border":"rgba(139, 233, 253, 0.35)","--ctrl-parallel-bg":"rgba(139, 233, 253, 0.03)","--ctrl-parallel-text":"#8be9fd","--ctrl-condition-border":"rgba(251, 191, 36, 0.35)","--ctrl-condition-bg":"rgba(251, 191, 36, 0.03)","--ctrl-condition-text":"#fbbf24","--ctrl-batch-border":"rgba(167, 139, 250, 0.35)","--ctrl-batch-bg":"rgba(167, 139, 250, 0.03)","--ctrl-batch-text":"#a78bfa","--ctrl-folded-bg":"rgba(148, 163, 184, 0.25)","--ctrl-folded-border":"rgba(148, 163, 184, 0.4)","--color-bg":"#0a0a0a","--color-bg-dots":"rgba(255, 255, 255, 0.35)","--color-text-muted":"#94a3b8","--color-controller-text":"#94a3b8"},I6e={...vue,"--surface-page":"#f8fafc","--surface-panel":"#ffffff","--surface-overlay":"rgba(255, 255, 255, 0.92)","--surface-overlay-hover":"rgba(241, 245, 249, 0.96)","--surface-overlay-disabled":"rgba(255, 255, 255, 0.7)","--surface-elevated":"rgba(15, 23, 42, 0.05)","--surface-elevated-hover":"rgba(15, 23, 42, 0.09)","--surface-sunken":"rgba(15, 23, 42, 0.03)","--surface-pill":"rgba(15, 23, 42, 0.05)","--surface-pill-border":"rgba(15, 23, 42, 0.1)","--border-subtle":"rgba(15, 23, 42, 0.08)","--border-default":"rgba(15, 23, 42, 0.12)","--border-strong":"rgba(15, 23, 42, 0.22)","--border-dashed":"rgba(15, 23, 42, 0.18)","--text-primary":"#020617","--text-default":"#0f172a","--text-secondary":"#1e293b","--text-muted":"#475569","--text-dim":"#64748b","--text-on-accent":"#ffffff","--shadow-sm":"0 2px 8px rgba(15, 23, 42, 0.08)","--shadow-md":"0 4px 16px rgba(15, 23, 42, 0.14)","--shadow-lg":"0 8px 24px rgba(15, 23, 42, 0.15)","--focus-ring":"rgba(2, 132, 199, 0.5)","--color-pipe":"#dc2626","--color-pipe-bg":"rgba(220, 38, 38, 0.1)","--color-pipe-text":"#ffffff","--color-stuff":"#0891b2","--color-stuff-bg":"rgba(8, 145, 178, 0.08)","--color-stuff-border":"#0e7490","--color-stuff-text":"#0f172a","--color-stuff-text-dim":"#475569","--color-edge":"#64748b","--color-batch-item":"#7c3aed","--color-batch-aggregate":"#15803d","--color-parallel-combine":"#6d28d9","--color-success":"#15803d","--color-success-bg":"rgba(21, 128, 61, 0.12)","--color-error":"#dc2626","--color-error-bg":"rgba(220, 38, 38, 0.1)","--color-error-border":"rgba(220, 38, 38, 0.25)","--color-accent":"#0284c7","--color-accent-strong":"#0284c7","--color-warning":"#d97706","--ctrl-sequence-border":"rgba(71, 85, 105, 0.3)","--ctrl-sequence-bg":"rgba(71, 85, 105, 0.04)","--ctrl-sequence-text":"#475569","--ctrl-parallel-border":"rgba(8, 145, 178, 0.4)","--ctrl-parallel-bg":"rgba(8, 145, 178, 0.05)","--ctrl-parallel-text":"#0e7490","--ctrl-condition-border":"rgba(217, 119, 6, 0.4)","--ctrl-condition-bg":"rgba(217, 119, 6, 0.05)","--ctrl-condition-text":"#b45309","--ctrl-batch-border":"rgba(124, 58, 237, 0.4)","--ctrl-batch-bg":"rgba(124, 58, 237, 0.05)","--ctrl-batch-text":"#6d28d9","--ctrl-folded-bg":"rgba(71, 85, 105, 0.18)","--ctrl-folded-border":"rgba(71, 85, 105, 0.35)","--color-bg":"#f8fafc","--color-bg-dots":"rgba(15, 23, 42, 0.18)","--color-text-muted":"#475569","--color-controller-text":"#475569"};function wI(e){return e===Ih.LIGHT?I6e:_6e}var Mf={direction:"LR",showControllers:!1,foldMode:lc.EXPANDED,theme:Wi.SYSTEM,toolbarPosition:Da.TOP_RIGHT,graphStyle:Os.DETAILED,nodesep:50,ranksep:100,edgeType:hB.DEFAULT,initialZoom:null,panToTop:!0};var SA={[Os.DETAILED]:{id:Os.DETAILED,name:"Detailed",description:"Every pipe with its inputs, outputs and settings",capabilities:{controllerFrameToggle:!0,foldAll:!0}},[Os.SIMPLE]:{id:Os.SIMPLE,name:"Simple",description:"The method's steps in plain words",capabilities:{controllerFrameToggle:!1,foldAll:!0},layout:{nodesep:28,ranksep:44,routeEdges:!0,groupPadding:{x:20,top:40,bottom:16}}}},L6e=[Os.DETAILED,Os.SIMPLE];function pD(e){return typeof e=="string"&&Object.hasOwn(SA,e)}function yue(e,t){return pD(e)?e:pD(t)?t:Mf.graphStyle}function wue(e){if(e===void 0||e===!1)return[];let t=e===!0?L6e:e,n=[];for(let r of t)pD(r)&&!n.includes(r)&&n.push(r);return n.length>=2?n:[]}var Fx=5;function T6e(e,t,n){let r=new Set,a=[e];for(;a.length>0;){let i=a.pop();for(let o of t[i]||[])r.add(o),n.has(o)&&a.push(o)}return r}function hD(e,t,n,r){let a={},i=Iu(e);for(let h of n)a[h.id]=h;let o={};for(let h of e.nodes)t.controllerNodeIds.has(h.id)&&(o[h.id]=T0(h,`nodes[${h.id}]`));let s={},l=new Set;function u(h){if(s[h]!==void 0)return s[h];if(l.has(h))throw new Error(`Cycle detected in containment tree: controller "${h}" is part of a containment cycle`);l.add(h);let w=t.containmentTree[h]||[],m=-1;for(let S of w)t.controllerNodeIds.has(S)&&(m=Math.max(m,u(S)));return l.delete(h),s[h]=m+1,s[h]}let c=Lu(e,t),A={};for(let[h,w]of Object.entries(c))I0(h)&&a[h]&&(A[w]||(A[w]=[]),A[w].push(h));let d=Array.from(t.controllerNodeIds);for(let h of d)u(h);d.sort((h,w)=>s[h]-s[w]);let f=[],g={};for(let h of d){let m=(t.containmentTree[h]||[]).filter(D=>a[D]),S=A[h]||[],b=[...m,...S];if(b.length===0)continue;let B,T,k,R,F=r?.[h];if(F)B=F.x,T=F.y,k=F.width,R=F.height;else{let D=1/0,z=1/0,O=-1/0,H=-1/0;for(let ve of b){let M=a[ve],W=M.position,J=F9(M),ie=k9(M);D=Math.min(D,W.x),z=Math.min(z,W.y),O=Math.max(O,W.x+J),H=Math.max(H,W.y+ie)}let X=1+(s[h]??0)*.15,j=Math.round(mB*X),Z=Math.round(gB*X),oe=Math.round(vB*X);B=D-j,T=z-Z,k=O-D+2*j,R=H-z+Z+oe}let N=o[h];if(!N)throw new fw(`nodes[${h}]`,`controller "${h}" is referenced by a "contains" edge but has no corresponding node in graphspec.nodes`);let V=N.pipe_code,P={id:h,type:I9,data:{label:V,pipeType:N.pipe_type,isController:!0,isPipe:!1,isStuff:!1,pipeCode:V,labelText:V,graphMode:i},position:{x:B,y:T},style:{width:k+"px",height:R+"px",padding:"0"}};f.push(P),a[h]=P;for(let D of b)g[D]=h}for(let[h,w]of Object.entries(g)){let m=a[h],S=a[w];!m||!S||(m.position={x:m.position.x-S.position.x,y:m.position.y-S.position.y},m.parentId=w,m.extent="parent")}return f}function bue(e,t,n,r,a,i,o,s,l){if(!a||!r||!n)return{nodes:e,edges:t};let u={},c=new Set,A={};for(let h of n.nodes)r.controllerNodeIds.has(h.id)&&(A[h.id]=T0(h,`nodes[${h.id}]`).pipe_type);for(let h of r.controllerNodeIds){let w=r.containmentTree[h]||[];u[h]=w.length;let m=A[h];(m==="PipeParallel"||m==="PipeBatch")&&w.length>Fx&&!i?.has(h)&&c.add(h)}let d=e,f=t;if(c.size>0){let h=new Set;for(let m of c){let b=(r.containmentTree[m]||[]).slice(Fx);for(let B of b)if(h.add(B),r.controllerNodeIds.has(B))for(let T of T6e(B,r.containmentTree,r.controllerNodeIds))h.add(T)}let w=Lu(n,r);for(let m of e){if(!I0(m.id)||h.has(m.id))continue;let S=w[m.id];if(!S||!c.has(S)&&!h.has(S))continue;let b=t.filter(B=>{if(B.source!==m.id&&B.target!==m.id)return!1;let T=B.source===m.id?B.target:B.source;return!I0(T)});(b.length===0||b.every(B=>{let T=B.source===m.id?B.target:B.source;return h.has(T)}))&&h.add(m.id)}d=e.filter(m=>!h.has(m.id)),f=t.filter(m=>!h.has(m.source)&&!h.has(m.target))}let g=hD(n,r,d,s);if(g.length===0)return{nodes:d,edges:f};for(let h of g){let w=u[h.id]??0,m=c.has(h.id);if(h.data.childCount=w,h.data.isCollapsed=m,o){let S=h.id;h.data.onToggleCollapse=()=>o(S)}if(l){let S=h.id;h.data.onToggleFold=b=>l(S,b)}}return{nodes:mD([...g,...d]),edges:f}}function mD(e){let t={};for(let i of e)t[i.id]=i;let n={},r=new Set;function a(i){if(n[i]!==void 0)return n[i];if(r.has(i))throw new Error(`Cycle detected in node parent chain: node "${i}" references itself as an ancestor`);r.add(i);let o=t[i];return n[i]=o&&o.parentId?1+a(o.parentId):0,r.delete(i),n[i]}for(let i of e)a(i.id);return[...e].sort((i,o)=>n[i.id]-n[o.id])}var R6e=new Set(["ai","api","faq","iban","id","io","ip","json","kpi","ocr","roi","seo","ui","uri","url","uuid","ux"]),N6e=/[aeiouy]/,xue=new Set(["cfg","cm","cnt","ctx","dr","dst","fn","ft","hmm","hr","kg","km","lb","mg","ml","mm","mr","mrs","ms","msg","nd","nth","pkg","pt","rd","src","st","th","tmp","vs"]),F6e=new Set(["cms","css","dns","gps","rss","sms"]),k6e={Html:"HTML",JSON:"JSON",TextAndImages:"Text and images",YesNo:"Yes or no",SearchResult:"Search result",Composite:"Combined results",Dynamic:"Data"},P6e=new Set(["Anything","Dynamic","Composite"]);function Cue(e){return e.length<2||!/^[a-z]+$/.test(e)||xue.has(e)||e.endsWith("s")&&xue.has(e.slice(0,-1))?!1:!N6e.test(e)||R6e.has(e)}function U6e(e,t){return/^\d+$/.test(e)?e:t&&e.length>=2?e.toUpperCase():e.endsWith("s")&&!F6e.has(e)&&Cue(e.slice(0,-1))?e.slice(0,-1).toUpperCase()+"s":Cue(e)?e.toUpperCase():e}function O6e(e){return e.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/([A-Za-z])(\d)/g,"$1 $2").split(/[\s_\-.]+/).filter(n=>n.length>0).map(n=>({word:n.toLowerCase(),wasAllCaps:n.length>=2&&n===n.toUpperCase()&&/[A-Z]/.test(n)}))}function Sue(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function kx(e){let t=e.lastIndexOf(".");return t===-1?e:e.slice(t+1)}function Ep(e){let t=O6e(kx(e.trim()));return t.length===0?"":Sue(t.map(n=>U6e(n.word,n.wasAllCaps)).join(" "))}function gD(e){let t=kx(e.trim());return k6e[t]??Ep(t)}function Bue(e){return P6e.has(kx(e.trim()))}function vD(e){let t=e.replace(/\s+/g," ").trim(),n=t.endsWith(".")&&!t.endsWith("..")?t.slice(0,-1):t;return Sue(n)}var D6e={true:"Yes",false:"No",default:"Otherwise"};function bI(e){return e.split("|").map(r=>r.trim()).filter(r=>r.length>0).map((r,a)=>{let i=D6e[r.toLowerCase()]??Ep(r);return a===0?i:i.charAt(0).toLowerCase()+i.slice(1)}).join(" or ")}var M6e=[[.28,"il .,'"],[.33,"fjt:;!()"],[.35,"/"],[.39,"I"],[.44,"r-"],[.51,"1z"],[.56,'7aceksvxyJ"'],[.59,"25"],[.6,"8"],[.61,"369bdghnopquF?"],[.64,"04"],[.67,"ELPSTZ"],[.72,"ABCDNRUVXY"],[.78,"GHKOQ"],[.8,"w"],[.83,"&"],[.89,"m"],[.94,"M"],[1,"W%"]],Q6e=new Map(M6e.flatMap(([e,t])=>[...t].map(n=>[n,e]))),H6e=.62,G6e=.78;function z6e(e){let t=Q6e.get(e);return t!==void 0?t:e!==e.toLowerCase()?G6e:H6e}function Px(e,t){let n=0;for(let r of e)n+=z6e(r);return n*t}function Ux(e,t,n,r){let a=e.split(/\s+/).filter(u=>u.length>0),i=Px(" ",n),o=a.length===0?0:1,s=0;for(let u of a){let c=Px(u,n);if(c>t){s>0&&(o+=1),s=0;for(let d of u){let f=Px(d,n);s>0&&s+f>t&&(o+=1,s=0),s+=f}continue}let A=s===0?c:s+i+c;A<=t?s=A:(o+=1,s=c)}let l=Math.min(o,r);return{lines:o,drawnLines:l,clamped:o>r}}var Eue="native",yD=160,q6e=200,V6e=12,j6e=10,kue=1.5,K6e=16,wD=6,bD=[{boxWidth:yD,fontPx:15,lineHeightPx:20,maxLines:3},{boxWidth:q6e,fontPx:15,lineHeightPx:20,maxLines:3},{boxWidth:yD,fontPx:13,lineHeightPx:17,maxLines:5},{boxWidth:yD,fontPx:12,lineHeightPx:16,maxLines:7}],$6e=18,W6e=22,Pue=11,X6e=13,Uue=[5,3],Oue=124,Y6e=12,Z6e=10,J6e=16,eHe=13,tHe=17,nHe=2,rHe=17,aHe=52,_ue=[188,220,252,284],Iue=13,iHe=16,Lue=3,oHe=.56,sHe=.4,lHe=84,xD=2;function uHe(e){return e-2*(V6e+kue)-xD}var cHe=Oue-2*Y6e-xD;function Tue(e){return Math.floor(e*oHe)-xD}var AHe=3,fHe={PipeLLM:as.AI,PipeStructure:as.AI,PipeJudge:as.JUDGE,PipeExtract:as.EXTRACT,PipeImgGen:as.IMAGE,PipeSearch:as.SEARCH,PipeFunc:as.CODE,PipeCompose:as.TEMPLATE,PipeDocGen:as.DOCUMENT,PipeSignature:as.PLANNED,PipeSequence:as.STEPS,PipeParallel:as.PARALLEL,PipeCondition:as.DECISION,PipeBatch:as.REPEAT,BindingStep:as.PICK},Due={ai:"AI",extract:"Extract",image:"Image",search:"Search",code:"Code",template:"Template",document:"Document",judge:"Judge",planned:"To build",steps:"Steps",parallel:"Side by side",decision:"Decision",repeat:"For each",pick:"Pick"};function Mue(e){for(let n of bD){let r=Rue(e,n);if(!r.clamped)return{fit:n,wrap:r}}let t=bD[bD.length-1];return{fit:t,wrap:Rue(e,t)}}function dHe(e,t={}){let{fit:n,wrap:r}=Mue(e),a=2*j6e+K6e+wD+Math.max(1,r.drawnLines)*n.lineHeightPx;return t.forEach&&(a+=wD+$6e),t.innerSteps&&(a+=wD+W6e),{width:n.boxWidth,height:Math.ceil(a+2*kue)}}function pHe(e,t){let n=Ux(e,cHe,eHe,nHe),r=Z6e+Math.max(1,n.drawnLines)*tHe+(t?rHe:0)+J6e;return{width:Oue,height:Math.max(aHe,r)}}function hHe(e){let t=_ue[0],n=Ux(e,Tue(t),Iue,Lue);for(let i of _ue.slice(1)){if(!n.clamped)break;t=i,n=Ux(e,Tue(t),Iue,Lue)}let r=Math.max(1,n.drawnLines)*iHe,a=Math.max(lHe,Math.ceil(r/sHe));return{width:t,height:a}}function Rue(e,t){return Ux(e,uHe(t.boxWidth),t.fontPx,t.maxLines)}var mHe=["failed","running","scheduled","canceled","skipped","succeeded"];function Nue(e){for(let t of mHe)if(e.includes(t))return t}function Que(e){let t={};for(let[n,r]of Object.entries(e))for(let a of r)t[a]=n;return t}function gHe(e){return[...new Set(e)]}function vHe(e,t,n){let r=new Map(e.nodes.map(l=>[l.id,l])),a=new Map,i=new Map,o=[];function s(l,u,c){let A=new Map;for(let d of l){let f=r.get(d),g=f?yHe(f):d,h=A.get(g)??0;A.set(g,h+1);let w=`${u}/${g}#${c?"*":h}`,m=a.get(w);m?m.push(d):a.set(w,[d]),o.push(d),s(t.containmentTree[d]??[],w,f?.pipe_type==="PipeBatch")}}s(e.nodes.filter(l=>!t.childNodeIds.has(l.id)).map(l=>l.id),"",!1);for(let l of a.values()){if(l.length<2)continue;let u=Math.max(...l.map(n)),c=l.find(A=>n(A)===u)??l[0];for(let A of l)A!==c&&i.set(A,c)}return{representativeOf:i,order:o}}function yHe(e){let t=e.domain_code&&e.pipe_code?Wl(e.domain_code,e.pipe_code):e.pipe_code??e.pipe_type;return`${e.kind}:${t}`}function Fue(e){let t=Ep(e),n=t.split(" ")[0]??"";return`For each ${n.length>=2&&n===n.toUpperCase()?t:t.charAt(0).toLowerCase()+t.slice(1)}`}function Hue(e){let{graphspec:t,nodes:n,analysis:r,rawAnalysis:a}=e,i=Iu(t),o=new Map(t.nodes.map(re=>[re.id,re])),s=new Map;for(let re of n)re.type===Kd&&s.set(re.id,re);let l=r.controllerNodeIds,u=re=>o.get(re)?.pipe_type,{representativeOf:c,order:A}=vHe(t,a,re=>{if(l.has(re))return 2;let me=s.get(re);return me?me.data.isController!==!0&&o.get(re)?.kind==="controller"?1:2:0}),d=re=>c.get(re)??re,f={};for(let[re,me]of Object.entries(Que(a.containmentTree)))f[re]=d(me);let g=new Map;for(let re of A)for(let me=f[re];me;me=f[me])if(s.get(me)?.data.isController===!0){g.set(re,me);break}let h=re=>g.get(re)??d(re),w=new Set([...c.keys(),...g.keys()]),m={};for(let re of A){let me=f[re];me&&!w.has(re)&&(m[me]??(m[me]=[])).push(re)}function S(re,me){let Re=f[re];for(;Re;){if(Re===me)return!0;Re=f[Re]}return!1}let b={};for(let re of l){if(w.has(re)||u(re)!=="PipeBatch")continue;let me=r.containmentTree[re]?.[0];me&&(b[re]=d(me))}let B=[...l].filter(re=>!w.has(re)&&u(re)==="PipeCondition"),T=new Set(B),k=new Set(Object.entries(b).filter(([re,me])=>!w.has(re)&&l.has(me)).map(([re])=>re)),R={};for(let[re,me]of Object.entries(b))!w.has(re)&&s.has(me)&&(R[me]=re);let F=new Map;for(let re of t.nodes){let me=d(re.id),Re=F.get(me);Re?Re.push(re.status):F.set(me,[re.status])}function N(re){return Nue(F.get(re.id)??[])??re.status}let V=[...s.values()].filter(re=>!w.has(re.id)&&(re.data.pipeType!==Do||Nue(F.get(re.id)??[])==="failed")),P=new Set(V.map(re=>re.id)),D=t.nodes.filter(re=>!a.childNodeIds.has(re.id)&&(re.kind==="controller"||re.kind==="operator")),z=new Set(D.flatMap(re=>re.io.inputs.map(me=>me.digest))),O=new Set(D.flatMap(re=>re.io.outputs.map(me=>me.digest))),H=new Map,K=new Map;for(let re of D)for(let me of re.io.inputs)!me.digest||H.has(me.digest)||O.has(me.digest)||H.set(me.digest,me);for(let re of D)for(let me of re.io.outputs)!me.digest||H.has(me.digest)||K.has(me.digest)||z.has(me.digest)||K.set(me.digest,me);let X=new Map;for(let re of t.edges){let me=re.source_stuff_digest,Re=re.target_stuff_digest;if(!me||!Re||me===Re||re.kind!=="parallel_combine"&&re.kind!=="batch_aggregate"&&re.kind!=="batch_item")continue;let We=X.get(Re);We?We.push(me):X.set(Re,[me])}let j=new Map;function Z(re,me=new Set){let Re=j.get(re);if(Re)return Re;if(H.has(re))return[Us(re)];if(me.has(re))return[];me.add(re);let We=[],He=r.stuffProducers[re]??[];for(let Ye of He){let zt=s.get(h(Ye));if(zt)if(zt.data.pipeType===Do&&!P.has(zt.id))for(let It of o.get(Ye)?.io.inputs??[])It.digest&&We.push(...Z(It.digest,me));else We.push(zt.id)}if(He.length===0)for(let Ye of X.get(re)??[])We.push(...Z(Ye,me));me.delete(re);let et=gHe(We);return j.set(re,et),et}function oe(re,me){let Re=me;for(;f[Re]&&f[Re]!==re;)Re=f[Re];return Re}function ve(re,me){let Re=o.get(me),We=Re?.tags?.outcome;if(We)return bI(We);let He=t.edges.find(Dt=>Dt.kind==="contains"&&d(Dt.source)===re&&Dt.target===me&&Dt.label);if(He?.label)return bI(He.label);let et=o.get(re);if(!et?.domain_code||!et.pipe_code||!Re?.pipe_code)return;let Ye=aN(t,Wl(et.domain_code,et.pipe_code));if(Ye?.type!=="PipeCondition")return;let zt=et.domain_code,It=Re.pipe_code;function ut(Dt){let wt=cw(Dt);if(!wt)return kx(Dt)===It;if(wt.pipeCode!==It)return!1;let An=wt.domainPath??zt;return Re?.domain_code===void 0||Re.domain_code===An}let Ct=Object.entries(Ye.outcome_map).filter(([,Dt])=>ut(Dt)).map(([Dt])=>Dt);return Ye.default_outcome&&ut(Ye.default_outcome)&&Ct.push("default"),Ct.length>0?bI(Ct.join("|")):void 0}function M(re){let me=[],Re=f[re];for(;Re;)T.has(Re)&&me.unshift(Re),Re=f[Re];return me}let W=new Map,J=0;function ie(re,me){if(re===me)return;let Re=`${re}->${me}`;if(W.has(Re))return;let We=T.has(re)?ve(re,oe(re,me)):void 0;W.set(Re,bHe(`simple_edge_${J++}`,re,me,We))}function pe(re,me){let Re=[...re];for(let We of M(me)){let He=Re.filter(et=>!S(et,We));if(He.length!==0){for(let et of He)ie(et,We);Re=[We,...Re.filter(et=>S(et,We))]}}for(let We of Re)ie(We,me)}let ge=new Map;function he(re){let me=Z(re);if(me.length>0)return me;let Re=r.stuffRegistry[re];return Re?(ge.set(re,{name:Re.name,digest:re,...Re.concept!==void 0?{concept:Re.concept}:{},...Re.multiplicity!==void 0?{multiplicity:Re.multiplicity}:{}}),[Us(re)]):[]}function ye(re,me){let Re=h(me);pe(Re===me?he(re):Z(re),Re)}for(let[re,me]of Object.entries(r.stuffConsumers))for(let Re of me)P.has(h(Re))&&ye(re,Re);for(let re of l)if(T.has(h(re)))for(let me of o.get(re)?.io.inputs??[])me.digest&&ye(me.digest,re);for(let re of K.keys())for(let me of Z(re))ie(me,Us(re));for(let[re,me]of[...W]){if(!T.has(me.source))continue;let Re=oe(me.source,me.target);[...W.values()].some(He=>He.target===me.target&&He.source!==me.source&&S(He.source,Re))&&W.delete(re)}function Ce(re){if(P.has(re)||T.has(re))return re;for(let me of m[re]??[]){let Re=Ce(me);if(Re)return Re}}for(let re of B)for(let me of m[re]??[]){let We=[...W.values()].some(He=>He.source===re&&(He.target===me||S(He.target,me)))?void 0:Ce(me);We&&ie(re,We)}let Be=[];function Fe(re){let me=Aw(t,re);return me?me.domain_code===Eue:re.startsWith(`${Eue}.`)||Bue(re)}function Pe(re,me){let Re=re.digest,We=re.concept,He=nA(re.multiplicity),et,Ye;if(me==="output"&&We&&!Fe(We))et=gD(We);else{et=Ep(re.name);let It=We?gD(We):void 0;Ye=It&&It.toLowerCase()!==et.toLowerCase()?It:void 0}let zt={kind:me,title:et,isList:He,...Ye?{subtitle:Ye}:{}};return{id:Us(Re),type:fB,data:{isPipe:!1,isStuff:!0,labelText:et,stuffRole:me,stuffDigest:Re,graphMode:i,simple:zt,layoutSize:pHe(et,Ye!==void 0)},position:{x:0,y:0}}}for(let re of[...H.values(),...ge.values()])Be.push(Pe(re,"input"));function Qe(re){let me=o.get(re);if(me?.domain_code&&me.pipe_code){let ut=aN(t,Wl(me.domain_code,me.pipe_code));if(ut?.type==="PipeBatch"&&ut.batch_params.input_item_stuff_name)return ut.batch_params.input_item_stuff_name}let Re=new Set([re]);for(let[ut,Ct]of c)Ct===re&&Re.add(ut);let We=t.edges.filter(ut=>ut.kind==="batch_item"&&Re.has(ut.source)&&ut.target_stuff_digest),He=new Set(We.map(ut=>ut.target_stuff_digest)),et=b[re]??a.containmentTree[re]?.[0],zt=(et?o.get(et):void 0)?.io.inputs.find(ut=>He.has(ut.digest));if(zt?.name)return zt.name;let It=We.find(ut=>ut.source===re)??We[0];return It?.target_stuff_digest&&r.stuffRegistry[It.target_stuff_digest]?.name||void 0}function ne(re){let me=o.get(re),Re=a.containmentTree[re]??[];return Re.length===0?me&&me.kind==="operator"?1:0:(me?.pipe_type==="PipeBatch"?Re.slice(0,1):Re).reduce((He,et)=>He+ne(et),0)}function De(re,me){if(re.pipe_type===Do)return Ep(re.pipe_code?.split(".").pop()??"");let Re=re;if(me&&re.pipe_type==="PipeBatch"){let He=o.get(a.containmentTree[re.id]?.[0]??"");He&&(Re=He)}return vD(Re.description??"")||Ep(Re.pipe_code??"")}let bt=new Map(V.map(re=>[re.id,re]));for(let re of t.nodes){let me=bt.get(re.id);if(me){let Re=me.data.isController===!0,We=re.pipe_type,He=De(re,Re),et=R[re.id]??(Re&&We==="PipeBatch"?re.id:void 0),Ye=et?Qe(et):void 0,zt=et?Fue(Ye||"item"):void 0,It=Re?ne(re.id):void 0,ut=me.data.pipeCardData?.onExpand,Ct={kind:"step",title:He,titleFit:Mue(He).fit,category:fHe[We],status:N(re),...i!==void 0?{graphMode:i}:{},...zt?{forEach:zt}:{},...It!==void 0?{innerStepCount:It}:{},...ut?{onExpand:ut}:{}};Be.push({id:re.id,type:AB,data:{nodeData:re,isPipe:!Re,isStuff:!1,isController:Re,labelText:He,pipeCode:re.pipe_code,pipeType:re.pipe_type,graphMode:i,simple:Ct,layoutSize:dHe(He,{forEach:zt!==void 0,innerSteps:It!==void 0})},position:{x:0,y:0}});continue}if(T.has(re.id)){let Re=vD(re.description??"")||Ep(re.pipe_code??"");Be.push({id:re.id,type:dB,data:{nodeData:re,isPipe:!1,isStuff:!1,isController:!0,labelText:Re,pipeCode:re.pipe_code,pipeType:re.pipe_type,graphMode:i,simple:{kind:"decision",title:Re,status:N(re),...i!==void 0?{graphMode:i}:{}},layoutSize:hHe(Re)},position:{x:0,y:0}})}}for(let re of K.values())Be.push(Pe(re,"output"));let ct=re=>{let me=f[re];for(;me;){if(k.has(me))return me;me=f[me]}},Me={};for(let re of k)Me[re]=[];for(let re of Be){let me=re.data.isStuff?void 0:ct(re.id);me&&Me[me].push(re.id)}for(let re of k){let me=ct(re);me&&Me[me].push(re)}let yt=new Set(Object.values(Me).flat());for(let re of k){let me=o.get(re);if(!me)continue;let Re=Fue(Qe(re)||"item");Be.push({id:re,type:_0,data:{nodeData:me,isPipe:!1,isStuff:!1,isController:!0,labelText:Re,pipeCode:me.pipe_code,pipeType:me.pipe_type,graphMode:i,simple:{kind:"frame",title:Re,status:N(me),...i!==void 0?{graphMode:i}:{}}},position:{x:0,y:0}})}let nt=new Set(Be.map(re=>re.id)),gt=new Map,vt=new Set;function Ut(re){if(nt.has(re))return re;if(gt.has(re))return gt.get(re);if(vt.has(re))return;vt.add(re);let me,Re=g.get(re)??c.get(re),We=b[re];if(Re)me=Ut(Re);else if(We&&R[We]===re)me=Ut(We);else if(u(re)===Do){for(let et of o.get(re)?.io.outputs??[])if(et.digest){for(let Ye of a.stuffConsumers[et.digest]??[])me??(me=Ut(Ye));if(!me&&nt.has(Us(et.digest))&&(me=Us(et.digest)),me)break}let He=f[re];!me&&He&&(me=Ut(He))}else for(let He of m[re]??[])if(me=Ut(He),me)break;return vt.delete(re),me&>.set(re,me),me}for(let re of t.nodes)Ut(re.id);return{nodes:Be,edges:[...W.values()],standIns:gt,analysis:{stuffRegistry:r.stuffRegistry,stuffProducers:{},stuffConsumers:{},controllerNodeIds:k,childNodeIds:yt,containmentTree:Me}}}function wHe(e){let[t,n]=Uue;return{width:Math.ceil(Px(e,Pue))+2*t,height:X6e+2*n}}function bHe(e,t,n,r){let a={id:e,source:t,target:n,type:pB,animated:!1,style:{stroke:"var(--color-edge)",strokeWidth:1.5},markerEnd:{type:yf,color:"var(--color-edge)"}};return r&&(a.label=r,a.labelStyle={fontSize:`${Pue}px`,fontFamily:"var(--font-sans)",fontWeight:600,fill:"var(--ctrl-condition-text)"},a.labelBgStyle={fill:"var(--simple-edge-label-bg, var(--color-bg))",fillOpacity:.92},a.labelBgPadding=[...Uue],a.labelBgBorderRadius=4,a.labelSize=wHe(r)),a}function Gue(e,t){let n=Que(t.containmentTree),r=new Set(e.nodes.filter(i=>i.pipe_type==="PipeSequence").map(i=>i.id)),a=new Set;for(let i of t.controllerNodeIds){let o=0,s=n[i];for(;s;)o+=1,s=n[s];o>=AHe&&r.has(i)&&a.add(i)}return a}function zue(e){let{nodes:t,edges:n,graphspec:r,analysis:a,controllerPositions:i,onToggleFold:o}=e,s=new Map,l=[];for(let A of t)A.type===_0?s.set(A.id,A):l.push(A);if(a.controllerNodeIds.size===0)return{nodes:l,edges:n};let c=hD(r,a,l,i).map(A=>{let d=s.get(A.id),f=A.id,g=d?.data.simple,h=g?.kind==="frame"&&o?{...g,onFold:w=>o(f,w)}:g;return{...A,type:_0,data:{...d?.data??A.data,simple:h}}});return{nodes:mD([...c,...l]),edges:n}}var xI={[Os.DETAILED]:{defaultFolds:()=>new Set,project:({nodes:e,edges:t,analysis:n})=>({nodes:e,edges:t,analysis:n}),frame:e=>bue(e.nodes,e.edges,e.graphspec,e.analysis,e.showControllers,e.expandedControllers,e.onToggleCollapse,e.controllerPositions,e.onToggleFold)},[Os.SIMPLE]:{defaultFolds:Gue,project:({graphspec:e,nodes:t,analysis:n,rawAnalysis:r})=>n&&r?Hue({graphspec:e,nodes:t,analysis:n,rawAnalysis:r}):{nodes:[],edges:[],analysis:null},frame:e=>e.graphspec&&e.analysis?zue({nodes:e.nodes,edges:e.edges,graphspec:e.graphspec,analysis:e.analysis,controllerPositions:e.controllerPositions,onToggleFold:e.onToggleFold}):{nodes:e.nodes,edges:e.edges}}};var Um=Ue(St(),1);function xHe(e){return e.kind==="pipe"?(0,Um.jsx)("div",{style:{padding:"10px 14px",display:"flex",flexDirection:"column",gap:"2px",textAlign:"center",width:"100%",boxSizing:"border-box",minWidth:0},title:e.label,children:(0,Um.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:"13px",fontWeight:600,color:"var(--color-pipe-text)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label})}):(0,Um.jsxs)("div",{style:{padding:"8px 24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px",textAlign:"center",width:"100%",boxSizing:"border-box",minWidth:0},title:e.concept?`${e.label}: ${e.concept}`:e.label,children:[(0,Um.jsx)("span",{style:{fontFamily:"var(--font-mono)",fontSize:"12px",fontWeight:600,color:"var(--color-stuff-text)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),e.concept&&(0,Um.jsx)("span",{style:{fontSize:"14px",color:"var(--color-stuff-text-dim)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.concept})]})}function que(e){return e.map(t=>t.data.labelDescriptor?{...t,data:{...t.data,label:xHe(t.data.labelDescriptor)}}:t)}var Ox=Ue(Ht(),1);var su=Ue(St(),1);function CI(e,t){let n=t===1?"1 issue":`${t} issues`;switch(e){case Xi.VALIDATING:return t>0?`Validating method\u2026 \u2014 ${n}`:"Validating method\u2026";case Xi.VALID:return t>0?`Method is valid \u2014 ${n}`:"Method is valid";case Xi.INVALID:return`Method is invalid \u2014 ${n}`;case Xi.ERROR:return"Validation could not run";case Xi.UNVALIDATED:return t>0?`Not validated \u2014 ${n} found reading the source`:"Not validated";default:return e}}function CD(e){switch(e){case Da.TOP_LEFT:case Da.TOP_CENTER:return"down-start";case Da.TOP_RIGHT:return"down-end";case Da.BOTTOM_LEFT:case Da.BOTTOM_CENTER:return"up-start";case Da.BOTTOM_RIGHT:return"up-end";case Da.CENTER_LEFT:return"side-end";case Da.CENTER_RIGHT:return"side-start";default:return e}}function CHe(e){switch(e){case Xi.VALIDATING:return"Validating\u2026";case Xi.VALID:return"No issues found.";case Xi.INVALID:return"No details available.";case Xi.ERROR:return"Validation could not run.";case Xi.UNVALIDATED:return"Nothing found reading the source. The method has not been validated.";default:return e}}function Vue({state:e,issues:t,onIssueClick:n,placement:r,id:a}){return(0,su.jsxs)("div",{id:a,className:`graph-validation-panel graph-validation-panel--${r}`,role:"region","aria-label":"Validation issues",children:[(0,su.jsx)("div",{className:"graph-validation-panel-header",children:CI(e,t.length)}),t.length===0?(0,su.jsx)("div",{className:"graph-validation-empty",children:CHe(e)}):(0,su.jsx)("ul",{className:"graph-validation-issues",role:"list",children:t.map((i,o)=>{let s=n!==void 0,l=(i.context||i.file)&&(0,su.jsxs)("div",{className:"graph-validation-issue-meta",children:[i.context&&(0,su.jsx)("span",{className:"graph-validation-issue-context",children:i.context}),i.file&&(0,su.jsx)("span",{className:"graph-validation-issue-file",children:i.file})]});return(0,su.jsx)("li",{className:`graph-validation-issue graph-validation-issue--${i.severity}`+(s?" graph-validation-issue--clickable":""),children:(0,su.jsxs)("div",{className:"graph-validation-issue-body",role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s?()=>n(o,i):void 0,onKeyDown:s?u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(o,i))}:void 0,children:[l,(0,su.jsx)("div",{className:"graph-validation-issue-message",children:i.message}),i.suggestedFix&&(0,su.jsx)("div",{className:"graph-validation-issue-fix",children:i.suggestedFix})]})},o)})})]})}var _p=Ue(Ht(),1);var SD=Ue(Ht(),1);function SI(e,t,n){let r=SD.default.useRef(n);r.current=n,SD.default.useEffect(()=>{if(!e)return;let a=o=>{let s=t.current;s&&o.target instanceof Node&&!s.contains(o.target)&&r.current("outside")},i=o=>{o.key==="Escape"&&r.current("escape")};return document.addEventListener("pointerdown",a,!0),document.addEventListener("keydown",i),()=>{document.removeEventListener("pointerdown",a,!0),document.removeEventListener("keydown",i)}},[e,t])}var Na=Ue(St(),1),BD={viewBox:"0 0 24 24",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},SHe={[Os.DETAILED]:(0,Na.jsxs)("svg",{...BD,children:[(0,Na.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,Na.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,Na.jsx)("line",{x1:"14",y1:"4",x2:"21",y2:"4"}),(0,Na.jsx)("line",{x1:"14",y1:"9",x2:"21",y2:"9"}),(0,Na.jsx)("line",{x1:"14",y1:"15",x2:"21",y2:"15"}),(0,Na.jsx)("line",{x1:"14",y1:"20",x2:"21",y2:"20"})]}),[Os.SIMPLE]:(0,Na.jsxs)("svg",{...BD,children:[(0,Na.jsx)("rect",{x:"3",y:"3",width:"8",height:"8",rx:"2"}),(0,Na.jsx)("path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}),(0,Na.jsx)("rect",{x:"13",y:"13",width:"8",height:"8",rx:"2"})]})},BHe=(0,Na.jsx)("svg",{...BD,children:(0,Na.jsx)("polyline",{points:"20 6 9 17 4 12"})});function jue(e){return SHe[e]}function EHe(e){return`Graph style: ${SA[e].name} \u2014 choose how the graph is drawn`}function Kue({value:e,options:t,onChange:n,placement:r}){let[a,i]=_p.default.useState(!1),[o,s]=_p.default.useState(0),l=_p.default.useRef(null),u=_p.default.useRef(null),c=_p.default.useRef([]),A=_p.default.useId();SI(a,l,w=>{i(!1),w==="escape"&&u.current?.focus()}),_p.default.useEffect(()=>{if(!a)return;let w=Math.max(0,t.indexOf(e));s(w),c.current[w]?.focus()},[a]);let d=w=>{let m=t.length,S=(w%m+m)%m;s(S),c.current[S]?.focus()},f=w=>{switch(w.key){case"ArrowDown":w.preventDefault(),d(o+1);break;case"ArrowUp":w.preventDefault(),d(o-1);break;case"Home":w.preventDefault(),d(0);break;case"End":w.preventDefault(),d(t.length-1);break;case"Tab":i(!1);break;default:break}},g=w=>{i(!1),u.current?.focus(),w!==e&&n(w)},h=EHe(e);return(0,Na.jsxs)("div",{className:"graph-toolbar-style",ref:l,children:[(0,Na.jsx)("button",{ref:u,type:"button",className:`graph-toolbar-btn${a?" graph-toolbar-btn--open":""}`,onClick:()=>i(!a),onKeyDown:w=>{(w.key==="ArrowDown"||w.key==="ArrowUp")&&(w.preventDefault(),i(!0))},title:h,"aria-label":h,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?A:void 0,children:jue(e)}),a&&(0,Na.jsx)("div",{id:A,role:"menu","aria-label":"Graph style",className:`graph-style-menu graph-style-menu--${r}`,onKeyDown:f,children:t.map((w,m)=>{let S=SA[w],b=w===e;return(0,Na.jsxs)("button",{ref:B=>{c.current[m]=B},type:"button",role:"menuitemradio","aria-checked":b,tabIndex:m===o?0:-1,className:`graph-style-menu-item${b?" graph-style-menu-item--checked":""}`,onClick:()=>g(w),children:[(0,Na.jsx)("span",{className:"graph-style-menu-icon","aria-hidden":"true",children:jue(w)}),(0,Na.jsxs)("span",{className:"graph-style-menu-text",children:[(0,Na.jsx)("span",{className:"graph-style-menu-name",children:S.name}),(0,Na.jsx)("span",{className:"graph-style-menu-description",children:S.description})]}),(0,Na.jsx)("span",{className:"graph-style-menu-check","aria-hidden":"true",children:b?BHe:null})]},w)})})]})}var ot=Ue(St(),1),_He=15;var IHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),(0,ot.jsx)("polyline",{points:"12 5 19 12 12 19"})]}),LHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,ot.jsx)("polyline",{points:"19 12 12 19 5 12"})]}),THe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})}),RHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,ot.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),NHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,ot.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,ot.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),(0,ot.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),FHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"}),(0,ot.jsx)("path",{d:"m7 16.5-4.74-2.85"}),(0,ot.jsx)("path",{d:"m7 16.5 5-3"}),(0,ot.jsx)("path",{d:"M7 16.5v5.17"}),(0,ot.jsx)("path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"}),(0,ot.jsx)("path",{d:"m17 16.5-5-3"}),(0,ot.jsx)("path",{d:"m17 16.5 4.74-2.85"}),(0,ot.jsx)("path",{d:"M17 16.5v5.17"}),(0,ot.jsx)("path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"}),(0,ot.jsx)("path",{d:"M12 8 7.26 5.15"}),(0,ot.jsx)("path",{d:"m12 8 4.74-2.85"}),(0,ot.jsx)("path",{d:"M12 13.5V8"})]}),kHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),(0,ot.jsx)("polyline",{points:"2 2 6 6 2 6"}),(0,ot.jsx)("polyline",{points:"22 2 18 6 22 6"}),(0,ot.jsx)("polyline",{points:"2 22 6 18 2 18"}),(0,ot.jsx)("polyline",{points:"22 22 18 18 22 18"})]}),PHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"9",y:"9",width:"6",height:"6",rx:"1"}),(0,ot.jsx)("polyline",{points:"3 3 7 7 3 7"}),(0,ot.jsx)("polyline",{points:"21 3 17 7 21 7"}),(0,ot.jsx)("polyline",{points:"3 21 7 17 3 17"}),(0,ot.jsx)("polyline",{points:"21 21 17 17 21 17"})]}),UHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,ot.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"4"}),(0,ot.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"22"}),(0,ot.jsx)("line",{x1:"4.93",y1:"4.93",x2:"6.34",y2:"6.34"}),(0,ot.jsx)("line",{x1:"17.66",y1:"17.66",x2:"19.07",y2:"19.07"}),(0,ot.jsx)("line",{x1:"2",y1:"12",x2:"4",y2:"12"}),(0,ot.jsx)("line",{x1:"20",y1:"12",x2:"22",y2:"12"}),(0,ot.jsx)("line",{x1:"4.93",y1:"19.07",x2:"6.34",y2:"17.66"}),(0,ot.jsx)("line",{x1:"17.66",y1:"6.34",x2:"19.07",y2:"4.93"})]}),OHe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),DHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),(0,ot.jsx)("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),(0,ot.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),MHe=(0,ot.jsx)("svg",{className:"graph-toolbar-validation-spin",viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),QHe=(0,ot.jsx)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,ot.jsx)("polyline",{points:"20 6 9 17 4 12"})}),HHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,ot.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,ot.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),GHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"}),(0,ot.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,ot.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),zHe=(0,ot.jsxs)("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ot.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,ot.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,ot.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]});function qHe(e){switch(e){case Xi.VALIDATING:return MHe;case Xi.VALID:return QHe;case Xi.INVALID:return HHe;case Xi.ERROR:return GHe;case Xi.UNVALIDATED:return zHe;default:return e}}var ED=[Wi.SYSTEM,Wi.LIGHT,Wi.DARK];function Wue(e){let t=ED.indexOf(e);return ED[(t+1)%ED.length]}function VHe(e){return e===Wi.LIGHT?UHe:e===Wi.DARK?OHe:DHe}function $ue(e){let t={[Wi.SYSTEM]:"system",[Wi.LIGHT]:"light",[Wi.DARK]:"dark"},n=Wue(e);return`Theme: ${t[e]} \u2014 switch to ${t[n]}`}function Xue({direction:e,onDirectionChange:t,showControllers:n,onShowControllersChange:r,graphStyle:a,styleMenuOptions:i=[],onGraphStyleChange:o,onZoomIn:s,onZoomOut:l,onFitView:u,onFoldAll:c,onExpandAll:A,foldAllDisabled:d=!1,expandAllDisabled:f=!1,themeMode:g,onThemeModeChange:h,rightOffset:w=0,position:m,validationState:S,validationIssues:b=[],onValidationIssueClick:B,validationOpen:T=!1,onValidationOpenChange:k}){let R=g!==void 0&&h!==void 0,F=R9(m),N=k??(()=>{}),V=Ox.default.useRef(N);V.current=N;let P=Ox.default.useRef(null),D=Ox.default.useId();Ox.default.useEffect(()=>{S===void 0&&V.current(!1)},[S]),SI(T,P,()=>V.current(!1));let z=a!==void 0&&o!==void 0&&i.length>=2,H=N9(m)==="right"&&w>0?{marginRight:_He+w}:void 0,K=e===$l.TB||e===$l.BT,X=K?"Switch to horizontal layout":"Switch to vertical layout",j=n?"Hide pipe controllers":"Show pipe controllers \u2014 groups pipes by their controlling pipe",Z=c||A,oe=d?"Fold all controllers (nothing to fold)":"Fold all controllers",ve=f?"Expand all controllers (nothing to expand)":"Expand all controllers";return(0,ot.jsx)(B0,{position:m,className:`graph-toolbar-panel graph-toolbar-panel--${F}`,style:H,children:(0,ot.jsxs)("div",{className:`graph-toolbar graph-toolbar--${F}`,children:[S!==void 0&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsxs)("div",{className:"graph-toolbar-validation",ref:P,children:[(0,ot.jsxs)("button",{type:"button",className:`graph-toolbar-btn graph-toolbar-validation-btn graph-toolbar-validation-btn--${S}`,onClick:()=>N(!T),title:CI(S,b.length),"aria-label":CI(S,b.length),"aria-expanded":T,"aria-haspopup":"true","aria-controls":D,children:[qHe(S),b.length>0&&(0,ot.jsx)("span",{className:"graph-toolbar-validation-badge",children:b.length>99?"99+":b.length})]}),T&&(0,ot.jsx)(Vue,{id:D,state:S,issues:b,onIssueClick:B,placement:CD(m)})]}),(0,ot.jsx)("div",{className:"graph-toolbar-separator"})]}),z&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)(Kue,{value:a,options:i,onChange:o,placement:CD(m)}),(0,ot.jsx)("div",{className:"graph-toolbar-separator"})]}),c&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:c,disabled:d,title:oe,"aria-label":oe,children:kHe}),A&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:A,disabled:f,title:ve,"aria-label":ve,children:PHe}),Z&&(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),r&&(0,ot.jsx)("button",{type:"button",className:`graph-toolbar-btn${n?" graph-toolbar-btn--active":""}`,onClick:()=>r(!n),title:j,"aria-label":j,children:FHe}),(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:()=>t(K?$l.LR:$l.TB),title:X,"aria-label":X,children:K?IHe:LHe}),(l||s||u)&&(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),l&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:l,title:"Zoom out","aria-label":"Zoom out",children:THe}),s&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:s,title:"Zoom in","aria-label":"Zoom in",children:RHe}),u&&(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:u,title:"Fit view","aria-label":"Fit view",children:NHe}),R&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("div",{className:"graph-toolbar-separator"}),(0,ot.jsx)("button",{type:"button",className:"graph-toolbar-btn",onClick:()=>h(Wue(g)),title:$ue(g),"aria-label":$ue(g),children:VHe(g)})]})]})})}var Jue=Ue(Ht(),1);function Yue(e,t){let n=e.x,r=e.y,a=e.x+e.width,i=e.y+e.height,o=(s,l)=>{!Number.isFinite(s)||!Number.isFinite(l)||(n=Math.min(n,s),r=Math.min(r,l),a=Math.max(a,s),i=Math.max(i,l))};for(let s of t)if(s){for(let l of s.points)o(l.x,l.y);s.label&&(o(s.label.x,s.label.y),o(s.label.x+s.label.width,s.label.y+s.label.height))}return{x:n,y:r,width:a-n,height:i-r}}function Zue(e,t,n=16){if(!(t>0)||!(e.width>0)||!(e.height>0))return null;let r=Math.max(t-2*n,1),a=Math.min(1,r/e.width);return{x:(t-e.width*a)/2-e.x*a,y:n-e.y*a,zoom:a,height:Math.ceil(e.height*a+2*n)}}function ece({onHeight:e}){let t=Hn(s=>s.width),n=x9(),r=v9(),a=y9(),{getNodesBounds:i,setViewport:o}=ow();return Jue.default.useLayoutEffect(()=>{if(!n||r.length===0)return;let s=Yue(i(r),a.map(u=>u.data?.route)),l=Zue(s,t);l&&(o({x:l.x,y:l.y,zoom:l.zoom}),e(l.height))},[n,r,a,t,i,o,e]),null}var _D=Ue(St(),1);function Zv({validation:e,onClick:t}){let n=`${e.count} validation ${e.count===1?"issue":"issues"}`,r=e.lines.join(`
|
|
259
259
|
`),a=`node-validation-badge node-validation-badge--${e.severity}`,i=e.count>99?"99+":String(e.count);return t?(0,_D.jsx)("button",{type:"button",className:a,title:r,"aria-label":`${n} \u2014 open validation panel`,onClick:o=>{o.stopPropagation(),t()},children:i}):(0,_D.jsx)("span",{className:a,title:r,"aria-label":n,children:i})}function Ip(e){return e?` node-validation-ring--${e.severity}`:""}var BA=Ue(St(),1),jHe={PipeSequence:{badge:"Sequence",icon:"\u2192"},PipeParallel:{badge:"Parallel",icon:"//"},PipeCondition:{badge:"Condition",icon:"\u25C7"},PipeBatch:{badge:"Batch",icon:"\u2261"}};function KHe(e){return e?jHe[e]:{badge:"",icon:""}}function $He(e){return e?`controller-group--${e.replace("Pipe","").toLowerCase()}`:""}function WHe({data:e}){let t=KHe(e.pipeType),n=$He(e.pipeType),r=(e.pipeType==="PipeParallel"||e.pipeType==="PipeBatch")&&(e.childCount??0)>Fx,a=r?(e.childCount??0)-Fx:0;return(0,BA.jsxs)("div",{className:`controller-group-node ${n}${Ip(e.validation)}`,children:[(0,BA.jsxs)("div",{className:"controller-group-header",children:[(0,BA.jsx)("span",{className:"controller-group-icon",children:t.icon}),(0,BA.jsx)("span",{className:"controller-group-badge",children:t.badge}),e.label&&(0,BA.jsx)("span",{className:"controller-group-label",children:e.label}),e.onToggleFold&&(0,BA.jsx)("button",{type:"button",className:"controller-group-fold",title:"Fold controller (alt/option: only this one)","aria-label":"Fold controller",onClick:i=>{i.stopPropagation(),e.onToggleFold?.({soloMode:i.altKey})},children:"\u2921"}),e.validation&&(0,BA.jsx)(Zv,{validation:e.validation,onClick:e.onValidationBadgeClick})]}),r&&(0,BA.jsx)("button",{className:"controller-group-collapse",onClick:i=>{i.stopPropagation(),e.onToggleCollapse?.()},children:e.isCollapsed?`+${a} hidden`:"collapse"})]})}var tce={controllerGroup:WHe};var nce=Ue(Ht(),1);var Jr=Ue(St(),1),XHe={PipeLLM:"LLM",PipeExtract:"Extract",PipeCompose:"Compose",PipeImgGen:"ImgGen",PipeSearch:"Search",PipeFunc:"Func",PipeStructure:"Structure",PipeJudge:"Judge",PipeDocGen:"DocGen",PipeSignature:"Signature",PipeSequence:"Sequence",PipeParallel:"Parallel",PipeCondition:"Condition",PipeBatch:"Batch",BindingStep:"Binding"},YHe={PipeSequence:!0,PipeParallel:!0,PipeCondition:!0,PipeBatch:!0};function ZHe(e){return e in YHe}var JHe={succeeded:{color:"#50FA7B",label:"Succeeded"},failed:{color:"#FF5555",label:"Failed"},running:{color:"#8BE9FD",label:"Running"},scheduled:{color:"#6272a4",label:"Scheduled"},skipped:{color:"#6272a4",label:"Skipped"},canceled:{color:"#6272a4",label:"Canceled"}},ID=4;function e8e(e){return XHe[e]}function Co({data:e,children:t}){let n=e8e(e.pipeType),r=JHe[e.status],a=e.status==="running",i=ZHe(e.pipeType),o=e.pipeType==="PipeSignature",s=e.pipeType===Do,l=e.graphMode==="static",u=l?e.tags?.outcome:void 0,c=l?e.tags?.batch_multiplicity:void 0,[A,d]=(0,nce.useState)(!1),f=e.inputs.length>ID,g=f&&!A?e.inputs.slice(0,ID):e.inputs,h=e.inputs.length-ID,w=e.direction==="TB"?"pipe-card--tb":"pipe-card--lr",m=i?" pipe-card--controller":"",S=o?" pipe-card--signature":"",b=s?" pipe-card--binding":"",B=l?" pipe-card--static":"",T=i?"pipe-card-badge pipe-card-badge--controller":o?"pipe-card-badge pipe-card-badge--signature":s?"pipe-card-badge pipe-card-badge--binding":"pipe-card-badge",k=Ip(e.validation);return(0,Jr.jsxs)("div",{className:`pipe-card ${w}${m}${S}${b}${B}${k}`,children:[(0,Jr.jsxs)("div",{className:"pipe-card-header",children:[(0,Jr.jsx)("span",{className:T,children:n}),e.docGenFormat&&(0,Jr.jsx)("span",{className:"pipe-card-format",title:`Document format: ${e.docGenFormat}`,children:e.docGenFormat.toUpperCase()}),(0,Jr.jsx)("span",{className:"pipe-card-code",title:e.pipeCode,children:e.pipeCode}),!l&&(0,Jr.jsx)("span",{className:"pipe-card-status",style:{color:r.color},title:r.label,children:(0,Jr.jsx)("span",{className:`pipe-card-status-dot ${a?"pipe-card-status-dot--pulse":""}`,style:{background:r.color}})}),e.onExpand&&(0,Jr.jsx)("button",{type:"button",className:"pipe-card-expand",title:"Expand controller (alt/option: only this one)","aria-label":"Expand controller",onClick:R=>{R.stopPropagation(),e.onExpand?.({soloMode:R.altKey})},children:"\u2922"}),e.validation&&(0,Jr.jsx)(Zv,{validation:e.validation,onClick:e.onValidationBadgeClick})]}),(u||c)&&(0,Jr.jsxs)("div",{className:"pipe-card-annotations",children:[u&&(0,Jr.jsxs)("span",{className:"pipe-card-annotation pipe-card-annotation--outcome",children:["outcome: ",u]}),c&&(0,Jr.jsx)("span",{className:"pipe-card-annotation pipe-card-annotation--batch",children:c})]}),e.description&&(0,Jr.jsx)("span",{className:"pipe-card-description",title:e.description,children:e.description}),e.inputs.length>0&&(0,Jr.jsxs)("div",{className:"pipe-card-io",children:[(0,Jr.jsx)("span",{className:"pipe-card-io-label",children:"INPUTS"}),(0,Jr.jsxs)("div",{className:"pipe-card-io-pills",children:[g.map(R=>(0,Jr.jsxs)("span",{className:"pipe-card-io-pill",title:`${R.name}: ${R.concept}`,children:[(0,Jr.jsx)("span",{className:"pipe-card-io-pill-name",children:R.name}),(0,Jr.jsx)("span",{className:"pipe-card-io-pill-concept",children:R.concept})]},R.name)),f&&(0,Jr.jsx)("button",{className:"pipe-card-io-more",onClick:R=>{R.stopPropagation(),d(F=>!F)},children:A?"show less":`+${h} more`})]})]}),e.outputs.length>0&&(0,Jr.jsxs)("div",{className:"pipe-card-io",children:[(0,Jr.jsx)("span",{className:"pipe-card-io-label",children:"OUTPUT"}),(0,Jr.jsx)("div",{className:"pipe-card-io-pills",children:e.outputs.map(R=>(0,Jr.jsxs)("span",{className:"pipe-card-io-pill",title:`${R.name}: ${R.concept}`,children:[(0,Jr.jsx)("span",{className:"pipe-card-io-pill-name",children:R.name}),(0,Jr.jsx)("span",{className:"pipe-card-io-pill-concept",children:R.concept})]},R.name))})]}),t]})}var t8e={PipeLLM:Co,PipeExtract:Co,PipeCompose:Co,PipeImgGen:Co,PipeSearch:Co,PipeFunc:Co,PipeStructure:Co,PipeJudge:Co,PipeDocGen:Co,PipeSignature:Co,PipeSequence:Co,PipeParallel:Co,PipeCondition:Co,PipeBatch:Co,BindingStep:Co};function rce(e){return t8e[e]}var Qf=Ue(St(),1);function n8e({data:e}){let t=rce(e.pipeType)??Co;return(0,Qf.jsx)(t,{data:e})}function ace({data:e,sourcePosition:t=nn.Bottom,targetPosition:n=nn.Top}){let r=e.pipeCardData;return r?(0,Qf.jsxs)(Qf.Fragment,{children:[(0,Qf.jsx)(tA,{type:"target",position:n}),(0,Qf.jsx)(n8e,{data:r}),(0,Qf.jsx)(tA,{type:"source",position:t})]}):null}var ze=Ue(St(),1),r8e={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function Jv({size:e=13,children:t}){return(0,ze.jsx)("svg",{...r8e,width:e,height:e,children:t})}var TD={ai:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"M9.94 15.5a2 2 0 0 0-1.44-1.44l-6.13-1.58a.5.5 0 0 1 0-.96L8.5 9.94A2 2 0 0 0 9.94 8.5l1.58-6.14a.5.5 0 0 1 .96 0l1.58 6.14a2 2 0 0 0 1.44 1.44l6.14 1.58a.5.5 0 0 1 0 .96l-6.14 1.58a2 2 0 0 0-1.44 1.44l-1.58 6.13a.5.5 0 0 1-.96 0z"}),(0,ze.jsx)("path",{d:"M20 3v4"}),(0,ze.jsx)("path",{d:"M22 5h-4"})]}),extract:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"M3 7V5a2 2 0 0 1 2-2h2"}),(0,ze.jsx)("path",{d:"M17 3h2a2 2 0 0 1 2 2v2"}),(0,ze.jsx)("path",{d:"M21 17v2a2 2 0 0 1-2 2h-2"}),(0,ze.jsx)("path",{d:"M7 21H5a2 2 0 0 1-2-2v-2"}),(0,ze.jsx)("path",{d:"M7 8h8"}),(0,ze.jsx)("path",{d:"M7 12h10"}),(0,ze.jsx)("path",{d:"M7 16h6"})]}),image:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,ze.jsx)("circle",{cx:"9",cy:"9",r:"2"}),(0,ze.jsx)("path",{d:"m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"})]}),search:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,ze.jsx)("path",{d:"m21 21-4.3-4.3"})]}),code:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("polyline",{points:"16 18 22 12 16 6"}),(0,ze.jsx)("polyline",{points:"8 6 2 12 8 18"})]}),template:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,ze.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,ze.jsx)("path",{d:"M16 13H8"}),(0,ze.jsx)("path",{d:"M16 17H8"})]}),document:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,ze.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,ze.jsx)("path",{d:"M12 18v-6"}),(0,ze.jsx)("path",{d:"m9 15 3 3 3-3"})]}),judge:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"}),(0,ze.jsx)("path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"}),(0,ze.jsx)("path",{d:"M7 21h10"}),(0,ze.jsx)("path",{d:"M12 3v18"}),(0,ze.jsx)("path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2"})]}),planned:(0,ze.jsx)("circle",{cx:"12",cy:"12",r:"9",strokeDasharray:"3 3"}),steps:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"}),(0,ze.jsx)("path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"}),(0,ze.jsx)("path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"})]}),parallel:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"M16 3h5v5"}),(0,ze.jsx)("path",{d:"M8 3H3v5"}),(0,ze.jsx)("path",{d:"M12 22v-8.3a4 4 0 0 0-1.17-2.87L3 3"}),(0,ze.jsx)("path",{d:"m15 9 6-6"})]}),decision:(0,ze.jsx)("path",{d:"M12 2 22 12 12 22 2 12Z"}),repeat:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("path",{d:"m17 2 4 4-4 4"}),(0,ze.jsx)("path",{d:"M3 11v-1a4 4 0 0 1 4-4h14"}),(0,ze.jsx)("path",{d:"m7 22-4-4 4-4"}),(0,ze.jsx)("path",{d:"M21 13v1a4 4 0 0 1-4 4H3"})]}),pick:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("polyline",{points:"15 10 20 15 15 20"}),(0,ze.jsx)("path",{d:"M4 4v7a4 4 0 0 0 4 4h12"})]})},a8e=(0,ze.jsxs)(Jv,{size:12,children:[(0,ze.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,ze.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,ze.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),(0,ze.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),i8e=(0,ze.jsxs)(Jv,{size:12,children:[(0,ze.jsx)("polyline",{points:"4 14 10 14 10 20"}),(0,ze.jsx)("polyline",{points:"20 10 14 10 14 4"}),(0,ze.jsx)("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),(0,ze.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),ice={succeeded:"Done",failed:"Failed",running:"Running",scheduled:"Waiting",skipped:"Skipped",canceled:"Canceled"},o8e={succeeded:(0,ze.jsx)("polyline",{points:"20 6 9 17 4 12"}),failed:(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,ze.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),running:(0,ze.jsx)("path",{d:"M21 12a9 9 0 1 1-6.22-8.56"}),scheduled:(0,ze.jsx)("circle",{cx:"12",cy:"12",r:"8"}),skipped:(0,ze.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),canceled:(0,ze.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})};function RD({status:e,graphMode:t}){return t==="static"?null:(0,ze.jsx)("span",{className:`simple-status simple-status--${e}`,title:ice[e],"aria-label":ice[e],children:(0,ze.jsx)(Jv,{size:11,children:o8e[e]})})}function ND({sourcePosition:e=nn.Right,targetPosition:t=nn.Left,children:n}){return(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(tA,{type:"target",position:t,className:"simple-handle"}),n,(0,ze.jsx)(tA,{type:"source",position:e,className:"simple-handle"})]})}function FD({validation:e,onClick:t}){return e?(0,ze.jsx)(Zv,{validation:e,onClick:t}):null}function BI(e,t){let n=e.simple;return!n||!t.includes(n.kind)?null:n}function s8e({data:e,sourcePosition:t,targetPosition:n}){let r=BI(e,["step"]);if(!r)return null;let a=r.graphMode!=="static"?` simple-step--${r.status}`:"";return(0,ze.jsx)(ND,{sourcePosition:t,targetPosition:n,children:(0,ze.jsxs)("div",{className:`simple-step simple-step--${r.category}${a}${Ip(e.validation)}`,children:[(0,ze.jsxs)("div",{className:"simple-step-header",children:[(0,ze.jsxs)("span",{className:"simple-step-category",children:[(0,ze.jsx)(Jv,{children:TD[r.category]}),Due[r.category]]}),(0,ze.jsx)(RD,{status:r.status,graphMode:r.graphMode}),(0,ze.jsx)(FD,{validation:e.validation,onClick:e.onValidationBadgeClick})]}),(0,ze.jsx)("div",{className:"simple-step-title",title:r.title,style:{fontSize:r.titleFit.fontPx,lineHeight:`${r.titleFit.lineHeightPx}px`,WebkitLineClamp:r.titleFit.maxLines},children:r.title}),r.forEach&&(0,ze.jsxs)("span",{className:"simple-step-foreach",children:[(0,ze.jsx)(Jv,{size:11,children:TD.repeat}),r.forEach]}),r.innerStepCount!==void 0&&(0,ze.jsxs)("button",{type:"button",className:"simple-step-open",title:"Show the steps inside (alt/option: only this one)",onClick:i=>{i.stopPropagation(),r.onExpand?.({soloMode:i.altKey})},disabled:!r.onExpand,children:[a8e,r.innerStepCount===1?"1 step inside":`${r.innerStepCount} steps inside`]})]})})}var l8e="M1 1 H99 V84 C80 98 62 74 44 86 C28 96 14 96 1 88 Z";function LD({className:e}){return(0,ze.jsx)("svg",{className:e,viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:(0,ze.jsx)("path",{d:l8e,vectorEffect:"non-scaling-stroke"})})}function u8e({data:e,sourcePosition:t,targetPosition:n}){let r=BI(e,["input","output"]);return r?(0,ze.jsx)(ND,{sourcePosition:t,targetPosition:n,children:(0,ze.jsxs)("div",{className:`simple-terminal simple-terminal--${r.kind}${r.isList?" simple-terminal--list":""}`,children:[r.isList&&(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(LD,{className:"simple-terminal-shape simple-terminal-shape--back2"}),(0,ze.jsx)(LD,{className:"simple-terminal-shape simple-terminal-shape--back1"})]}),(0,ze.jsx)(LD,{className:"simple-terminal-shape"}),(0,ze.jsxs)("div",{className:"simple-terminal-text",children:[(0,ze.jsx)("span",{className:"simple-terminal-title",title:r.title,children:r.title}),r.subtitle&&(0,ze.jsx)("span",{className:"simple-terminal-subtitle",children:r.subtitle})]})]})}):null}function c8e({data:e,sourcePosition:t,targetPosition:n}){let r=BI(e,["decision"]);if(!r)return null;let a=r.graphMode!=="static"?` simple-decision--${r.status}`:"";return(0,ze.jsx)(ND,{sourcePosition:t,targetPosition:n,children:(0,ze.jsxs)("div",{className:`simple-decision${a}${Ip(e.validation)}`,children:[(0,ze.jsx)("svg",{className:"simple-decision-shape",viewBox:"0 0 100 100",preserveAspectRatio:"none","aria-hidden":"true",children:(0,ze.jsx)("path",{d:"M50 1 L99 50 L50 99 L1 50 Z",vectorEffect:"non-scaling-stroke"})}),(0,ze.jsx)("div",{className:"simple-decision-text",title:r.title,children:r.title}),(0,ze.jsxs)("div",{className:"simple-decision-marks",children:[(0,ze.jsx)(RD,{status:r.status,graphMode:r.graphMode}),(0,ze.jsx)(FD,{validation:e.validation,onClick:e.onValidationBadgeClick})]})]})})}function A8e({data:e}){let t=BI(e,["frame"]);return t?(0,ze.jsx)("div",{className:`simple-frame${Ip(e.validation)}`,children:(0,ze.jsxs)("div",{className:"simple-frame-header",children:[(0,ze.jsxs)("span",{className:"simple-frame-title",children:[(0,ze.jsx)(Jv,{size:12,children:TD.repeat}),t.title]}),(0,ze.jsx)(RD,{status:t.status,graphMode:t.graphMode}),(0,ze.jsx)(FD,{validation:e.validation,onClick:e.onValidationBadgeClick}),t.onFold&&(0,ze.jsx)("button",{type:"button",className:"simple-frame-fold",title:"Fold into one step (alt/option: only this one)","aria-label":"Fold into one step",onClick:n=>{n.stopPropagation(),t.onFold?.({soloMode:n.altKey})},children:i8e})]})}):null}var oce={[AB]:s8e,[fB]:u8e,[dB]:c8e,[_0]:A8e};function sce(e,t,n){return Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n}function uce(e,t,n,r=8){if(e.length<2)return null;let a=e[0],i=e[e.length-1];if(!sce(a,t,r)||!sce(i,n,r))return null;let o=e.map(l=>({x:l.x,y:l.y})),s=o.length-1;return o.length>2&&(lce(o,0,1,t),lce(o,s,s-1,n)),o[0]={x:t.x,y:t.y},o[s]={x:n.x,y:n.y},o}function lce(e,t,n,r){let a=e[t],i=e[n];Math.abs(a.y-i.y)<=.5?i.y=r.y:Math.abs(a.x-i.x)<=.5&&(i.x=r.x)}function cce(e,t=8){if(e.length===0)return"";let n=[`M ${e[0].x},${e[0].y}`];for(let a=1;a<e.length-1;a++){let i=e[a-1],o=e[a],s=e[a+1],l=Math.hypot(o.x-i.x,o.y-i.y),u=Math.hypot(s.x-o.x,s.y-o.y),c=Math.min(t,l/2,u/2);if(c<=0){n.push(`L ${o.x},${o.y}`);continue}let A={x:o.x+(i.x-o.x)/l*c,y:o.y+(i.y-o.y)/l*c},d={x:o.x+(s.x-o.x)/u*c,y:o.y+(s.y-o.y)/u*c};n.push(`L ${A.x},${A.y}`,`Q ${o.x},${o.y} ${d.x},${d.y}`)}let r=e[e.length-1];return n.push(`L ${r.x},${r.y}`),n.join(" ")}function f8e(e){if(e.length===0)return{x:0,y:0};let t=0;for(let r=1;r<e.length;r++)t+=Math.hypot(e[r].x-e[r-1].x,e[r].y-e[r-1].y);let n=t/2;for(let r=1;r<e.length;r++){let a=e[r-1],i=e[r],o=Math.hypot(i.x-a.x,i.y-a.y);if(o>=n&&o>0){let s=n/o;return{x:a.x+(i.x-a.x)*s,y:a.y+(i.y-a.y)*s}}n-=o}return e[e.length-1]}function Ace(e,t){return e.label?{x:e.label.x+e.label.width/2,y:e.label.y+e.label.height/2}:f8e(t)}var dce=Ue(St(),1);function fce({id:e,sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:i,targetPosition:o,data:s,label:l,labelStyle:u,labelShowBg:c,labelBgStyle:A,labelBgPadding:d,labelBgBorderRadius:f,style:g,markerEnd:h,markerStart:w,interactionWidth:m}){let S=s?.route,b=S?uce(S.points,{x:t,y:n},{x:r,y:a}):null,B,T,k;return S&&b?(B=cce(b),{x:T,y:k}=Ace(S,b)):[B,T,k]=Eh({sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:i,targetPosition:o,borderRadius:8}),(0,dce.jsx)(E0,{id:e,path:B,labelX:T,labelY:k,label:l,labelStyle:u,labelShowBg:c,labelBgStyle:A,labelBgPadding:d,labelBgBorderRadius:f,style:g,markerEnd:h,markerStart:w,interactionWidth:m})}var So=Ue(St(),1),d8e={...tce,pipeCard:ace,...oce},p8e={[pB]:fce},h8e={panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,edgesFocusable:!1,elementsSelectable:!1,disableKeyboardA11y:!0};function m8e({nodeId:e,stuffData:t,producerPipeRef:n,consumer:r,graphspec:a,artifacts:i,theme:o,resolveUrl:s,resolveShareUrl:l,saveFiles:u,downloads:c}){let A=t.concept&&a?Aw(a,t.concept):void 0,d=Iu(a)===cB.DRY,f=$le(i),g=f?()=>(0,So.jsx)(Kle,{...f,stuff:t,...A?{concept:A}:{},...n?{producerPipeRef:n}:{},...r?{consumer:r}:{},...s?{resolveUrl:s}:{},...l?{resolveShareUrl:l}:{},...u?{saveFiles:u}:{},...c?{downloads:c}:{},theme:o}):void 0;return A?(0,So.jsx)(AD,{concept:A,ioData:t,isDryRun:d,instanceKey:e,renderData:g}):d?(0,So.jsx)("div",{className:"detail-not-available",children:"Dry run data hidden"}):(0,So.jsx)(So.Fragment,{children:g?.()??(0,So.jsx)("div",{className:"detail-not-available",children:"No data"})})}function g8e(e,t){return e===lc.FOLDED?new Set(t):new Set}function v8e(e,t){return e??t??Mf.theme??Wi.SYSTEM}function kD(e,t){return e===Wi.SYSTEM?t:e}function y8e(e,t){return e??t??Mf.toolbarPosition}function pce(e){return e?.replace(/\s*\bnode-validation-flash\b/,"")||void 0}function w8e(e){return e.map(t=>({...t,position:{...t.position},data:{...t.data},style:t.style?{...t.style}:void 0}))}function hce(e){let t=e.simple;return t?"status"in t?t.status:void 0:e.pipeCardData?.status}function b8e(e,t){return!t||Object.keys(t).length===0?e:e.map(n=>{if(n.data.graphMode==="static"||n.data.pipeCardData?.graphMode==="static"||n.data.pipeType===Do)return n;let r=n.data.pipeCode;if(!r||!Object.hasOwn(t,r))return n;let a=t[r],i=n.data.simple,o=i&&"status"in i?i:void 0;return hce(n.data)===a?n:{...n,data:{...n.data,nodeData:n.data.nodeData?{...n.data.nodeData,status:a}:n.data.nodeData,pipeCardData:n.data.pipeCardData?{...n.data.pipeCardData,status:a}:n.data.pipeCardData,simple:o?{...o,status:a}:i}}})}function mce(e){let{graph:t,config:n=Mf,initialDirection:r,initialShowControllers:a,initialFoldMode:i,hideToolbar:o=!1,interactive:s=!0,theme:l,graphStyle:u,onGraphStyleChange:c,styleMenu:A,toolbarPosition:d,systemTheme:f,showThemeToggle:g=!0,onThemeChange:h,onNavigateToPipe:w,onStuffNodeClick:m,onReactFlowInit:S,statusMap:b,onNodeSelect:B,onPaneClick:T,renderDetailExtra:k,resolveUrl:R,resolveShareUrl:F,saveFiles:N,downloads:V,validationState:P,validationIssues:D,onValidationIssueClick:z}=e,O=t?.graphSpec??null,H=Et.default.useMemo(()=>O===null?null:dw(O),[O]),[K,X]=Et.default.useState(()=>r??n.direction??Mf.direction??$l.TB),j=v8e(l,n.theme),[Z,oe]=Et.default.useState(j),ve=Et.default.useRef(j);Et.default.useEffect(()=>{j!==ve.current&&(ve.current=j,oe(j))},[j]);let M=U9(f),W=kD(Z,M),J=Et.default.useRef(h);J.current=h;let ie=Et.default.useRef({mode:Z,resolvedTheme:W});Et.default.useEffect(()=>{let Rt=ie.current;(Rt.mode!==Z||Rt.resolvedTheme!==W)&&(ie.current={mode:Z,resolvedTheme:W},J.current?.(Z,W))},[Z,W]);let pe=yue(u,n.graphStyle),[ge,he]=Et.default.useState(pe),ye=Et.default.useRef(pe);Et.default.useEffect(()=>{pe!==ye.current&&(ye.current=pe,he(pe))},[pe]);let Ce=Et.default.useRef(c);Ce.current=c;let Be=Et.default.useRef(ge);Et.default.useEffect(()=>{Be.current!==ge&&(Be.current=ge,Ce.current?.(ge))},[ge]);let Fe=Et.default.useRef(ge);Fe.current=ge;let Pe=SA[ge].capabilities,Qe=i??n.foldMode??Mf.foldMode??lc.EXPANDED,[ne,De]=Et.default.useState(()=>Qe===lc.FOLDED?!0:a??n.showControllers??Mf.showControllers??!1),bt=Et.default.useRef(Qe);bt.current=Qe;let ct=Et.default.useRef(null),[Me,yt]=Et.default.useState(null),[nt,gt]=Et.default.useState(null),{width:vt,isDragging:Ut,handleMouseDown:re}=Yle({defaultWidth:380,minWidth:280,maxWidth:800,containerRef:ct});Et.default.useEffect(()=>{yt(null),gt(null)},[H]),Et.default.useEffect(()=>{let Rt=ct.current;if(!Rt)return;let pt=wI(W),ft=n.paletteColors,fn=ft?{...pt,...ft}:pt;for(let[Sn,cn]of Object.entries(fn))Rt.style.setProperty(Sn,cn);return()=>{for(let Sn of Object.keys(fn))Rt.style.removeProperty(Sn)}},[n.paletteColors,W]);let[me,Re]=Et.default.useState(120),[We,He,et]=w9([]),[Ye,zt,It]=b9([]),ut=Et.default.useRef(null),Ct=Et.default.useRef(null),Dt=Et.default.useRef(null),wt=Et.default.useRef(null),[An,Tt]=Et.default.useState(new Set),$t=Et.default.useCallback(Rt=>{Tt(pt=>{let ft=new Set(pt);return ft.has(Rt)?ft.delete(Rt):ft.add(Rt),ft})},[]),[ln,Ft]=Et.default.useState(new Set),qt=Et.default.useRef(new Set),xn=Et.default.useRef(new Set),Fa=Et.default.useCallback((Rt,pt)=>{for(let ft of Rt)qt.current.delete(ft),pt?xn.current.delete(ft):xn.current.add(ft)},[]),pr=Et.default.useCallback((Rt,pt)=>{Ft(ft=>{let fn=new Set(ft),Sn=!fn.has(Rt),cn=Dt.current,qn=!pt?.soloMode&&cn?.graphspec&&cn.analysis?$9(Rt,cn.graphspec,cn.analysis.controllerNodeIds):new Set([Rt]);for(let Er of qn)Sn?fn.add(Er):fn.delete(Er);return Fa(qn,Sn),fn})},[Fa]),za=n.edgeType||hB.DEFAULT,ua=Et.default.useMemo(()=>({nodesep:n.nodesep,ranksep:n.ranksep}),[n.nodesep,n.ranksep]),Wt=Et.default.useRef(ne);Wt.current=ne;let zr=Et.default.useRef(K);zr.current=K;let ca=Et.default.useRef(ua);ca.current=ua;let an=Et.default.useRef(n.initialZoom);an.current=n.initialZoom;let oa=Et.default.useRef(n.panToTop);oa.current=n.panToTop;let er=Et.default.useRef(s);er.current=s;let zn=Et.default.useRef(An);zn.current=An;let Br=Et.default.useRef($t);Br.current=$t;let ni=Et.default.useRef(ln);ni.current=ln;let ri=Et.default.useRef(pr);ri.current=pr;let yi=Et.default.useRef(!0),ea=Et.default.useRef(0),qa=Et.default.useRef(!1),ai=Et.default.useRef(b);ai.current=b;let Cn=Et.default.useRef(D);Cn.current=D;let Va=Et.default.useRef(null);Va.current=Me?.nodeId??null;let[no,ro]=Et.default.useState(!1),Bo=Et.default.useCallback(()=>ro(!0),[]),Eo=P!==void 0&&!o&&s,qo=Et.default.useRef(Eo);qo.current=Eo;let wi=Et.default.useCallback(Rt=>{let pt=Dt.current,ft=X9(Cn.current,pt?.graphspec??null,pt?.childToCtrl??{},ni.current,Ct.current?._standIns),fn=J9(b8e(iue(que(Rt)),ai.current),ft,qo.current?Bo:void 0),Sn=Va.current;return Sn?fn.map(cn=>cn.id===Sn?{...cn,selected:!0}:cn):fn},[Bo]),ja=Et.default.useCallback((Rt,pt,ft,fn)=>xI[Rt].frame({nodes:w8e(pt.nodes),edges:pt.edges,graphspec:ft,analysis:fn,controllerPositions:pt.controllerPositions,showControllers:Wt.current,expandedControllers:zn.current,onToggleCollapse:Br.current,onToggleFold:ri.current}),[]),ws=()=>{let Rt=wt.current,pt=Ct.current;return Rt!==null&&pt!==null&&Rt.graphspec===pt._graphspec&&Rt.graphStyle===pt._graphStyle},Vo=Et.default.useRef([]);Vo.current=We;let Fr=Et.default.useRef(z);Fr.current=z;let Ka=Et.default.useRef(null);Et.default.useEffect(()=>()=>{Ka.current&&clearTimeout(Ka.current)},[]);let bs=Et.default.useCallback((Rt,pt)=>{Fr.current?.(Rt,pt);let ft=Dt.current;if(!ft?.graphspec||!ft.analysis)return;let fn=Z9(pt,ft.graphspec,ft.childToCtrl,ni.current,new Set(Vo.current.map(Sn=>Sn.id)),Ct.current?._standIns);fn&&(ut.current?.fitView({nodes:[{id:fn}],duration:500,padding:.4}),Ka.current&&clearTimeout(Ka.current),He(Sn=>Sn.map(cn=>{let qn=pce(cn.className);return cn.id===fn?{...cn,className:qn?`${qn} node-validation-flash`:"node-validation-flash"}:qn===cn.className?cn:{...cn,className:qn}})),Ka.current=setTimeout(()=>{He(Sn=>Sn.map(cn=>{let qn=pce(cn.className);return qn===cn.className?cn:{...cn,className:qn}}))},1800))},[He]);Et.default.useEffect(()=>{if(!Ct.current)return;let Rt=!1;return(async()=>{try{let pt=Ct.current;if(!pt)return;let ft=await yI(pt.nodes,pt.edges,K,SA[pt._graphStyle].layout??ua,pt._graphspec,pt._analysis);if(Rt)return;wt.current={nodes:ft.nodes,edges:ft.edges,controllerPositions:ft.controllerPositions,graphspec:pt._graphspec,graphStyle:pt._graphStyle};let fn=ja(pt._graphStyle,ft,pt._graphspec,pt._analysis);He(wi(fn.nodes)),zt(Xv(fn.edges)),setTimeout(()=>{!Rt&&ut.current&&er.current&&ut.current.fitView({padding:.1})},50)}catch(pt){console.error("[GraphViewer] ELK layout failed:",pt)}})(),()=>{Rt=!0}},[K,ua]),Et.default.useEffect(()=>{let Rt=wt.current,pt=Ct.current;if(!Rt||!pt||!ws())return;let ft=ja(Rt.graphStyle,Rt,pt._graphspec,pt._analysis);He(wi(ft.nodes)),zt(Xv(ft.edges))},[ne,An,$t,pr,wi]),Et.default.useEffect(()=>{if(!H){Ct.current=null,Dt.current=null,wt.current=null,He([]),zt([]);return}let Rt=!1,pt=Dt.current?.graphspec===H;pt||(Tt(new Set),zn.current=new Set);let ft=Fe.current,fn=xI[ft],{graphData:Sn,analysis:cn}=oue(H,za);Dt.current={nodes:Sn.nodes,edges:Sn.edges,analysis:cn,graphspec:H,childToCtrl:cn?Lu(H,cn):{}},pt||(xn.current=new Set);let qn=new Set,Er=new Set;if(cn){let Wo=pt?[...ni.current].filter(Ci=>!qt.current.has(Ci)):[...g8e(bt.current,cn.controllerNodeIds)];qn=new Set(Wo);for(let Ci of fn.defaultFolds(H,cn))qn.has(Ci)||xn.current.has(Ci)||(Er.add(Ci),qn.add(Ci))}qt.current=Er,Ft(qn),ni.current=qn,qa.current=qn.size>0,ea.current=qn.size,qn.size>0&&SA[ft].capabilities.controllerFrameToggle&&!Wt.current&&(De(!0),Wt.current=!0);let ii=qn.size>0&&cn?sN({nodes:Sn.nodes,edges:Sn.edges},cn,H,qn,ri.current):{nodes:Sn.nodes,edges:Sn.edges,analysis:cn},sa=fn.project({graphspec:H,nodes:ii.nodes,edges:ii.edges,analysis:ii.analysis,rawAnalysis:cn});return Ct.current={nodes:sa.nodes,edges:sa.edges,_analysis:sa.analysis,_graphspec:H,_graphStyle:ft,...sa.standIns?{_standIns:sa.standIns}:{}},(async()=>{try{let Wo=zr.current,Ci=SA[ft].layout??ca.current,Si=sa.nodes.some(le=>!le.position||le.position.x===0&&le.position.y===0)?await yI(sa.nodes,sa.edges,Wo,Ci,H,sa.analysis):{nodes:sa.nodes,edges:sa.edges,controllerPositions:{}};if(Rt)return;wt.current={nodes:Si.nodes,edges:Si.edges,controllerPositions:Si.controllerPositions,graphspec:H,graphStyle:ft};let st=ja(ft,Si,H,sa.analysis);He(wi(st.nodes)),zt(Xv(st.edges)),setTimeout(()=>{if(!Rt&&ut.current&&er.current&&(ut.current.fitView({padding:.1}),an.current!==void 0&&an.current!==null&&ut.current.zoomTo(an.current),oa.current)){let le=ut.current.getViewport();ut.current.setViewport({x:le.x,y:20,zoom:le.zoom})}},100)}catch(Wo){console.error("[GraphViewer] ELK layout failed:",Wo)}})(),()=>{Rt=!0}},[H,za,ge]),Et.default.useEffect(()=>{if(yi.current){yi.current=!1,ea.current=ln.size;return}if(qa.current){qa.current=!1,ea.current=ln.size;return}let Rt=ea.current;if(ea.current=ln.size,Rt===0&&ln.size===0||!Dt.current||!Dt.current.analysis)return;let pt=Dt.current,ft=pt.graphspec,fn=pt.analysis;if(!ft||!fn)return;let Sn=!1,cn=Fe.current,qn=sN({nodes:pt.nodes,edges:pt.edges},fn,ft,ln,pr),Er=xI[cn].project({graphspec:ft,nodes:qn.nodes,edges:qn.edges,analysis:qn.analysis,rawAnalysis:fn});return Ct.current={nodes:Er.nodes,edges:Er.edges,_analysis:Er.analysis,_graphspec:ft,_graphStyle:cn,...Er.standIns?{_standIns:Er.standIns}:{}},(async()=>{try{let ii=await yI(Er.nodes,Er.edges,zr.current,SA[cn].layout??ca.current,ft,Er.analysis);if(Sn)return;wt.current={nodes:ii.nodes,edges:ii.edges,controllerPositions:ii.controllerPositions,graphspec:ft,graphStyle:cn};let sa=ja(cn,ii,ft,Er.analysis);He(wi(sa.nodes)),zt(Xv(sa.edges)),setTimeout(()=>{!Sn&&ut.current&&er.current&&ut.current.fitView({padding:.1})},50)}catch(ii){console.error("[GraphViewer] ELK layout failed:",ii)}})(),()=>{Sn=!0}},[ln,pr]),Et.default.useEffect(()=>{let Rt=wt.current,pt=Ct.current;if(!Rt||!pt||!ws())return;let ft=ja(Rt.graphStyle,Rt,pt._graphspec,pt._analysis);He(wi(ft.nodes)),zt(Xv(ft.edges))},[b,wi]),Et.default.useEffect(()=>{let Rt=wt.current,pt=Ct.current;if(!Rt||!pt||!ws())return;let ft=ja(Rt.graphStyle,Rt,pt._graphspec,pt._analysis);He(wi(ft.nodes))},[D,Eo,wi]);let Di=Et.default.useCallback((Rt,pt)=>{let ft=pt.data;if(B?.(pt.id,ft,Rt),(ft.isController||ft.isPipe)&&ft.pipeType!==Do){let fn=ft.pipeCode||ft.labelText;fn&&w&&w(fn,hce(ft))}else if(ft.isStuff&&m&&H){let fn=lN(H,lw(pt.id));fn&&m(fn.item)}if(gt(null),Me?.nodeId===pt.id&&!nt)yt(null);else if(ft.isPipe||ft.isController)yt({kind:"pipe",nodeId:pt.id,nodeData:ft});else if(ft.isStuff&&H){let fn=lN(H,lw(pt.id));yt({kind:"stuff",nodeId:pt.id,nodeData:ft,stuffData:fn?.item,producerPipeRef:fn?.producerPipeRef,consumer:fn?.consumer})}He(fn=>fn.map(Sn=>({...Sn,selected:Sn.id===pt.id})))},[He,w,B,m,H,Me,nt]),jo=Et.default.useCallback(Rt=>{ut.current=Rt,S&&S(Rt)},[S]),bi=Et.default.useRef(s);Et.default.useEffect(()=>{if(bi.current===s)return;if(bi.current=s,!s){yt(null),gt(null),ro(!1);return}let Rt=setTimeout(()=>{ut.current?.fitView({padding:.1})},50);return()=>clearTimeout(Rt)},[s]);let $s=Et.default.useCallback(()=>{yt(null),gt(null),T?.()},[T]),ao=Et.default.useCallback(Rt=>{if(!H)return;let pt=Aw(H,Rt);pt&>(pt)},[H]),Ko=Me?.kind==="pipe"&&H?H.nodes.find(Rt=>Rt.id===Me.nodeId):void 0,$o=Me!==null||nt!==null,ir=y8e(d,n.toolbarPosition),ta=Dt.current?.analysis?.controllerNodeIds,or=Pe.foldAll&&(!Pe.controllerFrameToggle||ne),xi=Et.default.useMemo(()=>!or||!ta||ta.size===0?{onFoldAll:void 0,onExpandAll:void 0,foldAllDisabled:!1,expandAllDisabled:!1}:{onFoldAll:()=>{Fa(ta,!0),Ft(new Set(ta))},onExpandAll:()=>{Fa(ta,!1),Ft(new Set)},foldAllDisabled:ln.size===ta.size,expandAllDisabled:ln.size===0},[or,ta,ln,Fa]),wr=Et.default.useMemo(()=>wue(A),[A]);return(0,So.jsxs)("div",{ref:ct,className:`react-flow-container react-flow-container--theme-${W} react-flow-container--mode-${Z}${s?"":" react-flow-container--still"}`,style:s?void 0:{height:me},inert:!s,children:[(0,So.jsxs)(g9,{nodes:We,edges:Ye,nodeTypes:d8e,edgeTypes:p8e,onNodesChange:et,onEdgesChange:It,onNodeClick:s?Di:void 0,onPaneClick:s?$s:void 0,onInit:jo,fitView:s,fitViewOptions:{padding:.1},defaultEdgeOptions:{type:za},panOnScroll:s,minZoom:s?.1:.01,proOptions:{hideAttribution:!0},panActivationKeyCode:null,...s?{}:h8e,children:[s?(0,So.jsx)(S9,{variant:eA.Dots,gap:20,size:1,color:"var(--color-bg-dots)"}):(0,So.jsx)(ece,{onHeight:Re}),s&&!o&&(0,So.jsx)(Xue,{direction:K,onDirectionChange:X,showControllers:ne,onShowControllersChange:Pe.controllerFrameToggle?De:void 0,graphStyle:ge,styleMenuOptions:wr,onGraphStyleChange:he,onZoomIn:()=>{ut.current?.zoomIn()},onZoomOut:()=>{ut.current?.zoomOut()},onFitView:()=>{ut.current?.fitView({padding:.1})},onFoldAll:xi.onFoldAll,onExpandAll:xi.onExpandAll,foldAllDisabled:xi.foldAllDisabled,expandAllDisabled:xi.expandAllDisabled,themeMode:g?Z:void 0,onThemeModeChange:g?oe:void 0,rightOffset:$o?vt:0,position:ir,validationState:P,validationIssues:D,onValidationIssueClick:bs,validationOpen:no,onValidationOpenChange:ro})]}),s&&(0,So.jsxs)(Xle,{isOpen:$o,onClose:$s,width:vt,isDragging:Ut,onResizeHandleMouseDown:re,children:[nt?(0,So.jsx)(AD,{concept:nt}):Ko&&H?(0,So.jsx)(aue,{node:Ko,spec:H,onConceptClick:ao}):Me?.stuffData?(0,So.jsx)(m8e,{nodeId:Me.nodeId,stuffData:Me.stuffData,producerPipeRef:Me.producerPipeRef,consumer:Me.consumer,graphspec:H,theme:W,artifacts:t,resolveUrl:R,resolveShareUrl:F,saveFiles:N,downloads:V}):null,k&&Me&&!nt&&k(Me.nodeId,Me.nodeData)]})]})}function x8e(e){if(e==null)return lc.EXPANDED;if(e===lc.FOLDED||e===lc.EXPANDED||e===lc.AUTO)return e;throw new Error(`Invalid foldMode in standalone config: ${JSON.stringify(e)} \u2014 expected one of "folded", "expanded", "auto".`)}function C8e(e){if(e==null)return Wi.SYSTEM;if(e===Wi.LIGHT||e===Wi.DARK||e===Wi.SYSTEM)return e;throw new Error(`Invalid theme in standalone config: ${JSON.stringify(e)} \u2014 expected one of "dark", "light", "system".`)}function S8e(e){if(e==null)return $l.LR;if(e===$l.LR||e===$l.RL||e===$l.TB||e===$l.BT)return e;throw new Error(`Invalid direction in standalone config: ${JSON.stringify(e)} \u2014 expected one of "TB", "BT", "LR", "RL".`)}function B8e(e){if(e==null)return;let t=Object.values(Da);if(t.includes(e))return e;throw new Error(`Invalid toolbarPosition in standalone config: ${JSON.stringify(e)} \u2014 expected one of ${t.map(n=>`"${n}"`).join(", ")}.`)}function Dx(e,t){let n=e&&typeof e=="object"?e:{},r=S8e(n.direction),a=!!n.showControllers,i=x8e(n.foldMode),o=C8e(n.theme),s=B8e(n.toolbarPosition);return{graphspec:t,config:{...n,direction:r,showControllers:a,foldMode:i,theme:o,toolbarPosition:s},initialDirection:r,initialShowControllers:a,initialFoldMode:i,theme:o}}var Mx="unknown";function Nr(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ys(){return Object.create(null)}function Ot(e){return typeof e=="string"&&e.length>0?e:null}function ey(e){return typeof e=="number"&&Number.isInteger(e)?e:null}function Qx(e){return typeof e=="boolean"?e:null}var lu="native",ar=e=>({type:e,conceptRef:null,itemType:null,itemConceptRef:null}),PD=e=>({type:"concept",conceptRef:e,itemType:null,itemConceptRef:null}),gce=e=>({type:"list",conceptRef:null,itemType:"concept",itemConceptRef:e}),EI={Dynamic:{description:"A dynamic concept",fields:null},Text:{description:"A text",fields:{text:ar("text")}},Markdown:{description:"A text written in Markdown",refines:"native.Text",fields:{text:ar("text")}},Image:{description:"An image",fields:{url:ar("text"),public_url:ar("text"),source_prompt:ar("text"),source_negative_prompt:ar("text"),caption:ar("text"),mime_type:ar("text"),width:ar("integer"),height:ar("integer"),filename:ar("text")}},Document:{description:"A document",fields:{url:ar("text"),public_url:ar("text"),mime_type:ar("text"),filename:ar("text"),title:ar("text"),snippet:ar("text")}},Html:{description:"HTML content",fields:{inner_html:ar("text"),css_class:ar("text")}},TextAndImages:{description:"A text and an image",fields:{text:PD("native.Text"),images:gce("native.Image"),raw_html:ar("text")}},Number:{description:"A number",fields:{number:ar("number")}},YesNo:{description:"The answer to a yes/no question",fields:{yes_no:ar("boolean"),probability:ar("number")}},Choice:{description:"One option picked out of a declared set",fields:{choice:ar("text"),confidence:ar("number"),probabilities:ar("dict")}},Rating:{description:"A position on an ordered scale of described levels",fields:{level:ar("integer"),confidence:ar("number"),probabilities:ar("dict"),position:ar("number")}},Date:{description:"A calendar date, optionally with a time of day \u2014 as precise as its source states.",fields:{date:ar("date"),time:ar("time")}},Time:{description:"A time of day, optionally with a UTC offset \u2014 as precise as its source states.",fields:{time:ar("time")}},Page:{description:"The content of a page of a document, comprising text and linked images and an optional page view image",fields:{text_and_images:PD("native.TextAndImages"),page_view:PD("native.Image")}},JSON:{description:"A JSON object",fields:{json_obj:ar("dict")}},SearchResult:{description:"A search result with answer and sources",fields:{answer:ar("text"),sources:gce("native.Document")}},Anything:{description:"Anything",fields:null},Composite:{description:"A named composition of contents",fields:null}},dut=new Set(Object.keys(EI));function Om(e){return Object.hasOwn(EI,e)}function yce(e){return EI[e].fields}var E8e=/^(?:([A-Za-z0-9_][A-Za-z0-9_.]*)\.)?([A-Za-z0-9_]+)(?:\[(\d*)\])?([?!])?$/;function _8e(e){return e==="?"?"optional":e==="!"?"force":"plain"}function ty(e){if(typeof e!="string")return null;let t=E8e.exec(e.trim());if(!t)return null;let[,n,r,a,i]=t;return{domain:n??null,code:r,multiplicity:a===void 0?null:a===""?!0:Number.parseInt(a,10),presence:_8e(i)}}var I8e=new Set(["concept","hints"]),L8e=/^[A-Z][A-Za-z0-9]*$/;function vce(e){let t=ty(e);return t!==null&&L8e.test(t.code)}function OD(e,t){if(!Nr(t)||t.concept!==void 0)return null;let n=Object.keys(t);if(n.length===0)return null;let r=[];for(let a of n){let i=t[a],o=`${e}.${a}`;if(vce(i)||Nr(i)&&vce(i.concept)){r.push(o);continue}let s=OD(o,i);if(s===null)return null;r.push(...s)}return r}function T8e(e){return Nr(e)?{ref:ty(e.concept),missingConcept:e.concept===void 0,unknownKeys:Object.keys(e).filter(t=>!I8e.has(t))}:{ref:ty(e),missingConcept:!1,unknownKeys:[]}}function _I(e,t){return`${e.replaceAll(".","\xB7")}__${t}`}function qu(e){let t=EI[e];return{code:e,domain_code:lu,description:t.description,structure_class_name:`${e}Content`,refines:t.refines??null}}function UD(e,t){return{code:e,domain_code:t,description:"",structure_class_name:_I(t,e),refines:null}}function DD(e,t,n){return e.domain===lu?Om(e.code)?qu(e.code):UD(e.code,lu):e.domain!==null&&e.domain!==t?UD(e.code,e.domain):Object.hasOwn(n,e.code)?n[e.code]:e.domain===null&&Om(e.code)?qu(e.code):UD(e.code,t)}function wce(e,t,n){return{concept:DD(e,t,n),multiplicity:e.multiplicity,presence:e.presence}}function bce(e,t,n){let r=ty(e);return r===null?null:wce(r,t,n)}function xce(e,t,n){let{ref:r,missingConcept:a,unknownKeys:i}=T8e(e);return{spec:r===null?null:wce(r,t,n),missingConcept:a,unknownKeys:i}}var R8e="holds its value in a single field",N8e="is declared with neither a structure nor refines";function Bce(e){let t=e.lastIndexOf(".");return{domain:e.slice(0,t),code:e.slice(t+1)}}function Cce(e,t){return e.includes("->")||e.startsWith(`${lu}.`)||e.includes(".")?e:Om(e)?`${lu}.${e}`:`${t}.${e}`}function MD(e,t,n=new Set){if(t.includes("->"))return{shape:"no-structure",ref:t,reason:"belongs to a dependency, which a method's own bundles do not show"};let{domain:r,code:a}=Bce(t);if(r===lu){if(!Om(a))return{shape:"no-structure",ref:t,reason:"is not a native concept"};let l=yce(a);return l===null?{shape:"no-structure",ref:t,reason:"is structureless by definition"}:Object.keys(l).length===1?{shape:"value",ref:t,reason:R8e}:{shape:"structure",ref:t,fields:l}}if(n.has(t))return{shape:"no-structure",ref:t,reason:"refines itself through a cycle"};let i=e.domains[r],o=i!==void 0&&Object.hasOwn(i.concepts,a)?i.concepts[a]:void 0;if(i===void 0||o===void 0)return{shape:"no-structure",ref:t,reason:"is not declared in this method"};let s=Object.hasOwn(i.structures,a)?i.structures[a]:void 0;if(typeof s=="string")return{shape:"no-structure",ref:t,reason:"has a Python class for a structure, which a bundle does not show"};if(s!==void 0){let l=Object.create(null);for(let[u,c]of Object.entries(s))l[u]={...c,conceptRef:c.conceptRef===null?null:Cce(c.conceptRef,r),itemConceptRef:c.itemConceptRef===null?null:Cce(c.itemConceptRef,r)};return{shape:"structure",ref:t,fields:l}}if(o.refines!=null){let l=MD(e,o.refines,new Set([...n,t]));if(l.shape==="structure")return{shape:"structure",ref:t,fields:l.fields};let u=`refines '${l.ref}', which ${l.reason}`;return l.shape==="value"?{shape:"value",ref:t,reason:u}:{shape:"no-structure",ref:t,reason:u}}return{shape:"no-structure",ref:t,reason:N8e}}var II={text:"Text",number:"Number",integer:"Number",boolean:"YesNo",date:"Date",datetime:"Date",time:"Time",dict:"JSON"};function F8e(e){let t=e.type??"text";if(t==="concept")return{kind:"concept",ref:e.conceptRef,crossesList:!1};if(t==="list"){let r=e.itemType;if(r===null)return{kind:"underivable",crossesList:!0,reason:"the list declares no item_type"};if(r==="concept")return{kind:"concept",ref:e.itemConceptRef,crossesList:!0};let a=Object.hasOwn(II,r)?II[r]:null;return a===null?{kind:"underivable",crossesList:!0,reason:`the list's item_type '${r}' derives no concept`}:{kind:"leaf",nativeCode:a,crossesList:!0,description:`a list of ${r}`}}let n=Object.hasOwn(II,t)?II[t]:null;return n===null?{kind:"underivable",crossesList:!1,reason:`its type '${t}' derives no concept`}:{kind:"leaf",nativeCode:n,crossesList:!1,description:`a ${t} field`}}function k8e(e,t){let{domain:n,code:r}=Bce(t);return DD({domain:n,code:r,multiplicity:null,presence:"plain"},n,e.domains[n]?.concepts??{})}function Sce(e){return`${e.domain_code}.${e.code}`}function Ece(e,t,n){let r=t.split(".").slice(1);if(r.length===0)return{kind:"derived",concept:n.concept,multiplicity:n.multiplicity};let a=nA(n.multiplicity),i=t.split(".")[0],o=MD(e,Sce(n.concept)),s=null,l=Sce(n.concept),u=c=>({kind:"unresolved",reason:`cannot bind '${t}': ${c}`});for(let[c,A]of r.entries()){if(s!==null)return u(`'${i}' is ${s}, a leaf holding a plain value, so the segment '${A}' cannot follow it`);if(o===null)return u(`nothing is known of '${i}', so the segment '${A}' cannot be walked`);if(o.shape==="value")return u(`'${i}' holds a '${o.ref}', which ${o.reason}, so it is a leaf and the segment '${A}' cannot follow it`);if(o.shape==="no-structure")return u(`'${i}' holds a '${o.ref}', which ${o.reason}, so the segment '${A}' has no structure to walk`);let d=Object.hasOwn(o.fields,A)?o.fields[A]:void 0;if(d===void 0){let h=Object.keys(o.fields);return u(`'${i}' holds a '${o.ref}', which has no field '${A}'`+(h.length>0?` (its fields are ${h.map(w=>`'${w}'`).join(", ")})`:""))}i=`${i}.${A}`;let f=c===r.length-1,g=F8e(d);switch(g.crossesList&&(a=!0),g.kind){case"underivable":return u(`'${i}' derives no concept, since ${g.reason}`);case"concept":if(g.ref===null)return u(`the concept field '${i}' names no concept`);l=g.ref,o=f?null:MD(e,g.ref);break;case"leaf":l=`${lu}.${g.nativeCode}`,s=g.description,o=null;break}}return{kind:"derived",concept:k8e(e,l),multiplicity:a?!0:null}}function P8e(e,t){let n=a=>{let i=t[a.concept.domain_code]?.concepts[a.concept.code];return i!==void 0&&i!==a.concept?{...a,concept:i}:a},r=ys();for(let[a,i]of Object.entries(e.inputs))r[a]=n(i);return{...e,inputs:r,output:n(e.output)}}function _ce(e){let t=[],n=ys(),r=null,a=null,i=null;for(let o of e){let s=o.domain??Mx,l=n[s]??(n[s]={domain:s,concepts:ys(),structures:ys(),pipes:ys()});r===null&&o.domain!==null&&(r=o.domain),a===null&&o.main_pipe!==null&&(a=o.main_pipe,r=s),i===null&&o.description!==null&&(i=o.description);for(let[u,c]of Object.entries(o.concepts)){if(u in l.concepts){t.push({severity:"warning",code:"duplicate-concept",message:`concept "${s}.${u}" declared more than once \u2014 keeping the first declaration`,path:`concept.${u}`,domain_code:s});continue}l.concepts[u]=c,Object.hasOwn(o.structures,u)&&(l.structures[u]=o.structures[u])}for(let[u,c]of Object.entries(o.pipes)){let A=l.pipes[u];if(A===void 0){l.pipes[u]=c;continue}let d=A.type==="PipeSignature",f=c.type==="PipeSignature";if(d!==f){let g=A.type==="PipeSignature"?A:c,h=A.type==="PipeSignature"?c:A;d&&(l.pipes[u]=c);let w=g.type==="PipeSignature"?g.signature_for??null:null;w!==null&&w!==h.type&&t.push({severity:"warning",code:"signature-type-mismatch",message:`pipe "${s}.${u}": the signature promises \`signature_for = "${w}"\` but the concrete definition is a ${h.type} \u2014 using the concrete definition`,path:`pipe.${u}`,domain_code:s});continue}t.push({severity:"warning",code:"duplicate-pipe",message:`pipe "${s}.${u}" declared more than once \u2014 keeping the first declaration`,path:`pipe.${u}`,domain_code:s})}}for(let o of Object.values(n))for(let[s,l]of Object.entries(o.pipes))o.pipes[s]=P8e(l,n);return{domains:n,mainDomain:r,mainPipe:a,description:i,diagnostics:t}}var U8e=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,EA,_A,Ks,ny=class ny extends Date{constructor(n){let r=!0,a=!0,i="Z";if(typeof n=="string"){let o=n.match(U8e);o?(o[1]||(r=!1,n=`0000-01-01T${n}`),a=!!o[2],a&&n[10]===" "&&(n=n.replace(" ","T")),o[2]&&+o[2]>23?n="":(i=o[3]||null,n=n.toUpperCase(),!i&&a&&(n+="Z"))):n=""}super(n);pg(this,EA,!1);pg(this,_A,!1);pg(this,Ks,null);isNaN(this.getTime())||(Ul(this,EA,r),Ul(this,_A,a),Ul(this,Ks,i))}isDateTime(){return cr(this,EA)&&cr(this,_A)}isLocal(){return!cr(this,EA)||!cr(this,_A)||!cr(this,Ks)}isDate(){return cr(this,EA)&&!cr(this,_A)}isTime(){return cr(this,_A)&&!cr(this,EA)}isValid(){return cr(this,EA)||cr(this,_A)}toISOString(){let n=super.toISOString();if(this.isDate())return n.slice(0,10);if(this.isTime())return n.slice(11,23);if(cr(this,Ks)===null)return n.slice(0,-1);if(cr(this,Ks)==="Z")return n;let r=+cr(this,Ks).slice(1,3)*60+ +cr(this,Ks).slice(4,6);return r=cr(this,Ks)[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+cr(this,Ks)}static wrapAsOffsetDateTime(n,r="Z"){let a=new ny(n);return Ul(a,Ks,r),a}static wrapAsLocalDateTime(n){let r=new ny(n);return Ul(r,Ks,null),r}static wrapAsLocalDate(n){let r=new ny(n);return Ul(r,_A,!1),Ul(r,Ks,null),r}static wrapAsLocalTime(n){let r=new ny(n);return Ul(r,EA,!1),Ul(r,Ks,null),r}};EA=new WeakMap,_A=new WeakMap,Ks=new WeakMap;var Hx=ny;function O8e(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function D8e(e,t,n){let r=e.split(/\r\n|\n|\r/g),a="",i=(Math.log10(t+1)|0)+1;for(let o=t-1;o<=t+1;o++){let s=r[o-1];s&&(a+=o.toString().padEnd(i," "),a+=": ",a+=s,a+=`
|
|
260
260
|
`,o===t&&(a+=" ".repeat(i+n+2),a+=`^
|
|
261
261
|
`))}return a}var Mn=class extends Error{constructor(n,r){let[a,i]=O8e(r.toml,r.ptr),o=D8e(r.toml,a,i);super(`Invalid TOML document: ${n}
|