@farero-ai/ui 0.4.6 → 0.4.7
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/chunks/{chunk-PCK4EJ7D.js → chunk-BLVH5CWZ.js} +1 -1
- package/dist/chunks/{chunk-QHXTSMN4.js → chunk-JNOL5TLS.js} +1 -1
- package/dist/chunks/{chunk-YGPVIEBZ.js → chunk-MHKNH5JT.js} +1 -1
- package/dist/code.js +1 -1
- package/dist/commands.js +1 -1
- package/dist/fence.js +1 -1
- package/dist/generated-ui.js +1 -1
- package/dist/markdown.js +1 -1
- package/dist/transcript.js +1 -1
- package/package.json +1 -1
- /package/dist/chunks/{chunk-2FSGXRY6.js → chunk-MTA5M6VK.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-ZVJQ5X63.js";import{i as g}from"./chunk-
|
|
1
|
+
import{b}from"./chunk-ZVJQ5X63.js";import{i as g}from"./chunk-MHKNH5JT.js";import{a as x}from"./chunk-WQZ3EUKA.js";import{b as v}from"./chunk-FW2QVWXL.js";import{d as h}from"./chunk-HGN4GN2E.js";import{a as i}from"./chunk-5SBKMKFB.js";import{a as s}from"./chunk-3I4YBQX6.js";import{jsx as w}from"react/jsx-runtime";function z(e){return e.startsWith("+")&&!e.startsWith("+++")?"text-add":e.startsWith("-")&&!e.startsWith("---")?"text-del":e.startsWith("@@")?"text-accent":e.startsWith("diff ")||e.startsWith("index ")||e.startsWith("+++")||e.startsWith("---")?"text-faint":"text-muted"}s(z,"diffLineClass");var y=s(({patch:e})=>w("pre",{className:"!m-0 !rounded-none !border-0 overflow-x-auto overscroll-x-contain font-mono text-[11.5px] leading-[1.5]",children:e.split(`
|
|
2
2
|
`).map((r,o)=>w("div",{className:i("whitespace-pre",z(r)),children:r||" "},o))}),"PlainDiff");function _(e,r){let o=e.toLowerCase();return o==="diff"||o==="patch"?"diff":(o==="svg"||o==="xml")&&/^\s*(?:<\?xml[^>]*>\s*)?<svg\b/i.test(r.slice(0,512))&&/<\/svg>\s*$/i.test(r.slice(-512))?"svg":o==="html"&&/^\s*(?:<!doctype html[^>]*>\s*)?<html\b/i.test(r.slice(0,512))&&/<\/html>\s*$/i.test(r.slice(-512))?"html":"source"}s(_,"fenceKind");import{Download as R}from"lucide-react";import{lazy as S,Suspense as K,useState as N}from"react";import{jsx as t,jsxs as a}from"react/jsx-runtime";var L=S(()=>import("./IsolatedPreview-HJ6B36KF.js")),U=s(({source:e,language:r,kind:o,complete:n,actions:F,renderDiff:p})=>{let[c,W]=N("source"),[f,C]=N(!1),m=e.length<=1048576,d=o!=="source"&&m&&n,P=o==="diff"?"Diff":"Preview",l=t("pre",{className:i("!m-0 !rounded-none !border-0 overflow-x-auto overscroll-x-contain",f&&"whitespace-pre-wrap [overflow-wrap:anywhere]"),children:t("code",{className:r?`language-${r}`:void 0,children:t(g,{text:e,language:n?r:null})})}),u=a("div",{className:"ml-auto flex items-center gap-1","data-document-controls":!0,children:[c==="source"||!d?t(x,{pressed:f,onToggle:()=>C(D=>!D),size:12,className:"size-6 rounded-md hover:bg-surface-2"}):null,F,t("button",{type:"button",title:"Download source","aria-label":"Download code block",className:"flex size-6 items-center justify-center rounded-md text-muted hover:bg-surface-2",onClick:()=>b(e,o==="svg"?"svg":r??"txt"),children:t(R,{size:12})}),t(h,{text:e,label:"code",size:12,className:"size-6 rounded-md"})]});return o==="source"||!n?a("div",{className:"farero-ui group relative my-3 overflow-hidden rounded-xl border border-border-soft bg-bg",children:[l,t("div",{className:"absolute top-1 right-1 rounded-md border border-border-soft bg-bg/90 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100",children:u})]}):a("figure",{className:"farero-ui my-3 overflow-hidden rounded-xl border border-border-soft bg-bg",children:[a("figcaption",{className:"flex min-h-8 flex-wrap items-center gap-2 px-2 py-1 text-muted text-xs","data-document-controls":!0,children:[d?t(v,{value:c,options:[{id:"source",label:"Source"},{id:"rich",label:P}],onChange:W}):t("span",{children:r??"Code"}),u]}),c==="rich"&&d?t(K,{fallback:l,children:o==="diff"?t("div",{className:"max-h-[32rem] overflow-auto overscroll-contain",children:p?p(e):t(y,{patch:e})}):t(L,{source:e,kind:o==="svg"?"svg":"html"})}):l,m?null:t("p",{className:"px-3 text-muted text-xs",children:"Preview unavailable above 1 MiB. Full source can be copied or downloaded."})]})},"RichFence");export{z as a,_ as b,U as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as B}from"./chunk-JMYCJ5PW.js";import{a as k,b as v}from"./chunk-ONVWTQLU.js";import{a as _,j as D}from"./chunk-RWGTJDY3.js";import{e as N}from"./chunk-RR7BB4EQ.js";import{b as W,c as z}from"./chunk-
|
|
1
|
+
import{a as B}from"./chunk-JMYCJ5PW.js";import{a as k,b as v}from"./chunk-ONVWTQLU.js";import{a as _,j as D}from"./chunk-RWGTJDY3.js";import{e as N}from"./chunk-RR7BB4EQ.js";import{b as W,c as z}from"./chunk-BLVH5CWZ.js";import{e as w,i as O}from"./chunk-MHKNH5JT.js";import{a as H,c as $,g as y,h as b}from"./chunk-MTA5M6VK.js";import{d as I}from"./chunk-HGN4GN2E.js";import{a as S}from"./chunk-5SBKMKFB.js";import{a as s}from"./chunk-3I4YBQX6.js";var x="farero-attachment.invalid";function C(e){return`https://${x}/?path=${encodeURIComponent(e)}`}s(C,"attachmentHref");function E(e,t=!1){let n=H(e);for(let a=n.length-1;a>=0;a--){let l=n[a],u=n[a+1],c=u&&!e.slice(l.end,u.start).trim()?`
|
|
2
2
|
${e.slice(u.start)}`:e.slice(l.end),p=l.handoff.sources.at(-1).title.replace(/[\\`*_[\]<>]/g,"\\$&");e=`${e.slice(0,l.start)}[${p}](${$(l.handoff)})${c}`}let r=y(e);if(!r.length)return e;let i="",o=0;for(let a of r){if(i+=e.slice(o,a.start),!t||!/^Transcript of .+\.md$/.test(a.name)){let l=a.name.replace(/[\\`*_[\]<>]/g,"\\$&");i+=`[${l}](${C(a.path)})`}o=a.end}return i+e.slice(o)}s(E,"markdownSource");function We(e){return/\.(?:md|markdown|mdown|mkd|mkdn)$/i.test(e)}s(We,"isMarkdownFile");import{useId as le,useMemo as X}from"react";import ce from"react-markdown";import ue from"remark-breaks";import de from"remark-gfm";import pe from"remark-math";function T({foldHeadings:e=!0}={}){return t=>{let n=s(r=>{for(let i of r){if(i.type!=="element")continue;let o=i.position?.start.offset;if(o!==void 0&&/^(h[1-6]|p|table|pre)$/.test(i.tagName)&&(i.properties["data-block-id"]=`b${o}`),i.tagName==="pre"){let a=i.children.find(l=>l.type==="element"&&l.tagName==="code");a?.type==="element"&&(i.properties["data-fence-complete"]=a.properties["data-fence-complete"])}n(i.children)}},"anchor");n(t.children),e&&(t.children=U(t.children))}}s(T,"documentStructure");function U(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!=="element"||!/^h[1-6]$/.test(r.tagName)){t.push(r);continue}let i=Number(r.tagName[1]),o=n+1;for(;o<e.length;){let l=e[o];if(l.type==="element"&&/^h[1-6]$/.test(l.tagName)&&Number(l.tagName[1])<=i)break;o++}let a={type:"element",tagName:"summary",properties:{},children:[r]};t.push({type:"element",tagName:"details",properties:{open:!0,"data-document-section":!0},children:[a,...U(e.slice(n+1,o)).filter(l=>l.type!=="doctype")]}),n=o-1}return t}s(U,"sections");function q(){let e="",t,n=!1;return s(function(){let i=this.parser;i&&(this.parser=(o,a)=>{let l,u=o.startsWith(e);u||(n=!1);let c=t&&u&&!n?t.children.slice(0,-2):[],p=t?.children[c.length],f=c.length?p?.position?.start:void 0;f?.offset!==void 0?(l=i(o.slice(f.offset),a),K(l,f),l.children=[...c,...l.children]):l=i(o,a),!n&&l.children.slice(c.length).some(G)&&(n=!0,c.length&&(l=i(o,a)));for(let m of l.children.slice(n?0:c.length))V(m,o);return e=o,t=l,l})},"plugin")}s(q,"incrementalMarkdown");function G(e){return["definition","footnoteDefinition","linkReference","imageReference","footnoteReference"].includes(e.type)||e.type==="text"&&/\[[^\]\n]+\]/.test(e.value)?!0:(e.children??[]).some(G)}s(G,"hasReferences");function K(e,t){if(e.position)for(let n of[e.position.start,e.position.end])n.line===1&&(n.column+=t.column-1),n.line+=t.line-1,n.offset!==void 0&&(n.offset+=t.offset??0);for(let n of e.children??[])K(n,t)}s(K,"shiftPositions");function V(e,t){if(e.type==="code"){let n=t.slice(e.position?.start.offset,e.position?.end.offset),r=n.match(/^ {0,3}(`{3,}|~{3,})/),i=n.slice(n.lastIndexOf(`
|
|
3
3
|
`)+1).replace(/^\s*(?:>\s*)+/,"").trimStart(),o=!r||n.includes(`
|
|
4
4
|
`)&&new RegExp(`^ {0,3}${r[1][0]}{${r[1].length},}[ \\t]*$`).test(i);e.data={...e.data,hProperties:{...e.data?.hProperties,"data-fence-complete":o?"true":"false"}}}for(let n of e.children??[])V(n,t)}s(V,"markFence");import{jsx as Z}from"react/jsx-runtime";var fe=[T],me=[[T,{foldHeadings:!1}]],nt=s(({children:e,components:t,foldHeadings:n=!0,hideTranscriptAttachments:r=!1,onContextMenu:i})=>{let o=X(()=>[de,[pe,{singleDollarTextMath:!1}],q(),ue],[]),a=le(),l=X(()=>({clobberPrefix:`note-${a}-`}),[a]);return Z("div",{className:"md farero-ui",onContextMenu:i,children:Z(ce,{remarkPlugins:o,rehypePlugins:n?fe:me,remarkRehypeOptions:l,components:t,children:E(e,r)})})},"MarkdownBody");function j(e,t=null){return e.startsWith("~/")||/^[A-Za-z]:[\\/]/.test(e)||t&&(e===t||e.startsWith(`${t}/`))?!0:e.startsWith("/Users/")||e.startsWith("/home/")||e.startsWith("/private/")}s(j,"isAbsoluteFilePath");function Y(e){if(!e.startsWith("file://"))return null;let t=e.slice(7),n=t.startsWith("/")?t:t.startsWith("localhost/")?t.slice(9):null;return n?/^\/[A-Za-z]:[\\/]/.test(n)?n.slice(1):n:null}s(Y,"fileUrlToLocalPath");function J(e){let t="",n=s(r=>{for(let i of r)i.type==="text"?t+=i.value:i.type==="element"&&n(i.children)},"walk");return n(e.children),t.replace(/\n$/,"")}s(J,"fenceSource");function h(e){if(!e)return null;try{let t=new URL(e);return t.hostname===x?t.searchParams.get("path"):null}catch{return null}}s(h,"attachmentPath");function P(e){if(!e)return!1;try{let t=new URL(e,location.origin);return t.origin===location.origin&&t.pathname.startsWith("/w/")&&t.searchParams.has("handoff")&&!!t.searchParams.get("session")}catch{return!1}}s(P,"isChatHandoffHref");function L(e){let t=e&&(Y(e)??e);if(!t?.startsWith("/")||!j(t))return null;let n=t.match(/:([1-9]\d*)(?::\d+)?$/),r=n?t.slice(0,-n[0].length):t;return b(r)?null:r.slice(r.lastIndexOf("/")+1).includes(".")?t:null}s(L,"sourceReference");function dt(e){if(!e)return null;let t=e.split(/\r?\n/).filter(Boolean);if(t.length<2)return null;let n=t.map(L);return n.every(r=>r!==null)?n:null}s(dt,"sourceReferences");function pt({reference:e,external:t,externalPreview:n,button:r,metaKey:i,ctrlKey:o,shiftKey:a,altKey:l,defaultPrevented:u}){return u?"browser":r===0&&!i&&!o&&!a&&!l&&!e&&t&&n?"external-preview":e&&(r===0||r===1)?"preview":"browser"}s(pt,"chatLinkAction");var ge=/^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/,he=/^[\d.]+$/,ye=/(?:^|\.)(?:corp|example|home|home\.arpa|internal|intranet|invalid|lan|local|localhost|onion|private|test|ts\.net)$/;function ft(e){let t;try{t=new URL(e).hostname}catch{return null}return!ge.test(t)||he.test(t)||ye.test(t)||t===location.hostname?null:`https://icons.duckduckgo.com/ip3/${t}.ico`}s(ft,"linkFaviconUrl");function mt(e){return typeof e=="string"?e:Array.isArray(e)&&e.filter(n=>typeof n=="string").join("")||null}s(mt,"linkText");import{Children as be,isValidElement as ne}from"react";import{jsx as M,jsxs as te}from"react/jsx-runtime";function Q(e){return typeof e=="string"&&!e.trim()}s(Q,"isBlank");function xe(e){return ne(e)&&e.type==="br"}s(xe,"isLineBreak");function ee(e){if(!ne(e))return null;let{href:t}=e.props;return typeof t!="string"?null:h(t)!==null||P(t)?t:null}s(ee,"referenceHref");var oe=s(({children:e,node:t,...n})=>{let r=be.toArray(e),i=[],o=[],a=[],l=0;for(let c=0;c<=r.length;c++){if(c<r.length&&!xe(r[c])){a.push(r[c]);continue}if(!a.every(p=>Q(p)||ee(p)))break;for(let p of a){let f=ee(p);if(!f)continue;let m=h(f);m&&b(m)?i.push(p):o.push(p)}a=[],l=c+1}if(!i.length&&!o.length)return M("p",{...n,children:e});let u=r.slice(l);return te("p",{...n,children:[te("span",{className:S("flex flex-col gap-1",u.some(c=>!Q(c))&&"mb-[0.5em]"),children:[i.length?M("span",{className:"flex flex-wrap items-start gap-2",children:i}):null,o.length?M("span",{className:"flex flex-wrap items-center gap-1.5",children:o}):null]}),u]})},"ChatParagraph");import{useCallback as Ce,useEffect as Pe,useRef as re,useState as Re}from"react";import{createPortal as we}from"react-dom";import{Fragment as ke,jsx as R,jsxs as ie}from"react/jsx-runtime";var se=s(({href:e,children:t,...n})=>{let[r,i]=Re(),o=re(null),a=re(null),l=Ce(()=>{i(void 0),o.current?.focus({preventScroll:!0})},[]);return Pe(()=>{if(!r)return;a.current?.querySelector("button")?.focus({preventScroll:!0});let u=s(f=>{let m=f.target;!o.current?.contains(m)&&!a.current?.contains(m)&&i(void 0)},"dismiss"),c=s(f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),i(void 0),o.current?.focus({preventScroll:!0}))},"onEscape"),p=s(f=>{a.current?.contains(f.target)||i(void 0)},"scroll");return document.addEventListener("pointerdown",u),document.addEventListener("keydown",c,!0),document.addEventListener("scroll",p,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",c,!0),document.removeEventListener("scroll",p,!0),window.removeEventListener("resize",l)}},[r,l]),ie(ke,{children:[R("a",{...n,ref:o,href:e,"aria-expanded":!!r,"aria-haspopup":"dialog",onClick:u=>{let c=u.currentTarget.closest(".md"),p=e?.slice(1),f=p?Array.from(c?.querySelectorAll("[id]")??[]).find(g=>g.id===p):void 0;if(!f)return;u.preventDefault();let m=f.cloneNode(!0);for(let g of m.querySelectorAll("[data-footnote-backref]"))g.remove();let F=u.currentTarget.getBoundingClientRect();i(g=>g?void 0:{text:m.textContent?.trim()??"",left:Math.max(8,Math.min(F.left,window.innerWidth-272)),top:Math.max(8,Math.min(F.bottom+6,window.innerHeight-208))})},children:t}),r?we(ie("div",{ref:a,role:"dialog","aria-label":"Footnote","data-document-controls":!0,className:"farero-ui fixed z-50 max-h-48 w-64 max-w-[calc(100vw-1rem)] overflow-auto overscroll-contain rounded-lg border border-border bg-surface p-3 text-text text-xs shadow-xl",style:{left:r.left,top:r.top},children:[R("p",{className:"whitespace-pre-wrap",children:r.text}),R("a",{href:e,className:"mt-2 inline-block text-accent underline",onClick:()=>{let u=e?document.getElementById(e.slice(1)):null;for(let c=u?.closest("details");c;c=c.parentElement?.closest("details")??null)c.open=!0;i(void 0)},children:"Go to note"}),R("button",{type:"button",className:"ml-3 rounded px-1 text-muted",onClick:l,children:"Close"})]}),document.body):null]})},"FootnoteReference");import{MessageSquare as ve,Paperclip as Ne}from"lucide-react";import{lazy as Ee,Suspense as Te}from"react";import{jsx as d,jsxs as A}from"react/jsx-runtime";var Le=Ee(()=>import("./MathEquation-7ZVYQFEK.js")),Me=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function ae(e){return e.startsWith("http://")||e.startsWith("https://")}s(ae,"isHttpUrl");function Ae(e){return typeof e=="string"?e:Array.isArray(e)&&e.every(t=>typeof t=="string")?e.join(""):null}s(Ae,"fenceText");var Fe=s(({href:e,children:t,onOpenFile:n,filePaths:r,node:i,...o})=>{if(i?.properties.dataFootnoteRef)return d(se,{href:e,...o,children:t});if(!e)return d("span",{title:o.title,children:t});let a=h(e);if(a){let[u]=y(C(a)),c=u?u.name:a.slice(a.lastIndexOf("/")+1),p=[N(t??c),o.title,a].filter(Boolean).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as g}from"./chunk-
|
|
1
|
+
import{i as g}from"./chunk-MTA5M6VK.js";import{a as o,b as E,c as l}from"./chunk-3I4YBQX6.js";import{createCssVariablesTheme as w,createSingletonShorthands as _}from"shiki/core";var i={};E(i,{PIERRE_SYNTAX_LANGUAGES:()=>p,bundledLanguages:()=>f,bundledLanguagesInfo:()=>d,createHighlighter:()=>m,createJavaScriptRegexEngine:()=>T,createOnigurumaEngine:()=>R});l(i,Y);import{createBundledHighlighter as A}from"shiki/core";import{createJavaScriptRegexEngine as T}from"shiki/engine/javascript";import{createOnigurumaEngine as R}from"shiki/engine/oniguruma";import{bundledLanguages as f,bundledLanguagesInfo as d}from"shiki/langs";import*as Y from"shiki/core";var p=new Set(Object.keys(f)),m=A({langs:f,themes:{},engine:o(()=>T(),"engine")});var b=w({name:"farero"}),I=_(m),a=new Map,h=0,O=2e5,c=new Map;for(let n of d){let e=n.id;c.set(n.id,e);for(let t of n.aliases??[])c.set(t.toLowerCase(),e)}var G={h:"c",mm:"objective-cpp",sol:"solidity",svg:"xml",fsx:"fsharp"},P={dockerfile:"dockerfile",makefile:"make","cmakelists.txt":"cmake"},N={Bash:"shellscript"},y=64*1024;function S(n){if(!n||n.length>y||!/^\s*(?:\{|\[)/.test(n))return null;try{return JSON.parse(n),"json"}catch{return null}}o(S,"jsonLanguage");function Q(n,e){return e&&e.length>y?null:n&&N[g(n).name]||S(e)}o(Q,"languageForTool");function j(n){let e=n.slice(n.lastIndexOf("/")+1),t=P[e.toLowerCase()];if(t)return t;let r=e.lastIndexOf(".");if(r<1)return null;let s=e.slice(r+1).toLowerCase();return G[s]??c.get(s)??null}o(j,"languageForPath");function Z(n){switch(n){case"javascript":case"typescript":case"tsx":case"jsx":case"json":return"javascript";case"python":return"python";case"markdown":return"markdown";default:return null}}o(Z,"cmLanguageGroup");function ee(n,e,t){return t&&t.length>y?null:(n&&g(n).name==="Read"&&e?j(e):null)??S(t)}o(ee,"languageForToolOutput");function ne(n){let e=n?.match(/(?:^|\s)language-([\w+-]+)/)?.[1];return e?c.get(e.toLowerCase())??null:null}o(ne,"languageForFence");async function H(n,e){if(!e||!p.has(e)||n.length>1e5)return null;let t=`${e}\0${n}`,r=a.get(t);if(r)return a.delete(t),a.set(t,r),r;let s=F(n,e);for(a.set(t,s),h+=t.length;h>O||a.size>16;){let u=a.keys().next().value;if(u===void 0)break;h-=u.length,a.delete(u)}return s}o(H,"highlightLines");async function F(n,e){try{return await I.codeToTokensBase(n,{lang:e,theme:b})}catch{return null}}o(F,"tokenize");async function L(n,e){let t=await H(n,e);return t?t.flatMap((r,s)=>s?[{content:`
|
|
2
2
|
`,offset:0},...r]:r):null}o(L,"highlightCode");import{memo as v,useEffect as M,useState as U}from"react";import{Fragment as B,jsx as k}from"react/jsx-runtime";var X=o(({tokens:n})=>k(B,{children:n.map((e,t)=>{let r=e.fontStyle??0,s={color:e.color,fontStyle:r&1?"italic":void 0,fontWeight:r&2?600:void 0,textDecoration:r&4?"underline":void 0};return k("span",{style:s,children:e.content},t)})}),"Tokens"),ie=v(o(function({text:e,language:t}){let[r,s]=U(null);return M(()=>{let u=!0,x=setTimeout(()=>{e.length>1e5||!t||L(e,t).then(C=>{u&&s({text:e,tokens:C})})},160);return()=>{u=!1,clearTimeout(x)}},[e,t]),r?.text===e&&r.tokens?k(X,{tokens:r.tokens}):e},"Code"));export{Q as a,j as b,Z as c,ee as d,ne as e,H as f,L as g,X as h,ie as i};
|
package/dist/code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as e,c as g,d as a,e as n,f as r,g as t,h as l,i as u}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as e,c as g,d as a,e as n,f as r,g as t,h as l,i as u}from"./chunks/chunk-MHKNH5JT.js";import"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-3I4YBQX6.js";export{u as Code,l as Tokens,g as cmLanguageGroup,t as highlightCode,r as highlightLines,n as languageForFence,e as languageForPath,o as languageForTool,a as languageForToolOutput};
|
package/dist/commands.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,b as v,c as H}from"./chunks/chunk-S3DX6DGB.js";import{d as b,e as w}from"./chunks/chunk-
|
|
1
|
+
import{a as S,b as v,c as H}from"./chunks/chunk-S3DX6DGB.js";import{d as b,e as w}from"./chunks/chunk-MTA5M6VK.js";import{a as h}from"./chunks/chunk-5SBKMKFB.js";import{a as r}from"./chunks/chunk-3I4YBQX6.js";import{Check as z,ChevronRight as E}from"lucide-react";var A={ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192"};function m(e,t){let n=A[e.key]??(e.key.length===1?e.key.toUpperCase():e.key),o=n?[n]:[];return t?[...e.ctrl?["\u2303"]:[],...e.alt?["\u2325"]:[],...e.shift?["\u21E7"]:[],...e.mod?["\u2318"]:[],...o]:[...e.mod||e.ctrl?["Ctrl"]:[],...e.alt?["Alt"]:[],...e.shift?["Shift"]:[],...o]}r(m,"formatShortcut");function L(e,t){return m(e,t).join(t?"":"+")}r(L,"shortcutText");function T(e=typeof navigator>"u"?void 0:navigator){return/Mac|iPhone|iPad|iPod/i.test(`${e?.platform??""} ${e?.userAgent??""}`)}r(T,"isApplePlatform");function $(e,t,n){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;let o=!!t.mod;return e.metaKey===(n&&o)&&e.ctrlKey===(!n&&o||!!t.ctrl)&&e.shiftKey===!!t.shift&&e.altKey===!!t.alt}r($,"matchesShortcut");function g(e,t){return!(e.browserReserved&&!t.desktop)}r(g,"shortcutAvailable");import{jsx as s,jsxs as p}from"react/jsx-runtime";var F=r(({commands:e,grouped:t,platform:n,onRun:o,onHover:a,expandedId:i})=>{if(!e.length)return null;let c=t?I(e):[{label:"Actions",commands:e}];return s("div",{className:"farero-ui flex flex-col gap-2 pb-2",children:c.map(l=>p("section",{"aria-label":l.label,children:[s(N,{children:l.label}),s("div",{role:"menu","aria-label":l.label,className:"flex flex-col",children:l.commands.map(d=>s(K,{command:d,platform:n,breadcrumb:!t,onRun:o,onHover:a,expanded:i===d.id},d.id))})]},l.label))})},"CommandResults"),N=r(({children:e})=>s(S,{as:"h3",className:"px-2.5 pb-1",children:e}),"PaletteHeading");function I(e){let t=new Map;for(let n of e){let o=n.group??"Actions",a=t.get(o);a?a.push(n):t.set(o,[n])}return[...t].map(([n,o])=>({label:n,commands:o}))}r(I,"groupSections");var K=r(({command:e,platform:t,breadcrumb:n,onRun:o,onHover:a,expanded:i=!1,hit:c=!1,option:l})=>{let d=e.icon,k=e.shortcut&&g(e.shortcut,t)?e.shortcut:void 0,f=!!(e.children?.length?e.children.filter(u=>!u.hidden&&u.enabled!==!1):void 0)?.length,P=!f&&e.checked!==void 0,R=`${n&&e.group?`${e.group} \u203A `:""}${e.label}${e.detail?` \xB7 ${e.detail}`:""}`;return p("button",{type:"button",...l?{id:l.id,role:"option","aria-selected":l.selected,"aria-label":R,tabIndex:-1}:P?{role:"menuitemcheckbox","aria-checked":!!e.checked}:f?{role:"menuitem","aria-haspopup":"menu","aria-expanded":i,"data-palette-submenu":""}:{role:"menuitem"},"data-palette-row":"","data-palette-hit":c?"":void 0,"data-command-id":e.id,onClick:u=>o(e,u.currentTarget),onPointerEnter:u=>{u.pointerType!=="touch"&&a?.(e,u.currentTarget)},className:h("flex w-full items-center gap-3 rounded-xl px-2.5 py-2 text-left text-sm text-text hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none active:bg-surface-2",(i||l?.selected)&&"bg-surface-2"),children:[e.glyph?s("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted","aria-hidden":!0,children:e.glyph}):d?s(d,{size:16,className:"shrink-0 text-muted","aria-hidden":!0}):s("span",{className:"size-4 shrink-0","aria-hidden":!0}),p("span",{className:"min-w-0 flex-1 truncate",title:R,children:[n&&e.group?p("span",{className:"text-muted",children:[e.group," \u203A "]}):null,c?s(v,{className:"-mx-0.5",children:e.label}):e.label,e.detail?s("span",{className:"ml-2 text-faint text-xs",children:e.detail}):null]}),k?s(j,{parts:m(k,t.apple)}):null,P?s(B,{checked:!!e.checked}):null,f?s(E,{size:16,className:"shrink-0 text-faint","aria-hidden":!0}):null]})},"CommandRow"),j=r(({parts:e})=>s("span",{className:"hidden shrink-0 items-center gap-0.5 md:flex",children:e.map(t=>s(H,{children:t},t))}),"KeyCaps"),B=r(({checked:e})=>s("span",{"aria-hidden":!0,className:h("flex size-4 shrink-0 items-center justify-center rounded border",e?"border-accent bg-accent text-on-solid":"border-faint bg-surface"),children:e?s(z,{size:12,strokeWidth:3}):null}),"CheckMark");function U(e){return[e.group,e.label,...e.keywords??[]].filter(Boolean).join(" ").toLowerCase()}r(U,"haystack");function y(e){return!e.hidden&&e.enabled!==!1}r(y,"listed");function M(e,t){let n=w(U(e),t);if(n==null)return;let o=e.label.toLowerCase(),a=o.startsWith(t[0])?0:t.every(i=>o.includes(i))?1:2;return{proximity:n,surface:a}}r(M,"rankCommand");function C(e,t,n){return n.length===1?e.surface-t.surface:e.proximity-t.proximity||e.surface-t.surface}r(C,"compareRanks");function x(e,t){let n=M(e,t);for(let o of e.children??[]){if(!y(o))continue;let a=x(o,t);a&&(!n||C(a,n,t)<0)&&(n=a)}return n}r(x,"branchRank");function W(e,t){let n=e.filter(y),o=b(t);if(!o.length)return n;let a=[];for(let i of n){let c=x(i,o);c&&a.push({command:i,rank:c})}return a.sort((i,c)=>C(i.rank,c.rank,o)).map(i=>i.command)}r(W,"matchCommands");function Y(e,t){let n=b(t);if(!n.length)return[];let o=M(e,n);return(e.children??[]).filter(a=>{if(!y(a))return!1;let i=x(a,n);return!!i&&(!o||C(i,o,n)<0)})}r(Y,"submenuHits");export{F as CommandResults,K as CommandRow,N as PaletteHeading,m as formatShortcut,T as isApplePlatform,W as matchCommands,$ as matchesShortcut,g as shortcutAvailable,L as shortcutText,Y as submenuHits};
|
package/dist/fence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunks/chunk-LNOXROHT.js";import{a as e,b as r,c as t}from"./chunks/chunk-
|
|
1
|
+
import{a as o}from"./chunks/chunk-LNOXROHT.js";import{a as e,b as r,c as t}from"./chunks/chunk-BLVH5CWZ.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-MHKNH5JT.js";import"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{o as IsolatedPreview,t as RichFence,e as diffLineClass,r as fenceKind};
|
package/dist/generated-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as ee,i as te,j as ne,n as re,p as ae}from"./chunks/chunk-5WPOTZ7L.js";import"./chunks/chunk-MMVOWP5T.js";import{a as W,b as Q,c as X,d as Y}from"./chunks/chunk-6RFRRT4V.js";import{e as _,r as Z}from"./chunks/chunk-QHXTSMN4.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import{b as H}from"./chunks/chunk-HE55M4S6.js";import"./chunks/chunk-ONVWTQLU.js";import{a as U}from"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-PCK4EJ7D.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-YGPVIEBZ.js";import"./chunks/chunk-2FSGXRY6.js";import"./chunks/chunk-WQZ3EUKA.js";import{b as A}from"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import{a as C}from"./chunks/chunk-5SBKMKFB.js";import{a}from"./chunks/chunk-3I4YBQX6.js";import{useMemo as Ve}from"react";import{createStateStore as Ie}from"@json-render/core";import{JSONUIProvider as je,Renderer as Le}from"@json-render/react";import{Expand as Je,Minimize2 as qe}from"lucide-react";import{useEffect as ze,useLayoutEffect as Ke,useMemo as O,useRef as B,useState as me}from"react";import{createContext as j}from"react";var N=j(void 0),T=j({available:!1,pending:!1}),G=j({});import{createStateStore as xe}from"@json-render/core";var L=new Map;function se(e,t){return typeof t=="string"?t:e}a(se,"tabName");function ve(e){let t={};for(let[n,r]of Object.entries(e.elements)){if(r.type!=="Tabs")continue;let l=r.children[0];l&&(t[se(n,r.props.name)]=l)}return t}a(ve,"tabSelection");function he(e,t){for(let[n,r]of Object.entries(e.elements))if(r.type==="Tabs"&&se(n,r.props.name)===t)return r.children;return[]}a(he,"tabChildren");function M(e){return{...re(e),tabs:ve(e)}}a(M,"initialPanelState");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))t[n]=r;return t}a(oe,"record");function ie(e,t){let n=M(t),r=e.getSnapshot(),l={...n.values},d=oe(r.values);if(d)for(let[u,g]of Object.entries(d)){let P=l[u];P!==void 0&&typeof g==typeof P&&(typeof g=="string"||typeof g=="boolean")&&(l[u]=g)}let o={...n.tabs},b=oe(r.tabs);if(b)for(let[u,g]of Object.entries(b))typeof g!="string"||o[u]===void 0||he(t,u).includes(g)&&(o[u]=g);let m={data:n.data,values:l,tabs:o};JSON.stringify(r.data)===JSON.stringify(m.data)&&JSON.stringify(r.values)===JSON.stringify(m.values)&&JSON.stringify(r.tabs)===JSON.stringify(m.tabs)||e.update({"/data":m.data,"/values":m.values,"/tabs":m.tabs})}a(ie,"syncMemoryPanel");function J(e,t){let n=L.get(e);if(n)return n;let r=xe(M(t));return L.set(e,r),r}a(J,"memoryPanelStore");function Se(){L.clear(),Q()}a(Se,"releaseGeneratedUiMemory");import{defineRegistry as Pe,useBoundProp as F,useStateStore as R}from"@json-render/react";import{Children as Ne,useContext as $,useId as ke}from"react";import{useId as Ce,useMemo as le}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var we=W(),ce=a(({title:e,kind:t,data:n,valueLabel:r,retentionKey:l})=>{let[d,o]=X(l,we,()=>""),b=Ce(),m=le(()=>n.map((s,h)=>({...s,key:String(h)})),[n]),u=le(()=>m.filter(s=>s.label.toLocaleLowerCase().includes(d.toLocaleLowerCase())),[m,d]),g=Math.min(0,...u.map(s=>s.value)),x=Math.max(0,...u.map(s=>s.value))-g||1,y=a(s=>160-(s-g)/x*140,"y"),S=480/Math.max(1,u.length);return w("figure",{className:"min-w-0 space-y-2",children:[w("figcaption",{id:b,className:"font-medium text-sm",children:[e,r?w("span",{className:"text-muted",children:[" \xB7 ",r]}):null]}),v("input",{type:"search","aria-label":`Filter ${e}`,placeholder:"Filter labels\u2026",value:d,onChange:s=>o(s.target.value),className:"w-full rounded-lg border border-border bg-bg px-2 py-1.5 text-base sm:text-sm"}),u.length?w("svg",{viewBox:"0 0 520 185",role:"img","aria-labelledby":b,className:"w-full text-accent",children:[v("title",{children:e}),v("line",{x1:"20",x2:"500",y1:y(0),y2:y(0),stroke:"currentColor",className:"text-border"}),t==="line"?v("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",points:u.map((s,h)=>`${20+S*(h+.5)},${y(s.value)}`).join(" ")}):null,u.map((s,h)=>t==="bar"?v("rect",{x:20+S*h+S*.15,y:Math.min(y(0),y(s.value)),width:S*.7,height:Math.max(1,Math.abs(y(0)-y(s.value))),rx:"2",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key):v("circle",{cx:20+S*(h+.5),cy:y(s.value),r:"3",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key))]}):v("p",{className:"text-muted text-sm",children:"No matching values."}),v("dl",{className:"grid max-h-40 grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 overflow-y-auto overscroll-y-contain text-xs",children:u.map(s=>w("div",{className:"contents",children:[v("dt",{className:"break-words text-muted",children:s.label}),v("dd",{className:"tabular-nums",children:s.value.toLocaleString()})]},s.key))})]})},"Chart");import{jsx as i,jsxs as k}from"react/jsx-runtime";var de="w-full min-w-0 rounded-lg border border-border bg-bg px-2 py-1.5 text-base outline-none focus:border-accent disabled:opacity-50 sm:text-sm",ue=a(({label:e,children:t})=>{let n=ke();return k("div",{className:"min-w-0 space-y-1",children:[i("label",{htmlFor:n,className:"block text-muted text-xs",children:e}),t(n)]})},"Field"),Ue=a(({props:e,children:t})=>{let n=$(G)[e.name??""]??[],r=R(),[l,d]=F(String(r.get(`/tabs/${e.name}`)??""),`/tabs/${e.name}`),o=l&&n.includes(l)?l:n[0]??"";return k("div",{className:"min-w-0 space-y-3",children:[i(A,{value:o,options:n.map((b,m)=>({id:b,label:e.labels[m]??""})),onChange:d,wrap:!0}),Ne.toArray(t).map((b,m)=>i("div",{hidden:n[m]!==o,children:b},n[m]))]})},"PanelTabs"),Te=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("input",{id:d,name:e.name,type:e.type??"text",value:String(r??""),required:e.required,placeholder:e.placeholder,maxLength:4e3,onChange:o=>l(o.target.value),className:de})})},"PanelInput"),Ge=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("select",{id:d,name:e.name,value:String(r??""),onChange:o=>l(o.target.value),className:de,children:e.options.map(o=>i("option",{value:o.value,children:o.label},o.value))})})},"PanelSelect"),Me=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(n.get(`/values/${e.name}`)===!0,t?.checked??`/values/${e.name}`),d=r===!0;return k("div",{className:"flex items-center justify-between gap-3",children:[i("span",{className:"text-sm",children:e.label}),i(H,{label:e.label,checked:d,onChange:()=>l(!d)})]})},"PanelToggle"),Fe=a(({props:e,emit:t})=>{let n=$(T);return i(U,{type:"submit",size:"md",variant:"primary",disabled:!n.available||n.pending,onClick:r=>{r.preventDefault(),r.currentTarget.form?.reportValidity()&&t("press")},children:e.label})},"PanelSubmit");function Re(e,t,n){if(e)return`${e}:table:${t??""}:${n.join("\0")}`}a(Re,"tableRetention");var $e=a(({props:e})=>{let t=$(N);return k("div",{className:"min-w-0 space-y-2",children:[e.caption?i("p",{className:"text-muted text-xs",children:e.caption}):null,i(Y,{columns:e.columns,rows:e.rows.map(n=>n.map(r=>String(r??""))),retentionKey:Re(t,e.caption,e.columns)})]})},"PanelTable"),Oe=a(({props:e})=>{let t=$(N);return i(ce,{...e,retentionKey:t?`${t}:chart:${e.title}`:void 0})},"PanelChart"),Be=Pe(ne,{components:{Stack:a(({props:e,children:t})=>i("div",{className:C("flex min-w-0 gap-3",e.direction==="horizontal"?"flex-wrap items-start [&>*]:min-w-0 [&>*]:flex-1":"flex-col"),children:t}),"Stack"),Card:a(({props:e,children:t})=>k("section",{className:"min-w-0 space-y-3 rounded-lg border border-border-soft p-3",children:[e.title?i("h3",{className:"font-medium text-sm",children:e.title}):null,e.description?i("p",{className:"whitespace-pre-wrap break-words text-muted text-sm",children:e.description}):null,t]}),"Card"),Text:a(({props:e})=>i("p",{className:C("whitespace-pre-wrap break-words text-sm",e.tone==="muted"&&"text-muted"),children:e.text}),"Text"),Table:a(e=>i($e,{...e}),"Table"),Chart:a(e=>i(Oe,{...e}),"Chart"),Tabs:a(e=>i(Ue,{...e}),"Tabs"),Input:a(e=>i(Te,{...e}),"Input"),Select:a(e=>i(Ge,{...e}),"Select"),Toggle:a(e=>i(Me,{...e}),"Toggle"),Button:a(e=>i(Fe,{...e}),"Button")},actions:{submit:a(async()=>{},"submit")}}),Ee=te,q=Object.fromEntries(Object.entries(Be.registry).map(([e,t])=>[e,n=>Ee[e]?.props.safeParse(n.element.props).success?i(t,{...n}):i("p",{className:"text-muted text-xs",children:"This component has no valid value."})]));import{jsx as p,jsxs as z}from"react/jsx-runtime";var K=a(({panel:e,memoryKey:t,store:n,streaming:r=!1,ready:l=!0,notice:d,status:o,readOnly:b=!1,onSubmit:m})=>{let u=O(()=>n||(t?J(t,e.spec):Ie(M(e.spec))),[n,t,e.spec]);ze(()=>{n||!t||ie(u,e.spec)},[n,t,u,e.spec]);let g=O(()=>({...e.spec,elements:Object.fromEntries(Object.entries(e.spec.elements).map(([c,f])=>[c,f.type==="Tabs"?{...f,props:{...f.props,name:f.props.name??c}}:f]))}),[e.spec]),P=O(()=>Object.fromEntries(Object.entries(e.spec.elements).filter(([,c])=>c.type==="Tabs").map(([c,f])=>[String(f.props.name??c),f.children])),[e.spec]),[x,y]=me(!1),[S,s]=me(!1),h=B(null),V=B(null),I=B(!1),D=B({onSubmit:m,streaming:r,ready:l,store:u});D.current={onSubmit:m,streaming:r,ready:l,store:u};let pe=O(()=>({submit:a(async c=>{let{onSubmit:f,streaming:ge,ready:be,store:ye}=D.current;if(!(!f||ge||!be||I.current||typeof c.prompt!="string")){I.current=!0,s(!0);try{await f({prompt:c.prompt,values:ye.getSnapshot().values})}catch{}finally{I.current=!1,s(!1)}}},"submit")}),[]);Ke(()=>{let c=h.current;if(!c)return;let f=c.matches(":modal");if(x){if(f)return;c.close(),c.showModal();return}f&&c.close(),c.open=!0,f&&V.current?.focus({preventScroll:!0})},[x]);let fe=!!m&&!r&&l;return p(N,{value:n?void 0:t,children:p("dialog",{ref:h,"aria-label":e.title,"aria-modal":x,onCancel:c=>{c.preventDefault(),y(!1)},className:C("farero-ui overflow-hidden overscroll-contain rounded-xl border border-border-soft bg-surface p-0 text-text backdrop:bg-black/60",x?"fixed inset-0 m-auto h-[90dvh] w-[96vw] max-w-5xl":"relative m-0 w-full max-w-none"),children:p(je,{registry:q,store:u,handlers:pe,functions:ee,children:p(G,{value:P,children:p(T,{value:{available:fe,pending:S},children:z("div",{className:C("flex min-h-0 flex-col",x&&"h-full"),children:[z("header",{className:"flex shrink-0 items-center gap-2 border-border-soft border-b px-3 py-2",children:[p("h2",{className:"min-w-0 flex-1 truncate font-medium text-sm",children:e.title}),p(U,{ref:V,size:"sm",variant:"ghost","aria-label":x?"Collapse panel":"Expand panel",onClick:()=>y(c=>!c),children:x?p(qe,{size:14}):p(Je,{size:14})})]}),z("div",{className:C("min-h-0 overflow-auto overscroll-contain p-3",x?"flex-1":"max-h-[36rem]"),children:[p("form",{onSubmit:c=>c.preventDefault(),children:p("fieldset",{disabled:r||!l,className:"min-w-0 border-0 p-0",children:p(Le,{spec:g,registry:q,loading:r})})}),r?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:"Interface in progress"}):d?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:d}):null,b?p("p",{className:"mt-3 text-muted text-xs",children:"This saved view is read-only."}):null,o?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:o}):null]})]})})})})})})},"GeneratedPanel");import{jsx as E,jsxs as _e}from"react/jsx-runtime";var De=Z();function Ae(e){return E(_,{components:De,children:e})}a(Ae,"defaultText");var He=a(({text:e,memoryKey:t,renderText:n=Ae,streaming:r=!1,onSubmit:l})=>{let d=Ve(()=>ae(e),[e]);return E("div",{className:"farero-ui space-y-3",children:d.map(o=>o.kind==="text"?E("div",{children:n(o.text)},`text-${o.start}`):o.panel?E(K,{panel:o.panel,memoryKey:`${t}:${o.index}`,streaming:r||!o.complete,onSubmit:l},`panel-${o.start}`):_e("p",{role:"status",className:"text-muted text-xs",children:[o.title," \xB7"," ",o.error?"This interface could not be rendered.":o.complete?"Saving interface\u2026":"Interface in progress"]},`panel-${o.start}`))})},"GeneratedUiContent");export{K as GeneratedPanel,He as GeneratedUiContent,J as memoryPanelStore,Se as releaseGeneratedUiMemory};
|
|
1
|
+
import{f as ee,i as te,j as ne,n as re,p as ae}from"./chunks/chunk-5WPOTZ7L.js";import"./chunks/chunk-MMVOWP5T.js";import{a as W,b as Q,c as X,d as Y}from"./chunks/chunk-6RFRRT4V.js";import{e as _,r as Z}from"./chunks/chunk-JNOL5TLS.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import{b as H}from"./chunks/chunk-HE55M4S6.js";import"./chunks/chunk-ONVWTQLU.js";import{a as U}from"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-BLVH5CWZ.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-MHKNH5JT.js";import"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-WQZ3EUKA.js";import{b as A}from"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import{a as C}from"./chunks/chunk-5SBKMKFB.js";import{a}from"./chunks/chunk-3I4YBQX6.js";import{useMemo as Ve}from"react";import{createStateStore as Ie}from"@json-render/core";import{JSONUIProvider as je,Renderer as Le}from"@json-render/react";import{Expand as Je,Minimize2 as qe}from"lucide-react";import{useEffect as ze,useLayoutEffect as Ke,useMemo as O,useRef as B,useState as me}from"react";import{createContext as j}from"react";var N=j(void 0),T=j({available:!1,pending:!1}),G=j({});import{createStateStore as xe}from"@json-render/core";var L=new Map;function se(e,t){return typeof t=="string"?t:e}a(se,"tabName");function ve(e){let t={};for(let[n,r]of Object.entries(e.elements)){if(r.type!=="Tabs")continue;let l=r.children[0];l&&(t[se(n,r.props.name)]=l)}return t}a(ve,"tabSelection");function he(e,t){for(let[n,r]of Object.entries(e.elements))if(r.type==="Tabs"&&se(n,r.props.name)===t)return r.children;return[]}a(he,"tabChildren");function M(e){return{...re(e),tabs:ve(e)}}a(M,"initialPanelState");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))t[n]=r;return t}a(oe,"record");function ie(e,t){let n=M(t),r=e.getSnapshot(),l={...n.values},d=oe(r.values);if(d)for(let[u,g]of Object.entries(d)){let P=l[u];P!==void 0&&typeof g==typeof P&&(typeof g=="string"||typeof g=="boolean")&&(l[u]=g)}let o={...n.tabs},b=oe(r.tabs);if(b)for(let[u,g]of Object.entries(b))typeof g!="string"||o[u]===void 0||he(t,u).includes(g)&&(o[u]=g);let m={data:n.data,values:l,tabs:o};JSON.stringify(r.data)===JSON.stringify(m.data)&&JSON.stringify(r.values)===JSON.stringify(m.values)&&JSON.stringify(r.tabs)===JSON.stringify(m.tabs)||e.update({"/data":m.data,"/values":m.values,"/tabs":m.tabs})}a(ie,"syncMemoryPanel");function J(e,t){let n=L.get(e);if(n)return n;let r=xe(M(t));return L.set(e,r),r}a(J,"memoryPanelStore");function Se(){L.clear(),Q()}a(Se,"releaseGeneratedUiMemory");import{defineRegistry as Pe,useBoundProp as F,useStateStore as R}from"@json-render/react";import{Children as Ne,useContext as $,useId as ke}from"react";import{useId as Ce,useMemo as le}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var we=W(),ce=a(({title:e,kind:t,data:n,valueLabel:r,retentionKey:l})=>{let[d,o]=X(l,we,()=>""),b=Ce(),m=le(()=>n.map((s,h)=>({...s,key:String(h)})),[n]),u=le(()=>m.filter(s=>s.label.toLocaleLowerCase().includes(d.toLocaleLowerCase())),[m,d]),g=Math.min(0,...u.map(s=>s.value)),x=Math.max(0,...u.map(s=>s.value))-g||1,y=a(s=>160-(s-g)/x*140,"y"),S=480/Math.max(1,u.length);return w("figure",{className:"min-w-0 space-y-2",children:[w("figcaption",{id:b,className:"font-medium text-sm",children:[e,r?w("span",{className:"text-muted",children:[" \xB7 ",r]}):null]}),v("input",{type:"search","aria-label":`Filter ${e}`,placeholder:"Filter labels\u2026",value:d,onChange:s=>o(s.target.value),className:"w-full rounded-lg border border-border bg-bg px-2 py-1.5 text-base sm:text-sm"}),u.length?w("svg",{viewBox:"0 0 520 185",role:"img","aria-labelledby":b,className:"w-full text-accent",children:[v("title",{children:e}),v("line",{x1:"20",x2:"500",y1:y(0),y2:y(0),stroke:"currentColor",className:"text-border"}),t==="line"?v("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",points:u.map((s,h)=>`${20+S*(h+.5)},${y(s.value)}`).join(" ")}):null,u.map((s,h)=>t==="bar"?v("rect",{x:20+S*h+S*.15,y:Math.min(y(0),y(s.value)),width:S*.7,height:Math.max(1,Math.abs(y(0)-y(s.value))),rx:"2",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key):v("circle",{cx:20+S*(h+.5),cy:y(s.value),r:"3",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key))]}):v("p",{className:"text-muted text-sm",children:"No matching values."}),v("dl",{className:"grid max-h-40 grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 overflow-y-auto overscroll-y-contain text-xs",children:u.map(s=>w("div",{className:"contents",children:[v("dt",{className:"break-words text-muted",children:s.label}),v("dd",{className:"tabular-nums",children:s.value.toLocaleString()})]},s.key))})]})},"Chart");import{jsx as i,jsxs as k}from"react/jsx-runtime";var de="w-full min-w-0 rounded-lg border border-border bg-bg px-2 py-1.5 text-base outline-none focus:border-accent disabled:opacity-50 sm:text-sm",ue=a(({label:e,children:t})=>{let n=ke();return k("div",{className:"min-w-0 space-y-1",children:[i("label",{htmlFor:n,className:"block text-muted text-xs",children:e}),t(n)]})},"Field"),Ue=a(({props:e,children:t})=>{let n=$(G)[e.name??""]??[],r=R(),[l,d]=F(String(r.get(`/tabs/${e.name}`)??""),`/tabs/${e.name}`),o=l&&n.includes(l)?l:n[0]??"";return k("div",{className:"min-w-0 space-y-3",children:[i(A,{value:o,options:n.map((b,m)=>({id:b,label:e.labels[m]??""})),onChange:d,wrap:!0}),Ne.toArray(t).map((b,m)=>i("div",{hidden:n[m]!==o,children:b},n[m]))]})},"PanelTabs"),Te=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("input",{id:d,name:e.name,type:e.type??"text",value:String(r??""),required:e.required,placeholder:e.placeholder,maxLength:4e3,onChange:o=>l(o.target.value),className:de})})},"PanelInput"),Ge=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("select",{id:d,name:e.name,value:String(r??""),onChange:o=>l(o.target.value),className:de,children:e.options.map(o=>i("option",{value:o.value,children:o.label},o.value))})})},"PanelSelect"),Me=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(n.get(`/values/${e.name}`)===!0,t?.checked??`/values/${e.name}`),d=r===!0;return k("div",{className:"flex items-center justify-between gap-3",children:[i("span",{className:"text-sm",children:e.label}),i(H,{label:e.label,checked:d,onChange:()=>l(!d)})]})},"PanelToggle"),Fe=a(({props:e,emit:t})=>{let n=$(T);return i(U,{type:"submit",size:"md",variant:"primary",disabled:!n.available||n.pending,onClick:r=>{r.preventDefault(),r.currentTarget.form?.reportValidity()&&t("press")},children:e.label})},"PanelSubmit");function Re(e,t,n){if(e)return`${e}:table:${t??""}:${n.join("\0")}`}a(Re,"tableRetention");var $e=a(({props:e})=>{let t=$(N);return k("div",{className:"min-w-0 space-y-2",children:[e.caption?i("p",{className:"text-muted text-xs",children:e.caption}):null,i(Y,{columns:e.columns,rows:e.rows.map(n=>n.map(r=>String(r??""))),retentionKey:Re(t,e.caption,e.columns)})]})},"PanelTable"),Oe=a(({props:e})=>{let t=$(N);return i(ce,{...e,retentionKey:t?`${t}:chart:${e.title}`:void 0})},"PanelChart"),Be=Pe(ne,{components:{Stack:a(({props:e,children:t})=>i("div",{className:C("flex min-w-0 gap-3",e.direction==="horizontal"?"flex-wrap items-start [&>*]:min-w-0 [&>*]:flex-1":"flex-col"),children:t}),"Stack"),Card:a(({props:e,children:t})=>k("section",{className:"min-w-0 space-y-3 rounded-lg border border-border-soft p-3",children:[e.title?i("h3",{className:"font-medium text-sm",children:e.title}):null,e.description?i("p",{className:"whitespace-pre-wrap break-words text-muted text-sm",children:e.description}):null,t]}),"Card"),Text:a(({props:e})=>i("p",{className:C("whitespace-pre-wrap break-words text-sm",e.tone==="muted"&&"text-muted"),children:e.text}),"Text"),Table:a(e=>i($e,{...e}),"Table"),Chart:a(e=>i(Oe,{...e}),"Chart"),Tabs:a(e=>i(Ue,{...e}),"Tabs"),Input:a(e=>i(Te,{...e}),"Input"),Select:a(e=>i(Ge,{...e}),"Select"),Toggle:a(e=>i(Me,{...e}),"Toggle"),Button:a(e=>i(Fe,{...e}),"Button")},actions:{submit:a(async()=>{},"submit")}}),Ee=te,q=Object.fromEntries(Object.entries(Be.registry).map(([e,t])=>[e,n=>Ee[e]?.props.safeParse(n.element.props).success?i(t,{...n}):i("p",{className:"text-muted text-xs",children:"This component has no valid value."})]));import{jsx as p,jsxs as z}from"react/jsx-runtime";var K=a(({panel:e,memoryKey:t,store:n,streaming:r=!1,ready:l=!0,notice:d,status:o,readOnly:b=!1,onSubmit:m})=>{let u=O(()=>n||(t?J(t,e.spec):Ie(M(e.spec))),[n,t,e.spec]);ze(()=>{n||!t||ie(u,e.spec)},[n,t,u,e.spec]);let g=O(()=>({...e.spec,elements:Object.fromEntries(Object.entries(e.spec.elements).map(([c,f])=>[c,f.type==="Tabs"?{...f,props:{...f.props,name:f.props.name??c}}:f]))}),[e.spec]),P=O(()=>Object.fromEntries(Object.entries(e.spec.elements).filter(([,c])=>c.type==="Tabs").map(([c,f])=>[String(f.props.name??c),f.children])),[e.spec]),[x,y]=me(!1),[S,s]=me(!1),h=B(null),V=B(null),I=B(!1),D=B({onSubmit:m,streaming:r,ready:l,store:u});D.current={onSubmit:m,streaming:r,ready:l,store:u};let pe=O(()=>({submit:a(async c=>{let{onSubmit:f,streaming:ge,ready:be,store:ye}=D.current;if(!(!f||ge||!be||I.current||typeof c.prompt!="string")){I.current=!0,s(!0);try{await f({prompt:c.prompt,values:ye.getSnapshot().values})}catch{}finally{I.current=!1,s(!1)}}},"submit")}),[]);Ke(()=>{let c=h.current;if(!c)return;let f=c.matches(":modal");if(x){if(f)return;c.close(),c.showModal();return}f&&c.close(),c.open=!0,f&&V.current?.focus({preventScroll:!0})},[x]);let fe=!!m&&!r&&l;return p(N,{value:n?void 0:t,children:p("dialog",{ref:h,"aria-label":e.title,"aria-modal":x,onCancel:c=>{c.preventDefault(),y(!1)},className:C("farero-ui overflow-hidden overscroll-contain rounded-xl border border-border-soft bg-surface p-0 text-text backdrop:bg-black/60",x?"fixed inset-0 m-auto h-[90dvh] w-[96vw] max-w-5xl":"relative m-0 w-full max-w-none"),children:p(je,{registry:q,store:u,handlers:pe,functions:ee,children:p(G,{value:P,children:p(T,{value:{available:fe,pending:S},children:z("div",{className:C("flex min-h-0 flex-col",x&&"h-full"),children:[z("header",{className:"flex shrink-0 items-center gap-2 border-border-soft border-b px-3 py-2",children:[p("h2",{className:"min-w-0 flex-1 truncate font-medium text-sm",children:e.title}),p(U,{ref:V,size:"sm",variant:"ghost","aria-label":x?"Collapse panel":"Expand panel",onClick:()=>y(c=>!c),children:x?p(qe,{size:14}):p(Je,{size:14})})]}),z("div",{className:C("min-h-0 overflow-auto overscroll-contain p-3",x?"flex-1":"max-h-[36rem]"),children:[p("form",{onSubmit:c=>c.preventDefault(),children:p("fieldset",{disabled:r||!l,className:"min-w-0 border-0 p-0",children:p(Le,{spec:g,registry:q,loading:r})})}),r?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:"Interface in progress"}):d?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:d}):null,b?p("p",{className:"mt-3 text-muted text-xs",children:"This saved view is read-only."}):null,o?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:o}):null]})]})})})})})})},"GeneratedPanel");import{jsx as E,jsxs as _e}from"react/jsx-runtime";var De=Z();function Ae(e){return E(_,{components:De,children:e})}a(Ae,"defaultText");var He=a(({text:e,memoryKey:t,renderText:n=Ae,streaming:r=!1,onSubmit:l})=>{let d=Ve(()=>ae(e),[e]);return E("div",{className:"farero-ui space-y-3",children:d.map(o=>o.kind==="text"?E("div",{children:n(o.text)},`text-${o.start}`):o.panel?E(K,{panel:o.panel,memoryKey:`${t}:${o.index}`,streaming:r||!o.complete,onSubmit:l},`panel-${o.start}`):_e("p",{role:"status",className:"text-muted text-xs",children:[o.title," \xB7"," ",o.error?"This interface could not be rendered.":o.complete?"Saving interface\u2026":"Interface in progress"]},`panel-${o.start}`))})},"GeneratedUiContent");export{K as GeneratedPanel,He as GeneratedUiContent,J as memoryPanelStore,Se as releaseGeneratedUiMemory};
|
package/dist/markdown.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as n,e as a,f as c,g as p,h as f,i as m,j as i,k as l,l as d,m as s,n as h,o as x,p as y,q as k,r as C,s as R}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as n,e as a,f as c,g as p,h as f,i as m,j as i,k as l,l as d,m as s,n as h,o as x,p as y,q as k,r as C,s as R}from"./chunks/chunk-JNOL5TLS.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import"./chunks/chunk-ONVWTQLU.js";import"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import{e}from"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-BLVH5CWZ.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-MHKNH5JT.js";import"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{o as ATTACHMENT_HOST,y as ChatParagraph,k as FootnoteReference,a as MarkdownBody,R as ReadonlyMarkdownComponents,r as attachmentHref,m as attachmentPath,s as chatLinkAction,C as createReadonlyComponents,f as fenceSource,p as fileUrlToLocalPath,c as isAbsoluteFilePath,i as isChatHandoffHref,n as isMarkdownFile,h as linkFaviconUrl,x as linkText,t as markdownSource,e as reactText,l as sourceReference,d as sourceReferences};
|
package/dist/transcript.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as _,h as qe,r as Ge}from"./chunks/chunk-
|
|
1
|
+
import{e as _,h as qe,r as Ge}from"./chunks/chunk-JNOL5TLS.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import"./chunks/chunk-ONVWTQLU.js";import"./chunks/chunk-ITKN2ASJ.js";import{a as L}from"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import{c as We}from"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-BLVH5CWZ.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-MHKNH5JT.js";import{b as Pe,f as R,g as F,i as x,j as ie,k as Fe,l as Le,m as G,n as ae,o as h,p as De,q as H,r as Ue}from"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import{d as $e}from"./chunks/chunk-HGN4GN2E.js";import{a as I}from"./chunks/chunk-5SBKMKFB.js";import{a as i}from"./chunks/chunk-3I4YBQX6.js";function j(e){e=e.filter(s=>!s.supersededBy&&!Le(s.text));let t=new Map;for(let s of e)s.subagentLabel&&s.toolUseId&&!t.has(s.toolUseId)&&t.set(s.toolUseId,s);let n=new Map,r=new Set;for(let s of e){let a=s.parentToolUseId,l=a?t.get(a):void 0;if(!l||l===s)continue;let p=n.get(a)??[];p.push(s),n.set(a,p),r.add(s)}let o=i((s,a)=>{let l=s.toolUseId;if(!l||a.has(l))return{e:s,children:[]};let p=new Set(a);return p.add(l),{e:s,children:(n.get(l)??[]).map(u=>o(u,p))}},"build");return e.filter(s=>!r.has(s)).map(s=>o(s,new Set))}i(j,"transcriptTree");function He(e){let t=[],n=new Set,r=i(o=>{let s=o.e.toolUseId,a=o.e.subagentLabel;s&&a&&!n.has(s)&&(n.add(s),t.push({id:s,label:a,node:o}));for(let l of o.children)r(l)},"visit");for(let o of e)r(o);return t.sort((o,s)=>o.node.e.rowid-s.node.e.rowid||o.id.localeCompare(s.id))}i(He,"transcriptSubagents");var A=i(e=>e.role==="user"&&(e.queued||!h(e)),"isTurnPrompt");function je(e){let t=[],n=null,r=null,o=!1,s=i(()=>{n?t.push(n):o&&r&&t.push(r),n=null,r=null,o=!1},"close");for(let a of e)a.role==="assistant"?n=a:A(a)?(s(),o=!0):r=a;return s(),t}i(je,"turnActionEnds");function Qe(e){return e.source?.kind==="workflow"}i(Qe,"isWorkflowReport");function Tt(e,t){return e.flatMap(n=>Qe(n)&&n.parentSessionId===t?[n.wake?.promptId,n.wakeFailure?.promptId].filter(r=>r!==void 0):[])}i(Tt,"workflowReportPromptIds");var Ve=/^Report: (\S.*)$/;function le(e){let t=new Set,n=!1,r=!1;for(let o of e)if(!o.queued&&h(o)){let s=G.exec(o.text);r||=s?.[1]==="Workflow"||o.id.startsWith("workflow_");let a=s?.[1]==="Delegated"?s[3]:o.id.replace(/^return-/,"").replace(/(?:-wake-\d+|-retry(?:-\d+)?)$/,"");t.add(`job:${a}`)}else if(o.role==="tool"&&!o.aborted){if(o.subagentLabel){if(!o.toolUseId)return null;t.add(`native:${o.toolUseId}`)}else if(o.tool&&!o.error&&x(o.tool,o.text).name==="mcp__farero_host__delegate_task"){let s=Q(o.output);if(!s)return null;n||=!!s.workflowId,t.add(`job:${s.delegationId}`)}}return n&&r?null:t.size}i(le,"turnDelegationCount");function Q(e,t=0){if(t>6)return null;if(typeof e=="string")try{return Q(JSON.parse(e),t+1)}catch{return null}if(Array.isArray(e)){for(let r of e){let o=Q(r,t+1);if(o)return o}return null}if(!e||typeof e!="object")return null;let n=e;return n.isError||n.outputValidation?null:n.ok===!0&&typeof n.delegationId=="string"&&n.delegationId?{delegationId:n.delegationId,...typeof n.workflowId=="string"?{workflowId:n.workflowId}:{}}:Q(n.structuredContent??n.content??n.text,t+1)}i(Q,"delegationReceipt");function de(e){let t=G.exec(e),n="Worker complete",r=e,o=null;if(t){let[,,m,,S]=t;n=`${m.charAt(0).toUpperCase()}${m.slice(1)} ${S==="completed"?"complete":S}`;let k=r.split(`
|
|
2
2
|
`),T=k.findIndex(N=>G.test(N));if(T>=0){o=k[T].trim();let N=k[T].slice(t[0].length).replace(/^:\s*/,"").trim();S==="failed"&&N?k[T]=N:k.splice(T,1),r=k.join(`
|
|
3
3
|
`)}}let s=null,a=r.indexOf(ae);if(a>=0){let m=r.lastIndexOf(`
|
|
4
4
|
|
package/package.json
CHANGED
|
File without changes
|