@vpxa/aikit 0.1.162 → 0.1.163
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/package.json
CHANGED
|
@@ -1579,7 +1579,7 @@ html[data-theme='dark'] .aikit-theme-toggle-icon--moon {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
`,_t={actions:m,cards:ee,chart:te,checklist:ne,code:re,comparison:ae,"component-detail":fe,"data-table-schema":_e,"docs-browser":ye,"docs-hub":Ce,finding:Te,graph:De,heading:Oe,"lifecycle-flow":Ie,markdown:Ve,mermaid:He,metrics:We,paragraph:Ge,progress:qe,prompt:Ye,separator:Xe,"status-board":Qe,table:tt,tags:rt,text:it,timeline:at,tree:ot};function vt(e,t){let r={...e,value:o(e.value)},i=_t[r.type],a=i?i(r,t):bt(r);return r.title&&![`heading`,`finding`].includes(r.type)?`<section class="bk-section bk-section--${n(r.type)}"><h3 class="bk-section-title">${n(r.title)}</h3>${a}</section>`:a}function yt(e,t){return e.map(e=>vt(e,t)).join(`
|
|
1581
1581
|
`)}function bt(e){if(e.value===void 0||e.value===null)return``;if(typeof e.value==`string`)return`<p class="bk-paragraph">${n(e.value)}</p>`;try{return`<pre class="bk-fallback">${n(JSON.stringify(e.value,null,2))}</pre>`}catch{return`<pre class="bk-fallback">${n(String(e.value))}</pre>`}}var xt=class{templates=new Map;register(e){this.templates.set(e.id,e)}get(e){let t=this.templates.get(e);if(t)return t;let n=e.includes(`@`)?e:`${e}@`,r,i=-1;for(let[e,t]of this.templates){if(!e.startsWith(n))continue;let a=Number.parseInt(e.split(`@`)[1]??`0`,10);a>i&&(i=a,r=t)}return r}has(e){return this.get(e)!==void 0}list(){return[...this.templates.values()]}};const St=[`mcp-app`,`browser`];function k(e){return typeof e==`object`&&!!e}function Ct(e){return Array.isArray(e)?e.flatMap(e=>!k(e)||typeof e.label!=`string`?[]:[{label:e.label,checked:!!e.checked}]):[]}const A={id:`checklist@1`,label:`Checklist`,description:`Checklist with optional title and form hydration metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`checked`],properties:{label:{type:`string`},checked:{type:`boolean`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=[],n=k(e)&&typeof e.title==`string`?e.title:void 0,r=k(e)?Ct(e.items):[];return n&&t.push({type:`heading`,value:n}),t.push({type:`checklist`,value:r}),t},hydration:[`form`],supportedTransports:St},wt=[`mcp-app`,`browser`,`export`];function j(e){return typeof e==`object`&&!!e}function Tt(e){return j(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function Et(e){return j(e)&&typeof e.key==`string`&&typeof e.label==`string`}function Dt(e){return Array.isArray(e)?e.filter(j):[]}function Ot(e,t){if(Array.isArray(e)){let t=e.filter(Et);if(t.length>0)return t}return Object.keys(t[0]??{}).map(e=>({key:e,label:e}))}const M={id:`data-table@1`,label:`Data Table`,description:`Static data table with optional metrics and sortable table hydration.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`key`,`label`],properties:{key:{type:`string`},label:{type:`string`}},additionalProperties:!1}},rows:{type:`array`,items:{type:`object`}},stats:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}}},required:[`rows`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=j(e)?Dt(e.rows):[],n=j(e)?Ot(e.columns,t):[],r=n.map(e=>e.label),i=t.map(e=>n.map(t=>e[t.key])),a=[];if(j(e)&&Array.isArray(e.stats)){let t=e.stats.filter(Tt);t.length>0&&a.push({type:`metrics`,value:t})}return a.push({type:`table`,columns:n,headers:r,rows:i,value:{headers:r,rows:i}}),a},hydration:[`table`],supportedTransports:wt},kt=[`mcp-app`,`browser`,`export`];function N(e){return typeof e==`object`&&!!e}function At(e){return Array.isArray(e)?e.flatMap(e=>!N(e)||typeof e.type!=`string`||typeof e.content!=`string`?[]:[{type:e.type,content:e.content}]):[]}function jt(e){return Array.isArray(e)?e.flatMap(e=>!N(e)||typeof e.header!=`string`?[]:[{header:e.header,changes:At(e.changes)}]):[]}function Mt(e){return!N(e)||!Array.isArray(e.files)?[]:e.files.flatMap(e=>!N(e)||typeof e.path!=`string`||typeof e.status!=`string`?[]:[{path:e.path,status:e.status,additions:typeof e.additions==`number`?e.additions:0,deletions:typeof e.deletions==`number`?e.deletions:0,hunks:jt(e.hunks)}])}function Nt(e){return e===`add`?`+`:e===`delete`?`-`:` `}function Pt(e){let t=e.hunks.flatMap(e=>[e.header,...e.changes.map(e=>`${Nt(e.type)}${e.content}`)]).join(`
|
|
1582
|
-
`);return[{type:`heading`,value:e.path},{type:`paragraph`,value:`${e.status} | +${e.additions} / -${e.deletions}`},{type:`code`,language:`diff`,value:t}]}const P={id:`diff-view@1`,label:`Diff View`,description:`Static diff summary rendered as per-file diff code blocks.`,inputSchema:{type:`object`,properties:{files:{type:`array`,items:{type:`object`,required:[`path`,`status`,`additions`,`deletions`,`hunks`],properties:{path:{type:`string`},status:{type:`string`},additions:{type:`number`},deletions:{type:`number`},hunks:{type:`array`,items:{type:`object`,required:[`header`,`changes`],properties:{header:{type:`string`},changes:{type:`array`,items:{type:`object`,required:[`type`,`content`],properties:{type:{type:`string`},content:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`files`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>Mt(e).flatMap(Pt),hydration:[],supportedTransports:kt},Ft=[`mcp-app`,`browser`,`export`];function F(e){return typeof e==`object`&&!!e}function It(e){return F(e)&&typeof e.type==`string`}function Lt(e){return Array.isArray(e)&&e.every(It)}function Rt(e){if(!F(e))return{sections:[]};let t=Array.isArray(e.sections)?e.sections.flatMap(e=>{if(!F(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||Lt(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[];return{title:typeof e.title==`string`?e.title:void 0,sections:t}}function zt(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}const I={id:`document@1`,label:`Document`,description:`Structured document with optional title and section content blocks.`,inputSchema:{type:`object`,properties:{title:{type:`string`},sections:{type:`array`,items:{type:`object`,additionalProperties:!1,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}}}}},required:[`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=Rt(e),n=[];t.title&&n.push({type:`heading`,value:t.title});for(let e of t.sections)n.push(...zt(e));return n},hydration:[],supportedTransports:Ft},Bt=[`mcp-app`,`browser`,`export`];function Vt(e){return typeof e==`object`&&!!e}function Ht(e){return Vt(e)?{code:typeof e.code==`string`?e.code:`ERROR`,message:typeof e.message==`string`?e.message:`Unknown error`,details:typeof e.details==`string`?e.details:void 0,stack:typeof e.stack==`string`?e.stack:void 0}:{code:`ERROR`,message:`Unknown error`}}const L={id:`error@1`,label:`Error`,description:`Static error view with message and optional stack trace.`,inputSchema:{type:`object`,properties:{code:{type:`string`},message:{type:`string`},details:{type:`string`},stack:{type:`string`}},required:[`code`,`message`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=Ht(e),n=[{type:`heading`,value:`Error`},{type:`code`,title:t.code,language:`text`,value:t.details?`${t.message}\n\n${t.details}`:t.message}];return t.stack&&n.push({type:`code`,title:`Stack Trace`,language:`text`,value:t.stack}),n},hydration:[],supportedTransports:Bt};function R(e){return typeof e==`object`&&!!e}function Ut(e){return Array.isArray(e)?e.flatMap(e=>!R(e)||typeof e.name!=`string`||typeof e.label!=`string`?[]:[{name:e.name,label:e.label,type:typeof e.type==`string`?e.type:void 0,required:typeof e.required==`boolean`?e.required:void 0,placeholder:typeof e.placeholder==`string`?e.placeholder:void 0,default:typeof e.default==`string`?e.default:void 0,options:Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`):void 0,value:typeof e.value==`string`?e.value:void 0}]):[]}const z={id:`form@1`,label:`Form`,description:`Browser-only form template rendered as a heading and table of field metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},fields:{type:`array`,items:{type:`object`,required:[`name`,`label`],properties:{name:{type:`string`},label:{type:`string`},type:{type:`string`},required:{type:`boolean`},placeholder:{type:`string`},default:{type:`string`},options:{type:`array`,items:{type:`string`}},value:{type:`string`}},additionalProperties:!1}}},required:[`fields`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:R(e)&&typeof e.title==`string`?e.title:`Form`,fields:R(e)?Ut(e.fields):[]};return[{type:`heading`,value:t.title},{type:`table`,value:{headers:[`Label`,`Name`,`Type`,`Required`,`Default/Placeholder`],rows:t.fields.map(e=>[e.label||e.name,e.name,e.type||`text`,e.required?`Yes`:`No`,e.placeholder||e.default||``])}}]},hydration:[`form`],supportedTransports:[`browser`]},Wt=[`mcp-app`,`browser`];function B(e){return typeof e==`object`&&!!e}function Gt(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>!B(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]);return t.length>0?t:void 0}function Kt(e){return Array.isArray(e)?e.flatMap(e=>!B(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label,category:typeof e.category==`string`?e.category:void 0,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0}]):[]}function qt(e){return B(e)?{categories:Gt(e.categories),items:Kt(e.items)}:{items:[]}}function V(e){return{title:e.label,body:e.id,description:e.tags&&e.tags.length>0?e.tags.join(`, `):void 0}}function H(e,t){return t.length===0?[]:[{type:`heading`,value:e},{type:`cards`,value:t.map(V)}]}const U={id:`picker@1`,label:`Picker`,description:`Grouped item picker rendered as cards with picker hydration metadata.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}},items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},category:{type:`string`},tags:{type:`array`,items:{type:`string`}}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=qt(e),n=[];if(t.categories&&t.categories.length>0){let e=new Set(t.categories.map(e=>e.id)),r=[];for(let e of t.categories){let n=H(e.label,t.items.filter(t=>t.category===e.id));n.length>0&&r.push(n)}let i=H(`Other`,t.items.filter(t=>!t.category||!e.has(t.category)));return i.length>0&&r.push(i),n.push(...r.flatMap((e,t)=>t>0?[{type:`separator`},...e]:e)),n}return t.items.length>0&&n.push({type:`cards`,value:t.items.map(V)}),n},hydration:[`picker`],supportedTransports:Wt},Jt=[`mcp-app`,`browser`,`export`];function W(e){return typeof e==`object`&&!!e}function Yt(e){return W(e)&&typeof e.type==`string`}function Xt(e){return Array.isArray(e)&&e.every(Yt)}function Zt(e){return W(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function Qt(e){return Array.isArray(e)?e.flatMap(e=>{if(!W(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||Xt(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[]}function $t(e){return Array.isArray(e)?e.flatMap(e=>W(e)?[{title:typeof e.title==`string`?e.title:void 0,value:e.value,headers:Array.isArray(e.headers)?e.headers.filter(e=>typeof e==`string`):void 0,rows:Array.isArray(e.rows)?e.rows.filter(e=>Array.isArray(e)):void 0}]:[]):[]}function en(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}function tn(e){let t={type:`table`};return e.title&&(t.title=e.title),e.value!==void 0&&(t.value=e.value),e.headers&&(t.headers=e.headers),e.rows&&(t.rows=e.rows),t}const nn={id:`report@1`,label:`Report`,description:`Static report with title, optional metrics, narrative sections, and tables.`,inputSchema:{type:`object`,properties:{title:{type:`string`},metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}},sections:{type:`array`,items:{type:`object`,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}},additionalProperties:!1}},tables:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},value:{},headers:{type:`array`,items:{type:`string`}},rows:{type:`array`,items:{type:`array`,items:{}}}},additionalProperties:!1}}},required:[`title`,`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:W(e)&&typeof e.title==`string`?e.title:`Report`,metrics:W(e)&&Array.isArray(e.metrics)?e.metrics.filter(Zt):void 0,sections:W(e)?Qt(e.sections):[],tables:W(e)?$t(e.tables):void 0},n=[{type:`heading`,value:t.title}];t.metrics&&t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics});for(let e of t.sections)n.push(...en(e));for(let e of t.tables??[])n.push(tn(e));return n},hydration:[],supportedTransports:Jt},rn=[`mcp-app`,`browser`,`export`];function G(e){return typeof e==`object`&&!!e}function an(e){return Array.isArray(e)?e.flatMap(e=>{if(!G(e)||typeof e.category!=`string`||!Array.isArray(e.items))return[];let t=e.items.flatMap(e=>!G(e)||typeof e.label!=`string`||typeof e.status!=`string`?[]:[{label:e.label,status:e.status,badge:typeof e.badge==`string`?e.badge:void 0}]);return[{category:e.category,items:t}]}):[]}function on(e){return e.map(e=>({title:e.label,status:e.status,badge:e.badge}))}const K={id:`status-board@1`,label:`Status Board`,description:`Static status board grouped into category headings and card collections.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`category`,`items`],properties:{category:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`status`],properties:{label:{type:`string`},status:{type:`string`},badge:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`categories`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=G(e)?an(e.categories):[],n=[];for(let e of t)n.push({type:`heading`,value:e.category}),n.push({type:`cards`,value:on(e.items)});return n},hydration:[],supportedTransports:rn},sn=[`mcp-app`,`browser`,`export`];function q(e){return typeof e==`object`&&!!e}function cn(e){return Array.isArray(e)?e.flatMap(e=>!q(e)||typeof e.title!=`string`?[]:[{title:e.title,description:typeof e.description==`string`?e.description:void 0,timestamp:typeof e.timestamp==`string`?e.timestamp:void 0,status:typeof e.status==`string`?e.status:void 0}]):[]}function ln(e){return Array.isArray(e)?{entries:cn(e)}:q(e)?{entries:cn(e.entries??e.events??e.items),title:typeof e.title==`string`?e.title:void 0}:{entries:[]}}const J={type:`array`,items:{type:`object`,required:[`title`],properties:{title:{type:`string`},description:{type:`string`},timestamp:{type:`string`},status:{type:`string`}},additionalProperties:!1}},un={id:`timeline@1`,label:`Timeline`,description:`Static timeline events rendered as a timeline block.`,inputSchema:{oneOf:[J,{type:`object`,properties:{title:{type:`string`},entries:J,events:J,items:J},anyOf:[{required:[`entries`]},{required:[`events`]},{required:[`items`]}],additionalProperties:!1}]},defaultLayout:{},blocksFromData:e=>{let{entries:t,title:n}=ln(e),r=[];return n&&r.push({type:`heading`,value:n}),r.push({type:`timeline`,value:t}),r},hydration:[],supportedTransports:sn},dn=[`mcp-app`,`browser`,`export`];function Y(e){return typeof e==`object`&&!!e}function X(e){return Y(e)&&typeof e.label==`string`}function fn(e){return{name:e.label,children:Array.isArray(e.children)?e.children.filter(X).map(fn):[]}}function pn(e){if(!Y(e))return{};let t=e.root;return X(t)?fn(t):Y(t)?t:e}const mn={id:`tree@1`,label:`Tree`,description:`Static tree view data with optional tree hydration metadata.`,inputSchema:{oneOf:[{type:`object`,properties:{root:{type:`object`}},required:[`root`],additionalProperties:!0},{type:`object`,additionalProperties:!0}]},defaultLayout:{},blocksFromData:e=>[{type:`tree`,value:pn(e)}],hydration:[`tree`],supportedTransports:dn},Z=new xt;Z.register(A),Z.register(P),Z.register(I),Z.register(U),Z.register(nn),Z.register(un),Z.register(mn),Z.register(M),Z.register(L),Z.register(z),Z.register(K);let Q=0;function hn(){return Q=(Q+1)%(2**53-1),`${Date.now().toString(16).padStart(12,`0`).slice(-12)}${Q.toString(16).padStart(4,`0`).slice(-4)}${Array.from({length:8},()=>Math.floor(Math.random()*256).toString(16).padStart(2,`0`)).join(``)}`}function gn(e){return{id:e,version:1,entry:`@aikit/blocks-interactive/dist/islands/${e}.js`,selector:`[data-island="${e}"]`,needsData:!0}}function _n(e,t){let n=new TextEncoder;return n.encode(e).byteLength+t.reduce((e,t)=>e+n.encode(t).byteLength,0)}function vn(e,t){let n=[],r=t.registry??Z,i={colorScheme:e.colorScheme??t.colorScheme??`auto`,transport:t.transport,lang:e.lang,dir:e.dir},a=[...e.blocks??[]],o=[...a],s=[],c=[...e.actions??[]];if(e.template){let t=r.get(e.template);if(t)try{o=t.blocksFromData(e.data,i),t.actionsFromData&&(c=[...c,...t.actionsFromData(e.data)]),s=t.hydration.map(e=>gn(e))}catch(t){let r=t instanceof Error?t.message:String(t);n.push({level:`error`,message:`Template ${e.template} failed: ${r}`}),o=a.length===0?L.blocksFromData({code:`TEMPLATE_RENDER_ERROR`,message:`Failed to render template ${e.template}`,details:r},i):[...a]}else n.push({level:`warn`,message:`Template not found: ${e.template}`})}let l=yt(o,i),u=[S(o.map(e=>e.type))],d=t.nonce??hn(),f=e.metadata?.surfaceId??`surface-${d}`,p=s.length>0?JSON.stringify({data:e.data,blocks:o}):void 0,m=t.blockVendorScripts?[...new Set(o.flatMap(e=>t.blockVendorScripts?.[e.type]??[]))]:void 0;return{surfaceId:f,nonce:d,html:l,css:u,vendorScripts:m&&m.length>0?m:void 0,islands:s,actions:c,payload:p,estimatedBytes:_n(l,u),exportPolicy:s.length>0?`local-interactive`:`static-only`,diagnostics:n.length>0?n:void 0}}function yn(e){return e===`up`||e===`down`||e===`neutral`}function $(e){return typeof e==`object`&&!!e}function bn(e){return!$(e)||!Array.isArray(e.metrics)?{metrics:[]}:{metrics:e.metrics.flatMap(e=>{if(!$(e)||typeof e.label!=`string`||typeof e.value!=`string`&&typeof e.value!=`number`)return[];let t=$(e.trend)&&typeof e.trend.value==`string`&&yn(e.trend.direction)?{value:e.trend.value,direction:e.trend.direction}:void 0,n=Array.isArray(e.items)?e.items.flatMap(e=>!$(e)||typeof e.label!=`string`||typeof e.value!=`string`?[]:[{label:e.label,value:e.value}]):void 0;return[{id:typeof e.id==`string`?e.id:void 0,label:e.label,value:e.value,trend:t,status:e.status===`success`||e.status===`warning`||e.status===`error`||e.status===`info`?e.status:void 0,type:e.type===`progress`||e.type===`list`||e.type===`stat`?e.type:void 0,progress:typeof e.progress==`number`?On(e.progress):void 0,items:n}]})}}function xn(e){let t=e.type===`progress`&&typeof e.progress==`number`?`${e.progress}%`:void 0;return{label:e.label,value:e.value,trend:e.trend?.value??t,status:e.status}}function Sn(e){return e.type!==`progress`||typeof e.progress!=`number`?null:{label:e.label,value:On(e.progress),max:100}}function Cn(e){return $(e)?{columns:Array.isArray(e.columns)?e.columns.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]):[],cards:Array.isArray(e.cards)?e.cards.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.title!=`string`||typeof e.column!=`string`?[]:[{id:e.id,title:e.title,description:typeof e.description==`string`?e.description:void 0,column:e.column,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0,priority:e.priority===`high`||e.priority===`medium`||e.priority===`low`?e.priority:void 0}]):[]}:{columns:[],cards:[]}}function wn(e){return{title:e.title,description:e.description,badge:e.priority,body:e.tags?.join(`, `),status:e.priority}}function Tn(e){return!$(e)||!Array.isArray(e.items)?[]:e.items.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}])}function En(e){return $(e)?{name:typeof e.name==`string`?e.name:``,total:typeof e.total==`number`?e.total:typeof e.value==`number`?e.value:0,self:typeof e.self==`number`?e.self:void 0,children:Array.isArray(e.children)?e.children.map(e=>En(e)):[]}:{name:``,total:0,children:[]}}function Dn(e){return{name:e.self==null?`${e.name} (${e.total})`:`${e.name} (${e.total} total / ${e.self} self)`,children:(e.children??[]).map(Dn)}}function On(e){return Math.max(0,Math.min(100,e))}function kn(e){let t=bn(e),n=[];t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics.map(xn)});let r=t.metrics.map(Sn).filter(e=>e!==null);r.length>0&&n.push({type:`progress`,value:r});for(let e of t.metrics)e.type===`list`&&e.items&&e.items.length>0&&(n.push({type:`heading`,value:e.label}),n.push({type:`table`,value:e.items}));return n}function An(e){let t=Cn(e),n=[];for(let e of t.columns){let r=t.cards.filter(t=>t.column===e.id);n.push({type:`heading`,value:e.label}),n.push({type:`cards`,value:r.map(wn)})}return n}function jn(e){let t=Tn(e);return t.length===0?[]:[{type:`cards`,value:t.map((e,t)=>({title:e.label,body:e.id,badge:`#${t+1}`}))}]}function Mn(e){return!$(e)||!$(e.profile)?[]:[{type:`tree`,value:Dn(En(e.profile))}]}const Nn={id:`dashboard@1`,label:`Dashboard`,description:`Metric cards grid with optional charts.`,inputSchema:{type:`object`,properties:{metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{id:{type:`string`},label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:`object`,properties:{value:{type:`string`},direction:{enum:[`up`,`down`,`neutral`]}},required:[`value`,`direction`],additionalProperties:!1},status:{enum:[`success`,`warning`,`error`,`info`]},type:{enum:[`stat`,`progress`,`list`]},progress:{type:`number`},items:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`metrics`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>kn(e),hydration:[],supportedTransports:[`mcp-app`,`browser`]},Pn={id:`kanban@1`,label:`Kanban`,description:`Drag-and-drop task board grouped by columns.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},color:{type:`string`}},additionalProperties:!1}},cards:{type:`array`,items:{type:`object`,required:[`id`,`title`,`column`],properties:{id:{type:`string`},title:{type:`string`},description:{type:`string`},column:{type:`string`},tags:{type:`array`,items:{type:`string`}},priority:{enum:[`high`,`medium`,`low`]}},additionalProperties:!1}}},required:[`columns`,`cards`],additionalProperties:!1},defaultLayout:{maxWidth:`1400px`},blocksFromData:e=>An(e),hydration:[],supportedTransports:[`browser`]},Fn={id:`list-sort@1`,label:`Sortable List`,description:`Reorderable list of items with browser drag-and-drop interactions.`,inputSchema:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{maxWidth:`720px`},blocksFromData:e=>jn(e),hydration:[],supportedTransports:[`browser`]},In={id:`flame-graph@1`,label:`Flame Graph`,description:`Hierarchical performance profile with interactive zoom state.`,inputSchema:{type:`object`,properties:{profile:{type:`object`}},required:[`profile`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>Mn(e),hydration:[],supportedTransports:[`browser`]};function Ln(e){return e.replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/&/g,`\\u0026`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}function Rn(e,t){let n=[`
|
|
1582
|
+
`);return[{type:`heading`,value:e.path},{type:`paragraph`,value:`${e.status} | +${e.additions} / -${e.deletions}`},{type:`code`,language:`diff`,value:t}]}const P={id:`diff-view@1`,label:`Diff View`,description:`Static diff summary rendered as per-file diff code blocks.`,inputSchema:{type:`object`,properties:{files:{type:`array`,items:{type:`object`,required:[`path`,`status`,`additions`,`deletions`,`hunks`],properties:{path:{type:`string`},status:{type:`string`},additions:{type:`number`},deletions:{type:`number`},hunks:{type:`array`,items:{type:`object`,required:[`header`,`changes`],properties:{header:{type:`string`},changes:{type:`array`,items:{type:`object`,required:[`type`,`content`],properties:{type:{type:`string`},content:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`files`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>Mt(e).flatMap(Pt),hydration:[],supportedTransports:kt},Ft=[`mcp-app`,`browser`,`export`];function F(e){return typeof e==`object`&&!!e}function It(e){return F(e)&&typeof e.type==`string`}function Lt(e){return Array.isArray(e)&&e.every(It)}function Rt(e){if(!F(e))return{sections:[]};let t=Array.isArray(e.sections)?e.sections.flatMap(e=>{if(!F(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||Lt(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[];return{title:typeof e.title==`string`?e.title:void 0,sections:t}}function zt(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}const I={id:`document@1`,label:`Document`,description:`Structured document with optional title and section content blocks.`,inputSchema:{type:`object`,properties:{title:{type:`string`},sections:{type:`array`,items:{type:`object`,additionalProperties:!1,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}}}}},required:[`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=Rt(e),n=[];t.title&&n.push({type:`heading`,value:t.title});for(let e of t.sections)n.push(...zt(e));return n},hydration:[],supportedTransports:Ft},Bt=[`mcp-app`,`browser`,`export`];function Vt(e){return typeof e==`object`&&!!e}function Ht(e){return Vt(e)?{code:typeof e.code==`string`?e.code:`ERROR`,message:typeof e.message==`string`?e.message:`Unknown error`,details:typeof e.details==`string`?e.details:void 0,stack:typeof e.stack==`string`?e.stack:void 0}:{code:`ERROR`,message:`Unknown error`}}const L={id:`error@1`,label:`Error`,description:`Static error view with message and optional stack trace.`,inputSchema:{type:`object`,properties:{code:{type:`string`},message:{type:`string`},details:{type:`string`},stack:{type:`string`}},required:[`code`,`message`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=Ht(e),n=[{type:`heading`,value:`Error`},{type:`code`,title:t.code,language:`text`,value:t.details?`${t.message}\n\n${t.details}`:t.message}];return t.stack&&n.push({type:`code`,title:`Stack Trace`,language:`text`,value:t.stack}),n},hydration:[],supportedTransports:Bt};function R(e){return typeof e==`object`&&!!e}function Ut(e){return Array.isArray(e)?e.flatMap(e=>!R(e)||typeof e.name!=`string`||typeof e.label!=`string`?[]:[{name:e.name,label:e.label,type:typeof e.type==`string`?e.type:void 0,required:typeof e.required==`boolean`?e.required:void 0,placeholder:typeof e.placeholder==`string`?e.placeholder:void 0,default:typeof e.default==`string`?e.default:void 0,options:Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`):void 0,value:typeof e.value==`string`?e.value:void 0}]):[]}const z={id:`form@1`,label:`Form`,description:`Browser-only form template rendered as a heading and table of field metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},fields:{type:`array`,items:{type:`object`,required:[`name`,`label`],properties:{name:{type:`string`},label:{type:`string`},type:{type:`string`},required:{type:`boolean`},placeholder:{type:`string`},default:{type:`string`},options:{type:`array`,items:{type:`string`}},value:{type:`string`}},additionalProperties:!1}}},required:[`fields`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:R(e)&&typeof e.title==`string`?e.title:`Form`,fields:R(e)?Ut(e.fields):[]};return[{type:`heading`,value:t.title},{type:`table`,value:{headers:[`Label`,`Name`,`Type`,`Required`,`Default/Placeholder`],rows:t.fields.map(e=>[e.label||e.name,e.name,e.type||`text`,e.required?`Yes`:`No`,e.placeholder||e.default||``])}}]},hydration:[`form`],supportedTransports:[`browser`]},Wt=[`mcp-app`,`browser`];function B(e){return typeof e==`object`&&!!e}function Gt(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>!B(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]);return t.length>0?t:void 0}function Kt(e){return Array.isArray(e)?e.flatMap(e=>!B(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label,category:typeof e.category==`string`?e.category:void 0,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0}]):[]}function qt(e){return B(e)?{categories:Gt(e.categories),items:Kt(e.items)}:{items:[]}}function V(e){return{title:e.label,body:e.id,description:e.tags&&e.tags.length>0?e.tags.join(`, `):void 0}}function H(e,t){return t.length===0?[]:[{type:`heading`,value:e},{type:`cards`,value:t.map(V)}]}const U={id:`picker@1`,label:`Picker`,description:`Grouped item picker rendered as cards with picker hydration metadata.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}},items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},category:{type:`string`},tags:{type:`array`,items:{type:`string`}}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=qt(e),n=[];if(t.categories&&t.categories.length>0){let e=new Set(t.categories.map(e=>e.id)),r=[];for(let e of t.categories){let n=H(e.label,t.items.filter(t=>t.category===e.id));n.length>0&&r.push(n)}let i=H(`Other`,t.items.filter(t=>!t.category||!e.has(t.category)));return i.length>0&&r.push(i),n.push(...r.flatMap((e,t)=>t>0?[{type:`separator`},...e]:e)),n}return t.items.length>0&&n.push({type:`cards`,value:t.items.map(V)}),n},hydration:[`picker`],supportedTransports:Wt},Jt=[`mcp-app`,`browser`,`export`];function W(e){return typeof e==`object`&&!!e}function Yt(e){return W(e)&&typeof e.type==`string`}function Xt(e){return Array.isArray(e)&&e.every(Yt)}function Zt(e){return W(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function Qt(e){return Array.isArray(e)?e.flatMap(e=>{if(!W(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||Xt(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[]}function $t(e){return Array.isArray(e)?e.flatMap(e=>W(e)?[{title:typeof e.title==`string`?e.title:void 0,value:e.value,headers:Array.isArray(e.headers)?e.headers.filter(e=>typeof e==`string`):void 0,rows:Array.isArray(e.rows)?e.rows.filter(e=>Array.isArray(e)):void 0}]:[]):[]}function en(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}function tn(e){let t={type:`table`};return e.title&&(t.title=e.title),e.value!==void 0&&(t.value=e.value),e.headers&&(t.headers=e.headers),e.rows&&(t.rows=e.rows),t}const nn={id:`report@1`,label:`Report`,description:`Static report with title, optional metrics, narrative sections, and tables.`,inputSchema:{type:`object`,properties:{title:{type:`string`},metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}},sections:{type:`array`,items:{type:`object`,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}},additionalProperties:!1}},tables:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},value:{},headers:{type:`array`,items:{type:`string`}},rows:{type:`array`,items:{type:`array`,items:{}}}},additionalProperties:!1}}},required:[`title`,`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:W(e)&&typeof e.title==`string`?e.title:`Report`,metrics:W(e)&&Array.isArray(e.metrics)?e.metrics.filter(Zt):void 0,sections:W(e)?Qt(e.sections):[],tables:W(e)?$t(e.tables):void 0},n=[{type:`heading`,value:t.title}];t.metrics&&t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics});for(let e of t.sections)n.push(...en(e));for(let e of t.tables??[])n.push(tn(e));return n},hydration:[],supportedTransports:Jt},rn=[`mcp-app`,`browser`,`export`];function G(e){return typeof e==`object`&&!!e}function an(e){return Array.isArray(e)?e.flatMap(e=>{if(!G(e)||typeof e.category!=`string`||!Array.isArray(e.items))return[];let t=e.items.flatMap(e=>!G(e)||typeof e.label!=`string`||typeof e.status!=`string`?[]:[{label:e.label,status:e.status,badge:typeof e.badge==`string`?e.badge:void 0}]);return[{category:e.category,items:t}]}):[]}function on(e){return e.map(e=>({title:e.label,status:e.status,badge:e.badge}))}const K={id:`status-board@1`,label:`Status Board`,description:`Static status board grouped into category headings and card collections.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`category`,`items`],properties:{category:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`status`],properties:{label:{type:`string`},status:{type:`string`},badge:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`categories`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=G(e)?an(e.categories):[],n=[];for(let e of t)n.push({type:`heading`,value:e.category}),n.push({type:`cards`,value:on(e.items)});return n},hydration:[],supportedTransports:rn},sn=[`mcp-app`,`browser`,`export`];function q(e){return typeof e==`object`&&!!e}function cn(e){return Array.isArray(e)?e.flatMap(e=>!q(e)||typeof e.title!=`string`?[]:[{title:e.title,description:typeof e.description==`string`?e.description:void 0,timestamp:typeof e.timestamp==`string`?e.timestamp:void 0,status:typeof e.status==`string`?e.status:void 0}]):[]}function ln(e){return Array.isArray(e)?{entries:cn(e)}:q(e)?{entries:cn(e.entries??e.events??e.items),title:typeof e.title==`string`?e.title:void 0}:{entries:[]}}const J={type:`array`,items:{type:`object`,required:[`title`],properties:{title:{type:`string`},description:{type:`string`},timestamp:{type:`string`},status:{type:`string`}},additionalProperties:!1}},un={id:`timeline@1`,label:`Timeline`,description:`Static timeline events rendered as a timeline block.`,inputSchema:{oneOf:[J,{type:`object`,properties:{title:{type:`string`},entries:J,events:J,items:J},anyOf:[{required:[`entries`]},{required:[`events`]},{required:[`items`]}],additionalProperties:!1}]},defaultLayout:{},blocksFromData:e=>{let{entries:t,title:n}=ln(e),r=[];return n&&r.push({type:`heading`,value:n}),r.push({type:`timeline`,value:t}),r},hydration:[],supportedTransports:sn},dn=[`mcp-app`,`browser`,`export`];function Y(e){return typeof e==`object`&&!!e}function X(e){return Y(e)&&typeof e.label==`string`}function fn(e){return{name:e.label,children:Array.isArray(e.children)?e.children.filter(X).map(fn):[]}}function pn(e){if(!Y(e))return{};let t=e.root;return X(t)?fn(t):Y(t)?t:e}const mn={id:`tree@1`,label:`Tree`,description:`Static tree view data with optional tree hydration metadata.`,inputSchema:{oneOf:[{type:`object`,properties:{root:{type:`object`}},required:[`root`],additionalProperties:!0},{type:`object`,additionalProperties:!0}]},defaultLayout:{},blocksFromData:e=>[{type:`tree`,value:pn(e)}],hydration:[`tree`],supportedTransports:dn},Z=new xt;Z.register(A),Z.register(P),Z.register(I),Z.register(U),Z.register(nn),Z.register(un),Z.register(mn),Z.register(M),Z.register(L),Z.register(z),Z.register(K);let Q=0;function hn(){return Q=(Q+1)%(2**53-1),`${Date.now().toString(16).padStart(12,`0`).slice(-12)}${Q.toString(16).padStart(4,`0`).slice(-4)}${Array.from({length:8},()=>Math.floor(Math.random()*256).toString(16).padStart(2,`0`)).join(``)}`}function gn(e){return{id:e,version:1,entry:`@aikit/blocks-interactive/dist/islands/${e}.js`,selector:`[data-island="${e}"]`,needsData:!0}}function _n(e,t){let n=new TextEncoder;return n.encode(e).byteLength+t.reduce((e,t)=>e+n.encode(t).byteLength,0)}function vn(e,t){let n=[],r=t.registry??Z,i={colorScheme:e.colorScheme??t.colorScheme??`auto`,transport:t.transport,lang:e.lang,dir:e.dir},a=[...e.blocks??[]],o=[...a],s=[],c=[...e.actions??[]];if(e.template){let t=r.get(e.template);if(t)try{o=t.blocksFromData(e.data,i),t.actionsFromData&&(c=[...c,...t.actionsFromData(e.data)]),s=t.hydration.map(e=>gn(e))}catch(t){let r=t instanceof Error?t.message:String(t);n.push({level:`error`,message:`Template ${e.template} failed: ${r}`}),o=a.length===0?L.blocksFromData({code:`TEMPLATE_RENDER_ERROR`,message:`Failed to render template ${e.template}`,details:r},i):[...a]}else n.push({level:`warn`,message:`Template not found: ${e.template}`})}let l=yt(o,i),u=[S(o.map(e=>e.type))],d=t.nonce??hn(),f=e.metadata?.surfaceId??`surface-${d}`,p=s.length>0?JSON.stringify({data:e.data,blocks:o}):void 0,m=t.blockVendorScripts?[...new Set(o.flatMap(e=>t.blockVendorScripts?.[e.type]??[]))]:void 0;return{surfaceId:f,nonce:d,html:l,css:u,vendorScripts:m&&m.length>0?m:void 0,islands:s,actions:c,payload:p,estimatedBytes:_n(l,u),exportPolicy:s.length>0?`local-interactive`:`static-only`,diagnostics:n.length>0?n:void 0}}function yn(e){return e===`up`||e===`down`||e===`neutral`}function $(e){return typeof e==`object`&&!!e}function bn(e){return!$(e)||!Array.isArray(e.metrics)?{metrics:[]}:{metrics:e.metrics.flatMap(e=>{if(!$(e)||typeof e.label!=`string`||typeof e.value!=`string`&&typeof e.value!=`number`)return[];let t=$(e.trend)&&typeof e.trend.value==`string`&&yn(e.trend.direction)?{value:e.trend.value,direction:e.trend.direction}:void 0,n=Array.isArray(e.items)?e.items.flatMap(e=>!$(e)||typeof e.label!=`string`||typeof e.value!=`string`?[]:[{label:e.label,value:e.value}]):void 0;return[{id:typeof e.id==`string`?e.id:void 0,label:e.label,value:e.value,trend:t,status:e.status===`success`||e.status===`warning`||e.status===`error`||e.status===`info`?e.status:void 0,type:e.type===`progress`||e.type===`list`||e.type===`stat`?e.type:void 0,progress:typeof e.progress==`number`?On(e.progress):void 0,items:n}]})}}function xn(e){let t=e.type===`progress`&&typeof e.progress==`number`?`${e.progress}%`:void 0;return{label:e.label,value:e.value,trend:e.trend?.value??t,status:e.status}}function Sn(e){return e.type!==`progress`||typeof e.progress!=`number`?null:{label:e.label,value:On(e.progress),max:100}}function Cn(e){return $(e)?{columns:Array.isArray(e.columns)?e.columns.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]):[],cards:Array.isArray(e.cards)?e.cards.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.title!=`string`||typeof e.column!=`string`?[]:[{id:e.id,title:e.title,description:typeof e.description==`string`?e.description:void 0,column:e.column,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0,priority:e.priority===`high`||e.priority===`medium`||e.priority===`low`?e.priority:void 0}]):[]}:{columns:[],cards:[]}}function wn(e){return{title:e.title,description:e.description,badge:e.priority,body:e.tags?.join(`, `),status:e.priority}}function Tn(e){return!$(e)||!Array.isArray(e.items)?[]:e.items.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}])}function En(e){return $(e)?{name:typeof e.name==`string`?e.name:``,total:typeof e.total==`number`?e.total:typeof e.value==`number`?e.value:0,self:typeof e.self==`number`?e.self:void 0,children:Array.isArray(e.children)?e.children.map(e=>En(e)):[]}:{name:``,total:0,children:[]}}function Dn(e){return{name:e.self==null?`${e.name} (${e.total})`:`${e.name} (${e.total} total / ${e.self} self)`,children:(e.children??[]).map(Dn)}}function On(e){return Math.max(0,Math.min(100,e))}function kn(e){let t=bn(e),n=[];t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics.map(xn)});let r=t.metrics.map(Sn).filter(e=>e!==null);r.length>0&&n.push({type:`progress`,value:r});for(let e of t.metrics)e.type===`list`&&e.items&&e.items.length>0&&(n.push({type:`heading`,value:e.label}),n.push({type:`table`,value:e.items}));return n}function An(e){let t=Cn(e),n=[];return t.columns.forEach((e,r)=>{r>0&&n.push({type:`separator`,value:``});let i=t.cards.filter(t=>t.column===e.id);n.push({type:`heading`,value:e.label}),n.push({type:`cards`,value:i.map(wn)})}),n}function jn(e){let t=Tn(e);return t.length===0?[]:[{type:`cards`,value:t.map((e,t)=>({title:e.label,body:e.id,badge:`#${t+1}`}))}]}function Mn(e){return!$(e)||!$(e.profile)?[]:[{type:`tree`,value:Dn(En(e.profile))}]}const Nn={id:`dashboard@1`,label:`Dashboard`,description:`Metric cards grid with optional charts.`,inputSchema:{type:`object`,properties:{metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{id:{type:`string`},label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:`object`,properties:{value:{type:`string`},direction:{enum:[`up`,`down`,`neutral`]}},required:[`value`,`direction`],additionalProperties:!1},status:{enum:[`success`,`warning`,`error`,`info`]},type:{enum:[`stat`,`progress`,`list`]},progress:{type:`number`},items:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`metrics`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>kn(e),hydration:[],supportedTransports:[`mcp-app`,`browser`]},Pn={id:`kanban@1`,label:`Kanban`,description:`Drag-and-drop task board grouped by columns.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},color:{type:`string`}},additionalProperties:!1}},cards:{type:`array`,items:{type:`object`,required:[`id`,`title`,`column`],properties:{id:{type:`string`},title:{type:`string`},description:{type:`string`},column:{type:`string`},tags:{type:`array`,items:{type:`string`}},priority:{enum:[`high`,`medium`,`low`]}},additionalProperties:!1}}},required:[`columns`,`cards`],additionalProperties:!1},defaultLayout:{maxWidth:`1400px`},blocksFromData:e=>An(e),hydration:[],supportedTransports:[`browser`]},Fn={id:`list-sort@1`,label:`Sortable List`,description:`Reorderable list of items with browser drag-and-drop interactions.`,inputSchema:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{maxWidth:`720px`},blocksFromData:e=>jn(e),hydration:[],supportedTransports:[`browser`]},In={id:`flame-graph@1`,label:`Flame Graph`,description:`Hierarchical performance profile with interactive zoom state.`,inputSchema:{type:`object`,properties:{profile:{type:`object`}},required:[`profile`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>Mn(e),hydration:[],supportedTransports:[`browser`]};function Ln(e){return e.replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/&/g,`\\u0026`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}function Rn(e,t){let n=[`
|
|
1583
1583
|
* {
|
|
1584
1584
|
box-sizing: border-box;
|
|
1585
1585
|
}
|
|
@@ -1603,6 +1603,9 @@ main {
|
|
|
1603
1603
|
width: 100%;
|
|
1604
1604
|
max-width: 100%;
|
|
1605
1605
|
padding: var(--dt-space-8) var(--dt-space-4);
|
|
1606
|
+
display: flex;
|
|
1607
|
+
flex-direction: column;
|
|
1608
|
+
gap: var(--dt-space-6);
|
|
1606
1609
|
}
|
|
1607
1610
|
`,O,...(Array.isArray(t)?t:typeof t==`string`?[t]:[]).filter(e=>e.trim().length>0)].join(`
|
|
1608
1611
|
`);return[` <style>${e}</style>`,` <style>${n}</style>`].join(`
|
|
@@ -1611,7 +1614,7 @@ main {
|
|
|
1611
1614
|
color-scheme: light;
|
|
1612
1615
|
}`,`html[data-theme="dark"] {\n color-scheme: dark;\n${t}\n}`,`@media (prefers-color-scheme: dark) {\n html:not([data-theme]) {\n color-scheme: dark;\n${t}\n }\n}`].join(`
|
|
1613
1616
|
|
|
1614
|
-
`)}function Bn(e){return e.length===0?``:e.map(e=>{let t=e.initScript?` <script>\n${e.initScript}\n <\/script>\n`:``;if(e.inlineSource)
|
|
1617
|
+
`)}function Bn(e){return e.length===0?``:e.map(e=>{let t=e.initScript?` <script>\n${e.initScript}\n <\/script>\n`:``;if(e.inlineSource)return`${t} <script>${e.inlineSource.replace(/<\/script/gi,`<\\/script`)}${e.onload?`\n;${e.onload}`:``}<\/script>`;if(!e.src)return t.trimEnd();let r=e.onload?` onload="${e.onload}"`:``;if(!e.fallback)return`${t} <script src="${n(e.src)}"${r}><\/script>`;let i=e.onload?`f.onload=function(){${e.onload}};`:``;return`${t} <script src="${n(e.src)}"${r} onerror="(function(el){var f=document.createElement('script');f.src='${n(e.fallback)}';${i}document.head.appendChild(f);el.remove()})(this)"><\/script>`}).join(`
|
|
1615
1618
|
`)}function Vn(e){return[` <script>`,` (() => {`,` const preferredTheme = ${JSON.stringify(e)};`,` const storageKey = "aikit-theme-mode";`,` const html = document.documentElement;`,` const toolbox = {`,` container: () => document.querySelector(".aikit-toolbox"),`,` button: () => document.querySelector(".aikit-toolbox-toggle"),`,` menu: () => document.querySelector(".aikit-toolbox-menu"),`,` firstItem: () => document.querySelector(".aikit-toolbox-item"),`,` };`,` const systemTheme = () =>`,` window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches`,` ? "dark"`,` : "light";`,` const readStoredTheme = () => {`,` try {`,` const stored = localStorage.getItem("aikit-theme-mode");`,` return stored === "light" || stored === "dark" ? stored : null;`,` } catch (_error) {`,` return null;`,` }`,` };`,` const resolvedTheme = () => html.getAttribute("data-theme") || readStoredTheme() || systemTheme();`,` const setToolboxOpen = (open, options = {}) => {`,` const button = toolbox.button();`,` const menu = toolbox.menu();`,` if (!button || !menu) return;`,` menu.hidden = !open;`,` button.setAttribute("aria-expanded", String(open));`,` if (open) {`,` if (options.focusItem) toolbox.firstItem()?.focus();`,` } else if (options.restoreFocus) {`,` button.focus();`,` }`,` };`,` const inlineComputedStyles = (source, clone) => {`,` if (!(source instanceof Element) || !(clone instanceof Element)) return;`,` const computed = window.getComputedStyle(source);`,` const cssText = Array.from(computed)`,` .map((name) => {`,` const value = computed.getPropertyValue(name);`,` const priority = computed.getPropertyPriority(name);`,' return `${name}:${value}${priority ? " !important" : ""};`;',` })`,` .join("");`,` clone.setAttribute("style", cssText);`,` for (let index = 0; index < source.children.length; index += 1) {`,` inlineComputedStyles(source.children[index], clone.children[index]);`,` }`,` };`,` const captureDocumentAsPng = async () => {`,` const width = Math.max(`,` document.documentElement.scrollWidth,`,` document.documentElement.clientWidth,`,` document.body ? document.body.scrollWidth : 0,`,` );`,` const height = Math.max(`,` document.documentElement.scrollHeight,`,` document.documentElement.clientHeight,`,` document.body ? document.body.scrollHeight : 0,`,` );`,` const scale = window.devicePixelRatio || 1;`,` const canvas = document.createElement("canvas");`,` canvas.width = Math.max(1, Math.ceil(width * scale));`,` canvas.height = Math.max(1, Math.ceil(height * scale));`,` const context = canvas.getContext("2d");`,` if (!context) throw new Error("Canvas context unavailable");`,` context.scale(scale, scale);`,` const clone = document.documentElement.cloneNode(true);`,` if (!(clone instanceof Element)) throw new Error("Document clone failed");`,` clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");`,` clone.querySelectorAll("script").forEach((node) => node.remove());`,` inlineComputedStyles(document.documentElement, clone);`,' const svgMarkup = [`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`, `<foreignObject width="100%" height="100%">${new XMLSerializer().serializeToString(clone)}</foreignObject>`, "</svg>"].join("");',` const svgBlob = new Blob([svgMarkup], { type: "image/svg+xml;charset=utf-8" });`,` const objectUrl = URL.createObjectURL(svgBlob);`,` try {`,` await new Promise((resolve, reject) => {`,` const image = new Image();`,` image.onload = () => {`,` context.drawImage(image, 0, 0, width, height);`,` resolve(undefined);`,` };`,` image.onerror = () => reject(new Error("ForeignObject render failed"));`,` image.src = objectUrl;`,` });`,` } finally {`,` URL.revokeObjectURL(objectUrl);`,` }`,` const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));`,` if (!blob) throw new Error("PNG export failed");`,` const downloadUrl = URL.createObjectURL(blob);`,` const link = document.createElement("a");`,` const timestamp = new Date().toISOString().replace(/[.:]/g, "-");`,` link.href = downloadUrl;`," link.download = `aikit-screenshot-${timestamp}.png`;",` document.body.appendChild(link);`,` link.click();`,` link.remove();`,` URL.revokeObjectURL(downloadUrl);`,` };`,` const updateToggle = (theme) => {`,` const button = document.querySelector(".aikit-theme-toggle");`,` const nextTheme = theme === "dark" ? "light" : "dark";`,` if (button) {`,` button.setAttribute("aria-label", "Switch to " + nextTheme + " theme");`,` button.setAttribute("aria-pressed", String(theme === "dark"));`,` }`,` };`,` const applyTheme = (theme, persist = true) => {`,` html.setAttribute("data-theme", theme);`,` if (persist) {`,` try {`,` localStorage.setItem("aikit-theme-mode", theme);`,` } catch (_error) {`,` // Ignore storage failures.`,` }`,` }`,` updateToggle(theme);`,` };`,` if (preferredTheme === "light" || preferredTheme === "dark") {`,` applyTheme(preferredTheme, false);`,` } else {`,` applyTheme(readStoredTheme() || systemTheme(), false);`,` }`,` window.toggleTheme = () => {`,` applyTheme(resolvedTheme() === "dark" ? "light" : "dark");`,` };`,` window.toggleToolbox = () => {`,` const menu = toolbox.menu();`,` setToolboxOpen(Boolean(menu?.hidden), { focusItem: Boolean(menu?.hidden) });`,` };`,` window.screenshotPage = async () => {`,` const scrollX = window.scrollX;`,` const scrollY = window.scrollY;`,` setToolboxOpen(false);`,` window.scrollTo(0, 0);`,` await new Promise((resolve) => window.requestAnimationFrame(() => resolve(undefined)));`,` try {`,` await captureDocumentAsPng();`,` } catch (_error) {`,` window.print();`,` } finally {`,` window.scrollTo(scrollX, scrollY);`,` }`,` };`,` document.addEventListener("click", (event) => {`,` const container = toolbox.container();`,` if (!container) return;`,` const target = event.target;`,` if (target instanceof Node && container.contains(target)) return;`,` setToolboxOpen(false);`,` });`,` document.addEventListener("keydown", (event) => {`,` if (event.key === "Escape") {`,` setToolboxOpen(false, { restoreFocus: true });`,` return;`,` }`,` if ((event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") && event.target === toolbox.button()) {`,` event.preventDefault();`,` setToolboxOpen(true, { focusItem: true });`,` }`,` });`,` if (preferredTheme === "auto" && window.matchMedia) {`,` const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");`,` mediaQuery.addEventListener("change", () => {`,` if (readStoredTheme()) return;`,` applyTheme(systemTheme(), false);`,` });`,` }`,` })();`,` <\/script>`].join(`
|
|
1616
1619
|
`)}function Hn(e,t){if(t!==`local-interactive`)return``;let r=new Set,i=[];for(let t of e)r.has(t.entry)||(r.add(t.entry),i.push(` <script type="module" src="${n(t.entry)}"><\/script>`));return i.join(`
|
|
1617
1620
|
`)}function Un(e){let t=n(e.lang??`en`),r=n(e.dir??`ltr`),i=e.colorScheme??`auto`,a=e.generatedAt??new Date().toISOString(),o=[`lang="${t}"`,`dir="${r}"`];i!==`auto`&&o.push(`data-theme="${i}"`);let s=zn(e.tokenCss??mt(`light`)),c=Bn(e.headScripts??[]),l=e.islands.length>0&&e.payload?` <script type="application/json" id="surface-payload">${Ln(e.payload)}<\/script>`:``,u=Hn(e.islands,e.exportPolicy),d=[Vn(i),l,u].filter(Boolean).join(`
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
svg {
|
|
168
168
|
display: block;
|
|
169
169
|
width: 100%;
|
|
170
|
-
height:
|
|
171
|
-
min-height:
|
|
170
|
+
height: auto;
|
|
171
|
+
min-height: 600px;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
.empty-state {
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
svg {
|
|
238
|
-
min-height:
|
|
238
|
+
min-height: 500px;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
</style>
|
|
@@ -271,17 +271,17 @@
|
|
|
271
271
|
const themeButton = document.getElementById('theme-button');
|
|
272
272
|
const themes = ['auto', 'dark', 'light'];
|
|
273
273
|
const monoFont = '"JetBrains Mono", "SFMono-Regular", Consolas, ui-monospace, monospace';
|
|
274
|
-
const phaseGap =
|
|
275
|
-
const batchGap =
|
|
276
|
-
const taskGap =
|
|
277
|
-
const sequentialTaskGap =
|
|
278
|
-
const taskWidth =
|
|
279
|
-
const taskHeight =
|
|
280
|
-
const phaseHeaderHeight =
|
|
281
|
-
const canvasPadding =
|
|
282
|
-
const phasePaddingX =
|
|
283
|
-
const phasePaddingBottom =
|
|
284
|
-
const batchLabelHeight =
|
|
274
|
+
const phaseGap = 300;
|
|
275
|
+
const batchGap = 120;
|
|
276
|
+
const taskGap = 100;
|
|
277
|
+
const sequentialTaskGap = 140;
|
|
278
|
+
const taskWidth = 260;
|
|
279
|
+
const taskHeight = 88;
|
|
280
|
+
const phaseHeaderHeight = 72;
|
|
281
|
+
const canvasPadding = 80;
|
|
282
|
+
const phasePaddingX = 36;
|
|
283
|
+
const phasePaddingBottom = 44;
|
|
284
|
+
const batchLabelHeight = 32;
|
|
285
285
|
const phasePalette = [
|
|
286
286
|
'--dt-cyan',
|
|
287
287
|
'--tp-indigo',
|
|
@@ -531,9 +531,9 @@
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function measureTask(task) {
|
|
534
|
-
const titleLines = wrapText(task.title || task.id,
|
|
535
|
-
const agentLines = wrapText(task.agent || 'Unassigned',
|
|
536
|
-
const height = taskHeight + Math.max(0, titleLines.length - 1) *
|
|
534
|
+
const titleLines = wrapText(task.title || task.id, 28, 2);
|
|
535
|
+
const agentLines = wrapText(task.agent || 'Unassigned', 24, 1);
|
|
536
|
+
const height = taskHeight + Math.max(0, titleLines.length - 1) * 20;
|
|
537
537
|
return {
|
|
538
538
|
width: taskWidth,
|
|
539
539
|
height,
|
|
@@ -579,59 +579,61 @@
|
|
|
579
579
|
function layout(model) {
|
|
580
580
|
const phaseLayouts = [];
|
|
581
581
|
const taskBoxes = new Map();
|
|
582
|
-
let
|
|
583
|
-
let
|
|
582
|
+
let currentY = canvasPadding;
|
|
583
|
+
let maxWidth = 0;
|
|
584
584
|
|
|
585
585
|
model.phases.forEach((phase, phaseIndex) => {
|
|
586
|
-
const phaseX =
|
|
587
|
-
const phaseY =
|
|
588
|
-
let
|
|
589
|
-
|
|
586
|
+
const phaseX = canvasPadding;
|
|
587
|
+
const phaseY = currentY;
|
|
588
|
+
let batchCursorX = phaseX + phasePaddingX;
|
|
589
|
+
const batchBaseY = phaseY + phaseHeaderHeight + 18;
|
|
590
590
|
let rightEdge = phaseX + 320;
|
|
591
|
+
let maxBatchBottom = batchBaseY;
|
|
591
592
|
const batchLayouts = [];
|
|
592
593
|
|
|
593
594
|
phase.batches.forEach((batch) => {
|
|
594
|
-
const batchLayout = layoutBatch(batch,
|
|
595
|
+
const batchLayout = layoutBatch(batch, batchCursorX, batchBaseY);
|
|
595
596
|
batchLayout.boxes.forEach((box) => {
|
|
596
597
|
taskBoxes.set(box.task.id, box);
|
|
597
598
|
});
|
|
598
599
|
batchLayouts.push({
|
|
599
600
|
batch,
|
|
600
|
-
x:
|
|
601
|
-
y:
|
|
601
|
+
x: batchCursorX,
|
|
602
|
+
y: batchBaseY,
|
|
602
603
|
width: batchLayout.width,
|
|
603
604
|
height: batchLayout.height,
|
|
604
605
|
boxes: batchLayout.boxes,
|
|
605
606
|
});
|
|
606
|
-
rightEdge = Math.max(rightEdge,
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
rightEdge = Math.max(rightEdge, batchCursorX + batchLayout.width + phasePaddingX);
|
|
608
|
+
maxBatchBottom = Math.max(maxBatchBottom, batchBaseY + batchLayout.height);
|
|
609
|
+
batchCursorX += Math.max(taskWidth, batchLayout.width) + batchGap;
|
|
609
610
|
});
|
|
610
611
|
|
|
612
|
+
const phaseWidth = Math.max(600, rightEdge - phaseX);
|
|
611
613
|
const phaseHeight = Math.max(
|
|
612
614
|
phaseHeaderHeight + 120,
|
|
613
|
-
|
|
615
|
+
maxBatchBottom - phaseY + phasePaddingBottom,
|
|
614
616
|
);
|
|
615
617
|
|
|
616
618
|
phaseLayouts.push({
|
|
617
619
|
phase,
|
|
618
620
|
x: phaseX,
|
|
619
621
|
y: phaseY,
|
|
620
|
-
width:
|
|
622
|
+
width: phaseWidth,
|
|
621
623
|
height: phaseHeight,
|
|
622
624
|
color: phaseColor(phaseIndex),
|
|
623
625
|
batches: batchLayouts,
|
|
624
626
|
});
|
|
625
627
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
+
maxWidth = Math.max(maxWidth, phaseX + phaseWidth + canvasPadding);
|
|
629
|
+
currentY += phaseHeight + phaseGap;
|
|
628
630
|
});
|
|
629
631
|
|
|
630
632
|
return {
|
|
631
633
|
phases: phaseLayouts,
|
|
632
634
|
taskBoxes,
|
|
633
|
-
width: Math.max(
|
|
634
|
-
height: Math.max(
|
|
635
|
+
width: Math.max(1200, maxWidth),
|
|
636
|
+
height: Math.max(600, currentY - phaseGap + canvasPadding),
|
|
635
637
|
};
|
|
636
638
|
}
|
|
637
639
|
|
|
@@ -1008,6 +1010,7 @@
|
|
|
1008
1010
|
const layoutResult = layout(model);
|
|
1009
1011
|
svg.innerHTML = '';
|
|
1010
1012
|
svg.setAttribute('viewBox', '0 0 ' + layoutResult.width + ' ' + layoutResult.height);
|
|
1013
|
+
svg.style.height = layoutResult.height + 'px';
|
|
1011
1014
|
svg.setAttribute('aria-label', model.title + ' with ' + totalTasks + ' tasks');
|
|
1012
1015
|
svg.appendChild(renderDefs());
|
|
1013
1016
|
svg.appendChild(node('title', { id: 'diagram-title' }, model.title || 'Task execution plan'));
|