@objectstack/console 11.1.0 → 11.2.0
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/assets/{AdapterProvider-BTAMdG2T.js → AdapterProvider-BPgD5wI1.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-BtiQFQw8.js → AiPendingActionsPage-Cojy8a-z.js} +1 -1
- package/dist/assets/{ApiConsolePage-CQJbzAsw.js → ApiConsolePage-o44winom.js} +1 -1
- package/dist/assets/{AppDocsIndex-CbHC6KGX.js → AppDocsIndex-CnVwFuo5.js} +1 -1
- package/dist/assets/{AppManagementPage-DOoQrTPO.js → AppManagementPage-Dzv2LTfe.js} +1 -1
- package/dist/assets/{ApprovalsInboxPage-D6eWYxCu.js → ApprovalsInboxPage-CbMAm2Z1.js} +1 -1
- package/dist/assets/{AuditLogPage-F85cQBBY.js → AuditLogPage-Ckb7Ei0l.js} +1 -1
- package/dist/assets/{ComponentNavView-g9qw3mhW.js → ComponentNavView-C1ZKriwP.js} +1 -1
- package/dist/assets/ConsoleFloatingChatbot-DqrmAZNg.js +1 -0
- package/dist/assets/{DashboardView-mIWO-jW_.js → DashboardView-PNh3ds7Y.js} +1 -1
- package/dist/assets/{DashboardWidgetInspector-DOnyBhGN.js → DashboardWidgetInspector-BqmZ8NCC.js} +1 -1
- package/dist/assets/{DeveloperHubPage-Ci0wA8GZ.js → DeveloperHubPage-YHIc76u2.js} +1 -1
- package/dist/assets/{ExpressionProvider-NqLS0ljf.js → ExpressionProvider-CMntDoz9.js} +1 -1
- package/dist/assets/{FlowRunsPage-CNz2_VFK.js → FlowRunsPage-daH77deA.js} +1 -1
- package/dist/assets/{IntegrationsPage-CAZ3nsKJ.js → IntegrationsPage-FpPdGLBF.js} +1 -1
- package/dist/assets/{InterfaceListPage-D1BbH0Iy.js → InterfaceListPage-Npe_tn_H.js} +1 -1
- package/dist/assets/{ManagedByBadge-6DwSVsdr.js → ManagedByBadge-CLEdt1ik.js} +1 -1
- package/dist/assets/{MarketplaceAccessDenied-Cyx7lSjy.js → MarketplaceAccessDenied-DiK0S3Vq.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-C41H1YlB.js → MarketplaceInstalledPage-ytCNj-9Y.js} +1 -1
- package/dist/assets/{MarketplacePackagePage-Bihb2q1b.js → MarketplacePackagePage-CAsMrnZF.js} +1 -1
- package/dist/assets/{MarketplacePage-C2B6TMNM.js → MarketplacePage-Ct4PVYqJ.js} +1 -1
- package/dist/assets/{MetadataInspector-COEBMw6y.js → MetadataInspector-B3LWAl8X.js} +1 -1
- package/dist/assets/{MetadataProvider-D234gTjV.js → MetadataProvider-BRGGbotZ.js} +1 -1
- package/dist/assets/{PageView-DuiaqvzN.js → PageView-VljnDnGh.js} +1 -1
- package/dist/assets/{ProfilePage-B1oCou0F.js → ProfilePage-D6bk--bm.js} +1 -1
- package/dist/assets/{PublicFormsPage-C2prdsH6.js → PublicFormsPage-gyZqil7Y.js} +1 -1
- package/dist/assets/{RecordDetailView-B-AuOKPI.js → RecordDetailView-ClJoPCbl.js} +2 -2
- package/dist/assets/{RecordFormPage-CpKMoOCj.js → RecordFormPage-SzhX0SxR.js} +1 -1
- package/dist/assets/{ReportDefaultInspector-DxP-Ac7I.js → ReportDefaultInspector-BIOfFevD.js} +2 -2
- package/dist/assets/{ReportView-Cw9Ompki.js → ReportView-Bbmeyhqd.js} +1 -1
- package/dist/assets/{SearchResultsPage-CZ038ncU.js → SearchResultsPage-JwPvnRco.js} +1 -1
- package/dist/assets/{SettingsHub-BXe-fVlJ.js → SettingsHub-BbH3HtvN.js} +1 -1
- package/dist/assets/{SettingsView-DxPgTnlF.js → SettingsView-R0t6xrOR.js} +1 -1
- package/dist/assets/{SystemHubPage-CJq_1ITt.js → SystemHubPage-DW-xYOhx.js} +1 -1
- package/dist/assets/{data-adapter-02g96tfY.js → data-adapter-BwlZo45L.js} +1 -1
- package/dist/assets/{framework-h98DIM1k.js → framework-CakMZS2A.js} +7 -7
- package/dist/assets/{highlighted-body-OFNGDK62-DO9p_wSr.js → highlighted-body-OFNGDK62-BGuZxdtV.js} +1 -1
- package/dist/assets/{index-BQhiWf8_.js → index-Bc8lMePA.js} +1 -1
- package/dist/assets/index-CKUQ3pPE.css +2 -0
- package/dist/assets/mermaid-GHXKKRXX-BjC9P-Az.js +1 -0
- package/dist/assets/{metadata-admin-DStYGsRM.js → metadata-admin-CmNQ3PCe.js} +4 -4
- package/dist/assets/{plugin-calendar-BYmYEyQk.js → plugin-calendar-D1hSxakw.js} +1 -1
- package/dist/assets/{plugin-charts-BDFf0TCn.js → plugin-charts-DUJQWrQu.js} +1 -1
- package/dist/assets/{plugin-chatbot-CnuZn8AC.js → plugin-chatbot-xCaZPNnP.js} +4 -4
- package/dist/assets/{plugin-dashboard-CuwYQhsg.js → plugin-dashboard-C5-M_XlX.js} +1 -1
- package/dist/assets/{plugin-form-CH8ruD9E.js → plugin-form-C7Hglo5P.js} +1 -1
- package/dist/assets/{plugin-gantt-BB8ZeREv.js → plugin-gantt-C_CBI9Ze.js} +1 -1
- package/dist/assets/{plugin-grid-D414NLNP.js → plugin-grid-DxUHFaSG.js} +1 -1
- package/dist/assets/{plugin-kanban-BRFJEEAA.js → plugin-kanban-fK0Hn7gr.js} +1 -1
- package/dist/assets/{plugin-map-rEWoyyKa.js → plugin-map-CFUHBBgY.js} +1 -1
- package/dist/assets/{plugin-markdown-BgV76qm3.js → plugin-markdown-D2JDzxOb.js} +1 -1
- package/dist/assets/{plugin-report-C-YPOtvZ.js → plugin-report-C_gu6Sl0.js} +1 -1
- package/dist/assets/{plugin-timeline-CC91-fmI.js → plugin-timeline-JAVlYIZG.js} +1 -1
- package/dist/assets/{plugin-tree-D2QWz1x1.js → plugin-tree-ckWxLNeS.js} +1 -1
- package/dist/assets/{plugin-view-C6iEzx93.js → plugin-view-CYd_0MnO.js} +1 -1
- package/dist/assets/{plugins-views-CcoNygsH.js → plugins-views-CpVdFGRz.js} +2 -2
- package/dist/assets/{skeletons-BQ5aRDUn.js → skeletons-CTmAPzFj.js} +1 -1
- package/dist/assets/{src-C4OnKiir.js → src-CMNhRk8x.js} +1 -1
- package/dist/assets/src-DZhiMT1j.js +2 -0
- package/dist/assets/{types-BUZu4QOP.js → types-5UGg6DKH.js} +1 -1
- package/dist/assets/ui-components-BXvcyYmR.js +42 -0
- package/dist/assets/{ui-layout-BwokMuBv.js → ui-layout-DAe4Nna8.js} +1 -1
- package/dist/assets/{useActionModal-ChUaxcEW.js → useActionModal-B6_KUPqx.js} +1 -1
- package/dist/assets/{useOpenRecordList-BkSEs2q6.js → useOpenRecordList-yTGpfA54.js} +1 -1
- package/dist/assets/{useReconcileOnError-FPUCNTHc.js → useReconcileOnError-oxCJ7_s6.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ConsoleFloatingChatbot-Cy-Ny_TS.js +0 -1
- package/dist/assets/index-WhD62Q-7.css +0 -2
- package/dist/assets/mermaid-GHXKKRXX-DEmtnxCC.js +0 -1
- package/dist/assets/src-CKHT6scJ.js +0 -2
- package/dist/assets/ui-components-C9egdVxV.js +0 -42
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as a,g as o,m as s,t as c}from"./vendor-react-ClIa1CJA.js";import{V as l,i as u,kt as d}from"./framework-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-CMxvf4Kt.js";import{_ as a,g as o,m as s,t as c}from"./vendor-react-ClIa1CJA.js";import{V as l,i as u,kt as d}from"./framework-CakMZS2A.js";import{A as f,C as p,D as m,E as h,F as g,I as _,L as v,M as y,N as b,R as x,S,T as C,b as w,j as T,k as E,w as D,x as ee,y as O}from"./vendor-objectstack-BTQLr7T3.js";import{$n as te,As as k,Bt as ne,Cc as re,Di as ie,Ea as ae,Ft as oe,G as se,Go as ce,Gr as le,Hs as ue,Ht as de,It as fe,K as pe,Li as me,Lt as he,Ma as ge,Ns as _e,Nt as ve,Oc as A,Or as ye,Pt as be,Si as xe,Ts as Se,U as Ce,Ut as we,Vi as Te,Vs as Ee,Vt as De,W as Oe,Wt as ke,Xn as Ae,Xt as je,Yi as Me,Yn as Ne,Zn as Pe,Zt as Fe,ao as Ie,ar as Le,bc as Re,bs as ze,cc as Be,cn as Ve,cr as He,dn as Ue,dt as We,er as Ge,fn as Ke,ft as qe,gs as Je,gt as Ye,hi as Xe,hn as Ze,hs as Qe,ht as $e,ia as et,ii as tt,jr as j,js as nt,kr as rt,ln as it,lr as at,lt as ot,mt as st,nc as ct,nr as lt,or as ut,os as dt,ot as ft,pn as pt,pt as mt,q as ht,rr as gt,sc as _t,sn as vt,so as yt,sr as bt,ss as xt,st as St,tr as Ct,ui as wt,un as Tt,uo as Et,ur as Dt,ut as Ot,xn as kt,xr as M,xs as At,yo as jt,ys as Mt,za as Nt,zt as Pt}from"./ui-components-BXvcyYmR.js";import{a as Ft,i as It,o as Lt}from"./vendor-ui-utils-C92Fl7BT.js";import{Tn as Rt}from"./vendor-radix-90T7eS-d.js";import{t as N}from"./vendor-zod-BzP-Jkm3.js";import{_ as zt,b as Bt,c as Vt,d as Ht,f as Ut,g as Wt,h as Gt,l as Kt,m as qt,p as Jt,s as Yt,u as Xt,v as Zt,y as Qt}from"./vendor-markdown-BhPWU2N7.js";var $t=`vercel.ai.error`,en=Symbol.for($t),tn,nn,rn=class e extends (nn=Error,tn=en,nn){constructor({name:e,message:t,cause:n}){super(t),this[tn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,$t)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};function an(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var on=`AI_InvalidArgumentError`,sn=`vercel.ai.error.${on}`,cn=Symbol.for(sn),ln,un,dn=class extends (un=rn,ln=cn,un){constructor({message:e,cause:t,argument:n}){super({name:on,message:e,cause:t}),this[ln]=!0,this.argument=n}static isInstance(e){return rn.hasMarker(e,sn)}},fn=`AI_JSONParseError`,pn=`vercel.ai.error.${fn}`,mn=Symbol.for(pn),hn,gn,_n=class extends (gn=rn,hn=mn,gn){constructor({text:e,cause:t}){super({name:fn,message:`JSON parsing failed: Text: ${e}.
|
|
2
2
|
Error message: ${an(t)}`,cause:t}),this[hn]=!0,this.text=e}static isInstance(e){return rn.hasMarker(e,pn)}},vn=`AI_TypeValidationError`,yn=`vercel.ai.error.${vn}`,bn=Symbol.for(yn),xn,Sn,Cn=class e extends (Sn=rn,xn=bn,Sn){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:vn,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${an(t)}`,cause:t}),this[xn]=!0,this.value=e,this.context=n}static isInstance(e){return rn.hasMarker(e,yn)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},wn=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Tn=10,En=13,Dn=32;function On(e){}function kn(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=On,onError:n=On,onRetry:r=On,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
|
|
4
4
|
`)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new wn(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
|
|
@@ -95,14 +95,14 @@ ${e}</tr>
|
|
|
95
95
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Al(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=jl(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Al(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=jl(e);if(i===null)return Al(n);e=i;let a=`<img src="${e}" alt="${Al(n)}"`;return t&&(a+=` title="${Al(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Al(e.text)}},Vl=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Hl=class e{options;renderer;textRenderer;constructor(e){this.options=e||vc,this.options.renderer=this.options.renderer||new Bl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vl}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Ul=class{options;block;constructor(e){this.options=e||vc}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?zl.lex:zl.lexInline}provideParser(e=this.block){return e?Hl.parse:Hl.parseInline}},Wl=new class{defaults=_c();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Hl;Renderer=Bl;TextRenderer=Vl;Lexer=zl;Tokenizer=Rl;Hooks=Ul;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Bl(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Rl(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Ul;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Ul.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Ul.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return zl.lex(e,t??this.defaults)}parser(e,t){return Hl.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?zl.lex:zl.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Hl.parse:Hl.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?zl.lex:zl.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Hl.parse:Hl.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
96
96
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Al(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function B(e,t){return Wl.parse(e,t)}B.options=B.setOptions=function(e){return Wl.setOptions(e),B.defaults=Wl.defaults,yc(B.defaults),B},B.getDefaults=_c,B.defaults=vc,B.use=function(...e){return Wl.use(...e),B.defaults=Wl.defaults,yc(B.defaults),B},B.walkTokens=function(e,t){return Wl.walkTokens(e,t)},B.parseInline=Wl.parseInline,B.Parser=Hl,B.parser=Hl.parse,B.Renderer=Bl,B.TextRenderer=Vl,B.Lexer=zl,B.lexer=zl.lex,B.Tokenizer=Rl,B.Hooks=Ul,B.parse=B,B.options,B.setOptions,B.use,B.walkTokens,B.parseInline,Hl.parse,zl.lex;var Gl=n(o(),1),Kl=300,ql=`300px`,Jl=500;function Yl(e={}){let{immediate:t=!1,debounceDelay:n=Kl,rootMargin:r=ql,idleTimeout:i=Jl}=e,[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),c=(0,I.useRef)(null),l=(0,I.useRef)(null),u=(0,I.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,I.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,I.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,I.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var Xl=/\s/,Zl=/^\s+$/,Ql=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),$l=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,eu=e=>e.some(e=>$l(e)&&Ql.has(e.tagName)),tu=e=>{let t=[],n=``,r=!1;for(let i of e){let e=Xl.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},nu=e=>{let t=[],n=``;for(let r of e)Xl.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},ru=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},iu=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(eu(t))return Qt;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?nu(c):tu(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,Zl.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return ru(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},au=0;function ou(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=au++,i=()=>e=>{let r={count:0,newIndex:0};Bt(e,`text`,(e,i)=>iu(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}ou();var su=(0,I.createContext)(!1),cu=()=>(0,I.useContext)(su),lu=(...e)=>Ft(Lt(e)),uu=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},du=e=>e?(...t)=>uu(e,Ft(Lt(t))):lu,fu=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},pu=(0,I.createContext)(lu),V=()=>(0,I.useContext)(pu),mu=lu(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),hu=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},gu=(0,I.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=V(),c=(0,I.useMemo)(()=>s(mu),[s]),l=(0,I.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,hu(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,R.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,R.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,R.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,R.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
97
97
|
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,R.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),_u=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,R.jsx)(`div`,{className:V()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),vu=(0,I.createContext)({code:``}),yu=()=>(0,I.useContext)(vu),bu=({language:e})=>{let t=V();return(0,R.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,R.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},xu=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
98
|
-
`;)t--;return e.slice(0,t)},Su=(0,I.lazy)(()=>s(()=>import(`./highlighted-body-OFNGDK62-
|
|
98
|
+
`;)t--;return e.slice(0,t)},Su=(0,I.lazy)(()=>s(()=>import(`./highlighted-body-OFNGDK62-BGuZxdtV.js`).then(e=>({default:e.HighlightedCodeBlockBody})),[],import.meta.url)),Cu=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=V(),l=(0,I.useMemo)(()=>xu(e),[e]),u=(0,I.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
99
99
|
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,R.jsx)(vu.Provider,{value:{code:e},children:(0,R.jsxs)(_u,{isIncomplete:i,language:t,children:[(0,R.jsx)(bu,{language:t}),r?(0,R.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,R.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,R.jsx)(I.Suspense,{fallback:(0,R.jsx)(gu,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,R.jsx)(Su,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},wu={CheckIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,R.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,R.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,R.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,R.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,R.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},Tu=(0,I.createContext)(wu),Eu=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},Du=({icons:e,children:t})=>{let n=(0,I.useRef)(e),r=(0,I.useRef)(e?{...wu,...e}:wu);Eu(n.current,e)||(n.current=e,r.current=e?{...wu,...e}:wu);let i=r.current;return(0,R.jsx)(Tu.Provider,{value:i,children:t})},Ou=()=>(0,I.useContext)(Tu),ku={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},Au=(0,I.createContext)(ku),ju=()=>(0,I.useContext)(Au),Mu=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=V(),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(0),{code:d}=yu(),{isAnimating:f}=(0,I.useContext)(Rf),p=ju(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,I.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=Ou(),_=c?g.CheckIcon:g.CopyIcon;return(0,R.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,R.jsx)(_,{size:14})})},Nu={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},Pu=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=V(),{code:c}=yu(),{isAnimating:l}=(0,I.useContext)(Rf),u=ju(),d=Ou(),f=a??c,p=`file.${n&&n in Nu?Nu[n]:`txt`}`;return(0,R.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{fu(p,f,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,R.jsx)(d.DownloadIcon,{size:14})})},Fu=()=>{let{Loader2Icon:e}=Ou(),t=V();return(0,R.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,R.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,R.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,R.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},Iu=/\.[^/.]+$/,Lu=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=Ou(),c=V(),l=(0,I.useRef)(null),[u,d]=(0,I.useState)(!1),[f,p]=(0,I.useState)(!1),m=ju(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,I.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,I.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,I.useCallback)(e=>{d(!1),p(!0),a?.(e)},[a]),b=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(Iu,``)}.${i}`}fu(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,R.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,R.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,_&&`hidden`,t),"data-streamdown":`image`,onError:y,onLoad:v,ref:l,src:n,...o}),_&&(0,R.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,R.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,R.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:b,title:m.downloadImage,type:`button`,children:(0,R.jsx)(s,{size:14})})]}):null},Ru=0,zu=()=>{Ru+=1,Ru===1&&(document.body.style.overflow=`hidden`)},Bu=()=>{Ru=Math.max(0,Ru-1),Ru===0&&(document.body.style.overflow=``)},Vu=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=Ou(),c=V(),[l,u]=(0,I.useState)(!1),d=ju(),f=(0,I.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,I.useCallback)(()=>{r(),n()},[r,n]);return(0,I.useEffect)(()=>{if(t){zu();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Bu()}}},[t,n]),t?(0,R.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,R.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,R.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,R.jsx)(s,{size:16})}),(0,R.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,R.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,R.jsx)(o,{size:20}),(0,R.jsx)(`span`,{children:d.openExternalLink})]}),(0,R.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,R.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,R.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,R.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(i,{size:14}),(0,R.jsx)(`span`,{children:d.copied})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(a,{size:14}),(0,R.jsx)(`span`,{children:d.copyLink})]})}),(0,R.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,R.jsx)(o,{size:14}),(0,R.jsx)(`span`,{children:d.openLink})]})]})]})}):null},Hu=(0,I.createContext)(null),Uu=()=>(0,I.useContext)(Hu),Wu=()=>Uu()?.code??null,Gu=()=>Uu()?.mermaid??null,Ku=e=>{var t;let n=Uu();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},qu=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),Ju=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=V(),[s,c]=(0,I.useState)(!1),l=(0,I.useRef)(null),{isAnimating:u}=(0,I.useContext)(Rf),d=Ou(),f=Gu(),p=ju(),m=async t=>{try{if(t===`mmd`){fu(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!f){a?.(Error(`Mermaid plugin not available`));return}let n=f.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){fu(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){fu(`diagram.png`,await qu(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,I.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,R.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,R.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:p.downloadDiagram,type:`button`,children:t??(0,R.jsx)(d.DownloadIcon,{size:14})}),s?(0,R.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,R.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`svg`),title:p.downloadDiagramAsSvg,type:`button`,children:p.mermaidFormatSvg}),(0,R.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`png`),title:p.downloadDiagramAsPng,type:`button`,children:p.mermaidFormatPng}),(0,R.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`mmd`),title:p.downloadDiagramAsMmd,type:`button`,children:p.mermaidFormatMmd})]}):null]})},Yu=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=Ou(),c=V(),[l,u]=(0,I.useState)(!1),{isAnimating:d,controls:f}=(0,I.useContext)(Rf),p=ju(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=()=>{u(!l)};return(0,I.useEffect)(()=>{if(l){zu();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Bu()}}},[l]),(0,I.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:h,title:p.viewFullscreen,type:`button`,...a,children:(0,R.jsx)(o,{size:14})}),l?(0,Gl.createPortal)((0,R.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:h,onKeyDown:e=>{e.key===`Escape`&&h()},role:`button`,tabIndex:0,children:[(0,R.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:h,title:p.exitFullscreen,type:`button`,children:(0,R.jsx)(s,{size:20})}),(0,R.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,R.jsx)(Hf,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},Xu=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},Zu=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
100
100
|
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
101
101
|
`)},Qu=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
102
102
|
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
103
103
|
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
104
104
|
`)},$u=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},ed=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>$u(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?$u(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>$u(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
105
|
-
`)},td=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=V(),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=(0,I.useRef)(0),{isAnimating:f}=(0,I.useContext)(Rf),p=ju(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Xu(t),o=({csv:Zu,tsv:Qu,md:ed}[e]||ed)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,I.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=Ou(),g=c?h.CheckIcon:h.CopyIcon;return(0,R.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,R.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,R.jsx)(g,{height:14,width:14})}),o?(0,R.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},nd=({children:e,className:t,onDownload:n,onError:r})=>{let i=V(),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),{isAnimating:c}=(0,I.useContext)(Rf),l=ju(),u=Ou(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Xu(t),a=e===`csv`?Zu(i):ed(i);fu(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,I.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,R.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,R.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,R.jsx)(u.DownloadIcon,{size:14})}),a?(0,R.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,R.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,R.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},rd=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=Ou(),o=V(),[s,c]=(0,I.useState)(!1),{isAnimating:l}=(0,I.useContext)(Rf),u=ju(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,I.useEffect)(()=>{if(s){zu();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Bu()}}},[s]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,R.jsx)(i,{size:14})}),s?(0,Gl.createPortal)((0,R.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,R.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,R.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,R.jsx)(td,{}):null,r?(0,R.jsx)(nd,{}):null,(0,R.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,R.jsx)(a,{size:20})})]}),(0,R.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,R.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},id=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=V(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,R.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,R.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,R.jsx)(td,{}):null,l?(0,R.jsx)(nd,{}):null,u?(0,R.jsx)(rd,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,R.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,R.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ad=/startLine=(\d+)/,od=/\bnoLineNumbers\b/,sd=(0,I.lazy)(()=>s(()=>import(`./mermaid-GHXKKRXX-DEmtnxCC.js`).then(e=>({default:e.Mermaid})),[],import.meta.url)),cd=/language-([^\s]+)/;function ld(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function H(e,t){return e.className===t.className&&ld(e.node,t.node)}var ud=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,dd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},fd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},pd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},md=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`ol`,{className:V()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>H(e,t));md.displayName=`MarkdownOl`;var hd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`li`,{className:V()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&ld(e.node,t.node));hd.displayName=`MarkdownLi`;var gd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`ul`,{className:V()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>H(e,t));gd.displayName=`MarkdownUl`;var _d=(0,I.memo)(({className:e,node:t,...n})=>(0,R.jsx)(`hr`,{className:V()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>H(e,t));_d.displayName=`MarkdownHr`;var vd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`span`,{className:V()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>H(e,t));vd.displayName=`MarkdownStrong`;var yd=(0,I.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=V(),{linkSafety:o}=(0,I.useContext)(Rf),[s,c]=(0,I.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,I.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,I.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,I.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,R.jsx)(Vu,{...p})]}):(0,R.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>H(e,t)&&e.href===t.href);yd.displayName=`MarkdownA`;var bd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h1`,{className:V()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>H(e,t));bd.displayName=`MarkdownH1`;var xd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h2`,{className:V()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>H(e,t));xd.displayName=`MarkdownH2`;var Sd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h3`,{className:V()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>H(e,t));Sd.displayName=`MarkdownH3`;var Cd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h4`,{className:V()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>H(e,t));Cd.displayName=`MarkdownH4`;var wd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h5`,{className:V()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>H(e,t));wd.displayName=`MarkdownH5`;var Td=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h6`,{className:V()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>H(e,t));Td.displayName=`MarkdownH6`;var Ed=(0,I.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,I.useContext)(Rf);return(0,R.jsx)(id,{className:t,showControls:ud(i,`table`),showCopy:dd(i,`copy`),showDownload:dd(i,`download`),showFullscreen:dd(i,`fullscreen`),...r,children:e})},(e,t)=>H(e,t));Ed.displayName=`MarkdownTable`;var Dd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`thead`,{className:V()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>H(e,t));Dd.displayName=`MarkdownThead`;var Od=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`tbody`,{className:V()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>H(e,t));Od.displayName=`MarkdownTbody`;var kd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`tr`,{className:V()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>H(e,t));kd.displayName=`MarkdownTr`;var Ad=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`th`,{className:V()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>H(e,t));Ad.displayName=`MarkdownTh`;var jd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`td`,{className:V()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>H(e,t));jd.displayName=`MarkdownTd`;var Md=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`blockquote`,{className:V()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>H(e,t));Md.displayName=`MarkdownBlockquote`;var Nd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`sup`,{className:V()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>H(e,t));Nd.displayName=`MarkdownSup`;var Pd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`sub`,{className:V()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>H(e,t));Pd.displayName=`MarkdownSub`;var Fd=(0,I.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,I.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,I.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,I.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,I.isValidElement)(e))return e;if(e.type===md){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,R.jsx)(`section`,{className:t,...r,children:i}):null}return(0,R.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>H(e,t));Fd.displayName=`MarkdownSection`;var Id=(0,I.memo)(({node:e,className:t,children:n,...r})=>{let i=V(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,I.useContext)(Rf),l=Gu(),u=cu(),d=(t?.match(cd))?.at(1)??``,f=Ku(d);if(a)return(0,R.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(ad),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&od.test(p))&&c!==!1,v=``;if((0,I.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,R.jsx)(I.Suspense,{fallback:(0,R.jsx)(Fu,{}),children:(0,R.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=ud(s,`mermaid`),n=pd(s,`download`),r=pd(s,`copy`),a=pd(s,`fullscreen`),c=pd(s,`panZoom`),l=e&&(n||r||a);return(0,R.jsx)(I.Suspense,{fallback:(0,R.jsx)(Fu,{}),children:(0,R.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,R.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,R.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,R.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,R.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,R.jsx)(Ju,{chart:v,config:o?.config}):null,r?(0,R.jsx)(Mu,{code:v}):null,a?(0,R.jsx)(Yu,{chart:v,config:o?.config}):null]})}):null,(0,R.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,R.jsx)(sd,{chart:v,config:o?.config,showControls:c})})]})})}let y=ud(s,`code`),b=fd(s,`download`),x=fd(s,`copy`);return(0,R.jsx)(Cu,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,R.jsxs)(R.Fragment,{children:[b?(0,R.jsx)(Pu,{code:v,language:d}):null,x?(0,R.jsx)(Mu,{}):null]}):null})},(e,t)=>e.className===t.className&&ld(e.node,t.node));Id.displayName=`MarkdownCode`;var Ld=(0,I.memo)(Lu,(e,t)=>e.className===t.className&&ld(e.node,t.node));Ld.displayName=`MarkdownImg`;var Rd=(0,I.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,I.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,R.jsx)(R.Fragment,{children:e})}return(0,R.jsx)(`p`,{...n,children:e})},(e,t)=>H(e,t));Rd.displayName=`MarkdownParagraph`;var zd={ol:md,li:hd,ul:gd,hr:_d,strong:vd,a:yd,h1:bd,h2:xd,h3:Sd,h4:Cd,h5:wd,h6:Td,table:Ed,thead:Dd,tbody:Od,tr:kd,th:Ad,td:jd,blockquote:Md,code:Id,img:Ld,pre:({children:e})=>(0,I.isValidElement)(e)?(0,I.cloneElement)(e,{"data-block":`true`}):e,sup:Nd,sub:Pd,p:Rd,section:Fd},Bd=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Vd=/\p{L}/u;function Hd(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(Bd.test(e))return`rtl`;if(Vd.test(e))return`ltr`}return`ltr`}var Ud=/^[ \t]{0,3}(`{3,}|~{3,})/,Wd=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,Gd=e=>{let t=e.split(`
|
|
105
|
+
`)},td=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=V(),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=(0,I.useRef)(0),{isAnimating:f}=(0,I.useContext)(Rf),p=ju(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Xu(t),o=({csv:Zu,tsv:Qu,md:ed}[e]||ed)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,I.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=Ou(),g=c?h.CheckIcon:h.CopyIcon;return(0,R.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,R.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,R.jsx)(g,{height:14,width:14})}),o?(0,R.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,R.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},nd=({children:e,className:t,onDownload:n,onError:r})=>{let i=V(),[a,o]=(0,I.useState)(!1),s=(0,I.useRef)(null),{isAnimating:c}=(0,I.useContext)(Rf),l=ju(),u=Ou(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Xu(t),a=e===`csv`?Zu(i):ed(i);fu(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,I.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,R.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,R.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,R.jsx)(u.DownloadIcon,{size:14})}),a?(0,R.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,R.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,R.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},rd=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=Ou(),o=V(),[s,c]=(0,I.useState)(!1),{isAnimating:l}=(0,I.useContext)(Rf),u=ju(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,I.useEffect)(()=>{if(s){zu();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),Bu()}}},[s]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,R.jsx)(i,{size:14})}),s?(0,Gl.createPortal)((0,R.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,R.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,R.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,R.jsx)(td,{}):null,r?(0,R.jsx)(nd,{}):null,(0,R.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,R.jsx)(a,{size:20})})]}),(0,R.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,R.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},id=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=V(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,R.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,R.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,R.jsx)(td,{}):null,l?(0,R.jsx)(nd,{}):null,u?(0,R.jsx)(rd,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,R.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,R.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ad=/startLine=(\d+)/,od=/\bnoLineNumbers\b/,sd=(0,I.lazy)(()=>s(()=>import(`./mermaid-GHXKKRXX-BjC9P-Az.js`).then(e=>({default:e.Mermaid})),[],import.meta.url)),cd=/language-([^\s]+)/;function ld(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function H(e,t){return e.className===t.className&&ld(e.node,t.node)}var ud=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,dd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},fd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},pd=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},md=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`ol`,{className:V()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>H(e,t));md.displayName=`MarkdownOl`;var hd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`li`,{className:V()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&ld(e.node,t.node));hd.displayName=`MarkdownLi`;var gd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`ul`,{className:V()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>H(e,t));gd.displayName=`MarkdownUl`;var _d=(0,I.memo)(({className:e,node:t,...n})=>(0,R.jsx)(`hr`,{className:V()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>H(e,t));_d.displayName=`MarkdownHr`;var vd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`span`,{className:V()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>H(e,t));vd.displayName=`MarkdownStrong`;var yd=(0,I.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=V(),{linkSafety:o}=(0,I.useContext)(Rf),[s,c]=(0,I.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,I.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,I.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,I.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,R.jsx)(Vu,{...p})]}):(0,R.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>H(e,t)&&e.href===t.href);yd.displayName=`MarkdownA`;var bd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h1`,{className:V()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>H(e,t));bd.displayName=`MarkdownH1`;var xd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h2`,{className:V()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>H(e,t));xd.displayName=`MarkdownH2`;var Sd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h3`,{className:V()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>H(e,t));Sd.displayName=`MarkdownH3`;var Cd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h4`,{className:V()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>H(e,t));Cd.displayName=`MarkdownH4`;var wd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h5`,{className:V()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>H(e,t));wd.displayName=`MarkdownH5`;var Td=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`h6`,{className:V()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>H(e,t));Td.displayName=`MarkdownH6`;var Ed=(0,I.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,I.useContext)(Rf);return(0,R.jsx)(id,{className:t,showControls:ud(i,`table`),showCopy:dd(i,`copy`),showDownload:dd(i,`download`),showFullscreen:dd(i,`fullscreen`),...r,children:e})},(e,t)=>H(e,t));Ed.displayName=`MarkdownTable`;var Dd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`thead`,{className:V()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>H(e,t));Dd.displayName=`MarkdownThead`;var Od=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`tbody`,{className:V()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>H(e,t));Od.displayName=`MarkdownTbody`;var kd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`tr`,{className:V()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>H(e,t));kd.displayName=`MarkdownTr`;var Ad=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`th`,{className:V()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>H(e,t));Ad.displayName=`MarkdownTh`;var jd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`td`,{className:V()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>H(e,t));jd.displayName=`MarkdownTd`;var Md=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`blockquote`,{className:V()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>H(e,t));Md.displayName=`MarkdownBlockquote`;var Nd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`sup`,{className:V()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>H(e,t));Nd.displayName=`MarkdownSup`;var Pd=(0,I.memo)(({children:e,className:t,node:n,...r})=>(0,R.jsx)(`sub`,{className:V()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>H(e,t));Pd.displayName=`MarkdownSub`;var Fd=(0,I.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,I.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,I.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,I.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,I.isValidElement)(e))return e;if(e.type===md){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,R.jsx)(`section`,{className:t,...r,children:i}):null}return(0,R.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>H(e,t));Fd.displayName=`MarkdownSection`;var Id=(0,I.memo)(({node:e,className:t,children:n,...r})=>{let i=V(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,I.useContext)(Rf),l=Gu(),u=cu(),d=(t?.match(cd))?.at(1)??``,f=Ku(d);if(a)return(0,R.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(ad),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&od.test(p))&&c!==!1,v=``;if((0,I.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,R.jsx)(I.Suspense,{fallback:(0,R.jsx)(Fu,{}),children:(0,R.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=ud(s,`mermaid`),n=pd(s,`download`),r=pd(s,`copy`),a=pd(s,`fullscreen`),c=pd(s,`panZoom`),l=e&&(n||r||a);return(0,R.jsx)(I.Suspense,{fallback:(0,R.jsx)(Fu,{}),children:(0,R.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,R.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,R.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,R.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,R.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,R.jsx)(Ju,{chart:v,config:o?.config}):null,r?(0,R.jsx)(Mu,{code:v}):null,a?(0,R.jsx)(Yu,{chart:v,config:o?.config}):null]})}):null,(0,R.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,R.jsx)(sd,{chart:v,config:o?.config,showControls:c})})]})})}let y=ud(s,`code`),b=fd(s,`download`),x=fd(s,`copy`);return(0,R.jsx)(Cu,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,R.jsxs)(R.Fragment,{children:[b?(0,R.jsx)(Pu,{code:v,language:d}):null,x?(0,R.jsx)(Mu,{}):null]}):null})},(e,t)=>e.className===t.className&&ld(e.node,t.node));Id.displayName=`MarkdownCode`;var Ld=(0,I.memo)(Lu,(e,t)=>e.className===t.className&&ld(e.node,t.node));Ld.displayName=`MarkdownImg`;var Rd=(0,I.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,I.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,R.jsx)(R.Fragment,{children:e})}return(0,R.jsx)(`p`,{...n,children:e})},(e,t)=>H(e,t));Rd.displayName=`MarkdownParagraph`;var zd={ol:md,li:hd,ul:gd,hr:_d,strong:vd,a:yd,h1:bd,h2:xd,h3:Sd,h4:Cd,h5:wd,h6:Td,table:Ed,thead:Dd,tbody:Od,tr:kd,th:Ad,td:jd,blockquote:Md,code:Id,img:Ld,pre:({children:e})=>(0,I.isValidElement)(e)?(0,I.cloneElement)(e,{"data-block":`true`}):e,sup:Nd,sub:Pd,p:Rd,section:Fd},Bd=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Vd=/\p{L}/u;function Hd(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(Bd.test(e))return`rtl`;if(Vd.test(e))return`ltr`}return`ltr`}var Ud=/^[ \t]{0,3}(`{3,}|~{3,})/,Wd=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,Gd=e=>{let t=e.split(`
|
|
106
106
|
`),n=null,r=0;for(let e of t){let t=Ud.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},Kd=e=>{let t=e.split(`
|
|
107
107
|
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&Wd.test(t))return!0}return!1},qd=()=>e=>{Zt(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},Jd=[],Yd={allowDangerousHtml:!0},Xd=new WeakMap,Zd=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=Xd.get(e);n||(n=e.name,Xd.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=Xd.get(r);e||(e=r.name,Xd.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},Qd=e=>{let t=$d(e),n=e.children||``;return sf(t.runSync(t.parse(n),n),e)},$d=e=>{let t=Zd.get(e);if(t)return t;let n=tf(e);return Zd.set(e,n),n},ef=e=>e.some(e=>Array.isArray(e)?e[0]===Wt:e===Wt),tf=e=>{let t=e.rehypePlugins||Jd,n=e.remarkPlugins||Jd,r=ef(t)?n:[...n,qd],i=e.remarkRehypeOptions?{...Yd,...e.remarkRehypeOptions}:Yd;return Vt().use(Xt).use(r).use(Kt,i).use(t)},nf=e=>e,rf=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},af=(e,t)=>{for(let n in Ht)if(Object.hasOwn(Ht,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=Ht[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},of=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},sf=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||nf;Zt(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return rf(c,s,a,e.value),s;if(e.type===`element`&&(af(e,t),of(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return Ut(e,{Fragment:R.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0})},cf=/\[\^[\w-]{1,200}\](?!:)/,lf=/\[\^[\w-]{1,200}\]:/,uf=/<(\w+)[\s>]/,df=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),ff=new Map,pf=new Map,mf=e=>{let t=e.toLowerCase(),n=ff.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return ff.set(t,r),r},hf=e=>{let t=e.toLowerCase(),n=pf.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return pf.set(t,r),r},gf=(e,t)=>{if(df.has(t.toLowerCase()))return 0;let n=e.match(mf(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},_f=(e,t)=>{let n=e.match(hf(t));return n?n.length:0},vf=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},yf=e=>{let t=cf.test(e),n=lf.test(e);if(t||n)return[e];let r=zl.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=gf(t,e),o=_f(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(uf);if(e){let n=e[1];gf(t,n)>_f(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(vf(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},bf=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
108
108
|
|
|
@@ -117,4 +117,4 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
|
|
|
117
117
|
`})}return n},xf=/([\\`*_~[\]|])/g,Sf=e=>e.replace(xf,`\\$1`),Cf=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+Sf(n).replace(/\n\n/g,` `)+r)}return n},wf=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(wf).join(``):``,Tf=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));Zt(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=wf(e);e.children=t?[{type:`text`,value:t}]:[]}})},Ef=()=>e=>{Zt(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},Df=/^[ \t]*<[\w!/?-]/,Of=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,kf=e=>typeof e!=`string`||e.length===0||!Df.test(e)?e:e.replace(Of,`$1`),Af={...Gt,protocols:{...Gt.protocols,href:[...Gt.protocols?.href??[],`tel`]},attributes:{...Gt.attributes,code:[...Gt.attributes?.code??[],`metastring`]}},jf={raw:Wt,sanitize:[qt,Af],harden:[zt,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},Mf={gfm:[Jt,{}],codeMeta:Ef},Nf=Object.values(jf),Pf=Object.values(Mf),Ff={block:` ▋`,circle:` ●`},If=[`github-light`,`github-dark`],Lf={enabled:!0},Rf=(0,I.createContext)({shikiTheme:If,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:Lf}),zf=(0,I.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{if(o){let e=o.getLastRenderCharCount();o.setPrevContentLength(e)}let c=typeof e==`string`&&n?kf(e):e,l=(0,R.jsx)(Qd,{...s,children:c});return(0,R.jsx)(su.Provider,{value:i,children:a?(0,R.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});zf.displayName=`Block`;var Bf=(0,I.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=Nf,remarkPlugins:s=Pf,className:c,shikiTheme:l=If,mermaid:u,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:m=zf,parseMarkdownIntoBlocksFn:h=yf,caret:g,plugins:_,remend:v,linkSafety:y=Lf,lineNumbers:b=!0,allowedTags:x,literalTagContent:S,translations:C,icons:w,prefix:T,onAnimationStart:E,onAnimationEnd:D,...ee})=>{let O=(0,I.useId)(),[te,k]=(0,I.useTransition)(),ne=(0,I.useMemo)(()=>du(T),[T]),re=(0,I.useRef)(null),ie=(0,I.useRef)(E),ae=(0,I.useRef)(D);ie.current=E,ae.current=D,(0,I.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=re.current;if(re.current=f,i===null){f&&((e=ie.current)==null||e.call(ie));return}f&&!i?(n=ie.current)==null||n.call(ie):!f&&i&&((r=ae.current)==null||r.call(ae))},[f,t]);let oe=(0,I.useMemo)(()=>x?Object.keys(x):[],[x]),se=(0,I.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?gc(e,v):e;return S&&S.length>0&&(n=Cf(n,S)),oe.length>0&&(n=bf(n,oe)),n},[e,t,r,v,oe,S]),ce=(0,I.useMemo)(()=>h(se),[se,h]),[le,ue]=(0,I.useState)(ce);(0,I.useEffect)(()=>{t===`streaming`&&!he?k(()=>{ue(ce)}):ue(ce)},[ce,t]);let de=t===`streaming`?le:ce,fe=(0,I.useMemo)(()=>n===`auto`?de.map(Hd):void 0,[de,n]),pe=(0,I.useMemo)(()=>de.map((e,t)=>`${O}-${t}`),[de.length,O]),me=(0,I.useMemo)(()=>p===!0?`true`:p?JSON.stringify(p):``,[p]),he=(0,I.useMemo)(()=>me?me===`true`?ou():ou(p):null,[me]),ge=(0,I.useMemo)(()=>({shikiTheme:(_?.code)?.getThemes()??l,controls:d,isAnimating:f,lineNumbers:b,mode:t,mermaid:u,linkSafety:y}),[l,d,f,b,t,u,y,_?.code]),_e=(0,I.useMemo)(()=>({...ku,...C}),[(0,I.useMemo)(()=>C?JSON.stringify(C):``,[C])]),ve=(0,I.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...zd,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,I.createElement)(t,n):null:(0,I.createElement)(e,n)}return n},[a]),A=(0,I.useMemo)(()=>{let e=[];return _!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsBefore]),e=[...e,...s],_!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(e=[...e,_.math.remarkPlugin]),e},[s,_?.math,_?.cjk]),ye=(0,I.useMemo)(()=>{let e=o;if(x&&Object.keys(x).length>0&&o===Nf){let t={...Af,tagNames:[...Af.tagNames??[],...Object.keys(x)],attributes:{...Af.attributes,...x}};e=[jf.raw,[qt,t],jf.harden]}return S&&S.length>0&&(e=[...e,[Tf,S]]),_!=null&&_.math&&(e=[...e,_.math.rehypePlugin]),he&&f&&(e=[...e,he.rehypePlugin]),e},[o,_?.math,he,f,x,S]),be=(0,I.useMemo)(()=>{if(!f||de.length===0)return!1;let e=de.at(-1);return Gd(e)||Kd(e)},[f,de]),xe=(0,I.useMemo)(()=>g&&f&&!be?{"--streamdown-caret":`"${Ff[g]}"`}:void 0,[g,f,be]);return t===`static`?(0,R.jsx)(Au.Provider,{value:_e,children:(0,R.jsx)(Hu.Provider,{value:_??null,children:(0,R.jsx)(Rf.Provider,{value:ge,children:(0,R.jsx)(Du,{icons:w,children:(0,R.jsx)(pu.Provider,{value:ne,children:(0,R.jsx)(`div`,{className:ne(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?Hd(se):n,children:(0,R.jsx)(Qd,{components:ve,rehypePlugins:ye,remarkPlugins:A,...ee,children:se})})})})})})}):(0,R.jsx)(Au.Provider,{value:_e,children:(0,R.jsx)(Hu.Provider,{value:_??null,children:(0,R.jsx)(Rf.Provider,{value:ge,children:(0,R.jsx)(Du,{icons:w,children:(0,R.jsx)(pu.Provider,{value:ne,children:(0,R.jsxs)(`div`,{className:ne(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,g&&!be?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:xe,children:[de.length===0&&g&&f&&(0,R.jsx)(`span`,{}),de.map((e,t)=>{let a=t===de.length-1,o=f&&a&&Gd(e);return(0,R.jsx)(m,{animatePlugin:he,components:ve,content:e,dir:fe?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:ye,remarkPlugins:A,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...ee},pe[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);Bf.displayName=`Streamdown`;var Vf=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=Ou(),d=V(),f=(0,I.useRef)(null),p=(0,I.useRef)(null),[m,h]=(0,I.useState)(o),[g,_]=(0,I.useState)({x:0,y:0}),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)({x:0,y:0}),[S,C]=(0,I.useState)({x:0,y:0}),w=(0,I.useCallback)(e=>{h(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),T=(0,I.useCallback)(()=>{w(i)},[w,i]),E=(0,I.useCallback)(()=>{w(-i)},[w,i]),D=(0,I.useCallback)(()=>{h(o),_({x:0,y:0})},[o]),ee=(0,I.useCallback)(e=>{e.preventDefault(),w(e.deltaY>0?-i:i)},[w,i]),O=(0,I.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;y(!0),x({x:e.clientX,y:e.clientY}),C(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),te=(0,I.useCallback)(e=>{if(!v)return;e.preventDefault();let t=e.clientX-b.x,n=e.clientY-b.y;_({x:S.x+t,y:S.y+n})},[v,b,S]),k=(0,I.useCallback)(e=>{y(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,I.useEffect)(()=>{let e=f.current;if(e)return e.addEventListener(`wheel`,ee,{passive:!1}),()=>{e.removeEventListener(`wheel`,ee)}},[ee]),(0,I.useEffect)(()=>{let e=p.current;if(e&&v)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,te,{passive:!1}),e.addEventListener(`pointerup`,k),e.addEventListener(`pointercancel`,k),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,te),e.removeEventListener(`pointerup`,k),e.removeEventListener(`pointercancel`,k)}},[v,te,k]),(0,R.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:f,style:{cursor:v?`grabbing`:`grab`},children:[a?(0,R.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,R.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m>=r,onClick:T,title:`Zoom in`,type:`button`,children:(0,R.jsx)(l,{size:16})}),(0,R.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m<=n,onClick:E,title:`Zoom out`,type:`button`,children:(0,R.jsx)(u,{size:16})}),(0,R.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:D,title:`Reset zoom and pan`,type:`button`,children:(0,R.jsx)(c,{size:16})})]}):null,(0,R.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:O,ref:p,role:`application`,style:{transform:`translate(${g.x}px, ${g.y}px) scale(${m})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},Hf=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=V(),[o,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(!1),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(``),[m,h]=(0,I.useState)(0),{mermaid:g}=(0,I.useContext)(Rf),_=Gu(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=Yl({immediate:r});if((0,I.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,R.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,R.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,R.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,R.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,R.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,R.jsx)(`div`,{ref:b,children:(0,R.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,R.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,R.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,R.jsxs)(`details`,{className:a(`mt-2`),children:[(0,R.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,R.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,R.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,R.jsx)(Vf,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,R.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})},Uf=({className:e,from:t,...n})=>(0,R.jsx)(`div`,{className:A(`group flex w-full max-w-[95%] flex-col gap-2`,t===`user`?`is-user ml-auto justify-end`:`is-assistant`,e),...n}),Wf=({children:e,className:t,...n})=>(0,R.jsx)(`div`,{className:A(`is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm`,`group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground`,`group-[.is-assistant]:text-foreground`,t),...n,children:e}),Gf=({className:e,children:t,...n})=>(0,R.jsx)(`div`,{className:A(`flex items-center gap-1`,e),...n,children:t}),Kf=({tooltip:e,children:t,label:n,variant:r=`ghost`,size:i=`icon`,...a})=>{let o=(0,R.jsxs)(M,{size:i,type:`button`,variant:r,...a,children:[t,(0,R.jsx)(`span`,{className:`sr-only`,children:n||e})]});return e?(0,R.jsx)(oe,{children:(0,R.jsxs)(ve,{children:[(0,R.jsx)(fe,{asChild:!0,children:o}),(0,R.jsx)(be,{children:(0,R.jsx)(`p`,{children:e})})]})}):o};(0,I.createContext)(null);var qf=(0,I.memo)(({className:e,...t})=>(0,R.jsx)(Bf,{className:A(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);qf.displayName=`MessageResponse`;function Jf({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:A(`group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30`,`h-9 min-w-0 has-[>textarea]:h-auto`,`has-[>[data-align=inline-start]]:[&>input]:pl-2`,`has-[>[data-align=inline-end]]:[&>input]:pr-2`,`has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3`,`has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3`,`has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50`,`has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40`,e),...t})}var Yf=It(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]`,"inline-end":`order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]`,"block-start":`order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3`,"block-end":`order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3`}},defaultVariants:{align:`inline-start`}});function Xf({className:e,align:t=`inline-start`,...n}){return(0,R.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:A(Yf({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Zf=It(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5`,sm:`h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5`,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Qf({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,R.jsx)(M,{type:t,"data-size":r,variant:n,className:A(Zf({size:r}),e),...i})}function $f({className:e,...t}){return(0,R.jsx)(ft,{"data-slot":`input-group-control`,className:A(`flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent`,e),...t})}var ep=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,tp=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=ep[n[e]&63];return t},np=(0,I.createContext)(null),rp=(0,I.createContext)(null),ip=()=>(0,I.useContext)(np),ap=()=>(0,I.useContext)(rp),op=(0,I.createContext)(null),sp=()=>{let e=ap(),t=(0,I.useContext)(op),n=e??t;if(!n)throw Error(`usePromptInputAttachments must be used within a PromptInput or PromptInputProvider`);return n};function cp({data:e,className:t,...n}){let r=sp(),i=e.filename||``,a=(e.mediaType?.startsWith(`image/`)&&e.url?`image`:`file`)==`image`,o=i||(a?`Image`:`Attachment`);return(0,R.jsxs)(xp,{children:[(0,R.jsx)(Tt,{asChild:!0,children:(0,R.jsxs)(`div`,{className:A(`group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,t),...n,children:[(0,R.jsxs)(`div`,{className:`relative size-5 shrink-0`,children:[(0,R.jsx)(`div`,{className:`absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded bg-background transition-opacity group-hover:opacity-0`,children:a?(0,R.jsx)(`img`,{alt:i||`attachment`,className:`size-5 object-cover`,height:20,src:e.url,width:20}):(0,R.jsx)(`div`,{className:`flex size-5 items-center justify-center text-muted-foreground`,children:(0,R.jsx)(et,{className:`size-3`})})}),(0,R.jsxs)(M,{"aria-label":`Remove attachment`,className:`absolute inset-0 size-5 cursor-pointer rounded p-0 opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 [&>svg]:size-2.5`,onClick:t=>{t.stopPropagation(),r.remove(e.id)},type:`button`,variant:`ghost`,children:[(0,R.jsx)(ye,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})]}),(0,R.jsx)(`span`,{className:`flex-1 truncate`,children:o})]},e.id)}),(0,R.jsx)(Sp,{className:`w-auto p-2`,children:(0,R.jsxs)(`div`,{className:`w-auto space-y-3`,children:[a&&(0,R.jsx)(`div`,{className:`flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border`,children:(0,R.jsx)(`img`,{alt:i||`attachment preview`,className:`max-h-full max-w-full object-contain`,height:384,src:e.url,width:448})}),(0,R.jsx)(`div`,{className:`flex items-center gap-2.5`,children:(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 px-0.5`,children:[(0,R.jsx)(`h4`,{className:`truncate font-semibold text-sm leading-none`,children:i||(a?`Image`:`Attachment`)}),e.mediaType&&(0,R.jsx)(`p`,{className:`truncate font-mono text-muted-foreground text-xs`,children:e.mediaType})]})})]})})]})}function lp({children:e,className:t,...n}){let r=sp();return r.files.length?(0,R.jsx)(`div`,{className:A(`flex flex-wrap items-center gap-2 p-3 w-full`,t),...n,children:r.files.map(t=>(0,R.jsx)(I.Fragment,{children:e(t)},t.id))}):null}var up=({label:e=`Add photos or files`,...t})=>{let n=sp();return(0,R.jsxs)(Ze,{...t,onSelect:e=>{e.preventDefault(),n.openFileDialog()},children:[(0,R.jsx)(yt,{className:`mr-2 size-4`}),` `,e]})},dp=({className:e,accept:t,multiple:n,fileInputLabel:r=`Upload files`,globalDrop:i,syncHiddenInput:a,maxFiles:o,maxFileSize:s,onError:c,onSubmit:l,children:u,...d})=>{let f=ip(),p=!!f,m=(0,I.useRef)(null),h=(0,I.useRef)(null),[g,_]=(0,I.useState)([]),v=p?f.attachments.files:g,y=(0,I.useRef)(v);y.current=v;let b=(0,I.useCallback)(()=>{m.current?.click()},[]),x=(0,I.useCallback)(e=>!t||t.trim()===``?!0:t.split(`,`).map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith(`/*`)){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t}),[t]),S=(0,I.useCallback)(e=>{let t=Array.from(e),n=t.filter(e=>x(e));if(t.length&&n.length===0){c?.({code:`accept`,message:`No files match the accepted types.`});return}let r=n.filter(e=>s?e.size<=s:!0);if(n.length>0&&r.length===0){c?.({code:`max_file_size`,message:`All files exceed the maximum size.`});return}_(e=>{let t=typeof o==`number`?Math.max(0,o-e.length):void 0,n=typeof t==`number`?r.slice(0,t):r;typeof t==`number`&&r.length>t&&c?.({code:`max_files`,message:`Too many files. Some were not added.`});let i=[];for(let e of n)i.push({id:tp(),type:`file`,url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(i)})},[x,o,s,c]),C=(0,I.useCallback)(e=>_(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)}),[]),w=(0,I.useCallback)(()=>_(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[]),T=p?f.attachments.add:S,E=p?f.attachments.remove:C,D=p?f.attachments.clear:w,ee=p?f.attachments.openFileDialog:b;(0,I.useEffect)(()=>{p&&f.__registerFileInput(m,()=>m.current?.click())},[p,f]),(0,I.useEffect)(()=>{a&&m.current&&v.length===0&&(m.current.value=``)},[v,a]),(0,I.useEffect)(()=>{let e=h.current;if(!e||i)return;let t=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},n=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&T(e.dataTransfer.files)};return e.addEventListener(`dragover`,t),e.addEventListener(`drop`,n),()=>{e.removeEventListener(`dragover`,t),e.removeEventListener(`drop`,n)}},[T,i]),(0,I.useEffect)(()=>{if(!i)return;let e=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&T(e.dataTransfer.files)};return document.addEventListener(`dragover`,e),document.addEventListener(`drop`,t),()=>{document.removeEventListener(`dragover`,e),document.removeEventListener(`drop`,t)}},[T,i]),(0,I.useEffect)(()=>()=>{if(!p)for(let e of y.current)e.url&&URL.revokeObjectURL(e.url)},[p]);let O=e=>{e.currentTarget.files&&T(e.currentTarget.files),e.currentTarget.value=``},te=async e=>{try{let t=await(await fetch(e)).blob();return new Promise(e=>{let n=new FileReader;n.onloadend=()=>e(n.result),n.onerror=()=>e(null),n.readAsDataURL(t)})}catch{return null}},k=(0,I.useMemo)(()=>({files:v.map(e=>({...e,id:e.id})),add:T,remove:E,clear:D,openFileDialog:ee,fileInputRef:m}),[v,T,E,D,ee]),ne=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`input`,{accept:t,"aria-label":r,className:`hidden`,multiple:n,onChange:O,ref:m,title:r,type:`file`}),(0,R.jsx)(`form`,{className:A(`w-full`,e),onSubmit:e=>{e.preventDefault();let t=e.currentTarget,n=p?f.textInput.value:new FormData(t).get(`message`)||``;p||t.reset(),Promise.all(v.map(async({id:e,...t})=>{if(t.url&&t.url.startsWith(`blob:`)){let e=await te(t.url);return{...t,url:e??t.url}}return t})).then(t=>{try{let r=l({text:n,files:t},e);r instanceof Promise?r.then(()=>{D(),p&&f.textInput.clear()}).catch(()=>{}):(D(),p&&f.textInput.clear())}catch{}}).catch(()=>{})},ref:h,...d,children:(0,R.jsx)(Jf,{className:`overflow-hidden`,children:u})})]});return p?ne:(0,R.jsx)(op.Provider,{value:k,children:ne})},fp=({className:e,...t})=>(0,R.jsx)(`div`,{className:A(`contents`,e),...t}),pp=({onChange:e,className:t,placeholder:n=`What would you like to know?`,...r})=>{let i=ip(),a=sp(),[o,s]=(0,I.useState)(!1),c=e=>{if(e.key===`Enter`){if(o||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget.form;if(t?.querySelector(`button[type="submit"]`)?.disabled)return;t?.requestSubmit()}if(e.key===`Backspace`&&e.currentTarget.value===``&&a.files.length>0){e.preventDefault();let t=a.files[a.files.length-1];t&&a.remove(t.id)}},l=e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),a.add(n))},u=i?{value:i.textInput.value,onChange:t=>{i.textInput.setInput(t.currentTarget.value),e?.(t)}}:{onChange:e};return(0,R.jsx)($f,{className:A(`field-sizing-content max-h-48 min-h-16`,t),name:`message`,onCompositionEnd:()=>s(!1),onCompositionStart:()=>s(!0),onKeyDown:c,onPaste:l,placeholder:n,...r,...u})},mp=({className:e,...t})=>(0,R.jsx)(Xf,{align:`block-end`,className:A(`justify-between gap-1`,e),...t}),hp=({className:e,...t})=>(0,R.jsx)(`div`,{className:A(`flex items-center gap-1`,e),...t}),gp=({variant:e=`ghost`,className:t,size:n,...r})=>{let i=n??(I.Children.count(r.children)>1?`sm`:`icon-sm`);return(0,R.jsx)(Qf,{className:A(t),size:i,type:`button`,variant:e,...r})},_p=e=>(0,R.jsx)(Ke,{...e}),vp=({className:e,children:t,...n})=>(0,R.jsx)(kt,{asChild:!0,children:(0,R.jsx)(gp,{className:e,...n,children:t??(0,R.jsx)(Me,{className:`size-4`})})}),yp=({className:e,...t})=>(0,R.jsx)(pt,{align:`start`,className:A(e),...t}),bp=({className:e,variant:t=`default`,size:n=`icon-sm`,status:r,children:i,...a})=>{let o=(0,R.jsx)(dt,{className:`size-4`});return r===`submitted`?o=(0,R.jsx)(Nt,{className:`size-4 animate-spin`}):r===`streaming`?o=(0,R.jsx)(wt,{className:`size-4`}):r===`error`&&(o=(0,R.jsx)(ye,{className:`size-4`})),(0,R.jsx)(Qf,{"aria-label":`Submit`,className:A(e),size:n,type:`submit`,variant:t,...a,children:i??o})},xp=({openDelay:e=0,closeDelay:t=0,...n})=>(0,R.jsx)(Ve,{closeDelay:t,openDelay:e,...n}),Sp=({align:e=`start`,...t})=>(0,R.jsx)(it,{align:e,...t}),Cp=({className:e,children:t,...n})=>(0,R.jsxs)(je,{className:`w-full overflow-x-auto whitespace-nowrap`,...n,children:[(0,R.jsx)(`div`,{className:A(`flex w-max flex-nowrap items-center gap-2`,e),children:t}),(0,R.jsx)(Fe,{className:`hidden`,orientation:`horizontal`})]}),wp=({suggestion:e,onClick:t,className:n,variant:r=`outline`,size:i=`sm`,children:a,...o})=>(0,R.jsx)(M,{className:A(`cursor-pointer rounded-full px-4`,n),onClick:()=>{t?.(e)},size:i,type:`button`,variant:r,...o,children:a||e}),Tp=Object.defineProperty,Ep=Object.getOwnPropertyDescriptor,Dp=Object.getOwnPropertyNames,Op=Object.prototype.hasOwnProperty,kp=(e,t)=>{let n={};for(var r in e)Tp(n,r,{get:e[r],enumerable:!0});return t||Tp(n,Symbol.toStringTag,{value:`Module`}),n},Ap=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Dp(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Op.call(e,s)&&s!==n&&Tp(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Ep(t,s))||r.enumerable});return e},jp=(e,t,n)=>(Ap(e,t,`default`),n&&Ap(n,t,`default`)),Mp=[{id:`abap`,name:`ABAP`,import:(()=>s(()=>import(`./abap-CLvhMVsD.js`),[],import.meta.url))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>s(()=>import(`./actionscript-3--17pq3dv.js`),[],import.meta.url))},{id:`ada`,name:`Ada`,import:(()=>s(()=>import(`./ada-C5qYipkI.js`),[],import.meta.url))},{id:`angular-html`,name:`Angular HTML`,import:(()=>s(()=>import(`./angular-html-B9s24XBK.js`).then(e=>e.n),[],import.meta.url))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>s(()=>import(`./angular-ts-C7DCn4N7.js`),[],import.meta.url))},{id:`apache`,name:`Apache Conf`,import:(()=>s(()=>import(`./apache-U0d_L8uA.js`),[],import.meta.url))},{id:`apex`,name:`Apex`,import:(()=>s(()=>import(`./apex-VAyPSnFM.js`),[],import.meta.url))},{id:`apl`,name:`APL`,import:(()=>s(()=>import(`./apl-BFSpAsVe.js`),[],import.meta.url))},{id:`applescript`,name:`AppleScript`,import:(()=>s(()=>import(`./applescript-CCn79oCD.js`),[],import.meta.url))},{id:`ara`,name:`Ara`,import:(()=>s(()=>import(`./ara-4CJ0cIlV.js`),[],import.meta.url))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>s(()=>import(`./asciidoc-DE70LPWp.js`),[],import.meta.url))},{id:`asm`,name:`Assembly`,import:(()=>s(()=>import(`./asm-Cmm7eHzH.js`),[],import.meta.url))},{id:`astro`,name:`Astro`,import:(()=>s(()=>import(`./astro-By5nmri_.js`),[],import.meta.url))},{id:`awk`,name:`AWK`,import:(()=>s(()=>import(`./awk-BWXHIvNe.js`),[],import.meta.url))},{id:`ballerina`,name:`Ballerina`,import:(()=>s(()=>import(`./ballerina-B7ZEbQpA.js`),[],import.meta.url))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>s(()=>import(`./bat-Bo4NYOV-.js`),[],import.meta.url))},{id:`beancount`,name:`Beancount`,import:(()=>s(()=>import(`./beancount-D-usSTwE.js`),[],import.meta.url))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>s(()=>import(`./berry-DKpUyyne.js`),[],import.meta.url))},{id:`bibtex`,name:`BibTeX`,import:(()=>s(()=>import(`./bibtex-Ci_nEsc7.js`),[],import.meta.url))},{id:`bicep`,name:`Bicep`,import:(()=>s(()=>import(`./bicep-CUHmPFLl.js`),[],import.meta.url))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>s(()=>import(`./bird2-C6vDhewU.js`),[],import.meta.url))},{id:`blade`,name:`Blade`,import:(()=>s(()=>import(`./blade-BEsyb4Es.js`),[],import.meta.url))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>s(()=>import(`./bsl-BkkzgIyY.js`),[],import.meta.url))},{id:`c`,name:`C`,import:(()=>s(()=>import(`./c-CwKsiqWD.js`).then(e=>e.n),[],import.meta.url))},{id:`c3`,name:`C3`,import:(()=>s(()=>import(`./c3-BFHwR3_K.js`),[],import.meta.url))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>s(()=>import(`./cadence-CQ2zXKGN.js`),[],import.meta.url))},{id:`cairo`,name:`Cairo`,import:(()=>s(()=>import(`./cairo-DLTphjLi.js`),[],import.meta.url))},{id:`clarity`,name:`Clarity`,import:(()=>s(()=>import(`./clarity-SemFz856.js`),[],import.meta.url))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>s(()=>import(`./clojure-DqKBuwfJ.js`),[],import.meta.url))},{id:`cmake`,name:`CMake`,import:(()=>s(()=>import(`./cmake-Bj61d0ZC.js`),[],import.meta.url))},{id:`cobol`,name:`COBOL`,import:(()=>s(()=>import(`./cobol-AtgRrYrD.js`),[],import.meta.url))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>s(()=>import(`./codeowners-C8r90Shi.js`),[],import.meta.url))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>s(()=>import(`./codeql-oeQT6MSM.js`),[],import.meta.url))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>s(()=>import(`./coffee-Dx9BrBX9.js`),[],import.meta.url))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>s(()=>import(`./common-lisp-Cv5bFMCO.js`),[],import.meta.url))},{id:`coq`,name:`Coq`,import:(()=>s(()=>import(`./coq-BrsZFFmf.js`),[],import.meta.url))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>s(()=>import(`./cpp-DNQ-Fj9i.js`).then(e=>e.n),[],import.meta.url))},{id:`crystal`,name:`Crystal`,import:(()=>s(()=>import(`./crystal-BFAqiLnY.js`),[],import.meta.url))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>s(()=>import(`./csharp-oqKa8noW.js`),[],import.meta.url))},{id:`css`,name:`CSS`,import:(()=>s(()=>import(`./css-76WQuunA.js`).then(e=>e.n),[],import.meta.url))},{id:`csv`,name:`CSV`,import:(()=>s(()=>import(`./csv-Dx-8-gkx.js`),[],import.meta.url))},{id:`cue`,name:`CUE`,import:(()=>s(()=>import(`./cue-CE9AQfxI.js`),[],import.meta.url))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>s(()=>import(`./cypher-ClKdZ_lG.js`),[],import.meta.url))},{id:`d`,name:`D`,import:(()=>s(()=>import(`./d-qD-0Kul2.js`),[],import.meta.url))},{id:`dart`,name:`Dart`,import:(()=>s(()=>import(`./dart-CnvKMtbv.js`),[],import.meta.url))},{id:`dax`,name:`DAX`,import:(()=>s(()=>import(`./dax-BkyTk9wS.js`),[],import.meta.url))},{id:`desktop`,name:`Desktop`,import:(()=>s(()=>import(`./desktop-Dlh5hvp9.js`),[],import.meta.url))},{id:`diff`,name:`Diff`,import:(()=>s(()=>import(`./diff-woXpYk--.js`),[],import.meta.url))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>s(()=>import(`./docker-IyjqRm3v.js`),[],import.meta.url))},{id:`dotenv`,name:`dotEnv`,import:(()=>s(()=>import(`./dotenv-_5a1GRtc.js`),[],import.meta.url))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>s(()=>import(`./dream-maker-DW3nJb8Q.js`),[],import.meta.url))},{id:`edge`,name:`Edge`,import:(()=>s(()=>import(`./edge-BEfBxc5h.js`),[],import.meta.url))},{id:`elixir`,name:`Elixir`,import:(()=>s(()=>import(`./elixir-Bi1LyDCo.js`),[],import.meta.url))},{id:`elm`,name:`Elm`,import:(()=>s(()=>import(`./elm-BMPZeG5i.js`),[],import.meta.url))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>s(()=>import(`./emacs-lisp-B4R74twV.js`),[],import.meta.url))},{id:`erb`,name:`ERB`,import:(()=>s(()=>import(`./erb-Pmcx6TTx.js`),[],import.meta.url))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>s(()=>import(`./erlang-Cphh6RMH.js`),[],import.meta.url))},{id:`fennel`,name:`Fennel`,import:(()=>s(()=>import(`./fennel-DQxkIbk2.js`),[],import.meta.url))},{id:`fish`,name:`Fish`,import:(()=>s(()=>import(`./fish-BJitypiv.js`),[],import.meta.url))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>s(()=>import(`./fluent-C03EYrpw.js`),[],import.meta.url))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>s(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),[],import.meta.url))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>s(()=>import(`./fortran-free-form-CYNrtFtB.js`),[],import.meta.url))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>s(()=>import(`./fsharp-D13ZGOAj.js`),[],import.meta.url))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>s(()=>import(`./gdresource-C0sCabJj.js`),[],import.meta.url))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>s(()=>import(`./gdscript-Cp2uCuqX.js`),[],import.meta.url))},{id:`gdshader`,name:`GDShader`,import:(()=>s(()=>import(`./gdshader-CBce3t8t.js`),[],import.meta.url))},{id:`genie`,name:`Genie`,import:(()=>s(()=>import(`./genie-CV2tkWYe.js`),[],import.meta.url))},{id:`gherkin`,name:`Gherkin`,import:(()=>s(()=>import(`./gherkin-DExj1W_8.js`),[],import.meta.url))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>s(()=>import(`./git-commit-BSykSTBG.js`),[],import.meta.url))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>s(()=>import(`./git-rebase-Dj7t0bix.js`),[],import.meta.url))},{id:`gleam`,name:`Gleam`,import:(()=>s(()=>import(`./gleam-CSRkHgEL.js`),[],import.meta.url))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>s(()=>import(`./glimmer-js-DTpMHWUo.js`),[],import.meta.url))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>s(()=>import(`./glimmer-ts-BKOVQU61.js`),[],import.meta.url))},{id:`glsl`,name:`GLSL`,import:(()=>s(()=>import(`./glsl-DDNdYp2B.js`).then(e=>e.n),[],import.meta.url))},{id:`gn`,name:`GN`,import:(()=>s(()=>import(`./gn-ilITqXS6.js`),[],import.meta.url))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>s(()=>import(`./gnuplot-7GGW24-e.js`),[],import.meta.url))},{id:`go`,name:`Go`,import:(()=>s(()=>import(`./go-rLFTqkRN.js`),[],import.meta.url))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>s(()=>import(`./graphql-C-akFyqE.js`).then(e=>e.n),[],import.meta.url))},{id:`groovy`,name:`Groovy`,import:(()=>s(()=>import(`./groovy-CacY0gHj.js`),[],import.meta.url))},{id:`hack`,name:`Hack`,import:(()=>s(()=>import(`./hack-Z382E4IB.js`),[],import.meta.url))},{id:`haml`,name:`Ruby Haml`,import:(()=>s(()=>import(`./haml-DCWQJgln.js`).then(e=>e.n),[],import.meta.url))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>s(()=>import(`./handlebars-D_RRtkV5.js`),[],import.meta.url))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>s(()=>import(`./haskell-D8IpX4py.js`),[],import.meta.url))},{id:`haxe`,name:`Haxe`,import:(()=>s(()=>import(`./haxe-OTjmBuCE.js`),[],import.meta.url))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>s(()=>import(`./hcl-Dh228itO.js`),[],import.meta.url))},{id:`hjson`,name:`Hjson`,import:(()=>s(()=>import(`./hjson-CxZEssPk.js`),[],import.meta.url))},{id:`hlsl`,name:`HLSL`,import:(()=>s(()=>import(`./hlsl-Cvrh5tZx.js`),[],import.meta.url))},{id:`html`,name:`HTML`,import:(()=>s(()=>import(`./html-BqDo3pKb.js`).then(e=>e.n),[],import.meta.url))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>s(()=>import(`./html-derivative-DncxUXSH.js`),[],import.meta.url))},{id:`http`,name:`HTTP`,import:(()=>s(()=>import(`./http-CrTHj6_t.js`),[],import.meta.url))},{id:`hurl`,name:`Hurl`,import:(()=>s(()=>import(`./hurl-BdeVL_ga.js`),[],import.meta.url))},{id:`hxml`,name:`HXML`,import:(()=>s(()=>import(`./hxml-B0Qn7Nwc.js`),[],import.meta.url))},{id:`hy`,name:`Hy`,import:(()=>s(()=>import(`./hy-CZbG8q4J.js`),[],import.meta.url))},{id:`imba`,name:`Imba`,import:(()=>s(()=>import(`./imba-DsUTQ-LC.js`),[],import.meta.url))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>s(()=>import(`./ini-B5eOa1yu.js`),[],import.meta.url))},{id:`java`,name:`Java`,import:(()=>s(()=>import(`./java-DKFHmTAg.js`).then(e=>e.n),[],import.meta.url))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>s(()=>import(`./javascript-Jx16aUBb.js`).then(e=>e.n),[],import.meta.url))},{id:`jinja`,name:`Jinja`,import:(()=>s(()=>import(`./jinja-CQEVrK23.js`),[],import.meta.url))},{id:`jison`,name:`Jison`,import:(()=>s(()=>import(`./jison-BJRgvE0A.js`),[],import.meta.url))},{id:`json`,name:`JSON`,import:(()=>s(()=>import(`./json-DlFP2GYa.js`).then(e=>e.n),[],import.meta.url))},{id:`json5`,name:`JSON5`,import:(()=>s(()=>import(`./json5-BR5RXkoi.js`),[],import.meta.url))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>s(()=>import(`./jsonc-CYpm1nAK.js`),[],import.meta.url))},{id:`jsonl`,name:`JSON Lines`,import:(()=>s(()=>import(`./jsonl-CmCQp5Yx.js`),[],import.meta.url))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>s(()=>import(`./jsonnet-CJTPZ8u_.js`),[],import.meta.url))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>s(()=>import(`./jssm-DXw9l8Rf.js`),[],import.meta.url))},{id:`jsx`,name:`JSX`,import:(()=>s(()=>import(`./jsx-CIwpwN-u.js`).then(e=>e.n),[],import.meta.url))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>s(()=>import(`./julia-D4zLZb0D.js`),[],import.meta.url))},{id:`just`,name:`Just`,import:(()=>s(()=>import(`./just-BbmgE3ZP.js`),[],import.meta.url))},{id:`kdl`,name:`KDL`,import:(()=>s(()=>import(`./kdl-CsD5j6eV.js`),[],import.meta.url))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>s(()=>import(`./kotlin-DhhofPvG.js`),[],import.meta.url))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>s(()=>import(`./kusto-C7mF5XQf.js`),[],import.meta.url))},{id:`latex`,name:`LaTeX`,import:(()=>s(()=>import(`./latex-BUDs7Dcl.js`),[],import.meta.url))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>s(()=>import(`./lean-CewbzKMR.js`),[],import.meta.url))},{id:`less`,name:`Less`,import:(()=>s(()=>import(`./less-DVTAwKKz.js`),[],import.meta.url))},{id:`liquid`,name:`Liquid`,import:(()=>s(()=>import(`./liquid-Bc0s0G9S.js`),[],import.meta.url))},{id:`llvm`,name:`LLVM IR`,import:(()=>s(()=>import(`./llvm-Cm23YOpf.js`),[],import.meta.url))},{id:`log`,name:`Log file`,import:(()=>s(()=>import(`./log-BNLmms1o.js`),[],import.meta.url))},{id:`logo`,name:`Logo`,import:(()=>s(()=>import(`./logo-Cluzi2Zq.js`),[],import.meta.url))},{id:`lua`,name:`Lua`,import:(()=>s(()=>import(`./lua-dQaszIi_.js`).then(e=>e.n),[],import.meta.url))},{id:`luau`,name:`Luau`,import:(()=>s(()=>import(`./luau-FMPmPwt6.js`),[],import.meta.url))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>s(()=>import(`./make-Dixweg8N.js`),[],import.meta.url))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>s(()=>import(`./markdown-BYOwaDjH.js`),[],import.meta.url))},{id:`marko`,name:`Marko`,import:(()=>s(()=>import(`./marko-B5Uea28G.js`),[],import.meta.url))},{id:`matlab`,name:`MATLAB`,import:(()=>s(()=>import(`./matlab-D7qyCx1q.js`),[],import.meta.url))},{id:`mdc`,name:`MDC`,import:(()=>s(()=>import(`./mdc-CwQcy7BI.js`),[],import.meta.url))},{id:`mdx`,name:`MDX`,import:(()=>s(()=>import(`./mdx-DQZ5AkYe.js`),[],import.meta.url))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>s(()=>import(`./mermaid-Bk4SNUv9.js`),[],import.meta.url))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>s(()=>import(`./mipsasm-BMqwQI7S.js`),[],import.meta.url))},{id:`mojo`,name:`Mojo`,import:(()=>s(()=>import(`./mojo-BgCJLMeH.js`),[],import.meta.url))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>s(()=>import(`./moonbit-CaWjb8XO.js`),[],import.meta.url))},{id:`move`,name:`Move`,import:(()=>s(()=>import(`./move-B1IS1UjX.js`),[],import.meta.url))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>s(()=>import(`./narrat-_X_XdTYD.js`),[],import.meta.url))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>s(()=>import(`./nextflow-BJtWHP5T.js`),[],import.meta.url))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>s(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[],import.meta.url))},{id:`nginx`,name:`Nginx`,import:(()=>s(()=>import(`./nginx-SzmDaWuK.js`),[],import.meta.url))},{id:`nim`,name:`Nim`,import:(()=>s(()=>import(`./nim-CO_A6I25.js`),[],import.meta.url))},{id:`nix`,name:`Nix`,import:(()=>s(()=>import(`./nix-IvuFDN5E.js`),[],import.meta.url))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>s(()=>import(`./nushell-DcLAeLz5.js`),[],import.meta.url))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>s(()=>import(`./objective-c-D1A_Heim.js`),[],import.meta.url))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>s(()=>import(`./objective-cpp-BsSzOQcm.js`),[],import.meta.url))},{id:`ocaml`,name:`OCaml`,import:(()=>s(()=>import(`./ocaml-O90oeIOV.js`),[],import.meta.url))},{id:`odin`,name:`Odin`,import:(()=>s(()=>import(`./odin-B1RWQWA5.js`),[],import.meta.url))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>s(()=>import(`./openscad-BUDT5pXO.js`),[],import.meta.url))},{id:`pascal`,name:`Pascal`,import:(()=>s(()=>import(`./pascal-4ZHwLPI5.js`),[],import.meta.url))},{id:`perl`,name:`Perl`,import:(()=>s(()=>import(`./perl-DXgLsVg8.js`),[],import.meta.url))},{id:`php`,name:`PHP`,import:(()=>s(()=>import(`./php-C4KCWpl8.js`),[],import.meta.url))},{id:`pkl`,name:`Pkl`,import:(()=>s(()=>import(`./pkl-ot-7Btpt.js`),[],import.meta.url))},{id:`plsql`,name:`PL/SQL`,import:(()=>s(()=>import(`./plsql-DGHpHOYJ.js`),[],import.meta.url))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>s(()=>import(`./po-BiJDBrnU.js`),[],import.meta.url))},{id:`polar`,name:`Polar`,import:(()=>s(()=>import(`./polar-C7UOKdEL.js`),[],import.meta.url))},{id:`postcss`,name:`PostCSS`,import:(()=>s(()=>import(`./postcss-BXeXVLqQ.js`),[],import.meta.url))},{id:`powerquery`,name:`PowerQuery`,import:(()=>s(()=>import(`./powerquery-DNMTfnFr.js`),[],import.meta.url))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>s(()=>import(`./powershell-DshXNtvi.js`),[],import.meta.url))},{id:`prisma`,name:`Prisma`,import:(()=>s(()=>import(`./prisma-BsRQq5mF.js`),[],import.meta.url))},{id:`prolog`,name:`Prolog`,import:(()=>s(()=>import(`./prolog-iXnhIJG7.js`),[],import.meta.url))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>s(()=>import(`./proto-DB4EqR-F.js`),[],import.meta.url))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>s(()=>import(`./pug-bpEG1CVZ.js`),[],import.meta.url))},{id:`puppet`,name:`Puppet`,import:(()=>s(()=>import(`./puppet-CDv2pdJW.js`),[],import.meta.url))},{id:`purescript`,name:`PureScript`,import:(()=>s(()=>import(`./purescript-9MfHhQsQ.js`),[],import.meta.url))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>s(()=>import(`./python-gzcpVVnB.js`),[],import.meta.url))},{id:`qml`,name:`QML`,import:(()=>s(()=>import(`./qml-DGJzHzg9.js`),[],import.meta.url))},{id:`qmldir`,name:`QML Directory`,import:(()=>s(()=>import(`./qmldir-DCQb3MpD.js`),[],import.meta.url))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>s(()=>import(`./qss-Fe1Jh2GI.js`),[],import.meta.url))},{id:`r`,name:`R`,import:(()=>s(()=>import(`./r-CZt9UGEb.js`).then(e=>e.n),[],import.meta.url))},{id:`racket`,name:`Racket`,import:(()=>s(()=>import(`./racket-DcIDlBhZ.js`),[],import.meta.url))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>s(()=>import(`./raku-B3gFvitq.js`),[],import.meta.url))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>s(()=>import(`./razor-mTLK-dma.js`),[],import.meta.url))},{id:`reg`,name:`Windows Registry Script`,import:(()=>s(()=>import(`./reg-CRGYupPL.js`),[],import.meta.url))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>s(()=>import(`./regexp-DX5QhPdx.js`).then(e=>e.n),[],import.meta.url))},{id:`rel`,name:`Rel`,import:(()=>s(()=>import(`./rel-BtDbiS_P.js`),[],import.meta.url))},{id:`riscv`,name:`RISC-V`,import:(()=>s(()=>import(`./riscv-Ckw8ddFX.js`),[],import.meta.url))},{id:`ron`,name:`RON`,import:(()=>s(()=>import(`./ron-VUp2lXgN.js`),[],import.meta.url))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>s(()=>import(`./rosmsg-CAekHB0j.js`),[],import.meta.url))},{id:`rst`,name:`reStructuredText`,import:(()=>s(()=>import(`./rst-t-F-oATV.js`),[],import.meta.url))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>s(()=>import(`./ruby-D9DDGNv3.js`),[],import.meta.url))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>s(()=>import(`./rust-Cfkwpbl8.js`),[],import.meta.url))},{id:`sas`,name:`SAS`,import:(()=>s(()=>import(`./sas-BAEs8TsV.js`),[],import.meta.url))},{id:`sass`,name:`Sass`,import:(()=>s(()=>import(`./sass-DXrisJhu.js`),[],import.meta.url))},{id:`scala`,name:`Scala`,import:(()=>s(()=>import(`./scala-DKOlJaKm.js`),[],import.meta.url))},{id:`scheme`,name:`Scheme`,import:(()=>s(()=>import(`./scheme-DQCgrYNe.js`),[],import.meta.url))},{id:`scss`,name:`SCSS`,import:(()=>s(()=>import(`./scss-B6B5DSWC.js`).then(e=>e.n),[],import.meta.url))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>s(()=>import(`./sdbl-bTVj8UrX.js`),[],import.meta.url))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>s(()=>import(`./shaderlab-TOUzSsQk.js`),[],import.meta.url))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>s(()=>import(`./shellscript-DXt7nqYk.js`).then(e=>e.n),[],import.meta.url))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>s(()=>import(`./shellsession-DQ4guRhR.js`),[],import.meta.url))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>s(()=>import(`./smalltalk-B16xEiuN.js`),[],import.meta.url))},{id:`solidity`,name:`Solidity`,import:(()=>s(()=>import(`./solidity-CKzVLygQ.js`),[],import.meta.url))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>s(()=>import(`./soy-DtwGS8Y2.js`),[],import.meta.url))},{id:`sparql`,name:`SPARQL`,import:(()=>s(()=>import(`./sparql-D_iOobhT.js`),[],import.meta.url))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>s(()=>import(`./splunk-BC2Px7Mm.js`),[],import.meta.url))},{id:`sql`,name:`SQL`,import:(()=>s(()=>import(`./sql-ArzG0FT1.js`).then(e=>e.n),[],import.meta.url))},{id:`ssh-config`,name:`SSH Config`,import:(()=>s(()=>import(`./ssh-config-BgfXC-Er.js`),[],import.meta.url))},{id:`stata`,name:`Stata`,import:(()=>s(()=>import(`./stata-CdQ318yb.js`),[],import.meta.url))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>s(()=>import(`./stylus-B6D30XZt.js`),[],import.meta.url))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>s(()=>import(`./surrealql-RyXJ8VfM.js`),[],import.meta.url))},{id:`svelte`,name:`Svelte`,import:(()=>s(()=>import(`./svelte-CXkGIk7i.js`),[],import.meta.url))},{id:`swift`,name:`Swift`,import:(()=>s(()=>import(`./swift-DonLKvLd.js`),[],import.meta.url))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>s(()=>import(`./system-verilog-DJ5XKQeo.js`),[],import.meta.url))},{id:`systemd`,name:`Systemd Units`,import:(()=>s(()=>import(`./systemd-BxMlprV5.js`),[],import.meta.url))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>s(()=>import(`./talonscript-CohzipZa.js`),[],import.meta.url))},{id:`tasl`,name:`Tasl`,import:(()=>s(()=>import(`./tasl-DMoTqEGO.js`),[],import.meta.url))},{id:`tcl`,name:`Tcl`,import:(()=>s(()=>import(`./tcl-CZd0xW_V.js`),[],import.meta.url))},{id:`templ`,name:`Templ`,import:(()=>s(()=>import(`./templ-CJz86NIj.js`),[],import.meta.url))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>s(()=>import(`./terraform-DswuEJGm.js`),[],import.meta.url))},{id:`tex`,name:`TeX`,import:(()=>s(()=>import(`./tex-C71esTKh.js`),[],import.meta.url))},{id:`toml`,name:`TOML`,import:(()=>s(()=>import(`./toml-CcmNWLt0.js`),[],import.meta.url))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>s(()=>import(`./ts-tags-Qszjvpax.js`),[],import.meta.url))},{id:`tsv`,name:`TSV`,import:(()=>s(()=>import(`./tsv-sltzmVWM.js`),[],import.meta.url))},{id:`tsx`,name:`TSX`,import:(()=>s(()=>import(`./tsx-BEhriTf8.js`).then(e=>e.n),[],import.meta.url))},{id:`turtle`,name:`Turtle`,import:(()=>s(()=>import(`./turtle-ByJddavk.js`),[],import.meta.url))},{id:`twig`,name:`Twig`,import:(()=>s(()=>import(`./twig-CbaWuFm3.js`),[],import.meta.url))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>s(()=>import(`./typescript-CBu4i5lG.js`).then(e=>e.n),[],import.meta.url))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>s(()=>import(`./typespec-BRdr0IET.js`),[],import.meta.url))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>s(()=>import(`./typst-DI99ib-x.js`),[],import.meta.url))},{id:`v`,name:`V`,import:(()=>s(()=>import(`./v-DETTlOr0.js`),[],import.meta.url))},{id:`vala`,name:`Vala`,import:(()=>s(()=>import(`./vala-zf12oZj6.js`),[],import.meta.url))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>s(()=>import(`./vb-Djn5o6TS.js`),[],import.meta.url))},{id:`verilog`,name:`Verilog`,import:(()=>s(()=>import(`./verilog-CiiDBU1e.js`),[],import.meta.url))},{id:`vhdl`,name:`VHDL`,import:(()=>s(()=>import(`./vhdl-BroJfC0k.js`),[],import.meta.url))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>s(()=>import(`./viml-DvXPmvsu.js`),[],import.meta.url))},{id:`vue`,name:`Vue`,import:(()=>s(()=>import(`./vue-Bruwzb-A.js`),[],import.meta.url))},{id:`vue-html`,name:`Vue HTML`,import:(()=>s(()=>import(`./vue-html-C-3Ma2tD.js`),[],import.meta.url))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>s(()=>import(`./vue-vine-DQAt9DTg.js`),[],import.meta.url))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>s(()=>import(`./vyper-CgoNMtux.js`),[],import.meta.url))},{id:`wasm`,name:`WebAssembly`,import:(()=>s(()=>import(`./wasm-ByWQv1Qj.js`),[],import.meta.url))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>s(()=>import(`./wenyan-C8pVoKbM.js`),[],import.meta.url))},{id:`wgsl`,name:`WGSL`,import:(()=>s(()=>import(`./wgsl-BsKzXJz4.js`),[],import.meta.url))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>s(()=>import(`./wikitext-ClFFjSW2.js`),[],import.meta.url))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>s(()=>import(`./wit-DdvCle-K.js`),[],import.meta.url))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>s(()=>import(`./wolfram-DLL8P-h_.js`),[],import.meta.url))},{id:`xml`,name:`XML`,import:(()=>s(()=>import(`./xml-BS2GSQw_.js`).then(e=>e.n),[],import.meta.url))},{id:`xsl`,name:`XSL`,import:(()=>s(()=>import(`./xsl-CCmfIdf4.js`),[],import.meta.url))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>s(()=>import(`./yaml-C1LY7x4K.js`).then(e=>e.n),[],import.meta.url))},{id:`zenscript`,name:`ZenScript`,import:(()=>s(()=>import(`./zenscript-BnlCZFoB.js`),[],import.meta.url))},{id:`zig`,name:`Zig`,import:(()=>s(()=>import(`./zig-CMLA9XwU.js`),[],import.meta.url))}],Np=Object.fromEntries(Mp.map(e=>[e.id,e.import])),Pp=Object.fromEntries(Mp.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Fp={...Np,...Pp},Ip=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>s(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>s(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>s(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>s(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>s(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>s(()=>import(`./catppuccin-frappe-3VR1Za6u.js`),[],import.meta.url))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>s(()=>import(`./catppuccin-latte-DwIHMF0Q.js`),[],import.meta.url))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>s(()=>import(`./catppuccin-macchiato-DYnBP6_5.js`),[],import.meta.url))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>s(()=>import(`./catppuccin-mocha-DYhrFGRu.js`),[],import.meta.url))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>s(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>s(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>s(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>s(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>s(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>s(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>s(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>s(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>s(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>s(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>s(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>s(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>s(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>s(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>s(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>s(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>s(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>s(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>s(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>s(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>s(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>s(()=>import(`./kanagawa-dragon-CXtmUGW6.js`),[],import.meta.url))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>s(()=>import(`./kanagawa-lotus-BN08jTvb.js`),[],import.meta.url))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>s(()=>import(`./kanagawa-wave-CTweb8Dz.js`),[],import.meta.url))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>s(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>s(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>s(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>s(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>s(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>s(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>s(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>s(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>s(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>s(()=>import(`./monokai-CdkpiU2Y.js`),[],import.meta.url))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>s(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>s(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>s(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>s(()=>import(`./one-dark-pro-CLwyXe_n.js`),[],import.meta.url))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>s(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>s(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>s(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>s(()=>import(`./red-CJ3rzSJv.js`),[],import.meta.url))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>s(()=>import(`./rose-pine-BthvhNj6.js`),[],import.meta.url))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>s(()=>import(`./rose-pine-dawn-Dg85fqjY.js`),[],import.meta.url))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>s(()=>import(`./rose-pine-moon-hon4tzzS.js`),[],import.meta.url))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>s(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>s(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>s(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>s(()=>import(`./solarized-dark-DV17i1UV.js`),[],import.meta.url))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>s(()=>import(`./solarized-light-DSh2HLQt.js`),[],import.meta.url))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>s(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>s(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>s(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>s(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>s(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>s(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url))}].map(e=>[e.id,e.import])),Lp=r({createOnigurumaEngine:()=>lm,getDefaultWasmLoader:()=>cm,loadWasm:()=>nm,setDefaultWasmLoader:()=>sm}),Rp=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function zp(){return 2147483648}function Bp(){return typeof performance<`u`?performance.now():Date.now()}var Vp=(e,t)=>e+(t-e%t)%t;async function Hp(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=zp();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,Vp(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Bp,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var Up=Object.defineProperty,Wp=(e,t,n)=>t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>Wp(e,typeof t==`symbol`?t:t+``,n),W=null;function Gp(e){throw new Rp(e.UTF8ToString(e.getLastOnigError()))}var Kp=class e{constructor(t){U(this,`utf16Length`),U(this,`utf8Length`),U(this,`utf16Value`),U(this,`utf8Value`),U(this,`utf16OffsetToUtf8`),U(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},qp=class e{constructor(t){if(U(this,`id`,++e.LAST_ID),U(this,`_onigBinding`),U(this,`content`),U(this,`utf16Length`),U(this,`utf8Length`),U(this,`utf16OffsetToUtf8`),U(this,`utf8OffsetToUtf16`),U(this,`ptr`),!W)throw new Rp(`Must invoke loadWasm first.`);this._onigBinding=W,this.content=t;let n=new Kp(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=W.omalloc(1e4),e._sharedPtrInUse=!0,W.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(W)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};U(qp,`LAST_ID`,0),U(qp,`_sharedPtr`,0),U(qp,`_sharedPtrInUse`,!1);var Jp=qp,Yp=class{constructor(e){if(U(this,`_onigBinding`),U(this,`_ptr`),!W)throw new Rp(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Kp(e[r]);t[r]=i.createString(W),n[r]=i.utf8Length}let r=W.omalloc(4*e.length);W.HEAPU32.set(t,r/4);let i=W.omalloc(4*e.length);W.HEAPU32.set(n,i/4);let a=W.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)W.ofree(t[n]);W.ofree(i),W.ofree(r),a===0&&Gp(W),this._onigBinding=W,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Jp(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Xp(e){return typeof e.instantiator==`function`}function Zp(e){return typeof e.default==`function`}function Qp(e){return e.data!==void 0}function $p(e){return typeof Response<`u`&&e instanceof Response}function em(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var tm;function nm(e){if(tm)return tm;async function t(){W=await Hp(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Xp(n)?n=await n.instantiator(t):Zp(n)?n=await n.default(t):(Qp(n)&&(n=n.data),$p(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await im(n)(t):await am(n)(t):em(n)||n instanceof WebAssembly.Module?n=await rm(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await rm(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return tm=t(),tm}function rm(e){return t=>WebAssembly.instantiate(e,t)}function im(e){return t=>WebAssembly.instantiateStreaming(e,t)}function am(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var om;function sm(e){om=e}function cm(){return om}async function lm(e){return e&&await nm(e),{createScanner(e){return new Yp(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Jp(e)}}}var um=kp({});jp(um,Lp);var G=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function dm(e){return fm(e)}function fm(e){return Array.isArray(e)?pm(e):e instanceof RegExp?e:typeof e==`object`?mm(e):e}function pm(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=fm(e[n]);return t}function mm(e){let t={};for(let n in e)t[n]=fm(e[n]);return t}function hm(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function gm(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?gm(e.substring(0,e.length-1)):e.substr(~t+1)}var _m=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,vm=class{static hasCaptures(e){return e===null?!1:(_m.lastIndex=0,_m.test(e))}static replaceCaptures(e,t,n){return e.replace(_m,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function ym(e,t){return e<t?-1:+(e>t)}function bm(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=ym(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function xm(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Sm(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Cm=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},wm=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(km(e),t)}static createFromParsedTheme(e,t){return Mm(e,t)}_cachedMatchRoot=new Cm(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Em(e.parent,t.parentScopes));return n?new Om(n.fontStyle,n.foreground,n.background):null}},Tm=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Em(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Dm(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Dm(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Om=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function km(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&xm(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&xm(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Am(l,u,e,o,s,c)}}return n}var Am=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},jm=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(jm||{});function Mm(e,t){e.sort((e,t)=>{let n=ym(e.scope,t.scope);return n!==0||(n=bm(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Nm(t),o=new Om(n,a.getId(r),a.getId(i)),s=new Im(new Fm(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new wm(a,o,s)}var Nm=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Pm=Object.freeze([]),Fm=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Pm,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Im=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),Fm.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(bm(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Fm(e,t,n,r,i))}},Lm=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=zm(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Rm(e){return e}function zm(e){return e}function Bm(e,t){let n=[],r=Hm(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(Vm(i)){let e=[];do e.push(i),i=r.next();while(Vm(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function Vm(e){return!!e&&!!e.match(/[\w\.:]+/)}function Hm(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function Um(e){typeof e.dispose==`function`&&e.dispose()}var Wm=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Gm=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Km=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},qm=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Wm(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Km;for(let n of e)Jm(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Wm){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Jm(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof Wm?Xm({baseGrammar:a,selfGrammar:i},r):Ym(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new Wm(e))}function Ym(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Zm([r],t,n)}}function Xm(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Zm(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Zm(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Zm(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?hm({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Zm(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=rh(i);switch(a.kind){case 0:Xm({...t,selfGrammar:t.baseGrammar},n);break;case 1:Xm(t,n);break;case 2:Ym(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?Ym(a.ruleName,i,n):Xm(i,n)}else a.kind===4?n.add(new Gm(a.scopeName,a.ruleName)):n.add(new Wm(a.scopeName));break}}}var Qm=class{kind=0},$m=class{kind=1},eh=class{constructor(e){this.ruleName=e}kind=2},th=class{constructor(e){this.scopeName=e}kind=3},nh=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function rh(e){if(e===`$base`)return new Qm;if(e===`$self`)return new $m;let t=e.indexOf(`#`);return t===-1?new th(e):t===0?new eh(e.substring(1)):new nh(e.substring(0,t),e.substring(t+1))}var ih=/\\(\d+)/,ah=/\\(\d+)/g,oh=-1,sh=-2;function ch(e){return e}function lh(e){return e}var uh=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=vm.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=vm.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${gm(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:vm.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:vm.replaceCaptures(this._contentName,e,t)}},dh=class extends uh{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},fh=class extends uh{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new _h(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new vh,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ph=class extends uh{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new vh,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},mh=class extends uh{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new _h(i,this.id),this.beginCaptures=a,this._end=new _h(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new vh;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},hh=class extends uh{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new _h(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new _h(o,sh),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new vh;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new vh,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},gh=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new dh(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new fh(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=hm({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new ph(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new hh(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new mh(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=rh(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof ph||e instanceof mh||e instanceof hh)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},_h=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=ih.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return ah.lastIndex=0,this.source.replace(ah,(e,t)=>Sm(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},vh=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new yh(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new yh(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},yh=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
118
118
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},bh=class{constructor(e,t){this.languageId=e,this.tokenType=t}},xh=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new bh(e,8),this._embeddedLanguagesMatcher=new Sh(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new bh(0,0);_getBasicScopeAttributes=new Cm(e=>new bh(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Sh=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Sm(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ch=!1,wh=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Th(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Eh(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new wh(i,!0);f()}return new wh(i,!1);function f(){let o=Dh(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===oh){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Nh(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof mh){let r=o;Nh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof hh){let r=o;Nh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Nh(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Eh(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof hh&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=jh(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==sh){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Nh(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Dh(e,t,n,r,i,a){let o=Oh(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=kh(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Oh(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Ah(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function kh(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Ah(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Ah(e,t,n,r,i){return Ch?{ruleScanner:e.compile(t,n),findOptions:Mh(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function jh(e,t,n,r,i){return Ch?{ruleScanner:e.compileWhile(t,n),findOptions:Mh(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Mh(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Nh(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Th(e,p,n&&d.start===0,d.start,f,i,!1,0),Um(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Ph(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Ph=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Fh(e,t,n,r,i,a,o,s){return new zh(e,t,n,r,i,a,o,s)}function Ih(e,t,n,r,i){let a=Bm(t,Lh),o=gh.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Lh(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Rh(t[r],e))return n=r+1,!0;return!1})}function Rh(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var zh=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new xh(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Bh(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Bm(e,Lh);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Ih(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Ih(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(ch(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[lh(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Bh(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=gh.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Hh.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Lm.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Vh.createRootAndLookUpScopeName(a,r,this):Vh.createRoot(`unknown`,r),t=new Hh(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
119
119
|
`;let a=this.createOnigString(e),o=a.content.length,s=new Wh(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Th(this,a,i,0,t,s,!0,r);return Um(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Bh(e,t){return e=dm(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Vh=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Tm.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Tm(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Tm(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Lm.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Hh=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Vh.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:lh(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Vh.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ch(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Vh.fromExtension(r,n.contentNameScopesList))}},Uh=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Bm(e,Lh).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Bm(e,Lh).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Wh=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Lm.set(n,0,Rm(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Lm.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Gh=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,Fh(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},Kh=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Gh(wm.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(wm.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Uh(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new qm(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},qh=Hh.NULL;function Jh(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function Yh(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Xh(e){return Array.isArray(e)?e:[e]}async function Zh(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Qh(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function $h(e){return e===`ansi`||Qh(e)}function eg(e){return e===`none`}function tg(e){return eg(e)}var ng=/(\r?\n)/g;function rg(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(ng),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var ig={light:`#333333`,dark:`#bbbbbb`},ag={light:`#fffffe`,dark:`#1e1e1e`},og=`__shiki_resolved`;function sg(e){if(e?.[og])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?ig.light:ig.dark,n||=t.type===`light`?ag.light:ag.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,og,{enumerable:!1,writable:!1,value:!0}),t}async function cg(e){return[...new Set((await Promise.all(e.filter(e=>!$h(e)).map(async e=>await Zh(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function lg(e){return(await Promise.all(e.map(async e=>tg(e)?null:sg(await Zh(e))))).filter(e=>!!e)}function ug(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new G(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var dg=class extends Kh{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=sg(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=wm.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=ug(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new G(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},fg=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},pg=0;function mg(e){pg+=1,e.warnings!==!1&&pg>=10&&pg%10==0&&console.warn(`[Shiki] ${pg} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new G("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(sg),i=new dg(new fg(e.engine,n),r,n,e.langAlias),a;function o(t){return ug(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new G(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new G(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await cg(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await lg(e))}function g(){if(t)throw new G(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--pg)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function hg(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([lg(e.themes||[]),cg(e.langs||[]),e.engine]);return mg({...e,themes:t,langs:n,engine:r})}var gg=new WeakMap;function _g(e,t){gg.set(e,t)}function vg(e){return gg.get(e)}var yg=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(Xh(n).map(e=>[e,qh])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return bg(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function bg(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function xg(e,t){if(!(e instanceof yg))throw new G(`Invalid grammar state`);return e.getInternalStack(t)}var Sg=/,/,Cg=/ /;function wg(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Qh(e.resolveLangAlias(n.lang||`text`))||eg(r))return rg(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new G(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new G(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Eg(t,o,i,a,n)}function Tg(...e){if(e.length===2)return vg(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Qh(i)||eg(a))throw new G(`Plain language does not have grammar state`);if(i===`ansi`)throw new G(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new yg(Dg(n,c,o,s,r).stateStack,c.name,o.name)}function Eg(e,t,n,r,i){let a=Dg(e,t,n,r,i),o=new yg(a.stateStack,t.name,n.name);return _g(a.tokens,o),a.tokens}function Dg(e,t,n,r,i){let a=Jh(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=rg(e),l=i.grammarState?xg(i.grammarState,n.name)??qh:i.grammarContextCode==null?qh:Dg(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=Yh(r[Lm.getForeground(s)],a),l=Lm.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Sg).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Cg))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?Og(t.scopes):kg(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function Og(e){return e.map(e=>({scopeName:e}))}function kg(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Mg(e,i,t.slice(0,r))}}return n}function Ag(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function jg(e,t,n){if(!Ag(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Ag(e[r],n[i])&&--r,--i;return r===-1}function Mg(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(jg(e,t,n)){r.push(a);break}return r}function Ng(e,t,n,r=wg){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:vg(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Pg(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new yg(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&_g(s,c),s}function Pg(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var Fg=/\s+/g;function Ig(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(Fg)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(Fg);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var Lg=/:?lang=["']([^"']+)["']/g,Rg=/(?:```|~~~)([\w-]+)/g,zg=/\\begin\{([\w-]+)\}/g,Bg=/<script\s+(?:type|lang)=["']([^"']+)["']/gi;function Vg(e){let t=rg(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function Hg(e,t,n){let r=new Set;for(let t of e.matchAll(Lg)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Rg)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(zg)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(Bg)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var Ug=[`color`,`background-color`];function Wg(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Gg(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?Wg(e,t):e})):e}function Kg(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>qg(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&Ug.includes(a))if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new G('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function qg(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&jm.Italic&&(t[`font-style`]=`italic`),e.fontStyle&jm.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&jm.Underline&&n.push(`underline`),e.fontStyle&jm.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Jg(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function Yg(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=Vg(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new G(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}else{let t=n.lines[e.line];if(t===void 0)throw new G(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new G(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));Xg(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return Gg(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new G(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=Zg(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new G(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new G(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Ig(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function Xg(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new G(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new G(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function Zg(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(Zg).join(``):``}var Qg=[Yg()];function $g(e){let t=e_(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Qg]}function e_(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var t_=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],n_={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function r_(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function i_(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function a_(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)n_[r]&&t.push({type:`setDecoration`,value:n_[r]});else if(r<=29){let e=n_[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:t_[r-30]}});else if(r===38){let n=i_(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:t_[r-40]}});else if(r===48){let n=i_(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:t_[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:t_[r-100+8]}})}return t}function o_(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=r_(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=a_(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var s_={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function c_(e=s_){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<t_.length;e++)r.push(t(t_[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var l_=/#([0-9a-f]{3,8})/i,u_=/var\((--[\w-]+-ansi-[\w-]+)\)/,d_={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function f_(e,t,n){let r=Jh(e,n),i=rg(t),a=c_(Object.fromEntries(t_.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||d_[t]]}))),o=o_();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=Yh(i,r),o=Yh(o,r),n.decorations.has(`dim`)&&(i=p_(i));let s=jm.None;return n.decorations.has(`bold`)&&(s|=jm.Bold),n.decorations.has(`italic`)&&(s|=jm.Italic),n.decorations.has(`underline`)&&(s|=jm.Underline),n.decorations.has(`strikethrough`)&&(s|=jm.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function p_(e){let t=e.match(l_);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}else if(e.length===6)return`#${e}80`;else if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}else if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(u_);return n?`var(${n[1]}-dim)`:e}function m_(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Qh(r)&&!eg(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return f_(r,t,n)}return wg(e,t,n)}function h_(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new G("`themes` option must not be empty");let p=Ng(e,t,n,m_);if(c=vg(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new G(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>Kg(e,h,u,l,d))),c&&_g(a,c);let g=f.map(e=>Jh(e.theme,n));i=g_(f,m,g,u,l,`fg`,d),r=g_(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=Jh(n.theme,n);a=m_(e,t,n);let l=e.getTheme(n.theme);r=Yh(l.bg,s),i=Yh(l.fg,s),o=l.name,c=vg(a)}else throw new G("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function g_(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Yh(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new G('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Yh(t[r][a],n[r])||`inherit`}, ${Yh(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var __=/^\s+$/,v_=/^(\s*)(.*?)(\s*)$/;function y_(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>y_(e,t,n),codeToTokens:(t,n)=>h_(e,t,n)}){let i=t;for(let e of $g(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=h_(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=x_(a):d===`never`&&(a=S_(a)),f&&(a=C_(a));let p={...r,get source(){return i}};for(let e of $g(n))a=e.tokens?.call(p,a)||a;return b_(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function b_(e,t,n,r=vg(e)){let i=$g(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(t.rootStyle==null?l.style=`background-color:${t.bg};color:${t.fg}`:l.style=t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Ig,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
120
|
-
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Jg(a.htmlStyle||qg(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&_g(m,r),m}function x_(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&jm.Underline||i.fontStyle&jm.Strikethrough));o&&__.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function S_(e){return e.map(e=>e.flatMap(e=>{if(__.test(e.content))return e;let t=e.content.match(v_);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function C_(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Jg(e.htmlStyle||qg(e)),i=Jg(n.htmlStyle||qg(n)),a=e.fontStyle&&(e.fontStyle&jm.Underline||e.fontStyle&jm.Strikethrough),o=n.fontStyle&&(n.fontStyle&jm.Underline||n.fontStyle&jm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var w_=Yt;function T_(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>y_(e,t,n),codeToTokens:(t,n)=>h_(e,t,n)},i=w_(y_(e,t,n,r));for(let e of $g(n))i=e.postprocess?.call(r,i,n)||i;return i}async function E_(e){let t=await hg(e);return{getLastGrammarState:(...e)=>Tg(t,...e),codeToTokensBase:(e,n)=>m_(t,e,n),codeToTokensWithThemes:(e,n)=>Ng(t,e,n),codeToTokens:(e,n)=>h_(t,e,n),codeToHast:(e,n)=>y_(t,e,n),codeToHtml:(e,n)=>T_(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function D_(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,$h(n))return[];let r=t[n];if(!r)throw new G(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(tg(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new G(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await E_({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function O_(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function k_(e,t){let n=O_(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var{codeToHtml:A_,codeToHast:j_,codeToTokens:M_,codeToTokensBase:N_,codeToTokensWithThemes:P_,getSingletonHighlighter:F_,getLastGrammarState:I_}=k_(D_({langs:Fp,themes:Ip,engine:()=>(0,um.createOnigurumaEngine)(s(()=>import(`./wasm-BnjxR4X6.js`),[],import.meta.url))}),{guessEmbeddedLanguages:Hg}),L_=(0,I.createContext)({code:``}),R_={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function z_(e,t,n=!1){let r=n?[R_]:[];return await Promise.all([A_(e,{lang:t,theme:`one-light`,transformers:r}),A_(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}var B_=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),u=(0,I.useRef)(!1);return(0,I.useEffect)(()=>(z_(e,t,n).then(([e,t])=>{u.current||=(s(e),l(t),!0)}),()=>{u.current=!1}),[e,t,n]),(0,R.jsx)(L_.Provider,{value:{code:e},children:(0,R.jsx)(`div`,{className:A(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,R.jsx)(`div`,{className:`hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:c}}),i&&(0,R.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},V_=({className:e,...t})=>(0,R.jsx)(Ne,{className:A(`not-prose mb-4 w-full rounded-md border`,e),...t}),H_=e=>(0,R.jsxs)(Le,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,R.jsx)(ze,{className:`size-4`}),"input-available":(0,R.jsx)(Qe,{className:`size-4 animate-pulse`}),"approval-requested":(0,R.jsx)(Qe,{className:`size-4 text-yellow-600`}),"approval-responded":(0,R.jsx)(nt,{className:`size-4 text-blue-600`}),"output-available":(0,R.jsx)(nt,{className:`size-4 text-green-600`}),"output-error":(0,R.jsx)(At,{className:`size-4 text-red-600`}),"output-denied":(0,R.jsx)(At,{className:`size-4 text-orange-600`})}[e],{"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`}[e]]}),U_=({className:e,title:t,type:n,state:r,...i})=>(0,R.jsxs)(Pe,{className:A(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(rt,{className:`size-4 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),H_(r)]}),(0,R.jsx)(Ee,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),W_=({className:e,...t})=>(0,R.jsx)(Ae,{className:A(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),G_=({className:e,input:t,...n})=>(0,R.jsxs)(`div`,{className:A(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,R.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,R.jsx)(B_,{code:JSON.stringify(t,null,2),language:`json`})})]}),K_=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,R.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,I.isValidElement)(t)?i=(0,R.jsx)(B_,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,R.jsx)(B_,{code:t,language:`json`})),(0,R.jsxs)(`div`,{className:A(`space-y-2 p-4`,e),...r,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,R.jsxs)(`div`,{className:A(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,R.jsx)(`div`,{children:n}),i]})]})},q_=(0,I.createContext)({});function J_(e){let t=(0,I.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Y_=typeof window<`u`?I.useLayoutEffect:I.useEffect,X_=(0,I.createContext)(null);function Z_(e,t){e.indexOf(t)===-1&&e.push(t)}function Q_(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var $_=(e,t,n)=>n>t?t:n<e?e:n,ev={},tv=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),nv=e=>typeof e==`object`&&!!e,rv=e=>/^0[^.\s]+$/u.test(e);function iv(e){let t;return()=>(t===void 0&&(t=e()),t)}var av=e=>e,ov=(...e)=>e.reduce((e,t)=>n=>t(e(n))),sv=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},cv=class{constructor(){this.subscriptions=[]}add(e){return Z_(this.subscriptions,e),()=>Q_(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},lv=e=>e*1e3,uv=e=>e/1e3,dv=(e,t)=>t?1e3/t*e:0,fv=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,pv=1e-7,mv=12;function hv(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=fv(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>pv&&++s<mv);return o}function gv(e,t,n,r){if(e===t&&n===r)return av;let i=t=>hv(t,0,1,e,n);return e=>e===0||e===1?e:fv(i(e),t,r)}var _v=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vv=e=>t=>1-e(1-t),yv=gv(.33,1.53,.69,.99),bv=vv(yv),xv=_v(bv),Sv=e=>e>=1?1:(e*=2)<1?.5*bv(e):.5*(2-2**(-10*(e-1))),Cv=e=>1-Math.sin(Math.acos(e)),wv=vv(Cv),Tv=_v(Cv),Ev=gv(.42,0,1,1),Dv=gv(0,0,.58,1),Ov=gv(.42,0,.58,1),kv=e=>Array.isArray(e)&&typeof e[0]!=`number`,Av=e=>Array.isArray(e)&&typeof e[0]==`number`,jv={linear:av,easeIn:Ev,easeInOut:Ov,easeOut:Dv,circIn:Cv,circInOut:Tv,circOut:wv,backIn:bv,backInOut:xv,backOut:yv,anticipate:Sv},Mv=e=>typeof e==`string`,Nv=e=>{if(Av(e)){e.length;let[t,n,r,i]=e;return gv(t,n,r,i)}else if(Mv(e))return jv[e],`${e}`,jv[e];return e},Pv=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Fv={value:null,addProjectionMetrics:null};function Iv(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Fv.value&&Fv.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Lv=40;function Rv(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Pv.reduce((e,n)=>(e[n]=Iv(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=ev.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Lv),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Pv.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Pv.length;t++)o[Pv[t]].cancel(e)},state:i,steps:o}}var{schedule:K,cancel:zv,state:q,steps:Bv}=Rv(typeof requestAnimationFrame<`u`?requestAnimationFrame:av,!0),Vv;function Hv(){Vv=void 0}var Uv={now:()=>(Vv===void 0&&Uv.set(q.isProcessing||ev.useManualTiming?q.timestamp:performance.now()),Vv),set:e=>{Vv=e,queueMicrotask(Hv)}},Wv={layout:0,mainThread:0,waapi:0},Gv=e=>t=>typeof t==`string`&&t.startsWith(e),Kv=Gv(`--`),qv=Gv(`var(--`),Jv=e=>qv(e)?Yv.test(e.split(`/*`)[0].trim()):!1,Yv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Xv(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Zv={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Qv={...Zv,transform:e=>$_(0,1,e)},$v={...Zv,default:1},ey=e=>Math.round(e*1e5)/1e5,ty=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ny(e){return e==null}var ry=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,iy=(e,t)=>n=>!!(typeof n==`string`&&ry.test(n)&&n.startsWith(e)||t&&!ny(n)&&Object.prototype.hasOwnProperty.call(n,t)),ay=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ty);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},oy=e=>$_(0,255,e),sy={...Zv,transform:e=>Math.round(oy(e))},cy={test:iy(`rgb`,`red`),parse:ay(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+sy.transform(e)+`, `+sy.transform(t)+`, `+sy.transform(n)+`, `+ey(Qv.transform(r))+`)`};function ly(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var uy={test:iy(`#`),parse:ly,transform:cy.transform},dy=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fy=dy(`deg`),py=dy(`%`),J=dy(`px`),my=dy(`vh`),hy=dy(`vw`),gy={...py,parse:e=>py.parse(e)/100,transform:e=>py.transform(e*100)},_y={test:iy(`hsl`,`hue`),parse:ay(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+py.transform(ey(t))+`, `+py.transform(ey(n))+`, `+ey(Qv.transform(r))+`)`},Y={test:e=>cy.test(e)||uy.test(e)||_y.test(e),parse:e=>cy.test(e)?cy.parse(e):_y.test(e)?_y.parse(e):uy.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?cy.transform(e):_y.transform(e),getAnimatableNone:e=>{let t=Y.parse(e);return t.alpha=0,Y.transform(t)}},vy=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function yy(e){return isNaN(e)&&typeof e==`string`&&(e.match(ty)?.length||0)+(e.match(vy)?.length||0)>0}var by=`number`,xy=`color`,Sy=`var`,Cy=`var(`,wy="${}",Ty=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ey(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ty,e=>(Y.test(e)?(r.color.push(a),i.push(xy),n.push(Y.parse(e))):e.startsWith(Cy)?(r.var.push(a),i.push(Sy),n.push(e)):(r.number.push(a),i.push(by),n.push(parseFloat(e))),++a,wy)).split(wy),indexes:r,types:i}}function Dy(e){return Ey(e).values}function Oy({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===by?i+=ey(r[a]):e===xy?i+=Y.transform(r[a]):i+=r[a]}return i}}function ky(e){return Oy(Ey(e))}var Ay=e=>typeof e==`number`?0:Y.test(e)?Y.getAnimatableNone(e):e,jy=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Ay(e);function My(e){let t=Ey(e);return Oy(t)(t.values.map((e,n)=>jy(e,t.split[n])))}var Ny={test:yy,parse:Dy,createTransformer:ky,getAnimatableNone:My};function Py(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Fy({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Py(s,r,e+1/3),a=Py(s,r,e),o=Py(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Iy(e,t){return n=>n>0?t:e}var X=(e,t,n)=>e+(t-e)*n,Ly=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Ry=[uy,cy,_y],zy=e=>Ry.find(t=>t.test(e));function By(e){let t=zy(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===_y&&(n=Fy(n)),n}var Vy=(e,t)=>{let n=By(e),r=By(t);if(!n||!r)return Iy(e,t);let i={...n};return e=>(i.red=Ly(n.red,r.red,e),i.green=Ly(n.green,r.green,e),i.blue=Ly(n.blue,r.blue,e),i.alpha=X(n.alpha,r.alpha,e),cy.transform(i))},Hy=new Set([`none`,`hidden`]);function Uy(e,t){return Hy.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Wy(e,t){return n=>X(e,t,n)}function Gy(e){return typeof e==`number`?Wy:typeof e==`string`?Jv(e)?Iy:Y.test(e)?Vy:Yy:Array.isArray(e)?Ky:typeof e==`object`?Y.test(e)?Vy:qy:Iy}function Ky(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Gy(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function qy(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Gy(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Jy(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Yy=(e,t)=>{let n=Ny.createTransformer(t),r=Ey(e),i=Ey(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Hy.has(e)&&!i.values.length||Hy.has(t)&&!r.values.length?Uy(e,t):ov(Ky(Jy(r,i),i.values),n):(`${e}${t}`,Iy(e,t))};function Xy(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?X(e,t,n):Gy(e)(e,t)}var Zy=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>K.update(t,e),stop:()=>zv(t),now:()=>q.isProcessing?q.timestamp:Uv.now()}},Qy=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},$y=2e4;function eb(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function tb(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(eb(r),$y);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:uv(i)}}var Z={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function nb(e,t){return e*Math.sqrt(1-t*t)}var rb=12;function ib(e,t,n){let r=n;for(let n=1;n<rb;n++)r-=e(r)/t(r);return r}var ab=.001;function ob({duration:e=Z.duration,bounce:t=Z.bounce,velocity:n=Z.velocity,mass:r=Z.mass}){let i,a;Z.maxDuration;let o=1-t;o=$_(Z.minDamping,Z.maxDamping,o),e=$_(Z.minDuration,Z.maxDuration,uv(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=nb(t,o),c=Math.exp(-i);return ab-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=nb(t**2,o);return(-i(t)+ab>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=ib(i,a,s);if(e=lv(e),isNaN(c))return{stiffness:Z.stiffness,damping:Z.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var sb=[`duration`,`bounce`],cb=[`stiffness`,`damping`,`mass`];function lb(e,t){return t.some(t=>e[t]!==void 0)}function ub(e){let t={velocity:Z.velocity,stiffness:Z.stiffness,damping:Z.damping,mass:Z.mass,isResolvedFromDuration:!1,...e};if(!lb(e,cb)&&lb(e,sb))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*$_(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Z.mass,stiffness:i,damping:a}}else{let n=ob({...e,velocity:0});t={...t,...n,mass:Z.mass},t.isResolvedFromDuration=!0}return t}function db(e=Z.visualDuration,t=Z.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=ub({...n,velocity:-uv(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=uv(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Z.restSpeed.granular:Z.restSpeed.default,i||=v?Z.restDelta.granular:Z.restDelta.default;let y,b,x,S,C,w;if(h<1)x=nb(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>lv(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=lv(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=lv(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(eb(T),$y),t=Qy(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}db.applyToOptions=e=>{let t=tb(e,100,db);return e.ease=t.ease,e.duration=lv(t.duration),e.type=`keyframes`,e};var fb=5;function pb(e,t,n){let r=Math.max(t-fb,0);return dv(n-e(r),t-r)}function mb({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=db({keyframes:[f.value,m(f.value)],velocity:pb(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function hb(e,t,n){let r=[],i=n||ev.mix||Xy,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=ov(Array.isArray(t)?t[n]||av:t,a)),r.push(a)}return r}function gb(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=hb(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=sv(e[r],e[r+1],n);return s[r](i)};return n?t=>l($_(e[0],e[a-1],t)):l}function _b(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=sv(0,t,r);e.push(X(n,1,i))}}function vb(e){let t=[0];return _b(t,e.length-1),t}function yb(e,t){return e.map(e=>e*t)}function bb(e,t){return e.map(()=>t||Ov).splice(0,e.length-1)}function xb({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=kv(r)?r.map(Nv):Nv(r),a={done:!1,value:t[0]},o=gb(yb(n&&n.length===t.length?n:vb(t),e),t,{ease:Array.isArray(i)?i:bb(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Sb=e=>e!==null;function Cb(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Sb),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var wb={decay:mb,inertia:mb,tween:xb,keyframes:xb,spring:db};function Tb(e){typeof e.type==`string`&&(e.type=wb[e.type])}var Eb=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Db=e=>e/100,Ob=class extends Eb{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Uv.now()&&this.tick(Uv.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Wv.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Tb(e);let{type:t=xb,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||xb;s!==xb&&typeof o[0]!=`number`&&(this.mixKeyframes=ov(Db,Xy(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=eb(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=$_(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==mb&&(b.value=Cb(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return uv(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uv(e)}get time(){return uv(this.currentTime)}set time(e){e=lv(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return pb(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Uv.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=uv(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Zy,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Uv.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Wv.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function kb(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Ab=e=>e*180/Math.PI,jb=e=>Nb(Ab(Math.atan2(e[1],e[0]))),Mb={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:jb,rotateZ:jb,skewX:e=>Ab(Math.atan(e[1])),skewY:e=>Ab(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Nb=e=>(e%=360,e<0&&(e+=360),e),Pb=jb,Fb=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Ib=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Lb={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fb,scaleY:Ib,scale:e=>(Fb(e)+Ib(e))/2,rotateX:e=>Nb(Ab(Math.atan2(e[6],e[5]))),rotateY:e=>Nb(Ab(Math.atan2(-e[2],e[0]))),rotateZ:Pb,rotate:Pb,skewX:e=>Ab(Math.atan(e[4])),skewY:e=>Ab(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Rb(e){return+!!e.includes(`scale`)}function zb(e,t){if(!e||e===`none`)return Rb(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Lb,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Mb,i=t}if(!i)return Rb(t);let a=r[t],o=i[1].split(`,`).map(Vb);return typeof a==`function`?a(o):o[a]}var Bb=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return zb(n,t)};function Vb(e){return parseFloat(e.trim())}var Hb=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Ub=new Set([...Hb,`pathRotation`]),Wb=e=>e===Zv||e===J,Gb=new Set([`x`,`y`,`z`]),Kb=Hb.filter(e=>!Gb.has(e));function qb(e){let t=[];return Kb.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Jb={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>zb(t,`x`),y:(e,{transform:t})=>zb(t,`y`)};Jb.translateX=Jb.x,Jb.translateY=Jb.y;var Yb=new Set,Xb=!1,Zb=!1,Qb=!1;function $b(){if(Zb){let e=Array.from(Yb).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=qb(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Zb=!1,Xb=!1,Yb.forEach(e=>e.complete(Qb)),Yb.clear()}function ex(){Yb.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zb=!0)})}function tx(){Qb=!0,ex(),$b(),Qb=!1}var nx=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Yb.add(this),Xb||(Xb=!0,K.read(ex),K.resolveKeyframes($b))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}kb(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Yb.delete(this)}cancel(){this.state===`scheduled`&&(Yb.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},rx=e=>e.startsWith(`--`);function ix(e,t,n){rx(t)?e.style.setProperty(t,n):e.style[t]=n}var ax={};function ox(e,t){let n=iv(e);return()=>ax[t]??n()}var sx=ox(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),cx=ox(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),lx=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,ux={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:lx([0,.65,.55,1]),circOut:lx([.55,0,1,.45]),backIn:lx([.31,.01,.66,-.59]),backOut:lx([.33,1.53,.69,.99])};function dx(e,t){if(e)return typeof e==`function`?cx()?Qy(e,t):`ease-out`:Av(e)?lx(e):Array.isArray(e)?e.map(e=>dx(e,t)||ux.easeOut):ux[e]}function fx(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=dx(s,i);Array.isArray(d)&&(u.easing=d),Fv.value&&Wv.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Fv.value&&p.finished.finally(()=>{Wv.waapi--}),p}function px(e){return typeof e==`function`&&`applyToOptions`in e}function mx({type:e,...t}){return px(e)&&cx()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var hx=class extends Eb{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=mx(e);this.animation=fx(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Cb(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),ix(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return uv(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uv(e)}get time(){return uv(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=lv(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&sx()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),av):r(this)}},gx={anticipate:Sv,backInOut:xv,circInOut:Tv};function _x(e){return e in gx}function vx(e){typeof e.ease==`string`&&_x(e.ease)&&(e.ease=gx[e.ease])}var yx=10,bx=class extends hx{constructor(e){vx(e),Tb(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Ob({...a,autoplay:!1}),s=Math.max(yx,Uv.now()-this.startTime),c=$_(0,yx,s-yx),l=o.sample(s).value,{name:u}=this.options;i&&u&&ix(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},xx=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ny.test(e)||e===`0`)&&!e.startsWith(`url(`));function Sx(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Cx(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=xx(i,t),s=xx(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Sx(e)||(n===`spring`||px(n))&&r}function wx(e){e.duration=0,e.type=`keyframes`}var Tx=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Ex=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Dx(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Ex.test(e[t]))return!0;return!1}var Ox=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),kx=iv(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Ax(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return kx()&&n&&(Tx.has(n)||Ox.has(n)&&Dx(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var jx=40,Mx=class extends Eb{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Uv.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||nx;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Uv.now();let u=!0;Cx(e,i,a,o)||(u=!1,(ev.instantAnimations||!s)&&l?.(Cb(e,n,t)),e[0]=e[e.length-1],wx(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>jx?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Ax(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new bx({...d,element:p})}catch{m=new Ob(d)}else m=new Ob(d);m.finished.then(()=>{this.notifyFinished()}).catch(av),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),tx()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Nx(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var Px=30,Fx=e=>!isNaN(parseFloat(e)),Ix={current:void 0},Lx=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Uv.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Uv.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fx(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new cv);let n=this.events[e].add(t);return e===`change`?()=>{n(),K.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ix.current&&Ix.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Uv.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Px)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Px);return dv(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Rx(e,t){return new Lx(e,t)}function zx(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Bx(e,t){let n=e?.[t]??e?.default??e;return n===e?n:zx(n,e)}var Vx={type:`spring`,stiffness:500,damping:25,restSpeed:10},Hx=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Ux={type:`keyframes`,duration:.8},Wx={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Gx=(e,{keyframes:t})=>t.length>2?Ux:Ub.has(e)?e.startsWith(`scale`)?Hx(t[1]):Vx:Wx,Kx=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function qx(e){for(let t in e)if(!Kx.has(t))return!0;return!1}var Jx=(e,t,n,r={},i,a)=>o=>{let s=Bx(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=lv(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};qx(s)||Object.assign(u,Gx(e,u)),u.duration&&=lv(u.duration),u.repeatDelay&&=lv(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(wx(u),u.delay===0&&(d=!0)),(ev.instantAnimations||ev.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,wx(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Cb(u.keyframes,s);if(e!==void 0){K.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ob(u):new Mx(u)},Yx=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xx(e){let t=Yx.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Zx(e,t,n=1){`${e}`;let[r,i]=Xx(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return tv(e)?parseFloat(e):e}return Jv(i)?Zx(i,t,n+1):i}function Qx(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function $x(e,t,n,r){if(typeof t==`function`){let[i,a]=Qx(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Qx(r);t=t(n===void 0?e.custom:n,i,a)}return t}function eS(e,t,n){let r=e.getProps();return $x(r,t,n===void 0?r.custom:n,e)}var tS=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Hb]),nS=e=>Array.isArray(e);function rS(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rx(n))}function iS(e){return nS(e)?e[e.length-1]||0:e}function aS(e,t){let{transitionEnd:n={},transition:r={},...i}=eS(e,t)||{};i={...i,...n};for(let t in i)rS(e,t,iS(i[t]))}var Q=e=>!!(e&&e.getVelocity);function oS(e){return!!(Q(e)&&e.add)}function sS(e,t){let n=e.getValue(`willChange`);if(oS(n))return n.add(t);if(!n&&ev.WillChange){let n=new ev.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function cS(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var lS=`data-`+cS(`framerAppearId`);function uS(e){return e.props[lS]}function dS({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function fS(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?zx(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&dS(f,t))continue;let o={delay:n,...Bx(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){K.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=uS(e);if(n){let e=window.MotionHandoffAnimation(n,t,K);e!==null&&(o.startTime=e,p=!0)}}sS(e,t);let m=l??e.shouldReduceMotion;r.start(Jx(t,r,i,m&&tS.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>K.update(()=>{o&&aS(e,o)});d.length?Promise.all(d).then(t):t()}return d}function pS(e,t,n={}){let r=eS(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(fS(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return mS(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function mS(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(pS(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Nx(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function hS(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>pS(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=pS(e,t,n);else{let i=typeof t==`function`?eS(e,t,n.custom):t;r=Promise.all(fS(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var gS={test:e=>e===`auto`,parse:e=>e},_S=e=>t=>t.test(e),vS=[Zv,J,py,fy,hy,my,gS],yS=e=>vS.find(_S(e));function bS(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||rv(e)}var xS=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function SS(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ty)||[];if(!r)return e;let i=n.replace(r,``),a=+!!xS.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var CS=/\b([a-z-]*)\(.*?\)/gu,wS={...Ny,getAnimatableNone:e=>{let t=e.match(CS);return t?t.map(SS).join(` `):e}},TS={...Ny,getAnimatableNone:e=>{let t=Ny.parse(e);return Ny.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ES={...Zv,transform:Math.round},DS={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:fy,pathRotation:fy,rotateX:fy,rotateY:fy,rotateZ:fy,scale:$v,scaleX:$v,scaleY:$v,scaleZ:$v,skew:fy,skewX:fy,skewY:fy,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:Qv,originX:gy,originY:gy,originZ:J,zIndex:ES,fillOpacity:Qv,strokeOpacity:Qv,numOctaves:ES},OS={...DS,color:Y,backgroundColor:Y,outlineColor:Y,fill:Y,stroke:Y,borderColor:Y,borderTopColor:Y,borderRightColor:Y,borderBottomColor:Y,borderLeftColor:Y,filter:wS,WebkitFilter:wS,mask:TS,WebkitMask:TS},kS=e=>OS[e],AS=new Set([wS,TS]);function jS(e,t){let n=kS(e);return AS.has(n)||(n=Ny),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var MS=new Set([`auto`,`none`,`0`]);function NS(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!MS.has(t)&&Ey(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=jS(n,i)}var PS=class extends nx{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Jv(r))){let i=Zx(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!tS.has(n)||e.length!==2)return;let[r,i]=e,a=yS(r),o=yS(i);if(Xv(r)!==Xv(i)&&Jb[n]){this.needsMeasurement=!0;return}if(a!==o)if(Wb(a)&&Wb(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Jb[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||bS(e[t]))&&n.push(t);n.length&&NS(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jb[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Jb[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function FS(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var IS=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function LS(e){return nv(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:RS,cancel:zS}=Rv(queueMicrotask,!1),BS={x:!1,y:!1};function VS(){return BS.x||BS.y}function HS(e){return e===`x`||e===`y`?BS[e]?null:(BS[e]=!0,()=>{BS[e]=!1}):BS.x||BS.y?null:(BS.x=BS.y=!0,()=>{BS.x=BS.y=!1})}function US(e,t){let n=FS(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function WS(e){return!(e.pointerType===`touch`||VS())}function GS(e,t,n={}){let[r,i,a]=US(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!WS(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var KS=(e,t)=>t?e===t?!0:KS(e,t.parentElement):!1,qS=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,JS=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function YS(e){return JS.has(e.tagName)||e.isContentEditable===!0}var XS=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function ZS(e){return XS.has(e.tagName)||e.isContentEditable===!0}var QS=new WeakSet;function $S(e){return t=>{t.key===`Enter`&&e(t)}}function eC(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var tC=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=$S(()=>{if(QS.has(n))return;eC(n,`down`);let e=$S(()=>{eC(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>eC(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function nC(e){return qS(e)&&!VS()}var rC=new WeakSet;function iC(e,t,n={}){let[r,i,a]=US(e,n),o=e=>{let r=e.currentTarget;if(!nC(e)||rC.has(e))return;QS.add(r),n.stopPropagation&&rC.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),QS.has(r)&&QS.delete(r),nC(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||KS(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),LS(e)&&(e.addEventListener(`focus`,e=>tC(e,i)),!YS(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function aC(e){return nv(e)&&`ownerSVGElement`in e}var oC=new WeakMap,sC,cC=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:aC(r)&&`getBBox`in r?r.getBBox()[t]:r[n],lC=cC(`inline`,`width`,`offsetWidth`),uC=cC(`block`,`height`,`offsetHeight`);function dC({target:e,borderBoxSize:t}){oC.get(e)?.forEach(n=>{n(e,{get width(){return lC(e,t)},get height(){return uC(e,t)}})})}function fC(e){e.forEach(dC)}function pC(){typeof ResizeObserver>`u`||(sC=new ResizeObserver(fC))}function mC(e,t){sC||pC();let n=FS(e);return n.forEach(e=>{let n=oC.get(e);n||(n=new Set,oC.set(e,n)),n.add(t),sC?.observe(e)}),()=>{n.forEach(e=>{let n=oC.get(e);n?.delete(t),n?.size||sC?.unobserve(e)})}}var hC=new Set,gC;function _C(){gC=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};hC.forEach(t=>t(e))},window.addEventListener(`resize`,gC)}function vC(e){return hC.add(e),gC||_C(),()=>{hC.delete(e),!hC.size&&typeof gC==`function`&&(window.removeEventListener(`resize`,gC),gC=void 0)}}function yC(e,t){return typeof e==`function`?vC(e):mC(e,t)}function bC(e){return aC(e)&&e.tagName===`svg`}var xC=[...vS,Y,Ny],SC=e=>xC.find(_S(e)),CC=()=>({translate:0,scale:1,origin:0,originPoint:0}),wC=()=>({x:CC(),y:CC()}),TC=()=>({min:0,max:0}),$=()=>({x:TC(),y:TC()}),EC=new WeakMap;function DC(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function OC(e){return typeof e==`string`||Array.isArray(e)}var kC=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],AC=[`initial`,...kC];function jC(e){return DC(e.animate)||AC.some(t=>OC(e[t]))}function MC(e){return!!(jC(e)||e.variants)}function NC(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Q(i))e.addValue(r,i);else if(Q(a))e.addValue(r,Rx(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Rx(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var PC={current:null},FC={current:!1},IC=typeof window<`u`;function LC(){if(FC.current=!0,IC)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>PC.current=e.matches;e.addEventListener(`change`,t),t()}else PC.current=!1}var RC=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],zC={};function BC(e){zC=e}function VC(){return zC}var HC=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=nx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Uv.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,K.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=jC(t),this.isVariantNode=MC(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Q(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,EC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(FC.current||LC(),this.shouldReduceMotion=PC.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),zv(this.notifyUpdate),zv(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Tx.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new hx({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:lv(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Ub.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&K.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in zC){let t=zC[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):$()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<RC.length;t++){let n=RC[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=NC(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Rx(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(tv(n)||rv(n))?n=parseFloat(n):!SC(n)&&Ny.test(t)&&(n=jS(e,t)),this.setBaseTarget(e,Q(n)?n.get():n)),Q(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=$x(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Q(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new cv),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){RS.render(this.render)}},UC=class extends HC{constructor(){super(...arguments),this.KeyframeResolver=PS}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Q(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},WC=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function GC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function KC({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qC(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function JC(e){return e===void 0||e===1}function YC({scale:e,scaleX:t,scaleY:n}){return!JC(e)||!JC(t)||!JC(n)}function XC(e){return YC(e)||ZC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ZC(e){return QC(e.x)||QC(e.y)}function QC(e){return e&&e!==`0%`}function $C(e,t,n){return n+t*(e-n)}function ew(e,t,n,r,i){return i!==void 0&&(e=$C(e,i,r)),$C(e,n,r)+t}function tw(e,t=0,n=1,r,i){e.min=ew(e.min,t,n,r,i),e.max=ew(e.max,t,n,r,i)}function nw(e,{x:t,y:n}){tw(e.x,t.translate,t.scale,t.originPoint),tw(e.y,n.translate,n.scale,n.originPoint)}var rw=.999999999999,iw=1.0000000000001;function aw(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(ow(e.x,-a.scroll.offset.x),ow(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,nw(e,o)),r&&XC(a.latestValues)&&lw(e,a.latestValues,a.layout?.layoutBox))}t.x<iw&&t.x>rw&&(t.x=1),t.y<iw&&t.y>rw&&(t.y=1)}function ow(e,t){e.min+=t,e.max+=t}function sw(e,t,n,r,i=.5){tw(e,t,n,X(e.min,e.max,i),r)}function cw(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function lw(e,t,n){let r=n??e;sw(e.x,cw(t.x,r.x),t.scaleX,t.scale,t.originX),sw(e.y,cw(t.y,r.y),t.scaleY,t.scale,t.originY)}function uw(e,t){return GC(qC(e.getBoundingClientRect(),t))}function dw(e,t,n){let r=uw(e,n),{scroll:i}=t;return i&&(ow(r.x,i.offset.x),ow(r.y,i.offset.y)),r}var fw={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},pw=Hb.length;function mw(e,t,n){let r=``,i=!0;for(let a=0;a<pw;a++){let o=Hb[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=IS(s,DS[o]);if(!c){i=!1;let t=fw[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${IS(a,DS.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function hw(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Ub.has(e)){o=!0;continue}else if(Kv(e)){i[e]=n;continue}else{let t=IS(n,DS[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=mw(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function gw(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function _w(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vw={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${_w(e,t.target.x)}% ${_w(e,t.target.y)}%`}},yw={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ny.parse(e);if(i.length>5)return r;let a=Ny.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=X(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},bw={borderRadius:{...vw,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:vw,borderTopRightRadius:vw,borderBottomLeftRadius:vw,borderBottomRightRadius:vw,boxShadow:yw};function xw(e,{layout:t,layoutId:n}){return Ub.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!bw[e]||e===`opacity`)}function Sw(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Q(r[t])||i&&Q(i[t])||xw(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Cw(e){return window.getComputedStyle(e)}var ww=class extends UC{constructor(){super(...arguments),this.type=`html`,this.renderInstance=gw}readValueFromInstance(e,t){if(Ub.has(t))return this.projection?.isProjecting?Rb(t):Bb(e,t);{let n=Cw(e),r=(Kv(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return uw(e,t)}build(e,t,n){hw(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Sw(e,t,n)}},Tw={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Ew={offset:`strokeDashoffset`,array:`strokeDasharray`};function Dw(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Tw:Ew;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Ow=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function kw(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(hw(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Ow)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Dw(d,i,a,o,!1)}var Aw=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),jw=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Mw(e,t,n,r){gw(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Aw.has(n)?n:cS(n),t.attrs[n])}function Nw(e,t,n){let r=Sw(e,t,n);for(let n in e)if(Q(e[n])||Q(t[n])){let t=Hb.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Pw=class extends UC{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=$}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ub.has(t)){let e=kS(t);return e&&e.default||0}return t=Aw.has(t)?t:cS(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Nw(e,t,n)}build(e,t,n){kw(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Mw(e,t,n,r)}mount(e){this.isSVGTag=jw(e.tagName),super.mount(e)}},Fw=AC.length;function Iw(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Iw(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Fw;n++){let r=AC[n],i=e.props[r];(OC(i)||i===!1)&&(t[r]=i)}return t}function Lw(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Rw=[...kC].reverse(),zw=kC.length;function Bw(e){return t=>Promise.all(t.map(({animation:t,options:n})=>hS(e,t,n)))}function Vw(e){let t=Bw(e),n=Ww(),r=!0,i=!1,a=t=>(n,r)=>{let i=eS(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Iw(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<zw;t++){let p=Rw[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=OC(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||DC(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Hw(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=nS(t)&&nS(n)?!Lw(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=eS(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Nx(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=eS(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Ww(),i=!0}}}function Hw(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Lw(t,e):!1}function Uw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ww(){return{animate:Uw(!0),whileInView:Uw(),whileHover:Uw(),whileTap:Uw(),whileDrag:Uw(),whileFocus:Uw(),exit:Uw()}}function Gw(e,t){e.min=t.min,e.max=t.max}function Kw(e,t){Gw(e.x,t.x),Gw(e.y,t.y)}function qw(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Jw=.9999,Yw=1.0001,Xw=-.01,Zw=.01;function Qw(e){return e.max-e.min}function $w(e,t,n){return Math.abs(e-t)<=n}function eT(e,t,n,r=.5){e.origin=r,e.originPoint=X(t.min,t.max,e.origin),e.scale=Qw(n)/Qw(t),e.translate=X(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Jw&&e.scale<=Yw||isNaN(e.scale))&&(e.scale=1),(e.translate>=Xw&&e.translate<=Zw||isNaN(e.translate))&&(e.translate=0)}function tT(e,t,n,r){eT(e.x,t.x,n.x,r?r.originX:void 0),eT(e.y,t.y,n.y,r?r.originY:void 0)}function nT(e,t,n,r=0){e.min=(r?X(n.min,n.max,r):n.min)+t.min,e.max=e.min+Qw(t)}function rT(e,t,n,r){nT(e.x,t.x,n.x,r?.x),nT(e.y,t.y,n.y,r?.y)}function iT(e,t,n,r=0){let i=r?X(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Qw(t)}function aT(e,t,n,r){iT(e.x,t.x,n.x,r?.x),iT(e.y,t.y,n.y,r?.y)}function oT(e,t,n,r,i){return e-=t,e=$C(e,1/n,r),i!==void 0&&(e=$C(e,1/i,r)),e}function sT(e,t=0,n=1,r=.5,i,a=e,o=e){if(py.test(t)&&(t=parseFloat(t),t=X(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=X(a.min,a.max,r);e===a&&(s-=t),e.min=oT(e.min,t,n,s,i),e.max=oT(e.max,t,n,s,i)}function cT(e,t,[n,r,i],a,o){sT(e,t[n],t[r],t[i],t.scale,a,o)}var lT=[`x`,`scaleX`,`originX`],uT=[`y`,`scaleY`,`originY`];function dT(e,t,n,r){cT(e.x,t,lT,n?n.x:void 0,r?r.x:void 0),cT(e.y,t,uT,n?n.y:void 0,r?r.y:void 0)}function fT(e){return e.translate===0&&e.scale===1}function pT(e){return fT(e.x)&&fT(e.y)}function mT(e,t){return e.min===t.min&&e.max===t.max}function hT(e,t){return mT(e.x,t.x)&&mT(e.y,t.y)}function gT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function _T(e,t){return gT(e.x,t.x)&&gT(e.y,t.y)}function vT(e){return Qw(e.x)/Qw(e.y)}function yT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bT(e){return[e(`x`),e(`y`)]}function xT(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var ST=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],CT=ST.length,wT=e=>typeof e==`string`?parseFloat(e):e,TT=e=>typeof e==`number`||J.test(e);function ET(e,t,n,r,i,a){i?(e.opacity=X(0,n.opacity??1,OT(r)),e.opacityExit=X(t.opacity??1,0,kT(r))):a&&(e.opacity=X(t.opacity??1,n.opacity??1,r));for(let i=0;i<CT;i++){let a=ST[i],o=DT(t,a),s=DT(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||TT(o)===TT(s)?(e[a]=Math.max(X(wT(o),wT(s),r),0),(py.test(s)||py.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=X(t.rotate||0,n.rotate||0,r))}function DT(e,t){return e[t]===void 0?e.borderRadius:e[t]}var OT=AT(0,.5,wv),kT=AT(.5,.95,av);function AT(e,t,n){return r=>r<e?0:r>t?1:n(sv(e,t,r))}function jT(e,t,n){let r=Q(e)?e:Rx(e);return r.start(Jx(``,r,t,n)),r.animation}function MT(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var NT=(e,t)=>e.depth-t.depth,PT=class{constructor(){this.children=[],this.isDirty=!1}add(e){Z_(this.children,e),this.isDirty=!0}remove(e){Q_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(NT),this.isDirty=!1,this.children.forEach(e)}};function FT(e,t){let n=Uv.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(zv(r),e(a-t))};return K.setup(r,!0),()=>zv(r)}function IT(e){return Q(e)?e.get():e}var LT=class{constructor(){this.members=[]}add(e){Z_(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Q_(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Q_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},RT={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zT={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},BT=[``,`X`,`Y`,`Z`],VT=1e3,HT=0;function UT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function WT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=uS(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,K,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&WT(r)}function GT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=HT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Fv.value&&(zT.nodes=zT.calculatedTargetDeltas=zT.calculatedProjections=0),this.nodes.forEach(JT),this.nodes.forEach(rE),this.nodes.forEach(iE),this.nodes.forEach(YT),Fv.addProjectionMetrics&&Fv.addProjectionMetrics(zT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new PT)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cv),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=aC(t)&&!bC(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;K.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=FT(i,250),RT.hasAnimatedSinceResize&&(RT.hasAnimatedSinceResize=!1,this.nodes.forEach(nE)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||dE,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!_T(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Bx(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||nE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),zv(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(aE),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&WT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(QT),this.nodes.forEach(ZT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($T);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(eE),this.nodes.forEach(tE),this.nodes.forEach(KT),this.nodes.forEach(qT)):this.nodes.forEach($T),this.clearAllSnapshots();let e=Uv.now();q.delta=$_(0,1e3/60,e-q.timestamp),q.timestamp=e,q.isProcessing=!0,Bv.update.process(q),Bv.preRender.process(q),Bv.render.process(q),q.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,RS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(XT),this.sharedNodes.forEach(oE)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,K.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){K.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Qw(this.snapshot.measuredBox.x)&&!Qw(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=$(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!pT(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||XC(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),hE(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return $();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(_E))){let{scroll:e}=this.root;e&&(ow(t.x,e.offset.x),ow(t.y,e.offset.y))}return t}removeElementScroll(e){let t=$();if(Kw(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Kw(t,e),ow(t.x,i.offset.x),ow(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||$();Kw(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(ow(r.x,-n.scroll.offset.x),ow(r.y,-n.scroll.offset.y)),XC(n.latestValues)&&lw(r,n.latestValues,n.layout?.layoutBox)}return XC(this.latestValues)&&lw(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=$();Kw(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!XC(n.latestValues))continue;let r;n.instance&&(YC(n.latestValues)&&n.updateSnapshot(),r=$(),Kw(r,n.measurePageBox())),dT(t,n.latestValues,n.snapshot?.layoutBox,r)}return XC(this.latestValues)&&dT(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==q.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=q.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=$(),this.targetWithTransforms=$()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Kw(this.target,this.layout.layoutBox),nw(this.target,this.targetDelta)):Kw(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Fv.value&&zT.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||YC(this.parent.latestValues)||ZC(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$(),this.relativeTargetOrigin=$(),aT(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Kw(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===q.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Kw(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;aw(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=$());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(qw(this.prevProjectionDelta.x,this.projectionDelta.x),qw(this.prevProjectionDelta.y,this.projectionDelta.y)),tT(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!yT(this.projectionDelta.x,this.prevProjectionDelta.x)||!yT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Fv.value&&zT.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=wC(),this.projectionDelta=wC(),this.projectionDeltaWithTransform=wC()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=wC();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=$(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(uE));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=X(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=X(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(sE(o.x,e.x,n),sE(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(aT(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),lE(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&hT(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=$(),Kw(f,this.relativeTarget)),c&&(this.animationValues=a,ET(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(zv(this.pendingAnimation),void 0),this.pendingAnimation=K.update(()=>{RT.hasAnimatedSinceResize=!0,Wv.layout++,this.motionValue||=Rx(0),this.motionValue.jump(0,!1),this.currentAnimation=jT(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Wv.layout--},onComplete:()=>{Wv.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VT),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&gE(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||$();let t=Qw(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Qw(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Kw(t,n),lw(t,i),tT(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new LT),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&UT(`z`,e,r,this.animationValues);for(let t=0;t<BT.length;t++)UT(`rotate${BT[t]}`,e,r,this.animationValues),UT(`skew${BT[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=IT(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=IT(t?.pointerEvents)||``),this.hasProjected&&!XC(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=xT(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in bw){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=bw[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?IT(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(ZT),this.root.sharedNodes.clear()}}}function KT(e){e.updateLayout()}function qT(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)bT(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Qw(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Gw(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gE(i,t.layoutBox,n)&&bT(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Qw(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=wC();tT(o,n,t.layoutBox);let s=wC();a?tT(s,e.applyTransform(r,!0),t.measuredBox):tT(s,n,t.layoutBox);let c=!pT(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=$();aT(s,t.layoutBox,i.layoutBox,o);let c=$();aT(c,n,a.layoutBox,o),_T(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function JT(e){Fv.value&&zT.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function YT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function XT(e){e.clearSnapshot()}function ZT(e){e.clearMeasurements()}function QT(e){e.isLayoutDirty=!0,e.updateLayout()}function $T(e){e.isLayoutDirty=!1}function eE(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function tE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function rE(e){e.resolveTargetDelta()}function iE(e){e.calcProjection()}function aE(e){e.resetSkewAndRotation()}function oE(e){e.removeLeadSnapshot()}function sE(e,t,n){e.translate=X(t.translate,0,n),e.scale=X(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cE(e,t,n,r){e.min=X(t.min,n.min,r),e.max=X(t.max,n.max,r)}function lE(e,t,n,r){cE(e.x,t.x,n.x,r),cE(e.y,t.y,n.y,r)}function uE(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dE={duration:.45,ease:[.4,0,.1,1]},fE=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pE=fE(`applewebkit/`)&&!fE(`chrome/`)?Math.round:av;function mE(e){e.min=pE(e.min),e.max=pE(e.max)}function hE(e){mE(e.x),mE(e.y)}function gE(e,t,n){return e===`position`||e===`preserve-aspect`&&!$w(vT(t),vT(n),.2)}function _E(e){return e!==e.root&&e.scroll?.wasRoot}var vE=GT({attachResizeListener:(e,t)=>MT(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yE={current:void 0},bE=GT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yE.current){let e=new vE({});e.mount(window),e.setOptions({layoutScroll:!0}),yE.current=e}return yE.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xE=(0,I.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function SE(e=!0){let t=(0,I.useContext)(X_);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,I.useId)();(0,I.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,I.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var CE=(0,I.createContext)({strict:!1}),wE={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},TE=!1;function EE(){if(TE)return;let e={};for(let t in wE)e[t]={isEnabled:e=>wE[t].some(t=>!!e[t])};BC(e),TE=!0}function DE(){return EE(),VC()}function OE(e){let t=DE();for(let n in e)t[n]={...t[n],...e[n]};BC(t)}var kE=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function AE(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||kE.has(e)}var jE=r({default:()=>ME}),ME,NE=t((()=>{throw ME={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),PE=e=>!AE(e);function FE(e){typeof e==`function`&&(PE=t=>t.startsWith(`on`)?!AE(t):e(t))}try{FE((NE(),e(jE)).default)}catch{}function IE(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Q(e[i])||(PE(i)||n===!0&&AE(i)||!t&&!AE(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var LE=(0,I.createContext)({});function RE(e,t){if(jC(e)){let{initial:t,animate:n}=e;return{initial:t===!1||OC(t)?t:void 0,animate:OC(n)?n:void 0}}return e.inherit===!1?{}:t}function zE(e){let{initial:t,animate:n}=RE(e,(0,I.useContext)(LE));return(0,I.useMemo)(()=>({initial:t,animate:n}),[BE(t),BE(n)])}function BE(e){return Array.isArray(e)?e.join(` `):e}var VE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function HE(e,t,n){for(let r in t)!Q(t[r])&&!xw(r,n)&&(e[r]=t[r])}function UE({transformTemplate:e},t){return(0,I.useMemo)(()=>{let n=VE();return hw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function WE(e,t){let n=e.style||{},r={};return HE(r,n,e),Object.assign(r,UE(e,t)),r}function GE(e,t){let n={},r=WE(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var KE=()=>({...VE(),attrs:{}});function qE(e,t,n,r){let i=(0,I.useMemo)(()=>{let n=KE();return kw(n,t,jw(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};HE(t,e.style,e),i.style={...t,...i.style}}return i}var JE=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function YE(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(JE.indexOf(e)>-1||/[A-Z]/u.test(e))}function XE(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??YE(e)?qE:GE)(t,r,i,e),c=IE(t,typeof e==`string`,a),l=e===I.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,I.useMemo)(()=>Q(u)?u.get():u,[u]);return(0,I.createElement)(e,{...l,children:d})}function ZE({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:QE(n,r,i,e),renderState:t()}}function QE(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=IT(a[e]);let{initial:o,animate:s}=e,c=jC(e),l=MC(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!DC(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=$x(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var $E=e=>(t,n)=>{let r=(0,I.useContext)(LE),i=(0,I.useContext)(X_),a=()=>ZE(e,t,r,i);return n?a():J_(a)},eD=$E({scrapeMotionValuesFromProps:Sw,createRenderState:VE}),tD=$E({scrapeMotionValuesFromProps:Nw,createRenderState:KE}),nD=Symbol.for(`motionComponentSymbol`);function rD(e,t,n){let r=(0,I.useRef)(n);(0,I.useInsertionEffect)(()=>{r.current=n});let i=(0,I.useRef)(null);return(0,I.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var iD=(0,I.createContext)({});function aD(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function oD(e,t,n,r,i,a){let{visualElement:o}=(0,I.useContext)(LE),s=(0,I.useContext)(CE),c=(0,I.useContext)(X_),l=(0,I.useContext)(xE),u=l.reducedMotion,d=l.skipAnimations,f=(0,I.useRef)(null),p=(0,I.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,I.useContext)(iD);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&sD(f.current,n,i,h);let g=(0,I.useRef)(!1);(0,I.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[lS],v=(0,I.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Y_(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,I.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function sD(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:cD(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&aD(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function cD(e){if(e)return e.options.allowProjection===!1?cD(e.parent):e.projection}function lD(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&OE(r);let a=n?n===`svg`:YE(e),o=a?tD:eD;function s(n,s){let c,l={...(0,I.useContext)(xE),...n,layoutId:uD(n)},{isStatic:u}=l,d=zE(n),f=o(n,u);if(!u&&typeof window<`u`){dD(l,r);let t=fD(l);c=t.MeasureLayout,d.visualElement=oD(e,f,l,i,t.ProjectionNode,a)}return(0,R.jsxs)(LE.Provider,{value:d,children:[c&&d.visualElement?(0,R.jsx)(c,{visualElement:d.visualElement,...l}):null,XE(e,n,rD(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,I.forwardRef)(s);return c[nD]=e,c}function uD({layoutId:e}){let t=(0,I.useContext)(q_).id;return t&&e!==void 0?t+`-`+e:e}function dD(e,t){(0,I.useContext)(CE).strict}function fD(e){let{drag:t,layout:n}=DE();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function pD(e,t){if(typeof Proxy>`u`)return lD;let n=new Map,r=(n,r)=>lD(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,lD(a,void 0,e,t)),n.get(a))})}var mD=(e,t)=>t.isSVG??YE(e)?new Pw(t):new ww(t,{allowProjection:e!==I.Fragment}),hD=class extends WC{constructor(e){super(e),e.animationState||=Vw(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();DC(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},gD=0,_D={animation:{Feature:hD},exit:{Feature:class extends WC{constructor(){super(...arguments),this.id=gD++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=eS(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function vD(e){return{point:{x:e.pageX,y:e.pageY}}}var yD=e=>t=>qS(t)&&e(t,vD(t));function bD(e,t,n,r){return MT(e,t,yD(n),r)}var xD=({current:e})=>e?e.ownerDocument.defaultView:null,SD=(e,t)=>Math.abs(e-t);function CD(e,t){let n=SD(e.x,t.x),r=SD(e.y,t.y);return Math.sqrt(n**2+r**2)}var wD=new Set([`auto`,`scroll`]),TD=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=ED(this.lastRawMoveEventInfo,this.transformPagePoint));let e=OD(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=CD(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=q;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=ED(t,this.transformPagePoint),K.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=OD(e.type===`pointercancel`?this.lastMoveEventInfo:ED(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!qS(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=ED(vD(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=q;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,OD(s,this.history)),this.removeListeners=ov(bD(this.contextWindow,`pointermove`,this.handlePointerMove),bD(this.contextWindow,`pointerup`,this.handlePointerUp),bD(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(wD.has(e.overflowX)||wD.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),K.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),zv(this.updatePoint)}};function ED(e,t){return t?{point:t(e.point)}:e}function DD(e,t){return{x:e.x-t.x,y:e.y-t.y}}function OD({point:e},t){return{point:e,delta:DD(e,AD(t)),offset:DD(e,kD(t)),velocity:jD(t,.1)}}function kD(e){return e[0]}function AD(e){return e[e.length-1]}function jD(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=AD(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>lv(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>lv(t)*2&&(r=e[1]);let a=uv(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function MD(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?X(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?X(n,e,r.max):Math.min(e,n)),e}function ND(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function PD(e,{top:t,left:n,bottom:r,right:i}){return{x:ND(e.x,n,i),y:ND(e.y,t,r)}}function FD(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function ID(e,t){return{x:FD(e.x,t.x),y:FD(e.y,t.y)}}function LD(e,t){let n=.5,r=Qw(e),i=Qw(t);return i>r?n=sv(t.min,t.max-r,e.min):r>i&&(n=sv(e.min,e.max-i,t.min)),$_(0,1,n)}function RD(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var zD=.35;function BD(e=zD){return e===!1?e=0:e===!0&&(e=zD),{x:VD(e,`left`,`right`),y:VD(e,`top`,`bottom`)}}function VD(e,t,n){return{min:HD(e,t),max:HD(e,n)}}function HD(e,t){return typeof e==`number`?e:e[t]||0}var UD=new WeakMap,WD=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(vD(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=HS(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bT(e=>{let t=this.getAxisMotionValue(e).get()||0;if(py.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=Qw(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&K.update(()=>i(e,t),!1,!0),sS(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=JD(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&K.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new TD(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:xD(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&K.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!qD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=MD(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&aD(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=PD(n.layoutBox,e):this.constraints=!1,this.elastic=BD(t),r!==this.constraints&&!aD(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&bT(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=RD(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!aD(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=dw(n,r.root,this.visualElement.getTransformPagePoint()),a=ID(r.layout.layoutBox,i);if(t){let e=t(KC(a));this.hasMutatedConstraints=!!e,e&&(a=GC(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=bT(o=>{if(!qD(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return sS(this.visualElement,e),n.start(Jx(e,n,0,t,this.visualElement,!1))}stopAnimation(){bT(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){bT(t=>{let{drag:n}=this.getProps();if(!qD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-X(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!aD(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};bT(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=LD({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),bT(t=>{if(!qD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(X(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;UD.set(this.visualElement,this);let e=this.visualElement.current,t=bD(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&ZS(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();aD(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=KD(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),K.read(r);let o=MT(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(bT(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=zD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function GD(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function KD(e,t,n){let r=yC(e,GD(n)),i=yC(t,GD(n));return()=>{r(),i()}}function qD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function JD(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var YD=class extends WC{constructor(e){super(e),this.removeGroupControls=av,this.removeListeners=av,this.controls=new WD(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||av}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},XD=e=>(t,n)=>{e&&K.update(()=>e(t,n),!1,!0)},ZD=class extends WC{constructor(){super(...arguments),this.removePointerDownListener=av}onPointerDown(e){this.session=new TD(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xD(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:XD(e),onStart:XD(t),onMove:XD(n),onEnd:(e,t)=>{delete this.session,r&&K.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=bD(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},QD=!1,$D=class extends I.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),QD&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),RT.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),QD=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||K.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),RS.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;QD=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function eO(e){let[t,n]=SE(),r=(0,I.useContext)(q_);return(0,R.jsx)($D,{...e,layoutGroup:r,switchLayoutGroup:(0,I.useContext)(iD),isPresent:t,safeToRemove:n})}var tO={pan:{Feature:ZD},drag:{Feature:YD,ProjectionNode:bE,MeasureLayout:eO}};function nO(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&K.postRender(()=>i(t,vD(t)))}var rO=class extends WC{mount(){let{current:e}=this.node;e&&(this.unmount=GS(e,(e,t)=>(nO(this.node,t,`Start`),e=>nO(this.node,e,`End`))))}unmount(){}},iO=class extends WC{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=ov(MT(this.node.current,`focus`,()=>this.onFocus()),MT(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function aO(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&K.postRender(()=>i(t,vD(t)))}var oO=class extends WC{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=iC(e,(e,t)=>(aO(this.node,t,`Start`),(e,{success:t})=>aO(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},sO=new WeakMap,cO=new WeakMap,lO=e=>{let t=sO.get(e.target);t&&t(e)},uO=e=>{e.forEach(lO)};function dO({root:e,...t}){let n=e||document;cO.has(n)||cO.set(n,{});let r=cO.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(uO,{root:e,...t})),r[i]}function fO(e,t,n){let r=dO(t);return sO.set(e,n),r.observe(e),()=>{sO.delete(e),r.unobserve(e)}}var pO={some:0,all:1},mO=class extends WC{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:pO[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=fO(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(hO(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function hO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var gO={inView:{Feature:mO},tap:{Feature:oO},focus:{Feature:iO},hover:{Feature:rO}},_O={layout:{ProjectionNode:bE,MeasureLayout:eO}},vO=pD({..._D,...gO,...tO,..._O},mD),yO=(0,I.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=vO.create(t),o=(0,I.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,R.jsx)(a,{animate:{backgroundPosition:`0% center`},className:A(`relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent`,`[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]`,n),initial:{backgroundPosition:`100% center`},style:{"--spread":`${o}px`,backgroundImage:`var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`},transition:{repeat:1/0,duration:r,ease:`linear`},children:e})}),bO=(0,I.createContext)(null),xO=()=>{let e=(0,I.useContext)(bO);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},SO=1e3,CO=1e3,wO=(0,I.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[c,l]=Rt({prop:n,defaultProp:r,onChange:i}),[u,d]=Rt({prop:a,defaultProp:void 0}),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(null);return(0,I.useEffect)(()=>{t?m===null&&h(Date.now()):m!==null&&(d(Math.ceil((Date.now()-m)/CO)),h(null))},[t,m,d]),(0,I.useEffect)(()=>{if(r&&!t&&c&&!f){let e=setTimeout(()=>{l(!1),p(!0)},SO);return()=>clearTimeout(e)}},[t,c,r,l,f]),(0,R.jsx)(bO.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:l,duration:u},children:(0,R.jsx)(Ne,{className:A(`not-prose mb-4`,e),onOpenChange:e=>{l(e)},open:c,...s,children:o})})}),TO=(e,t)=>e||t===0?(0,R.jsx)(yO,{duration:1,children:`Thinking...`}):t===void 0?(0,R.jsx)(`p`,{children:`Thought for a few seconds`}):(0,R.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),EO=(0,I.memo)(({className:e,children:t,getThinkingMessage:n=TO,...r})=>{let{isStreaming:i,isOpen:a,duration:o}=xO();return(0,R.jsx)(Pe,{className:A(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...r,children:t??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ct,{className:`size-4`}),n(i,o),(0,R.jsx)(Ee,{className:A(`size-4 transition-transform`,a?`rotate-180`:`rotate-0`)})]})})}),DO=(0,I.memo)(({className:e,children:t,...n})=>(0,R.jsx)(Ae,{className:A(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,R.jsx)(Bf,{children:t})}));wO.displayName=`Reasoning`,EO.displayName=`ReasoningTrigger`,DO.displayName=`ReasoningContent`;var OO=({className:e,...t})=>(0,R.jsx)(Ne,{className:A(`not-prose mb-4 text-primary text-xs`,e),...t}),kO=({className:e,count:t,children:n,...r})=>(0,R.jsx)(Pe,{className:A(`flex items-center gap-2`,e),...r,children:n??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`font-medium`,children:[`Used `,t,` sources`]}),(0,R.jsx)(Ee,{className:`h-4 w-4`})]})}),AO=({className:e,...t})=>(0,R.jsx)(Ae,{className:A(`mt-3 flex w-fit flex-col gap-2`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),jO=({href:e,title:t,children:n,...r})=>(0,R.jsx)(`a`,{className:`flex items-center gap-2`,href:e,rel:`noreferrer`,target:`_blank`,...r,children:n??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Be,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`block font-medium`,children:t})]})});function MO(e){let t=e??{},n=t.data&&typeof t.data==`object`?t.data:t,r=n.seedApplied,i=n.probes;if(!r&&!i)return;let a={};return r&&(r.success===!1?a.seedError=r.error??(Array.isArray(r.errors)&&r.errors.length?String(r.errors[0]):`Sample data failed to load.`):a.seededRows=(r.inserted??0)+(r.updated??0)),i&&(a.checked={seeds:i.checked?.seeds??0,views:i.checked?.views??0,widgets:i.checked?.widgets??0},a.issues=(i.issues??[]).filter(e=>e&&typeof e.message==`string`).map(e=>({severity:e.severity===`error`?`error`:`warning`,code:String(e.code??`runtime_issue`),message:String(e.message)}))),a}function NO(e){return e===`user`?`user`:`assistant`}function PO(e){let t=e.trim();if(t.length<2||!(t.startsWith(`{`)||t.startsWith(`[`))||!(t.endsWith(`}`)||t.endsWith(`]`)))return!1;try{return JSON.parse(t),!0}catch{return!1}}function FO(e){let t=e.state??(e.errorText?`output-error`:e.result===void 0?`input-available`:`output-available`);return t===`output-error`||t===`output-denied`?`failed`:t===`approval-requested`||t===`approval-responded`?`awaiting`:t===`output-available`?`completed`:`running`}function IO(e){return[{create_object:`新建对象`,add_field:`新增字段`,modify_field:`修改字段`,delete_field:`删除字段`,create_metadata:`新建`,update_metadata:`修改`,create_seed:`生成示例数据`,create_package:`新建应用包`}[e.verb]??e.verb,`${e.field?`${e.object?`${e.object}.`:``}${e.field}`:e.object??e.name??``}${e.type?`(${e.type})`:``}`,e.details].filter(Boolean).join(` `)}function LO(e){return e.toolName===`propose_blueprint`}function RO(e){return LO(e)&&FO(e)===`completed`&&!e.proposedPlan&&!e.proposedChanges&&!e.draftReview?.items.length}var zO=[`待补`,`后续`,`将在`,`稍后`,`暂不`,`暂未`,`尚未`,`确认后一起补`,`一起补`,`另行`,`日后`,`not yet`,`will be implemented`,`will be added`,`to be added`,`to be implemented`,`later`,`deferred`,`follow-up`,`follow up`,`future`,`subsequent`,`coming soon`,`tbd`];function BO(e){let t=[],n=[];for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();if(!e)continue;let i=e.toLowerCase();zO.some(e=>i.includes(e))?n.push(e):t.push(e)}return{designNotes:t,deferred:n}}function VO(e){let t=FO(e);return t===`awaiting`||t===`failed`||!!e.pendingActionId||!!e.draftReview?.items.length||!!e.proposedPlan||!!e.proposedChanges||RO(e)}function HO(e){switch(e){case`failed`:return 4;case`awaiting`:return 3;case`running`:return 2;case`completed`:return 1}}function UO(e){let t=new Map;for(let n of e){let e=FO(n),r=`${n.toolName}:${e}`,i=t.get(r);if(i){i.count+=1,i.errorText=i.errorText??n.errorText;continue}t.set(r,{key:r,title:po(n.toolName)||n.toolName,rawName:n.toolName,count:1,state:e,errorText:n.errorText})}return Array.from(t.values()).sort((e,t)=>{let n=HO(t.state)-HO(e.state);return n===0?e.title.localeCompare(t.title):n})}function WO({health:e}){if(!e)return null;let t=e.issues??[],n=t.filter(e=>e.severity===`error`),r=t.filter(e=>e.severity!==`error`),i=e.checked,a=!!i&&i.seeds+i.views+i.widgets>0,o=[];if(typeof e.seededRows==`number`&&e.seededRows>0&&!e.seedError&&o.push(`${e.seededRows} sample row${e.seededRows===1?``:`s`} live`),a&&n.length===0){let e=[];i.views>0&&e.push(`${i.views} view${i.views===1?``:`s`}`),i.widgets>0&&e.push(`${i.widgets} widget${i.widgets===1?``:`s`}`),i.seeds>0&&e.push(`${i.seeds} seed${i.seeds===1?``:`s`}`),e.length&&o.push(`${e.join(` · `)} verified`)}return o.length===0&&!e.seedError&&t.length===0?null:(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`publish-health`,children:[o.length>0?(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-emerald-700`,children:[(0,R.jsx)(k,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:o.join(` · `)})]}):null,e.seedError?(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.seedError})]}):null,n.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`e${t}`)),r.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-amber-600`,children:[(0,R.jsx)(_e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`w${t}`))]})}var GO=I.forwardRef(({className:e,messages:t=[],placeholder:n=`Type your message...`,onSendMessage:r,onClear:i,onStop:a,onReload:o,onUpgrade:s,disabled:c=!1,readOnly:u=!1,isLoading:d=!1,error:f,showTimestamp:p=!1,showAvatars:m=!1,userAvatarUrl:h,userAvatarFallback:g=`You`,assistantAvatarUrl:_,assistantAvatarFallback:v=`AI`,hideClearBar:y=!1,maxHeight:b=`500px`,enableMarkdown:x=!0,enableFileUpload:S=!1,acceptedFileTypes:C=`image/*,.pdf,.doc,.docx,.txt`,maxFileSize:w=10*1024*1024,suggestions:T,labels:E,models:D,selectedModelId:ee,onModelChange:O,headerSlot:te,promptOverlaySlot:ne,onInputChange:re,onToolApprove:ie,toolApproveLabel:ae=`Approve`,toolDenyLabel:oe=`Deny`,toolDenyReason:se=`User denied the operation`,toolDecisions:de,onReviewDraft:fe,toolReviewLabel:pe=e=>`Review ${e} change${e===1?``:`s`}`,onPublishDrafts:he,onOpenBuiltApp:ge,openBuiltAppLabel:ve=`Open app`,onPreviewDraftApp:ye,previewDraftLabel:be=`Preview`,onDraftArtifacts:Ce,onBuildMaterialized:we,publishDraftsLabel:Ee=`Publish`,publishedLabel:De=`Published`,verifiedLabel:Oe=`Verified`,nextStepsLabel:ke=`What's next`,planTitleLabel:Ae=`Proposed plan`,planExtendLabel:je=`Adding to existing app`,planQuestionsLabel:Me=`Confirm before building`,planAssumptionsLabel:Ne=`Assumptions`,planDeferredLabel:Pe=`Not yet built`,planApproveHintLabel:Fe=`Reply to approve or adjust this plan.`,planApproveLabel:Ie=`Build it`,planAdjustLabel:Le=`Adjust`,planBuiltLabel:Re=`Built`,planReadyLabel:ze=`The plan is ready. Build it now, or tell me what to adjust.`,planApproveMessage:Be=`Looks good — build it as proposed.`,planApproveDefaultsMessage:Ve=`Build it with your best assumptions; use sensible defaults for the open questions.`,planAnswerMessage:He=(e,t)=>`For "${e}", go with: ${t}.`,fetchPendingDraftCount:Ue,autoPublishDrafts:We=!1,processVisibility:Ge=`summary`,surface:Ke=`card`,...qe},Je)=>{let Ye=d?`streaming`:`ready`,Xe=Ke===`plain`,[Ze,Qe]=I.useState(null),$e=I.useRef(``),et=I.useRef(null),j=I.useMemo(()=>({emptyTitle:E?.emptyTitle??`Start a conversation`,emptyDescription:E?.emptyDescription??`Ask anything — the assistant has access to your current app context.`,clear:E?.clear??`Clear`,sendHint:E?.sendHint??`to send`,agentActivity:E?.agentActivity??`Agent activity`,toolCompleted:E?.toolCompleted??`Completed`,toolRunning:E?.toolRunning??`Running`,toolAwaitingApproval:E?.toolAwaitingApproval??`Awaiting approval`,toolFailed:E?.toolFailed??`Failed`,toolDetailsHidden:E?.toolDetailsHidden??`Detailed tool inputs and outputs are hidden in this view.`,copy:E?.copy??`Copy`,copied:E?.copied??`Copied`,regenerate:E?.regenerate??`Regenerate`,model:E?.model??`Model`,submit:E?.submit??`Submit`,uploadFiles:E?.uploadFiles??`Upload files`,stopResponse:E?.stopResponse??`Stop response`,sendFailedRateLimited:E?.sendFailedRateLimited??`You're sending messages too quickly. Your message is kept below — wait a moment and try again.`,sendFailedGeneric:E?.sendFailedGeneric??`Couldn't send your message. It's kept below — please try again.`,trace:E?.trace??`trace`,viewTrace:E?.viewTrace??`View trace`,connectionWaiting:E?.connectionWaiting??`Waiting for server…`,connectionStalledLabel:E?.connectionStalledLabel??`Still working…`,connectionOfflineLabel:E?.connectionOfflineLabel??`Connection lost — reconnecting…`,designingPlanLabel:E?.designingPlanLabel??`Designing your app…`,designingPlanHints:E?.designingPlanHints??ek}),[E]),[nt,rt]=I.useState(()=>new Set),[it,at]=I.useState(()=>new Map),[ot,st]=I.useState(()=>new Map),ct=I.useRef(new Set),lt=I.useCallback(async e=>{if(Ue)try{let t=await Ue(e);st(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}catch{}},[Ue]);I.useEffect(()=>{if(!Ue||d)return;let e=new Set;for(let n of t)for(let t of n.toolInvocations??[]){let n=t.draftReview?.packageId,r=t.toolCallId;n&&r&&!ct.current.has(r)&&(ct.current.add(r),e.add(n))}for(let t of e)lt(t)},[t,d,Ue,lt]);let ut=I.useCallback(async e=>{if(!he)return;let n=[];for(let r of t)for(let t of r.toolInvocations??[])t.draftReview?.packageId===e&&t.toolCallId&&n.push(t.toolCallId);let r=await he(e),i=r&&typeof r==`object`?r:void 0;if((i?i.ok!==!1:r!==!1)&&n.length>0){rt(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});let e=i?.health;e&&at(t=>{let r=new Map(t);for(let t of n)r.set(t,e);return r})}lt(e)},[he,t,lt]),ft=I.useRef(new Set),pt=I.useRef(!1);I.useEffect(()=>{let e=[];for(let n of t)for(let t of n.toolInvocations??[]){let n=t.draftReview;n?.autoPublishable&&n.packageId&&t.toolCallId&&n.items.length>0&&e.push({key:t.toolCallId,packageId:n.packageId})}if(!pt.current){pt.current=!0;for(let t of e)ft.current.add(t.key);return}if(!We||!he||d)return;let n=e.filter(e=>!ft.current.has(e.key));if(n.length!==0){for(let e of n)ft.current.add(e.key);for(let e of[...new Set(n.map(e=>e.packageId))])ut(e)}},[t,d,We,he,ut]);let mt=I.useRef(new Set);I.useEffect(()=>{if(!Ce)return;let e=new Map,n;for(let r of t){for(let t of r.buildProgress?.items??[])t?.type&&t?.name&&e.set(`${t.type}:${t.name}`,t);for(let t of r.toolInvocations??[]){let r=t.draftReview;for(let t of r?.items??[])t?.type&&t?.name&&e.set(`${t.type}:${t.name}`,t);r?.packageId&&r.items?.some(e=>e.type===`app`)&&(n=r.packageId)}}let r=mt.current,i=!1;for(let t of e.keys())r.has(t)||(r.add(t),i=!0);i&&Ce([...e.values()],n)},[t,Ce]);let ht=I.useRef(new Set);I.useEffect(()=>{if(we)for(let e of t)for(let t of e.toolInvocations??[]){let e=t.draftReview;if(!e?.materialized||!t.toolCallId)continue;let n=e.items.find(e=>e.type===`app`);!n||ht.current.has(t.toolCallId)||(ht.current.add(t.toolCallId),we(n.name))}},[t,we]);let gt=I.useCallback(e=>{let t=!!e.text?.trim(),n=e.files?.map(e=>e.file).filter(Boolean),i=!!(n&&n.length>0);if(!(t||i))return;let a=e.text?.trim()??``;$e.current=a,et.current=null,r?.(a,n)},[r]),vt=I.useCallback(e=>{r?.(e)},[r]),yt=I.useRef(null),bt=I.useCallback(e=>{r?.(e?Ve:Be)},[r,Be,Ve]),St=I.useCallback(()=>{let e=yt.current?.querySelector(`textarea`);e&&(e.focus(),e.scrollIntoView({block:`nearest`}))},[]);I.useEffect(()=>{if(!f||!vo(f)||et.current===f)return;et.current=f;let e=$e.current;if(!e)return;let t=yt.current?.querySelector(`textarea`);t&&t.value.trim()===``&&(t.value=e,t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.focus())},[f]);let Ct=I.useCallback(e=>{navigator.clipboard?.writeText(e.content),Qe(e.id),window.setTimeout(()=>Qe(t=>t===e.id?null:t),1500)},[]),wt=I.useMemo(()=>{let e=new Set,n=[],r=-1,i=0;for(let e of t)for(let t of e.toolInvocations??[])(t.proposedPlan||RO(t))&&t.toolCallId&&n.push({id:t.toolCallId,order:i}),t.toolName===`apply_blueprint`&&(r=i),i+=1;for(let t of n)t.order<r&&e.add(t.id);return e},[t]),Tt=I.useMemo(()=>{let e=new Set,n=[],r=new Map,i=0;for(let e of t)for(let t of e.toolInvocations??[])t.proposedChanges&&t.toolCallId?n.push({id:t.toolCallId,toolName:t.toolName??``,order:i}):t.toolName&&r.set(t.toolName,i),i+=1;for(let t of n){let n=r.get(t.toolName);n!==void 0&&n>t.order&&e.add(t.id)}return e},[t]),Dt=e=>{let t=e.state??(e.errorText?`output-error`:e.result===void 0?`input-available`:`output-available`),n=`tool-${e.toolName}`,i=de?.[e.toolCallId],a=t===`approval-requested`&&!!ie&&!i,o=t===`approval-requested`&&!!e.pendingActionId,s=po(e.toolName),c=mo(e.result),l=Ge===`debug`&&s&&s.toLowerCase()!==e.toolName.toLowerCase(),u=Ge===`debug`||a,d=e.draftReview?.packageId,f=d===void 0?void 0:ot.get(d),p=f===void 0?nt.has(e.toolCallId):f===0,m=t===`input-streaming`||t===`input-available`,h=(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{children:s||e.toolName}),l?(0,R.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground`,children:e.toolName}):null,m?LO(e)?(0,R.jsx)(rk,{label:j.designingPlanLabel,hints:j.designingPlanHints,offlineLabel:j.connectionOfflineLabel}):(0,R.jsx)(ik,{offlineLabel:j.connectionOfflineLabel}):null]});return(0,R.jsxs)(V_,{defaultOpen:t===`output-error`||t===`approval-requested`||!!(e.draftReview&&e.draftReview.items.length>0)||!!e.proposedPlan||!!e.proposedChanges||RO(e),children:[(0,R.jsx)(U_,{type:n,state:t,title:h}),(0,R.jsxs)(W_,{children:[u&&e.args!==void 0?(0,R.jsx)(G_,{input:e.args}):null,o?null:u||t===`output-error`?(0,R.jsx)(mk,{output:c,errorText:e.errorText}):null,i?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 p-3 border-t text-xs `+(i.state===`error`?`bg-destructive/10 text-destructive`:i.state===`success`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`:`bg-muted/30 text-muted-foreground`),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,children:i.state===`pending`?`...`:i.state===`success`?`OK`:`X`}),(0,R.jsx)(`span`,{children:i.message??(i.state===`pending`?`Submitting decision...`:i.state===`success`?`Action approved and executed.`:`Decision failed.`)})]}):null,a?(0,R.jsxs)(`div`,{className:`flex gap-2 p-3 border-t bg-muted/30`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>ie?.(e.toolCallId,!0),className:`inline-flex h-7 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:ae}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>ie?.(e.toolCallId,!1,se),className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,children:oe})]}):null,e.draftReview&&e.draftReview.items.length>0&&(fe||he&&e.draftReview.packageId)?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 p-3 border-t bg-muted/30`,children:[he&&e.draftReview.packageId?p?(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700`,children:[(0,R.jsx)(k,{className:`size-3.5`}),De,e.draftReview.failedCount?` · ${e.draftReview.failedCount} need${e.draftReview.failedCount===1?`s`:``} attention`:``]}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void ut(e.draftReview.packageId),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`draft-publish`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ee,typeof f==`number`&&f>0?` (${f})`:``]}):null,fe?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>fe(e.draftReview.items),className:he&&e.draftReview.packageId?`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[(0,R.jsx)(jt,{className:`size-3.5`}),pe(e.draftReview.items.length)]}):null,ye&&!p?(()=>{let t=e.draftReview.items.find(e=>e.type===`app`);return t?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ye(t.name,{materialized:e.draftReview.materialized===!0,appSegment:e.draftReview.packageId}),className:`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`,"data-testid":`draft-preview-app`,children:[(0,R.jsx)(ce,{className:`size-3.5`}),be]}):null})():null,e.draftReview.verification?e.draftReview.verification.errors>0?(0,R.jsxs)(`span`,{className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-200 bg-amber-50 px-2.5 text-xs font-medium text-amber-700`,"data-testid":`draft-verification-chip`,children:[(0,R.jsx)(le,{className:`size-3.5`}),`${e.draftReview.verification.errors} issue${e.draftReview.verification.errors===1?``:`s`}`]}):(0,R.jsxs)(`span`,{className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700`,"data-testid":`draft-verification-chip`,children:[(0,R.jsx)(xe,{className:`size-3.5`}),Oe]}):null,e.draftReview.summary?(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.draftReview.summary}):null]}),e.draftReview.issues&&e.draftReview.issues.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`draft-issues`,children:[e.draftReview.issues.filter(e=>e.severity===`error`).map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.fix?`${e.message} — ${e.fix}`:e.message})]},`e${t}`)),e.draftReview.issues.filter(e=>e.severity!==`error`).map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-amber-600`,children:[(0,R.jsx)(_e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`w${t}`))]}):null,nt.has(e.toolCallId)?(0,R.jsx)(WO,{health:it.get(e.toolCallId)}):null,e.draftReview.nextSteps&&e.draftReview.nextSteps.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`draft-next-steps`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-foreground/80`,children:ke}),e.draftReview.nextSteps.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-foreground/40`,children:`→`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null]}):null,e.proposedPlan?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-plan`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),Ae]}),e.proposedPlan.targetApp?(0,R.jsxs)(`span`,{className:`inline-flex w-fit items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300`,"data-testid":`proposed-plan-extend`,children:[`+ `,je,` 「`,e.proposedPlan.targetApp,`」`]}):null,e.proposedPlan.summary?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.proposedPlan.summary}):null,e.proposedPlan.objects.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.proposedPlan.objects.map(e=>(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80`,title:e.name,children:[(0,R.jsx)(tt,{className:`size-3 text-foreground/40`}),e.label||e.name,e.fieldCount>0?(0,R.jsxs)(`span`,{className:`text-foreground/40`,children:[`· `,e.fieldCount]}):null]},e.name))}):null,(()=>{let t=e.proposedPlan.counts,n=[];return t.objects&&n.push(`${t.objects} object${t.objects===1?``:`s`}`),t.views&&n.push(`${t.views} view${t.views===1?``:`s`}`),t.dashboards&&n.push(`${t.dashboards} dashboard${t.dashboards===1?``:`s`}`),t.seedData&&n.push(`sample data`),n.length?(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n.join(` · `)}):null})(),(()=>{let{designNotes:t,deferred:n}=BO(e.proposedPlan.assumptions);return(0,R.jsxs)(R.Fragment,{children:[t.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`proposed-plan-assumptions`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-foreground/70`,children:Ne}),t.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-foreground/40`,children:`·`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null,n.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-dashed border-amber-300 bg-amber-50/60 px-2 py-1.5 dark:border-amber-800/60 dark:bg-amber-950/20`,"data-testid":`proposed-plan-deferred`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300`,children:[(0,R.jsx)(Et,{className:`size-3.5`}),Pe]}),n.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-amber-500/80`,children:`·`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null]})})(),e.proposedPlan.questions.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-amber-200 bg-amber-50 px-2 py-1.5 dark:border-amber-900/50 dark:bg-amber-950/30`,"data-testid":`proposed-plan-questions`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300`,children:[(0,R.jsx)(Se,{className:`size-3.5`}),Me]}),e.proposedPlan.questions.map((t,n)=>{let i=e.proposedPlan.questionChoices?.find(e=>e.text===t);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0`,children:`?`}),(0,R.jsx)(`span`,{children:t})]}),r&&i&&i.options.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1 pl-3.5`,"data-testid":`proposed-plan-choice`,children:i.options.map((e,n)=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(He(t,e)),className:`inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40`,children:e},n))}):null]},n)})]}):null,r?wt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-plan-built`,children:[(0,R.jsx)(k,{className:`size-3.5`}),Re]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>bt(e.proposedPlan.questions.length>0),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-plan-approve`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ie]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-plan-adjust`,children:Le})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:Fe})]}):null,RO(e)?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-plan-fallback`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),Ae]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ze}),r?wt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-plan-built`,children:[(0,R.jsx)(k,{className:`size-3.5`}),Re]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>bt(!1),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-plan-approve`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ie]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-plan-adjust`,children:Le})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:Fe})]}):null,e.proposedChanges?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-changes`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),`确认改动`]}),e.proposedChanges.summary?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.proposedChanges.summary}):null,(0,R.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.proposedChanges.changes.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80`,children:[(0,R.jsx)(tt,{className:`mt-px size-3 shrink-0 text-foreground/40`}),(0,R.jsx)(`span`,{children:IO(e)})]},t))}),r?Tt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-changes-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-changes-confirmed`,children:[(0,R.jsx)(k,{className:`size-3.5`}),`已确认`]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-changes-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`确认修改,应用你刚才提议的改动。`),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-changes-confirm`,children:[(0,R.jsx)(k,{className:`size-3.5`}),`确认修改`]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-changes-adjust`,children:`调整`})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:`回复以确认或调整该改动。`})]}):null]})]},e.toolCallId)};return(0,R.jsxs)(`div`,{ref:Je,className:A(Xe?`flex min-h-0 flex-col overflow-hidden bg-background`:`flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background`,e),style:{maxHeight:b},...qe,children:[i&&!y&&t.length>0&&(0,R.jsx)(`div`,{className:A(`flex items-center justify-end px-4 py-2`,Xe?`bg-background`:`border-b bg-muted/30`),children:(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:j.clear})}),te?(0,R.jsx)(`div`,{className:A(`shrink-0`,!Xe&&`border-b bg-background/50`),children:te}):null,(0,R.jsxs)(Po,{className:`flex-1 min-h-0`,children:[(0,R.jsxs)(Fo,{className:A(`space-y-4`,Xe?`mx-auto w-full max-w-2xl px-4 py-8 sm:px-0`:`px-4 py-3`),children:[t.length===0?(0,R.jsxs)(Io,{className:`gap-3 px-0 py-8`,children:[(0,R.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-md bg-muted/70 text-muted-foreground`,children:_?(0,R.jsx)(`img`,{src:_,alt:``,className:`size-full rounded-md object-cover`}):(0,R.jsx)(_t,{className:`size-4`})}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-foreground/90`,children:j.emptyTitle}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j.emptyDescription})]}),T&&T.length>0?(0,R.jsx)(Cp,{className:`justify-center gap-2`,children:T.map(e=>(0,R.jsx)(wp,{className:`h-8 border-border/60 bg-background/80 px-3 text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60`,suggestion:e,onClick:vt},e))}):null]}):t.map(e=>{let t=e.role===`user`,n=e.toolInvocations??[],r=e.reasoning?.trim(),i=e.sources??[],a=t?void 0:e.buildProgress,s=!t&&!n.some(e=>!!e.proposedPlan)?e.blueprintProgress:void 0,c=!t&&!!e.streaming&&!e.content&&n.length===0&&!r&&!a&&!s,u=!t&&Ge===`summary`?n.filter(e=>!VO(e)&&!(s&&e.toolName===`propose_blueprint`)):[],d=!t&&Ge===`debug`?n:!t&&Ge!==`debug`?n.filter(VO):[];return(0,R.jsx)(Uf,{from:NO(e.role),children:(0,R.jsxs)(`div`,{className:A(`flex w-full gap-2.5`,m?t?`flex-row-reverse items-start`:`flex-row items-start`:`flex-col`),children:[m?(0,R.jsx)(KO,{isUser:t,url:t?h:_,fallback:t?g:v}):null,(0,R.jsxs)(`div`,{className:A(`flex min-w-0 flex-col gap-2`,m&&!t&&`flex-1`),children:[(0,R.jsxs)(Wf,{children:[s?(0,R.jsx)(sk,{progress:s,designingLabel:j.designingPlanLabel,extendLabel:je,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null,a?(0,R.jsx)(ck,{progress:a,onOpenBuiltApp:ge,openBuiltAppLabel:ve,onPreviewDraftApp:ye,previewDraftLabel:be,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null,!t&&Ge===`debug`&&r?(0,R.jsxs)(wO,{isStreaming:!!e.streaming&&!e.content,className:`mb-2`,children:[(0,R.jsx)(EO,{}),(0,R.jsx)(DO,{children:r})]}):null,!t&&Ge===`summary`&&u.length>0?(0,R.jsx)(lk,{groups:UO(u),labels:j}):null,!t&&d.length>0?d.map(Dt):null,t?e.content?(0,R.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.content}):null:c?(0,R.jsx)(JO,{}):e.content?(0,R.jsx)(qf,{children:e.content}):null,e.streaming&&!c?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse`}):null,!t&&(e.charts?.length??0)>0?(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-3`,"data-testid":`chat-charts`,children:e.charts.map((e,t)=>(0,R.jsxs)(`div`,{className:`rounded-lg border bg-background p-3`,style:{width:`min(520px, 80vw)`},"data-testid":`chat-chart`,children:[e.title?(0,R.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:e.title}):null,(0,R.jsx)(l,{schema:{type:`chart`,chartType:e.chartType??`bar`,data:e.data,xAxisKey:e.xAxisKey,series:e.series}})]},t))}):null,!t&&i.length>0?(0,R.jsxs)(OO,{children:[(0,R.jsx)(kO,{count:i.length}),(0,R.jsx)(AO,{children:i.map((e,t)=>(0,R.jsx)(jO,{href:e.url,title:e.title??e.url},e.id??e.url??t))})]}):null,p&&e.timestamp?(0,R.jsx)(`div`,{className:`text-[10px] opacity-70 mt-1`,children:e.timestamp}):null]}),!t&&!c?(0,R.jsxs)(Gf,{className:`opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[(0,R.jsx)(Kf,{label:Ze===e.id?j.copied:j.copy,tooltip:Ze===e.id?j.copied:j.copy,onClick:()=>Ct(e),children:Ze===e.id?(0,R.jsx)(ue,{className:`size-3.5`}):(0,R.jsx)(xt,{className:`size-3.5`})}),o?(0,R.jsx)(Kf,{label:j.regenerate,tooltip:j.regenerate,onClick:o,children:(0,R.jsx)(Te,{className:`size-3.5`})}):null,Ge===`debug`&&e.traceId?(0,R.jsx)(`a`,{href:`#trace/${e.traceId}`,"data-trace-id":e.traceId,className:`text-[10px] text-muted-foreground hover:text-foreground ml-1 underline`,title:j.viewTrace,children:j.trace}):null]}):null]})]})},e.id)}),d&&!t.some(e=>e.streaming)?(0,R.jsx)(qO,{showAvatar:m,assistantAvatarUrl:_,assistantAvatarFallback:v,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null]}),(0,R.jsx)(Lo,{})]}),f?vo(f)&&!_o(f)?(0,R.jsx)(fk,{error:f,rateLimitedLabel:j.sendFailedRateLimited,genericLabel:j.sendFailedGeneric}):(0,R.jsx)(pk,{error:f,onReload:o,onUpgrade:s}):null,u?null:(0,R.jsxs)(`div`,{ref:yt,className:A(`relative`,Xe&&`mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0`),children:[ne?(0,R.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 px-3 pb-1`,children:ne}):null,(0,R.jsxs)(dp,{accept:C,fileInputLabel:j.uploadFiles,maxFileSize:w,onSubmit:gt,onError:e=>{console.warn(`[plugin-chatbot] prompt-input error`,e)},children:[S?(0,R.jsx)(fp,{children:(0,R.jsx)(lp,{children:e=>(0,R.jsx)(cp,{data:e})})}):null,(0,R.jsx)(pp,{placeholder:n,disabled:c||Ye===`streaming`,onChange:re?e=>re(e.currentTarget.value):void 0}),(0,R.jsxs)(mp,{children:[(0,R.jsxs)(hp,{children:[S?(0,R.jsxs)(_p,{children:[(0,R.jsx)(vp,{}),(0,R.jsx)(yp,{children:(0,R.jsx)(up,{})})]}):null,D&&D.length>0?(0,R.jsx)(`select`,{"aria-label":j.model,value:ee??D[0].id,onChange:e=>O?.(e.target.value),className:`h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:D.map(e=>(0,R.jsxs)(`option`,{value:e.id,children:[e.label??e.id,e.provider?` · ${e.provider}`:``]},e.id))}):null,(0,R.jsxs)(`span`,{className:`hidden items-center gap-1 text-[10px] text-muted-foreground sm:inline-flex`,"aria-hidden":`true`,children:[(0,R.jsx)(`kbd`,{className:`inline-flex h-4 items-center rounded border bg-muted px-1 font-mono text-[10px] leading-none`,children:`⌘`}),(0,R.jsx)(dt,{className:`h-3 w-3`}),(0,R.jsx)(`span`,{className:`opacity-70`,children:j.sendHint})]})]}),(0,R.jsx)(bp,{"aria-label":Ye===`streaming`?j.stopResponse:j.submit,status:Ye,disabled:c,onClick:Ye===`streaming`?a:void 0,type:Ye===`streaming`?`button`:`submit`})]})]})]})]})});GO.displayName=`ChatbotEnhanced`;function KO({isUser:e,url:t,fallback:n}){return(0,R.jsx)(`div`,{className:A(`mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium`,e?`bg-secondary text-secondary-foreground`:`bg-primary/10 text-primary`),"aria-hidden":`true`,children:t?(0,R.jsx)(`img`,{src:t,alt:``,className:`size-full object-cover`}):e?n?.trim()?.charAt(0)?.toUpperCase()||`U`:(0,R.jsx)(_t,{className:`size-4`})})}function qO({showAvatar:e,assistantAvatarUrl:t,assistantAvatarFallback:n,waitingLabel:r,stalledLabel:i,offlineLabel:a}){return(0,R.jsx)(Uf,{from:`assistant`,"aria-live":`polite`,children:(0,R.jsxs)(`div`,{className:A(`flex w-full gap-2.5`,e?`flex-row items-start`:`flex-col`),children:[e?(0,R.jsx)(KO,{isUser:!1,url:t,fallback:n}):null,(0,R.jsx)(Wf,{className:`rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(JO,{}),(0,R.jsx)($O,{active:!0,pending:!0,activityKey:0,waitingLabel:r,stalledLabel:i,offlineLabel:a})]})})]})})}function JO(){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`Assistant is responding`}),(0,R.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`}),(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`}),(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`})]})]})}function YO(e){let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}var XO=6;function ZO(e,t){let n=I.useRef(0),r=I.useRef(0),[i,a]=I.useState({elapsed:0,quiet:0});return I.useEffect(()=>{let e=Date.now();n.current=e,r.current=e},[]),I.useEffect(()=>{let e=Date.now();r.current=e,a({elapsed:Math.floor((e-n.current)/1e3),quiet:0})},[t]),I.useEffect(()=>{if(!e)return;let t=()=>{let e=Date.now();a({elapsed:Math.floor((e-n.current)/1e3),quiet:Math.floor((e-r.current)/1e3)})};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),{elapsedSeconds:i.elapsed,quietSeconds:i.quiet,live:i.quiet<XO}}function QO(){let[e,t]=I.useState(()=>typeof navigator<`u`&&navigator.onLine===!1);return I.useEffect(()=>{if(typeof window>`u`)return;let e=()=>t(!1),n=()=>t(!0);return window.addEventListener(`online`,e),window.addEventListener(`offline`,n),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,n)}},[]),e}function $O({active:e,activityKey:t,pending:n=!1,waitingLabel:r,stalledLabel:i=`Still working…`,offlineLabel:a=`Connection lost — reconnecting…`}){let{elapsedSeconds:o,quietSeconds:s,live:c}=ZO(e,t),l=QO()?`offline`:c?n?`waiting`:`receiving`:`stalled`,u=YO(o);return(0,R.jsxs)(`span`,{className:A(`inline-flex items-center gap-1.5 text-xs tabular-nums`,l===`offline`?`text-red-600 font-medium`:l===`stalled`?`text-amber-600 font-medium`:`font-normal text-muted-foreground`),"aria-live":`polite`,"data-liveness-tier":l,title:l===`offline`?`${a} · ${u} elapsed`:l===`receiving`?`Receiving from server · ${u} elapsed`:l===`stalled`?`${i} (${s}s with no response) · ${u} elapsed`:`${r} · ${u} elapsed`,children:[l===`offline`?(0,R.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}):(0,R.jsx)(`span`,{"aria-hidden":!0,className:A(`size-1.5 shrink-0 rounded-full`,l===`receiving`?`bg-emerald-500 animate-pulse`:l===`stalled`?`bg-amber-500`:`bg-muted-foreground/50 animate-pulse`)}),(0,R.jsx)(Je,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,R.jsx)(`span`,{children:u}),l===`receiving`?null:(0,R.jsxs)(`span`,{children:[`· `,l===`offline`?a:l===`stalled`?i:r]})]})}var ek=[`Mapping out the data you’ll track…`,`Shaping objects and their fields…`,`Connecting related records…`,`Setting up relationships and lookups…`,`Planning the screens and views…`,`Laying out forms and lists…`,`Adding sensible defaults and validations…`,`Sketching a dashboard to track it…`,`Double-checking the structure hangs together…`,`Pulling the plan together…`],tk=3500;function nk(e,t,n=tk){if(t<=0)return-1;if(t===1)return 0;let r=Math.floor((Number.isFinite(e)&&e>0?e:0)/(n>0?n:tk));return Math.min(r,t-1)}function rk({label:e,hints:t,offlineLabel:n}){let[r,i]=I.useState(0);I.useEffect(()=>{if(t.length<=1)return;let e=Date.now(),n=setInterval(()=>i(Date.now()-e),tk);return()=>clearInterval(n)},[t.length]);let a=nk(r,t.length),o=a>=0?t[a]:void 0,s=t.length>1&&t.length<=12;return(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,"data-testid":`build-proposal-progress`,"aria-live":`polite`,children:[(0,R.jsx)(Xe,{className:`size-3 shrink-0 animate-pulse text-primary`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`font-medium text-foreground/80`,children:e}),o?(0,R.jsx)(`span`,{className:`truncate animate-in fade-in duration-500`,children:o},o):null,s?(0,R.jsx)(`span`,{className:`hidden shrink-0 items-center gap-0.5 sm:inline-flex`,"data-testid":`build-proposal-progress-dots`,"aria-hidden":!0,children:t.map((e,t)=>(0,R.jsx)(`span`,{className:A(`size-1 rounded-full transition-colors`,t<=a?`bg-primary/70`:`bg-muted-foreground/25`)},t))}):null,(0,R.jsx)(ik,{offlineLabel:n})]})}function ik({offlineLabel:e}){let[t,n]=I.useState(0),r=QO();return I.useEffect(()=>{let e=Date.now(),t=setInterval(()=>n(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[]),(0,R.jsxs)(`span`,{className:A(`inline-flex items-center gap-1 text-xs tabular-nums`,r?`text-red-600 font-medium`:`text-muted-foreground`),"aria-live":`polite`,"data-tool-running-timer":!0,children:[r?(0,R.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}):(0,R.jsx)(Je,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,R.jsx)(`span`,{children:YO(t)}),r?(0,R.jsxs)(`span`,{children:[`· `,e]}):null]})}var ak=[`object`,`view`,`dashboard`,`app`,`seed`],ok={object:`Objects`,view:`Views`,dashboard:`Dashboards`,app:`App`,seed:`Sample data`};function sk({progress:e,designingLabel:t=`Designing your app…`,extendLabel:n=`Adding to existing app`,waitingLabel:r=`Waiting for server…`,stalledLabel:i=`Still working…`,offlineLabel:a=`Connection lost — reconnecting…`}){let{phase:o,summary:s,appLabel:c,targetApp:l,objects:u,counts:d,seq:f}=e,p=o===`done`,m=f??`${o}:${u.length}`,h=p&&(s||c)||t,g=[];return d?.objects&&g.push(`${d.objects} object${d.objects===1?``:`s`}`),d?.views&&g.push(`${d.views} view${d.views===1?``:`s`}`),d?.dashboards&&g.push(`${d.dashboards} dashboard${d.dashboards===1?``:`s`}`),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,"data-testid":`blueprint-progress`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[p?(0,R.jsx)(k,{className:`size-4 shrink-0 text-emerald-600`}):(0,R.jsx)(Nt,{className:`size-4 shrink-0 animate-spin text-primary`}),(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:h}),l?(0,R.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-1.5 py-0.5 text-[10px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300`,"data-testid":`blueprint-progress-extend`,children:[`+ `,n,` 「`,l,`」`]}):null,p?null:(0,R.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,R.jsx)($O,{active:!0,activityKey:m,waitingLabel:r,stalledLabel:i,offlineLabel:a})})]}),!p&&(s||c)?(0,R.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:s||c}):null,u.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,"data-testid":`blueprint-progress-objects`,children:u.map(e=>(0,R.jsxs)(`span`,{className:`inline-flex animate-in fade-in items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80 duration-500`,title:e.name,children:[(0,R.jsx)(tt,{className:`size-3 text-foreground/40`}),e.label||e.name,e.fields?(0,R.jsxs)(`span`,{className:`text-foreground/40`,children:[`· `,e.fields]}):null]},e.name))}):null,g.length>0?(0,R.jsx)(`span`,{className:`mt-2 block text-[11px] text-muted-foreground`,children:g.join(` · `)}):null]})}function ck({progress:e,onOpenBuiltApp:t,openBuiltAppLabel:n=`Open app`,onPreviewDraftApp:r,previewDraftLabel:i=`Preview`,waitingLabel:a=`Waiting for server…`,stalledLabel:o=`Still working…`,offlineLabel:s=`Connection lost — reconnecting…`}){let{phase:c,appLabel:l,items:u,done:d,total:f,seq:p}=e,m=c===`done`,h=p??`${c}:${d}:${u.length}`,g=u.find(e=>e.type===`app`),_=f>0?Math.min(100,Math.round(d/f*100)):m?100:6,v=new Map;for(let e of u){let t=v.get(e.type)??[];t.push(e.name.replace(/_sample$/,``)),v.set(e.type,t)}let y=[...ak.filter(e=>v.has(e)),...[...v.keys()].filter(e=>!ak.includes(e))];return(0,R.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,"data-testid":`build-progress`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[m?(0,R.jsx)(k,{className:`size-4 shrink-0 text-emerald-600`}):(0,R.jsx)(Nt,{className:`size-4 shrink-0 animate-spin text-primary`}),(0,R.jsx)(`span`,{children:m?`Built ${l??`your app`}`:`Building ${l??`your app`}…`}),!m&&c===`data`?(0,R.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`adding sample data`}):null,m?null:(0,R.jsx)(`span`,{className:`ml-auto`,children:(0,R.jsx)($O,{active:!0,activityKey:h,waitingLabel:a,stalledLabel:o,offlineLabel:s})})]}),(0,R.jsx)(`div`,{className:`mb-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:A(`h-full rounded-full transition-all duration-500`,m?`bg-emerald-500`:`bg-primary`),style:{width:`${_}%`}})}),(0,R.jsx)(`ul`,{className:`space-y-1`,children:y.map(e=>{let t=v.get(e);return(0,R.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(k,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600`}),(0,R.jsxs)(`span`,{className:`min-w-0 text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:ok[e]??e}),` `,t.slice(0,6).join(`, `),t.length>6?` +${t.length-6} more`:``]})]},e)})}),m&&g&&(t||r)?(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[t?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(g.name),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`build-progress-open-app`,children:[n,(0,R.jsx)(Re,{className:`size-3.5`})]}):null,r?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(g.name),className:`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`,"data-testid":`build-progress-preview-app`,children:[(0,R.jsx)(ce,{className:`size-3.5`}),i]}):null]}):null]})}function lk({groups:e,labels:t}){return e.length===0?null:(0,R.jsx)(`div`,{className:`not-prose mb-2 border-l border-border/70 pl-3`,children:(0,R.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex min-h-6 items-center justify-between gap-3 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(uk,{state:e.state}),(0,R.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.title}),e.count>1?(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:[`x`,e.count]}):null]}),e.state===`running`?e.rawName===`propose_blueprint`?(0,R.jsx)(rk,{label:t.designingPlanLabel,hints:t.designingPlanHints,offlineLabel:t.connectionOfflineLabel}):(0,R.jsx)(ik,{offlineLabel:t.connectionOfflineLabel}):(0,R.jsx)(`span`,{className:A(`shrink-0 text-[10px] font-medium`,e.state===`failed`?`text-destructive`:e.state===`completed`?`text-emerald-700 dark:text-emerald-400`:`text-muted-foreground`),children:dk(e.state,t)})]},e.key))})})}function uk({state:e}){return e===`failed`?(0,R.jsx)(At,{className:`size-3.5 shrink-0 text-destructive`}):e===`completed`?(0,R.jsx)(k,{className:`size-3.5 shrink-0 text-emerald-600`}):(0,R.jsx)(Je,{className:`size-3.5 shrink-0 text-muted-foreground`})}function dk(e,t){switch(e){case`failed`:return t.toolFailed;case`awaiting`:return t.toolAwaitingApproval;case`running`:return t.toolRunning;case`completed`:return t.toolCompleted}}function fk({error:e,rateLimitedLabel:t,genericLabel:n}){let r=I.useMemo(()=>bo(e)?t:n,[e,t,n]);return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,"data-testid":`chat-send-error`,children:(0,R.jsx)(`div`,{className:`rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(le,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600`}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1 break-words leading-snug`,children:r})]})})})}function pk({error:e,onReload:t,onUpgrade:n}){let r=I.useMemo(()=>_o(e),[e]),{summary:i,details:a}=I.useMemo(()=>ho(e),[e]),[o,s]=I.useState(!1);if(r){let e=typeof navigator<`u`&&!!navigator.language?.toLowerCase().startsWith(`zh`),t=(e?r.message:r.messageEn??r.message)||(e?`AI 额度已用完。`:`You have reached your AI quota.`),i=r.topUp?e?`购买额度包`:`Buy a credit pack`:e?`升级方案`:`Upgrade plan`;return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,children:(0,R.jsx)(`div`,{className:`rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium leading-snug text-foreground`,children:e?`需要升级`:`Upgrade needed`}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words leading-snug text-muted-foreground`,children:t})]}),n?(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex h-7 shrink-0 items-center rounded-md border border-amber-400/50 bg-background px-2 text-xs font-medium text-amber-700 hover:bg-amber-100/60 dark:text-amber-300`,children:i}):null]})})})}return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,children:(0,R.jsxs)(`div`,{className:`rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-foreground`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(_e,{className:`mt-0.5 h-4 w-4 shrink-0 text-destructive`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium leading-snug text-destructive`,children:`Response failed`}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words leading-snug text-muted-foreground`,children:i||`Something went wrong. Please try again.`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[a?(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`inline-flex h-7 items-center rounded-md px-2 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-foreground`,"aria-expanded":o,children:o?`Hide`:`Details`}):null,t?(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex h-7 items-center rounded-md border border-destructive/30 bg-background px-2 text-xs font-medium text-destructive hover:bg-destructive/10`,children:[(0,R.jsx)(Te,{className:`mr-1 h-3 w-3`}),`Retry`]}):null]})]}),o&&a?(0,R.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded border bg-background px-2 py-1 font-mono text-[11px] leading-snug text-muted-foreground`,children:a}):null]})})}function mk({output:e,errorText:t}){return t?(0,R.jsx)(K_,{output:void 0,errorText:t}):e==null||e===``?null:typeof e==`string`&&!PO(e)?(0,R.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Result`}),(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground`,children:(0,R.jsx)(qf,{children:e})})]}):(0,R.jsx)(K_,{output:e,errorText:void 0})}function hk({floatingConfig:e,headerExtra:t,headerActions:n,...r}){let{position:i=`bottom-right`,defaultOpen:a=!1,panelWidth:o=400,panelHeight:s=520,title:c=`Chat`,triggerSize:l=56}=e??{},[u,d]=I.useState(null);I.useEffect(()=>{let e=document.getElementById(`floating-chatbot-portal`);return e||(e=document.createElement(`div`),e.id=`floating-chatbot-portal`,document.body.appendChild(e)),d(e),()=>{e&&e.parentNode&&!e.hasChildNodes()&&e.parentNode.removeChild(e)}},[]);let f=(0,R.jsxs)(Qa,{defaultOpen:a,children:[(0,R.jsx)(io,{position:i,size:l}),(0,R.jsx)(uo,{title:c,position:i,width:o,height:s,headerExtra:t,headerActions:n,children:(0,R.jsx)(GO,{...r,maxHeight:`100%`,className:`h-full border-0 rounded-none`})})]});return u?Gl.createPortal(f,u):f}d.register(`chatbot`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,sendMessage:a}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(Nk,{messages:r,placeholder:e.placeholder,onSendMessage:e=>{a(e)},disabled:e.disabled||i,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,maxHeight:e.maxHeight,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot`,inputs:[{name:`messages`,type:`array`,label:`Initial Messages`,description:`Array of message objects with id, role, content, and optional timestamp`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`showTimestamp`,type:`boolean`,label:`Show Timestamps`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`userAvatarUrl`,type:`string`,label:`User Avatar URL`,description:`URL of the user avatar image`},{name:`userAvatarFallback`,type:`string`,label:`User Avatar Fallback`,defaultValue:`You`,description:`Fallback text shown when user avatar image is not available`},{name:`assistantAvatarUrl`,type:`string`,label:`Assistant Avatar URL`,description:`URL of the assistant avatar image`},{name:`assistantAvatarFallback`,type:`string`,label:`Assistant Avatar Fallback`,defaultValue:`AI`,description:`Fallback text shown when assistant avatar image is not available`},{name:`maxHeight`,type:`string`,label:`Max Height`,defaultValue:`500px`},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint (e.g., /api/v1/ai/chat). When set, enables streaming AI mode.`},{name:`conversationId`,type:`string`,label:`Conversation ID`,description:`Multi-turn conversation identifier`},{name:`systemPrompt`,type:`string`,label:`System Prompt`,description:`System prompt to configure assistant behavior`},{name:`model`,type:`string`,label:`AI Model`,description:`AI model identifier (e.g., gpt-4o)`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1,description:`Automatically send a response after user message (for demo purposes, ignored when API is set)`},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,showTimestamp:!1,disabled:!1,userAvatarFallback:`You`,assistantAvatarFallback:`AI`,maxHeight:`500px`,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3,className:`w-full max-w-2xl`}}),d.register(`chatbot-enhanced`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,error:a,sendMessage:o,stop:s,reload:c,clear:l,isApiMode:u}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(GO,{messages:r,placeholder:e.placeholder,onSendMessage:(e,t)=>{o(e,t)},onClear:()=>{l(),e.onClear?.()},onStop:u&&i?s:void 0,onReload:u?c:void 0,disabled:e.disabled,isLoading:i,error:a,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,maxHeight:e.maxHeight,enableMarkdown:e.enableMarkdown??!0,enableFileUpload:e.enableFileUpload??!1,processVisibility:e.processVisibility,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot (Enhanced)`,inputs:[{name:`messages`,type:`array`,label:`Initial Messages`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`showTimestamp`,type:`boolean`,label:`Show Timestamps`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`enableMarkdown`,type:`boolean`,label:`Enable Markdown`,defaultValue:!0},{name:`enableFileUpload`,type:`boolean`,label:`Enable File Upload`,defaultValue:!1},{name:`processVisibility`,type:`enum`,label:`Agent Process Visibility`,defaultValue:`summary`},{name:`userAvatarUrl`,type:`string`,label:`User Avatar URL`},{name:`userAvatarFallback`,type:`string`,label:`User Avatar Fallback`,defaultValue:`You`},{name:`assistantAvatarUrl`,type:`string`,label:`Assistant Avatar URL`},{name:`assistantAvatarFallback`,type:`string`,label:`Assistant Avatar Fallback`,defaultValue:`AI`},{name:`maxHeight`,type:`string`,label:`Max Height`,defaultValue:`500px`},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint for streaming AI mode`},{name:`conversationId`,type:`string`,label:`Conversation ID`},{name:`systemPrompt`,type:`string`,label:`System Prompt`},{name:`model`,type:`string`,label:`AI Model`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,showTimestamp:!1,disabled:!1,enableMarkdown:!0,enableFileUpload:!1,userAvatarFallback:`You`,assistantAvatarFallback:`AI`,maxHeight:`500px`,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3,className:`w-full max-w-2xl`}}),d.register(`chatbot-floating`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,error:a,sendMessage:o,stop:s,reload:c,clear:l,isApiMode:u}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(hk,{floatingConfig:e.floatingConfig,messages:r,placeholder:e.placeholder,onSendMessage:(e,t)=>{o(e,t)},onClear:()=>{l(),e.onClear?.()},onStop:u&&i?s:void 0,onReload:u?c:void 0,disabled:e.disabled,isLoading:i,error:a,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,enableMarkdown:e.enableMarkdown??!0,enableFileUpload:e.enableFileUpload??!1,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot (Floating)`,inputs:[{name:`displayMode`,type:`string`,label:`Display Mode`,defaultValue:`floating`,description:`Set to "floating" for FAB widget`},{name:`floatingConfig.position`,type:`string`,label:`FAB Position`,defaultValue:`bottom-right`,description:`bottom-right or bottom-left`},{name:`floatingConfig.defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!1},{name:`floatingConfig.panelWidth`,type:`number`,label:`Panel Width`,defaultValue:400},{name:`floatingConfig.panelHeight`,type:`number`,label:`Panel Height`,defaultValue:520},{name:`floatingConfig.title`,type:`string`,label:`Panel Title`,defaultValue:`Chat`},{name:`floatingConfig.triggerSize`,type:`number`,label:`Trigger Size`,defaultValue:56},{name:`messages`,type:`array`,label:`Initial Messages`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`enableMarkdown`,type:`boolean`,label:`Enable Markdown`,defaultValue:!0},{name:`enableFileUpload`,type:`boolean`,label:`Enable File Upload`,defaultValue:!1},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint for streaming AI mode`},{name:`conversationId`,type:`string`,label:`Conversation ID`},{name:`systemPrompt`,type:`string`,label:`System Prompt`},{name:`model`,type:`string`,label:`AI Model`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{displayMode:`floating`,floatingConfig:{position:`bottom-right`,defaultOpen:!1,panelWidth:400,panelHeight:520,title:`Chat`,triggerSize:56},messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,enableMarkdown:!0,enableFileUpload:!1,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3}});var gk=`/api/v1/ai`;function _k(e,t,n){let r=e.replace(/\/$/,``),i=new URLSearchParams;if(n)for(let[e,t]of Object.entries(n))t==null||t===``||i.set(e,String(t));let a=i.toString();return`${r}${t}${a?`?${a}`:``}`}async function vk(e,t,n){let r=await fetch(e,{credentials:`include`,...t,headers:{Accept:`application/json`,"Content-Type":`application/json`,...n??{},...t.headers??{}}}),i=null;try{i=await r.json()}catch{}if(!r.ok){let e=i?.error?.message??i?.message??i?.error??`${r.status} ${r.statusText}`,t=Error(typeof e==`string`?e:JSON.stringify(e));throw t.status=r.status,t.body=i,t}return i}function yk(e={}){let{apiBase:t=gk,status:n=`pending`,conversationId:r,limit:i,headers:a,pollInterval:o=5e3,enabled:s=!0}=e,[c,l]=I.useState([]),[u,d]=I.useState(0),[f,p]=I.useState(!1),[m,h]=I.useState(void 0),g=I.useRef({apiBase:t,status:n,conversationId:r,limit:i,headers:a});g.current={apiBase:t,status:n,conversationId:r,limit:i,headers:a};let _=I.useCallback(async()=>{let{apiBase:e,status:t,conversationId:n,limit:r,headers:i}=g.current;p(!0),h(void 0);try{let a=await vk(_k(e,`/pending-actions`,{status:t&&t!==`all`?t:void 0,conversationId:n,limit:r}),{method:`GET`},i);l(Array.isArray(a.items)?a.items:[]),d(typeof a.total==`number`?a.total:a.items?.length??0)}catch(e){h(e instanceof Error?e:Error(String(e)))}finally{p(!1)}},[]),v=I.useCallback(async e=>{let{apiBase:t,headers:n}=g.current,r=_k(t,`/pending-actions/${encodeURIComponent(e)}/approve`);try{return await vk(r,{method:`POST`,body:`{}`},n)}finally{_()}},[_]),y=I.useCallback(async(e,t)=>{let{apiBase:n,headers:r}=g.current,i=_k(n,`/pending-actions/${encodeURIComponent(e)}/reject`);try{return await vk(i,{method:`POST`,body:JSON.stringify(t?{reason:t}:{})},r)}finally{_()}},[_]);return I.useEffect(()=>{if(!s||(_(),!o||o<=0))return;let e=setInterval(()=>{_()},o);return()=>clearInterval(e)},[s,o,_,t,n,r,i]),{items:c,total:u,isLoading:f,error:m,refresh:_,approve:v,reject:y}}var bk={pending:{variant:`secondary`,label:`Pending`},approved:{variant:`default`,label:`Approved`},executed:{variant:`default`,label:`Executed`},failed:{variant:`destructive`,label:`Failed`},rejected:{variant:`outline`,label:`Rejected`}};function xk({status:e}){let t=bk[e]??{variant:`outline`,label:e};return(0,R.jsx)(Le,{variant:t.variant,children:t.label})}function Sk(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/1e3);if(r<45)return`just now`;let i=Math.round(r/60);if(i<60)return`${i}m ago`;let a=Math.round(i/60);if(a<24)return`${a}h ago`;let o=Math.round(a/24);if(o<30)return`${o}d ago`;try{return new Date(e).toLocaleDateString()}catch{return e}}function Ck(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function wk({value:e,max:t=320}){let n=typeof e==`string`?e:JSON.stringify(e,null,2);return n==null||n===``?(0,R.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`—`}):(0,R.jsx)(`pre`,{className:`bg-muted/40 rounded text-xs p-2 overflow-auto whitespace-pre-wrap break-all`,style:{maxHeight:t},children:n})}function Tk(e){switch(e){case`pending`:return`pending`;case`all`:return`all`;case`decided`:return`all`}}function Ek({apiBase:e,headers:t,pollInterval:n=5e3,conversationId:r,variant:i=`card`,title:a=`AI Approvals`,description:o=`Actions an AI agent proposed that need a human review before execution.`,className:s}){let[c,l]=I.useState(`pending`),[u,d]=I.useState(null),[f,p]=I.useState(null),[m,h]=I.useState(``),[g,_]=I.useState(null),[v,y]=I.useState(null),[b,x]=I.useState(null),{items:S,isLoading:C,error:w,refresh:T,approve:E,reject:D}=yk({apiBase:e,headers:t,pollInterval:n,conversationId:r,status:Tk(c)}),ee=I.useMemo(()=>c===`decided`?S.filter(e=>e.status!==`pending`):S,[S,c]),O=I.useMemo(()=>u?S.find(e=>e.id===u)??null:null,[u,S]),re=I.useCallback(async e=>{_(e),y(null);try{let t=await E(e),n=t.status===`executed`;x({id:e,kind:`approve`,ok:n,message:n?`Executed`:t.error??`Action failed during execution`})}catch(t){let n=t instanceof Error?t.message:String(t);y(n),x({id:e,kind:`approve`,ok:!1,message:n})}finally{_(null)}},[E]),ie=I.useCallback(async(e,t)=>{_(e),y(null);try{await D(e,t.trim()||void 0),x({id:e,kind:`reject`,ok:!0,message:`Rejected`}),p(null),h(``)}catch(t){let n=t instanceof Error?t.message:String(t);y(n),x({id:e,kind:`reject`,ok:!1,message:n})}finally{_(null)}},[D]),ae=(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(St,{value:c,onValueChange:e=>l(e),children:(0,R.jsxs)(ot,{children:[(0,R.jsx)(Ot,{value:`pending`,children:`Pending`}),(0,R.jsx)(Ot,{value:`decided`,children:`Decided`}),(0,R.jsx)(Ot,{value:`all`,children:`All`})]})}),(0,R.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void T(),disabled:C,"data-testid":`ai-inbox-refresh`,children:[(0,R.jsx)(Te,{className:`h-3.5 w-3.5 mr-1.5 ${C?`animate-spin`:``}`}),`Refresh`]})]}),w?(0,R.jsxs)(at,{variant:`destructive`,children:[(0,R.jsx)(_e,{className:`h-4 w-4`}),(0,R.jsx)(Dt,{children:w.message})]}):null,v?(0,R.jsxs)(at,{variant:`destructive`,children:[(0,R.jsx)(_e,{className:`h-4 w-4`}),(0,R.jsx)(Dt,{children:v})]}):null,b&&!v?(0,R.jsxs)(at,{variant:b.ok?`default`:`destructive`,children:[b.ok?(0,R.jsx)(k,{className:`h-4 w-4`}):(0,R.jsx)(At,{className:`h-4 w-4`}),(0,R.jsxs)(Dt,{children:[b.kind===`approve`?`Approve`:`Reject`,` for`,` `,(0,R.jsxs)(`code`,{className:`text-xs`,children:[b.id.slice(0,8),`…`]}),`:`,` `,b.message??(b.ok?`OK`:`Failed`)]})]}):null,C&&ee.length===0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(he,{className:`h-10 w-full`}),(0,R.jsx)(he,{className:`h-10 w-full`}),(0,R.jsx)(he,{className:`h-10 w-full`})]}):ee.length===0?(0,R.jsx)(Ce,{children:(0,R.jsxs)(se,{children:[(0,R.jsx)(pe,{children:(0,R.jsx)(Ie,{className:`h-8 w-8 text-muted-foreground`})}),(0,R.jsx)(ht,{children:`No actions waiting`}),(0,R.jsx)(Oe,{children:`When the AI proposes a sensitive action it will appear here for review.`})]})}):(0,R.jsx)(`div`,{className:`rounded-md border`,children:(0,R.jsxs)(We,{children:[(0,R.jsx)($e,{children:(0,R.jsxs)(Ye,{children:[(0,R.jsx)(st,{className:`w-[140px]`,children:`Tool`}),(0,R.jsx)(st,{className:`w-[140px]`,children:`Action`}),(0,R.jsx)(st,{className:`w-[120px]`,children:`Object`}),(0,R.jsx)(st,{className:`w-[110px]`,children:`Status`}),(0,R.jsx)(st,{className:`w-[110px]`,children:`Proposed`}),(0,R.jsx)(st,{className:`w-[260px] text-right`,children:`Decision`})]})}),(0,R.jsx)(qe,{children:ee.map(e=>{let t=e.status===`pending`,n=g===e.id;return(0,R.jsxs)(Ye,{children:[(0,R.jsx)(mt,{className:`font-mono text-xs`,children:e.tool_name}),(0,R.jsx)(mt,{className:`text-sm`,children:e.action_name}),(0,R.jsx)(mt,{className:`text-sm`,children:e.object_name}),(0,R.jsx)(mt,{children:(0,R.jsx)(xk,{status:e.status})}),(0,R.jsx)(mt,{className:`text-xs text-muted-foreground`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,R.jsx)(Qe,{className:`h-3 w-3`}),` `,Sk(e.proposed_at)]})}),(0,R.jsx)(mt,{className:`text-right`,children:(0,R.jsxs)(`div`,{className:`inline-flex gap-1.5`,children:[(0,R.jsxs)(M,{size:`sm`,variant:`ghost`,onClick:()=>d(e.id),"data-testid":`ai-inbox-view-${e.id}`,children:[(0,R.jsx)(ce,{className:`h-3.5 w-3.5 mr-1`}),` View`]}),t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(M,{size:`sm`,variant:`default`,disabled:n,onClick:()=>void re(e.id),"data-testid":`ai-inbox-approve-${e.id}`,children:[(0,R.jsx)(k,{className:`h-3.5 w-3.5 mr-1`}),n?`Working…`:`Approve`]}),(0,R.jsxs)(M,{size:`sm`,variant:`destructive`,disabled:n,onClick:()=>{p(e.id),h(``)},"data-testid":`ai-inbox-reject-${e.id}`,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]}):null]})})]},e.id)})})]})})]});return(0,R.jsxs)(R.Fragment,{children:[i===`card`?(0,R.jsxs)(te,{className:s,children:[(0,R.jsxs)(lt,{className:`pb-3`,children:[(0,R.jsxs)(gt,{className:`flex items-center gap-2`,children:[(0,R.jsx)(_t,{className:`h-4 w-4`}),` `,a]}),o?(0,R.jsx)(Ct,{children:o}):null]}),(0,R.jsx)(Ge,{children:ae})]}):(0,R.jsx)(`div`,{className:s,children:ae}),(0,R.jsx)(Pt,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,R.jsxs)(ne,{className:`sm:max-w-[560px] overflow-y-auto`,children:[(0,R.jsxs)(de,{children:[(0,R.jsxs)(we,{className:`flex items-center gap-2`,children:[(0,R.jsx)(_t,{className:`h-4 w-4`}),O?O.action_name:`Pending action`]}),(0,R.jsx)(De,{children:O?(0,R.jsxs)(R.Fragment,{children:[`Tool `,(0,R.jsx)(`code`,{className:`text-xs`,children:O.tool_name}),` on`,` `,(0,R.jsx)(`code`,{className:`text-xs`,children:O.object_name})]}):`Loading…`})]}),O?(0,R.jsxs)(`div`,{className:`px-4 space-y-4 mt-4`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,R.jsx)(`div`,{className:`mt-1`,children:(0,R.jsx)(xk,{status:O.status})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Proposed`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs`,children:Sk(O.proposed_at)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Proposed by`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.proposed_by??`—`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Decided by`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.decided_by??`—`})]}),O.conversation_id?(0,R.jsxs)(`div`,{className:`col-span-2`,children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Conversation`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.conversation_id})]}):null]}),(0,R.jsx)(ke,{}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Tool input`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:Ck(O.tool_input)})})]}),O.result?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Result`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:Ck(O.result)})})]}):null,O.error?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-destructive`,children:`Error`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:O.error})})]}):null,O.rejection_reason?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Rejection reason`}),(0,R.jsx)(`div`,{className:`mt-1.5 text-sm`,children:O.rejection_reason})]}):null,O.status===`pending`?(0,R.jsxs)(`div`,{className:`pt-2 flex gap-2`,children:[(0,R.jsxs)(M,{size:`sm`,onClick:()=>void re(O.id),disabled:g===O.id,children:[(0,R.jsx)(k,{className:`h-3.5 w-3.5 mr-1`}),`Approve & Execute`]}),(0,R.jsxs)(M,{size:`sm`,variant:`destructive`,onClick:()=>{p(O.id),h(``)},disabled:g===O.id,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]}):null]}):null]})}),(0,R.jsx)(Pt,{open:!!f,onOpenChange:e=>{e||(p(null),h(``))},children:(0,R.jsxs)(ne,{side:`bottom`,className:`max-h-[40vh]`,children:[(0,R.jsxs)(de,{children:[(0,R.jsx)(we,{children:`Reject this action?`}),(0,R.jsx)(De,{children:`The reason is shown back to the AI so it can adjust its next response.`})]}),(0,R.jsxs)(`div`,{className:`px-4 mt-3 space-y-3`,children:[(0,R.jsx)(ft,{value:m,onChange:e=>h(e.target.value),placeholder:`Optional reason (e.g. 'Wrong record id — please confirm with the user first.')`,rows:4,"data-testid":`ai-inbox-reject-reason`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>{p(null),h(``)},children:`Cancel`}),(0,R.jsxs)(M,{variant:`destructive`,size:`sm`,onClick:()=>f&&void ie(f,m),disabled:!f||g===f,"data-testid":`ai-inbox-reject-confirm`,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]})]})]})})]})}function Dk(e){return!e||e.length===0?`/api/v1/ai`:e.endsWith(`/`)?e.slice(0,-1):e}function Ok(e,t){let n={...e??{}};return t&&(n[`Content-Type`]=`application/json`),n}async function kk(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return{raw:t}}}function Ak(e){let{messages:t,apiBase:n,headers:r,onDecided:i,continueConversation:a}=e,o=Dk(n),s=I.useMemo(()=>{let e=new Map;for(let n of t){let t=n.toolInvocations??[];for(let n of t)n.pendingActionId&&n.toolCallId&&e.set(n.toolCallId,{pendingActionId:n.pendingActionId,toolName:n.toolName})}return e},[t]),[c,l]=I.useState({}),u=I.useRef(0),[d,f]=I.useState(!1),p=I.useCallback((e,t)=>{l(n=>{if(!t){if(!(e in n))return n;let{[e]:t,...r}=n;return r}return{...n,[e]:t}})},[]);return{decisions:c,decide:I.useCallback(async(e,t,n)=>{let c=s.get(e);if(!c){p(e,{state:`error`,message:`No pending-action id found for this tool call. The tool result may not be a HITL proposal.`});return}let{pendingActionId:l,toolName:d}=c;p(e,{state:`pending`,message:t?`Approving…`:`Rejecting…`}),u.current+=1,f(!0);try{let s=`${o}/pending-actions/${encodeURIComponent(l)}/${t?`approve`:`reject`}`,c=t?`{}`:JSON.stringify({reason:n??``}),u=await fetch(s,{method:`POST`,credentials:`include`,headers:Ok(r,!0),body:c}),f=await kk(u)??{};if(!u.ok){let t=typeof f.error==`string`?f.error:`Approval failed: HTTP ${u.status}`;p(e,{state:`error`,message:t}),i?.(e,{id:l,status:`failed`,error:t});return}let m=f.status??(t?`executed`:`rejected`),h=!1;if(m===`executed`?(p(e,{state:`success`,message:`Approved — action executed.`}),h=!0):m===`rejected`?(p(e,{state:`success`,message:n?`Rejected: ${n}`:`Rejected.`}),h=!0):m===`failed`?p(e,{state:`error`,message:f.error??`Action approved but execution failed.`}):(p(e,{state:`success`,message:`Status: ${m}`}),h=!0),i?.(e,f),h&&a){let r=jk({approved:t,status:m,toolName:d,pendingActionId:l,outcome:f,reason:n});r&&a(r,{toolCallId:e,pendingActionId:l,decision:t?`approved`:`rejected`,outcome:f,toolName:d})}}catch(t){p(e,{state:`error`,message:t instanceof Error?t.message:String(t)})}finally{--u.current,u.current<=0&&(u.current=0,f(!1))}},[o,r,s,i,a,p]),isDeciding:d}}function jk(e){let{approved:t,status:n,toolName:r,pendingActionId:i,outcome:a,reason:o}=e,s=`[HITL ${i}]`;if(t&&n===`executed`){let e=a.result;return`${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e==null?`(no payload)`:typeof e==`string`?e:Mk(JSON.stringify(e),800)}. Acknowledge the outcome concisely and continue the user's task.`}if(!t&&n===`rejected`)return`${s} The operator rejected the \`${r}\` call.${o&&o.trim().length>0?` Reason: ${o}.`:``} Acknowledge the rejection and ask whether to try a different approach.`;if(n===`failed`){let e=a.error;return`${s} The \`${r}\` call was approved but execution failed: ${typeof e==`string`?e:Mk(JSON.stringify(e??{}),400)}. Apologize concisely and offer alternatives.`}}function Mk(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}var Nk=I.forwardRef(({className:e,messages:t=[],placeholder:n=`Type your message...`,onSendMessage:r,disabled:i=!1,showTimestamp:a=!1,userAvatarUrl:o,userAvatarFallback:s=`You`,assistantAvatarUrl:c,assistantAvatarFallback:l=`AI`,maxHeight:u=`500px`,...d},f)=>{let[p,m]=I.useState(``),h=I.useRef(null),g=I.useRef(null);I.useEffect(()=>{if(h.current){let e=h.current.querySelector(`[data-radix-scroll-area-viewport]`);e&&(e.scrollTop=e.scrollHeight)}},[t]);let _=()=>{p.trim()&&r&&(r(p.trim()),m(``),g.current?.focus())},v=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())};return(0,R.jsxs)(`div`,{ref:f,className:A(`flex flex-col border rounded-lg bg-background overflow-hidden`,e),style:{maxHeight:u},...d,children:[(0,R.jsx)(je,{ref:h,className:`flex-1 p-4`,children:(0,R.jsx)(`div`,{className:`space-y-4`,children:t.length===0?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-32 text-muted-foreground text-sm`,children:`No messages yet. Start a conversation!`}):t.map(e=>(0,R.jsx)(Pk,{message:e,showTimestamp:a,userAvatarUrl:o,userAvatarFallback:s,assistantAvatarUrl:c,assistantAvatarFallback:l},e.id))})}),(0,R.jsx)(`div`,{className:`border-t p-4`,children:(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(vt,{ref:g,value:p,onChange:e=>m(e.target.value),onKeyDown:v,placeholder:n,disabled:i,className:`flex-1`}),(0,R.jsx)(M,{onClick:_,disabled:i||!p.trim(),size:`icon`,children:(0,R.jsx)(ie,{className:`h-4 w-4`})})]})})]})});Nk.displayName=`Chatbot`;var Pk=({message:e,showTimestamp:t,userAvatarUrl:n,userAvatarFallback:r,assistantAvatarUrl:i,assistantAvatarFallback:a})=>{let o=e.role===`user`;if(e.role===`system`)return(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted px-3 py-1 rounded-full`,children:e.content})});let s=o?e.avatar||n:e.avatar||i,c=o?e.avatarFallback||r:e.avatarFallback||a;return(0,R.jsxs)(`div`,{className:A(`flex gap-3`,o?`flex-row-reverse`:`flex-row`),children:[(0,R.jsxs)(ut,{className:`h-8 w-8`,children:[(0,R.jsx)(He,{src:s}),(0,R.jsx)(bt,{className:`text-xs`,children:c})]}),(0,R.jsxs)(`div`,{className:A(`flex flex-col gap-1`,o?`items-end`:`items-start`),children:[(0,R.jsx)(`div`,{className:A(`rounded-lg px-4 py-2 max-w-[70%] break-words`,o?`bg-primary text-primary-foreground`:`bg-muted`),children:(0,R.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content})}),t&&e.timestamp&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.timestamp})]})]})},Fk=I.forwardRef(({className:e,avatarSrc:t,avatarFallback:n=`AI`,...r},i)=>(0,R.jsxs)(`div`,{ref:i,className:A(`flex gap-3`,e),...r,children:[(0,R.jsxs)(ut,{className:`h-8 w-8`,children:[(0,R.jsx)(He,{src:t}),(0,R.jsx)(bt,{className:`text-xs`,children:n})]}),(0,R.jsx)(`div`,{className:`flex items-center bg-muted rounded-lg px-4 py-2`,children:(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce [animation-delay:-0.3s]`}),(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce [animation-delay:-0.15s]`}),(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce`})]})})]}));Fk.displayName=`TypingIndicator`;export{Pa as C,Ca as S,Ua as _,MO as a,Da as b,Rf as c,Ka as d,Ja as f,Wa as g,Ga as h,GO as i,Hf as l,Va as m,Ek as n,gu as o,Ba as p,hk as r,Wu as s,Ak as t,Xa as u,Ha as v,Ta as x,Ra as y};
|
|
120
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Jg(a.htmlStyle||qg(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&_g(m,r),m}function x_(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&jm.Underline||i.fontStyle&jm.Strikethrough));o&&__.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function S_(e){return e.map(e=>e.flatMap(e=>{if(__.test(e.content))return e;let t=e.content.match(v_);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function C_(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Jg(e.htmlStyle||qg(e)),i=Jg(n.htmlStyle||qg(n)),a=e.fontStyle&&(e.fontStyle&jm.Underline||e.fontStyle&jm.Strikethrough),o=n.fontStyle&&(n.fontStyle&jm.Underline||n.fontStyle&jm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var w_=Yt;function T_(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>y_(e,t,n),codeToTokens:(t,n)=>h_(e,t,n)},i=w_(y_(e,t,n,r));for(let e of $g(n))i=e.postprocess?.call(r,i,n)||i;return i}async function E_(e){let t=await hg(e);return{getLastGrammarState:(...e)=>Tg(t,...e),codeToTokensBase:(e,n)=>m_(t,e,n),codeToTokensWithThemes:(e,n)=>Ng(t,e,n),codeToTokens:(e,n)=>h_(t,e,n),codeToHast:(e,n)=>y_(t,e,n),codeToHtml:(e,n)=>T_(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function D_(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,$h(n))return[];let r=t[n];if(!r)throw new G(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(tg(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new G(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await E_({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function O_(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function k_(e,t){let n=O_(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var{codeToHtml:A_,codeToHast:j_,codeToTokens:M_,codeToTokensBase:N_,codeToTokensWithThemes:P_,getSingletonHighlighter:F_,getLastGrammarState:I_}=k_(D_({langs:Fp,themes:Ip,engine:()=>(0,um.createOnigurumaEngine)(s(()=>import(`./wasm-BnjxR4X6.js`),[],import.meta.url))}),{guessEmbeddedLanguages:Hg}),L_=(0,I.createContext)({code:``}),R_={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function z_(e,t,n=!1){let r=n?[R_]:[];return await Promise.all([A_(e,{lang:t,theme:`one-light`,transformers:r}),A_(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}var B_=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),u=(0,I.useRef)(!1);return(0,I.useEffect)(()=>(z_(e,t,n).then(([e,t])=>{u.current||=(s(e),l(t),!0)}),()=>{u.current=!1}),[e,t,n]),(0,R.jsx)(L_.Provider,{value:{code:e},children:(0,R.jsx)(`div`,{className:A(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`overflow-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,R.jsx)(`div`,{className:`hidden overflow-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:c}}),i&&(0,R.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},V_=({className:e,...t})=>(0,R.jsx)(Ne,{className:A(`not-prose mb-4 w-full rounded-md border`,e),...t}),H_=e=>(0,R.jsxs)(Le,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,R.jsx)(ze,{className:`size-4`}),"input-available":(0,R.jsx)(Qe,{className:`size-4 animate-pulse`}),"approval-requested":(0,R.jsx)(Qe,{className:`size-4 text-yellow-600`}),"approval-responded":(0,R.jsx)(nt,{className:`size-4 text-blue-600`}),"output-available":(0,R.jsx)(nt,{className:`size-4 text-green-600`}),"output-error":(0,R.jsx)(At,{className:`size-4 text-red-600`}),"output-denied":(0,R.jsx)(At,{className:`size-4 text-orange-600`})}[e],{"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`}[e]]}),U_=({className:e,title:t,type:n,state:r,...i})=>(0,R.jsxs)(Pe,{className:A(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(rt,{className:`size-4 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),H_(r)]}),(0,R.jsx)(Ee,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),W_=({className:e,...t})=>(0,R.jsx)(Ae,{className:A(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),G_=({className:e,input:t,...n})=>(0,R.jsxs)(`div`,{className:A(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,R.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,R.jsx)(B_,{code:JSON.stringify(t,null,2),language:`json`})})]}),K_=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,R.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,I.isValidElement)(t)?i=(0,R.jsx)(B_,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,R.jsx)(B_,{code:t,language:`json`})),(0,R.jsxs)(`div`,{className:A(`space-y-2 p-4`,e),...r,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,R.jsxs)(`div`,{className:A(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,R.jsx)(`div`,{children:n}),i]})]})},q_=(0,I.createContext)({});function J_(e){let t=(0,I.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Y_=typeof window<`u`?I.useLayoutEffect:I.useEffect,X_=(0,I.createContext)(null);function Z_(e,t){e.indexOf(t)===-1&&e.push(t)}function Q_(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var $_=(e,t,n)=>n>t?t:n<e?e:n,ev={},tv=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),nv=e=>typeof e==`object`&&!!e,rv=e=>/^0[^.\s]+$/u.test(e);function iv(e){let t;return()=>(t===void 0&&(t=e()),t)}var av=e=>e,ov=(...e)=>e.reduce((e,t)=>n=>t(e(n))),sv=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},cv=class{constructor(){this.subscriptions=[]}add(e){return Z_(this.subscriptions,e),()=>Q_(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},lv=e=>e*1e3,uv=e=>e/1e3,dv=(e,t)=>t?1e3/t*e:0,fv=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,pv=1e-7,mv=12;function hv(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=fv(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>pv&&++s<mv);return o}function gv(e,t,n,r){if(e===t&&n===r)return av;let i=t=>hv(t,0,1,e,n);return e=>e===0||e===1?e:fv(i(e),t,r)}var _v=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,vv=e=>t=>1-e(1-t),yv=gv(.33,1.53,.69,.99),bv=vv(yv),xv=_v(bv),Sv=e=>e>=1?1:(e*=2)<1?.5*bv(e):.5*(2-2**(-10*(e-1))),Cv=e=>1-Math.sin(Math.acos(e)),wv=vv(Cv),Tv=_v(Cv),Ev=gv(.42,0,1,1),Dv=gv(0,0,.58,1),Ov=gv(.42,0,.58,1),kv=e=>Array.isArray(e)&&typeof e[0]!=`number`,Av=e=>Array.isArray(e)&&typeof e[0]==`number`,jv={linear:av,easeIn:Ev,easeInOut:Ov,easeOut:Dv,circIn:Cv,circInOut:Tv,circOut:wv,backIn:bv,backInOut:xv,backOut:yv,anticipate:Sv},Mv=e=>typeof e==`string`,Nv=e=>{if(Av(e)){e.length;let[t,n,r,i]=e;return gv(t,n,r,i)}else if(Mv(e))return jv[e],`${e}`,jv[e];return e},Pv=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Fv={value:null,addProjectionMetrics:null};function Iv(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Fv.value&&Fv.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Lv=40;function Rv(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Pv.reduce((e,n)=>(e[n]=Iv(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=ev.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Lv),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Pv.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Pv.length;t++)o[Pv[t]].cancel(e)},state:i,steps:o}}var{schedule:K,cancel:zv,state:q,steps:Bv}=Rv(typeof requestAnimationFrame<`u`?requestAnimationFrame:av,!0),Vv;function Hv(){Vv=void 0}var Uv={now:()=>(Vv===void 0&&Uv.set(q.isProcessing||ev.useManualTiming?q.timestamp:performance.now()),Vv),set:e=>{Vv=e,queueMicrotask(Hv)}},Wv={layout:0,mainThread:0,waapi:0},Gv=e=>t=>typeof t==`string`&&t.startsWith(e),Kv=Gv(`--`),qv=Gv(`var(--`),Jv=e=>qv(e)?Yv.test(e.split(`/*`)[0].trim()):!1,Yv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Xv(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Zv={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Qv={...Zv,transform:e=>$_(0,1,e)},$v={...Zv,default:1},ey=e=>Math.round(e*1e5)/1e5,ty=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ny(e){return e==null}var ry=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,iy=(e,t)=>n=>!!(typeof n==`string`&&ry.test(n)&&n.startsWith(e)||t&&!ny(n)&&Object.prototype.hasOwnProperty.call(n,t)),ay=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(ty);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},oy=e=>$_(0,255,e),sy={...Zv,transform:e=>Math.round(oy(e))},cy={test:iy(`rgb`,`red`),parse:ay(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+sy.transform(e)+`, `+sy.transform(t)+`, `+sy.transform(n)+`, `+ey(Qv.transform(r))+`)`};function ly(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var uy={test:iy(`#`),parse:ly,transform:cy.transform},dy=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fy=dy(`deg`),py=dy(`%`),J=dy(`px`),my=dy(`vh`),hy=dy(`vw`),gy={...py,parse:e=>py.parse(e)/100,transform:e=>py.transform(e*100)},_y={test:iy(`hsl`,`hue`),parse:ay(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+py.transform(ey(t))+`, `+py.transform(ey(n))+`, `+ey(Qv.transform(r))+`)`},Y={test:e=>cy.test(e)||uy.test(e)||_y.test(e),parse:e=>cy.test(e)?cy.parse(e):_y.test(e)?_y.parse(e):uy.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?cy.transform(e):_y.transform(e),getAnimatableNone:e=>{let t=Y.parse(e);return t.alpha=0,Y.transform(t)}},vy=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function yy(e){return isNaN(e)&&typeof e==`string`&&(e.match(ty)?.length||0)+(e.match(vy)?.length||0)>0}var by=`number`,xy=`color`,Sy=`var`,Cy=`var(`,wy="${}",Ty=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ey(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Ty,e=>(Y.test(e)?(r.color.push(a),i.push(xy),n.push(Y.parse(e))):e.startsWith(Cy)?(r.var.push(a),i.push(Sy),n.push(e)):(r.number.push(a),i.push(by),n.push(parseFloat(e))),++a,wy)).split(wy),indexes:r,types:i}}function Dy(e){return Ey(e).values}function Oy({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===by?i+=ey(r[a]):e===xy?i+=Y.transform(r[a]):i+=r[a]}return i}}function ky(e){return Oy(Ey(e))}var Ay=e=>typeof e==`number`?0:Y.test(e)?Y.getAnimatableNone(e):e,jy=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Ay(e);function My(e){let t=Ey(e);return Oy(t)(t.values.map((e,n)=>jy(e,t.split[n])))}var Ny={test:yy,parse:Dy,createTransformer:ky,getAnimatableNone:My};function Py(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Fy({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Py(s,r,e+1/3),a=Py(s,r,e),o=Py(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Iy(e,t){return n=>n>0?t:e}var X=(e,t,n)=>e+(t-e)*n,Ly=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Ry=[uy,cy,_y],zy=e=>Ry.find(t=>t.test(e));function By(e){let t=zy(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===_y&&(n=Fy(n)),n}var Vy=(e,t)=>{let n=By(e),r=By(t);if(!n||!r)return Iy(e,t);let i={...n};return e=>(i.red=Ly(n.red,r.red,e),i.green=Ly(n.green,r.green,e),i.blue=Ly(n.blue,r.blue,e),i.alpha=X(n.alpha,r.alpha,e),cy.transform(i))},Hy=new Set([`none`,`hidden`]);function Uy(e,t){return Hy.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Wy(e,t){return n=>X(e,t,n)}function Gy(e){return typeof e==`number`?Wy:typeof e==`string`?Jv(e)?Iy:Y.test(e)?Vy:Yy:Array.isArray(e)?Ky:typeof e==`object`?Y.test(e)?Vy:qy:Iy}function Ky(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Gy(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function qy(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Gy(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Jy(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Yy=(e,t)=>{let n=Ny.createTransformer(t),r=Ey(e),i=Ey(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Hy.has(e)&&!i.values.length||Hy.has(t)&&!r.values.length?Uy(e,t):ov(Ky(Jy(r,i),i.values),n):(`${e}${t}`,Iy(e,t))};function Xy(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?X(e,t,n):Gy(e)(e,t)}var Zy=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>K.update(t,e),stop:()=>zv(t),now:()=>q.isProcessing?q.timestamp:Uv.now()}},Qy=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},$y=2e4;function eb(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function tb(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(eb(r),$y);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:uv(i)}}var Z={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function nb(e,t){return e*Math.sqrt(1-t*t)}var rb=12;function ib(e,t,n){let r=n;for(let n=1;n<rb;n++)r-=e(r)/t(r);return r}var ab=.001;function ob({duration:e=Z.duration,bounce:t=Z.bounce,velocity:n=Z.velocity,mass:r=Z.mass}){let i,a;Z.maxDuration;let o=1-t;o=$_(Z.minDamping,Z.maxDamping,o),e=$_(Z.minDuration,Z.maxDuration,uv(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=nb(t,o),c=Math.exp(-i);return ab-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=nb(t**2,o);return(-i(t)+ab>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=ib(i,a,s);if(e=lv(e),isNaN(c))return{stiffness:Z.stiffness,damping:Z.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var sb=[`duration`,`bounce`],cb=[`stiffness`,`damping`,`mass`];function lb(e,t){return t.some(t=>e[t]!==void 0)}function ub(e){let t={velocity:Z.velocity,stiffness:Z.stiffness,damping:Z.damping,mass:Z.mass,isResolvedFromDuration:!1,...e};if(!lb(e,cb)&&lb(e,sb))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*$_(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Z.mass,stiffness:i,damping:a}}else{let n=ob({...e,velocity:0});t={...t,...n,mass:Z.mass},t.isResolvedFromDuration=!0}return t}function db(e=Z.visualDuration,t=Z.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=ub({...n,velocity:-uv(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=uv(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Z.restSpeed.granular:Z.restSpeed.default,i||=v?Z.restDelta.granular:Z.restDelta.default;let y,b,x,S,C,w;if(h<1)x=nb(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>lv(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=lv(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=lv(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(eb(T),$y),t=Qy(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}db.applyToOptions=e=>{let t=tb(e,100,db);return e.ease=t.ease,e.duration=lv(t.duration),e.type=`keyframes`,e};var fb=5;function pb(e,t,n){let r=Math.max(t-fb,0);return dv(n-e(r),t-r)}function mb({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=db({keyframes:[f.value,m(f.value)],velocity:pb(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function hb(e,t,n){let r=[],i=n||ev.mix||Xy,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=ov(Array.isArray(t)?t[n]||av:t,a)),r.push(a)}return r}function gb(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=hb(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=sv(e[r],e[r+1],n);return s[r](i)};return n?t=>l($_(e[0],e[a-1],t)):l}function _b(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=sv(0,t,r);e.push(X(n,1,i))}}function vb(e){let t=[0];return _b(t,e.length-1),t}function yb(e,t){return e.map(e=>e*t)}function bb(e,t){return e.map(()=>t||Ov).splice(0,e.length-1)}function xb({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=kv(r)?r.map(Nv):Nv(r),a={done:!1,value:t[0]},o=gb(yb(n&&n.length===t.length?n:vb(t),e),t,{ease:Array.isArray(i)?i:bb(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Sb=e=>e!==null;function Cb(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Sb),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var wb={decay:mb,inertia:mb,tween:xb,keyframes:xb,spring:db};function Tb(e){typeof e.type==`string`&&(e.type=wb[e.type])}var Eb=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Db=e=>e/100,Ob=class extends Eb{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Uv.now()&&this.tick(Uv.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},Wv.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Tb(e);let{type:t=xb,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||xb;s!==xb&&typeof o[0]!=`number`&&(this.mixKeyframes=ov(Db,Xy(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=eb(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=$_(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==mb&&(b.value=Cb(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return uv(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uv(e)}get time(){return uv(this.currentTime)}set time(e){e=lv(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return pb(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Uv.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=uv(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Zy,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Uv.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,Wv.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function kb(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Ab=e=>e*180/Math.PI,jb=e=>Nb(Ab(Math.atan2(e[1],e[0]))),Mb={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:jb,rotateZ:jb,skewX:e=>Ab(Math.atan(e[1])),skewY:e=>Ab(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Nb=e=>(e%=360,e<0&&(e+=360),e),Pb=jb,Fb=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Ib=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Lb={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fb,scaleY:Ib,scale:e=>(Fb(e)+Ib(e))/2,rotateX:e=>Nb(Ab(Math.atan2(e[6],e[5]))),rotateY:e=>Nb(Ab(Math.atan2(-e[2],e[0]))),rotateZ:Pb,rotate:Pb,skewX:e=>Ab(Math.atan(e[4])),skewY:e=>Ab(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Rb(e){return+!!e.includes(`scale`)}function zb(e,t){if(!e||e===`none`)return Rb(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Lb,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Mb,i=t}if(!i)return Rb(t);let a=r[t],o=i[1].split(`,`).map(Vb);return typeof a==`function`?a(o):o[a]}var Bb=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return zb(n,t)};function Vb(e){return parseFloat(e.trim())}var Hb=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Ub=new Set([...Hb,`pathRotation`]),Wb=e=>e===Zv||e===J,Gb=new Set([`x`,`y`,`z`]),Kb=Hb.filter(e=>!Gb.has(e));function qb(e){let t=[];return Kb.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Jb={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>zb(t,`x`),y:(e,{transform:t})=>zb(t,`y`)};Jb.translateX=Jb.x,Jb.translateY=Jb.y;var Yb=new Set,Xb=!1,Zb=!1,Qb=!1;function $b(){if(Zb){let e=Array.from(Yb).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=qb(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Zb=!1,Xb=!1,Yb.forEach(e=>e.complete(Qb)),Yb.clear()}function ex(){Yb.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zb=!0)})}function tx(){Qb=!0,ex(),$b(),Qb=!1}var nx=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Yb.add(this),Xb||(Xb=!0,K.read(ex),K.resolveKeyframes($b))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}kb(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Yb.delete(this)}cancel(){this.state===`scheduled`&&(Yb.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},rx=e=>e.startsWith(`--`);function ix(e,t,n){rx(t)?e.style.setProperty(t,n):e.style[t]=n}var ax={};function ox(e,t){let n=iv(e);return()=>ax[t]??n()}var sx=ox(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),cx=ox(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),lx=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,ux={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:lx([0,.65,.55,1]),circOut:lx([.55,0,1,.45]),backIn:lx([.31,.01,.66,-.59]),backOut:lx([.33,1.53,.69,.99])};function dx(e,t){if(e)return typeof e==`function`?cx()?Qy(e,t):`ease-out`:Av(e)?lx(e):Array.isArray(e)?e.map(e=>dx(e,t)||ux.easeOut):ux[e]}function fx(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=dx(s,i);Array.isArray(d)&&(u.easing=d),Fv.value&&Wv.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Fv.value&&p.finished.finally(()=>{Wv.waapi--}),p}function px(e){return typeof e==`function`&&`applyToOptions`in e}function mx({type:e,...t}){return px(e)&&cx()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var hx=class extends Eb{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=mx(e);this.animation=fx(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Cb(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),ix(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return uv(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+uv(e)}get time(){return uv(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=lv(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&sx()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),av):r(this)}},gx={anticipate:Sv,backInOut:xv,circInOut:Tv};function _x(e){return e in gx}function vx(e){typeof e.ease==`string`&&_x(e.ease)&&(e.ease=gx[e.ease])}var yx=10,bx=class extends hx{constructor(e){vx(e),Tb(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Ob({...a,autoplay:!1}),s=Math.max(yx,Uv.now()-this.startTime),c=$_(0,yx,s-yx),l=o.sample(s).value,{name:u}=this.options;i&&u&&ix(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},xx=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Ny.test(e)||e===`0`)&&!e.startsWith(`url(`));function Sx(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Cx(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=xx(i,t),s=xx(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Sx(e)||(n===`spring`||px(n))&&r}function wx(e){e.duration=0,e.type=`keyframes`}var Tx=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Ex=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Dx(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Ex.test(e[t]))return!0;return!1}var Ox=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),kx=iv(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Ax(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return kx()&&n&&(Tx.has(n)||Ox.has(n)&&Dx(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var jx=40,Mx=class extends Eb{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Uv.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||nx;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Uv.now();let u=!0;Cx(e,i,a,o)||(u=!1,(ev.instantAnimations||!s)&&l?.(Cb(e,n,t)),e[0]=e[e.length-1],wx(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>jx?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Ax(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new bx({...d,element:p})}catch{m=new Ob(d)}else m=new Ob(d);m.finished.then(()=>{this.notifyFinished()}).catch(av),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),tx()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function Nx(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var Px=30,Fx=e=>!isNaN(parseFloat(e)),Ix={current:void 0},Lx=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Uv.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Uv.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Fx(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new cv);let n=this.events[e].add(t);return e===`change`?()=>{n(),K.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ix.current&&Ix.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Uv.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Px)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Px);return dv(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Rx(e,t){return new Lx(e,t)}function zx(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Bx(e,t){let n=e?.[t]??e?.default??e;return n===e?n:zx(n,e)}var Vx={type:`spring`,stiffness:500,damping:25,restSpeed:10},Hx=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Ux={type:`keyframes`,duration:.8},Wx={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Gx=(e,{keyframes:t})=>t.length>2?Ux:Ub.has(e)?e.startsWith(`scale`)?Hx(t[1]):Vx:Wx,Kx=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function qx(e){for(let t in e)if(!Kx.has(t))return!0;return!1}var Jx=(e,t,n,r={},i,a)=>o=>{let s=Bx(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=lv(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};qx(s)||Object.assign(u,Gx(e,u)),u.duration&&=lv(u.duration),u.repeatDelay&&=lv(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(wx(u),u.delay===0&&(d=!0)),(ev.instantAnimations||ev.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,wx(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Cb(u.keyframes,s);if(e!==void 0){K.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ob(u):new Mx(u)},Yx=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xx(e){let t=Yx.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Zx(e,t,n=1){`${e}`;let[r,i]=Xx(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return tv(e)?parseFloat(e):e}return Jv(i)?Zx(i,t,n+1):i}function Qx(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function $x(e,t,n,r){if(typeof t==`function`){let[i,a]=Qx(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Qx(r);t=t(n===void 0?e.custom:n,i,a)}return t}function eS(e,t,n){let r=e.getProps();return $x(r,t,n===void 0?r.custom:n,e)}var tS=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Hb]),nS=e=>Array.isArray(e);function rS(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rx(n))}function iS(e){return nS(e)?e[e.length-1]||0:e}function aS(e,t){let{transitionEnd:n={},transition:r={},...i}=eS(e,t)||{};i={...i,...n};for(let t in i)rS(e,t,iS(i[t]))}var Q=e=>!!(e&&e.getVelocity);function oS(e){return!!(Q(e)&&e.add)}function sS(e,t){let n=e.getValue(`willChange`);if(oS(n))return n.add(t);if(!n&&ev.WillChange){let n=new ev.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function cS(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var lS=`data-`+cS(`framerAppearId`);function uS(e){return e.props[lS]}function dS({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function fS(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?zx(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&dS(f,t))continue;let o={delay:n,...Bx(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){K.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=uS(e);if(n){let e=window.MotionHandoffAnimation(n,t,K);e!==null&&(o.startTime=e,p=!0)}}sS(e,t);let m=l??e.shouldReduceMotion;r.start(Jx(t,r,i,m&&tS.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>K.update(()=>{o&&aS(e,o)});d.length?Promise.all(d).then(t):t()}return d}function pS(e,t,n={}){let r=eS(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(fS(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return mS(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function mS(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(pS(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Nx(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function hS(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>pS(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=pS(e,t,n);else{let i=typeof t==`function`?eS(e,t,n.custom):t;r=Promise.all(fS(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var gS={test:e=>e===`auto`,parse:e=>e},_S=e=>t=>t.test(e),vS=[Zv,J,py,fy,hy,my,gS],yS=e=>vS.find(_S(e));function bS(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||rv(e)}var xS=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function SS(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(ty)||[];if(!r)return e;let i=n.replace(r,``),a=+!!xS.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var CS=/\b([a-z-]*)\(.*?\)/gu,wS={...Ny,getAnimatableNone:e=>{let t=e.match(CS);return t?t.map(SS).join(` `):e}},TS={...Ny,getAnimatableNone:e=>{let t=Ny.parse(e);return Ny.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},ES={...Zv,transform:Math.round},DS={borderWidth:J,borderTopWidth:J,borderRightWidth:J,borderBottomWidth:J,borderLeftWidth:J,borderRadius:J,borderTopLeftRadius:J,borderTopRightRadius:J,borderBottomRightRadius:J,borderBottomLeftRadius:J,width:J,maxWidth:J,height:J,maxHeight:J,top:J,right:J,bottom:J,left:J,inset:J,insetBlock:J,insetBlockStart:J,insetBlockEnd:J,insetInline:J,insetInlineStart:J,insetInlineEnd:J,padding:J,paddingTop:J,paddingRight:J,paddingBottom:J,paddingLeft:J,paddingBlock:J,paddingBlockStart:J,paddingBlockEnd:J,paddingInline:J,paddingInlineStart:J,paddingInlineEnd:J,margin:J,marginTop:J,marginRight:J,marginBottom:J,marginLeft:J,marginBlock:J,marginBlockStart:J,marginBlockEnd:J,marginInline:J,marginInlineStart:J,marginInlineEnd:J,fontSize:J,backgroundPositionX:J,backgroundPositionY:J,rotate:fy,pathRotation:fy,rotateX:fy,rotateY:fy,rotateZ:fy,scale:$v,scaleX:$v,scaleY:$v,scaleZ:$v,skew:fy,skewX:fy,skewY:fy,distance:J,translateX:J,translateY:J,translateZ:J,x:J,y:J,z:J,perspective:J,transformPerspective:J,opacity:Qv,originX:gy,originY:gy,originZ:J,zIndex:ES,fillOpacity:Qv,strokeOpacity:Qv,numOctaves:ES},OS={...DS,color:Y,backgroundColor:Y,outlineColor:Y,fill:Y,stroke:Y,borderColor:Y,borderTopColor:Y,borderRightColor:Y,borderBottomColor:Y,borderLeftColor:Y,filter:wS,WebkitFilter:wS,mask:TS,WebkitMask:TS},kS=e=>OS[e],AS=new Set([wS,TS]);function jS(e,t){let n=kS(e);return AS.has(n)||(n=Ny),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var MS=new Set([`auto`,`none`,`0`]);function NS(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!MS.has(t)&&Ey(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=jS(n,i)}var PS=class extends nx{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Jv(r))){let i=Zx(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!tS.has(n)||e.length!==2)return;let[r,i]=e,a=yS(r),o=yS(i);if(Xv(r)!==Xv(i)&&Jb[n]){this.needsMeasurement=!0;return}if(a!==o)if(Wb(a)&&Wb(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Jb[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||bS(e[t]))&&n.push(t);n.length&&NS(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Jb[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Jb[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function FS(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var IS=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function LS(e){return nv(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:RS,cancel:zS}=Rv(queueMicrotask,!1),BS={x:!1,y:!1};function VS(){return BS.x||BS.y}function HS(e){return e===`x`||e===`y`?BS[e]?null:(BS[e]=!0,()=>{BS[e]=!1}):BS.x||BS.y?null:(BS.x=BS.y=!0,()=>{BS.x=BS.y=!1})}function US(e,t){let n=FS(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function WS(e){return!(e.pointerType===`touch`||VS())}function GS(e,t,n={}){let[r,i,a]=US(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!WS(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var KS=(e,t)=>t?e===t?!0:KS(e,t.parentElement):!1,qS=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,JS=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function YS(e){return JS.has(e.tagName)||e.isContentEditable===!0}var XS=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function ZS(e){return XS.has(e.tagName)||e.isContentEditable===!0}var QS=new WeakSet;function $S(e){return t=>{t.key===`Enter`&&e(t)}}function eC(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var tC=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=$S(()=>{if(QS.has(n))return;eC(n,`down`);let e=$S(()=>{eC(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>eC(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function nC(e){return qS(e)&&!VS()}var rC=new WeakSet;function iC(e,t,n={}){let[r,i,a]=US(e,n),o=e=>{let r=e.currentTarget;if(!nC(e)||rC.has(e))return;QS.add(r),n.stopPropagation&&rC.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),QS.has(r)&&QS.delete(r),nC(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||KS(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),LS(e)&&(e.addEventListener(`focus`,e=>tC(e,i)),!YS(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function aC(e){return nv(e)&&`ownerSVGElement`in e}var oC=new WeakMap,sC,cC=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:aC(r)&&`getBBox`in r?r.getBBox()[t]:r[n],lC=cC(`inline`,`width`,`offsetWidth`),uC=cC(`block`,`height`,`offsetHeight`);function dC({target:e,borderBoxSize:t}){oC.get(e)?.forEach(n=>{n(e,{get width(){return lC(e,t)},get height(){return uC(e,t)}})})}function fC(e){e.forEach(dC)}function pC(){typeof ResizeObserver>`u`||(sC=new ResizeObserver(fC))}function mC(e,t){sC||pC();let n=FS(e);return n.forEach(e=>{let n=oC.get(e);n||(n=new Set,oC.set(e,n)),n.add(t),sC?.observe(e)}),()=>{n.forEach(e=>{let n=oC.get(e);n?.delete(t),n?.size||sC?.unobserve(e)})}}var hC=new Set,gC;function _C(){gC=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};hC.forEach(t=>t(e))},window.addEventListener(`resize`,gC)}function vC(e){return hC.add(e),gC||_C(),()=>{hC.delete(e),!hC.size&&typeof gC==`function`&&(window.removeEventListener(`resize`,gC),gC=void 0)}}function yC(e,t){return typeof e==`function`?vC(e):mC(e,t)}function bC(e){return aC(e)&&e.tagName===`svg`}var xC=[...vS,Y,Ny],SC=e=>xC.find(_S(e)),CC=()=>({translate:0,scale:1,origin:0,originPoint:0}),wC=()=>({x:CC(),y:CC()}),TC=()=>({min:0,max:0}),$=()=>({x:TC(),y:TC()}),EC=new WeakMap;function DC(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function OC(e){return typeof e==`string`||Array.isArray(e)}var kC=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],AC=[`initial`,...kC];function jC(e){return DC(e.animate)||AC.some(t=>OC(e[t]))}function MC(e){return!!(jC(e)||e.variants)}function NC(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Q(i))e.addValue(r,i);else if(Q(a))e.addValue(r,Rx(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Rx(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var PC={current:null},FC={current:!1},IC=typeof window<`u`;function LC(){if(FC.current=!0,IC)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>PC.current=e.matches;e.addEventListener(`change`,t),t()}else PC.current=!1}var RC=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],zC={};function BC(e){zC=e}function VC(){return zC}var HC=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=nx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Uv.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,K.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=jC(t),this.isVariantNode=MC(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Q(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,EC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(FC.current||LC(),this.shouldReduceMotion=PC.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),zv(this.notifyUpdate),zv(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Tx.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new hx({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:lv(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Ub.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&K.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in zC){let t=zC[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):$()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<RC.length;t++){let n=RC[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=NC(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Rx(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(tv(n)||rv(n))?n=parseFloat(n):!SC(n)&&Ny.test(t)&&(n=jS(e,t)),this.setBaseTarget(e,Q(n)?n.get():n)),Q(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=$x(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Q(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new cv),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){RS.render(this.render)}},UC=class extends HC{constructor(){super(...arguments),this.KeyframeResolver=PS}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Q(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},WC=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function GC({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function KC({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qC(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function JC(e){return e===void 0||e===1}function YC({scale:e,scaleX:t,scaleY:n}){return!JC(e)||!JC(t)||!JC(n)}function XC(e){return YC(e)||ZC(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ZC(e){return QC(e.x)||QC(e.y)}function QC(e){return e&&e!==`0%`}function $C(e,t,n){return n+t*(e-n)}function ew(e,t,n,r,i){return i!==void 0&&(e=$C(e,i,r)),$C(e,n,r)+t}function tw(e,t=0,n=1,r,i){e.min=ew(e.min,t,n,r,i),e.max=ew(e.max,t,n,r,i)}function nw(e,{x:t,y:n}){tw(e.x,t.translate,t.scale,t.originPoint),tw(e.y,n.translate,n.scale,n.originPoint)}var rw=.999999999999,iw=1.0000000000001;function aw(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(ow(e.x,-a.scroll.offset.x),ow(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,nw(e,o)),r&&XC(a.latestValues)&&lw(e,a.latestValues,a.layout?.layoutBox))}t.x<iw&&t.x>rw&&(t.x=1),t.y<iw&&t.y>rw&&(t.y=1)}function ow(e,t){e.min+=t,e.max+=t}function sw(e,t,n,r,i=.5){tw(e,t,n,X(e.min,e.max,i),r)}function cw(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function lw(e,t,n){let r=n??e;sw(e.x,cw(t.x,r.x),t.scaleX,t.scale,t.originX),sw(e.y,cw(t.y,r.y),t.scaleY,t.scale,t.originY)}function uw(e,t){return GC(qC(e.getBoundingClientRect(),t))}function dw(e,t,n){let r=uw(e,n),{scroll:i}=t;return i&&(ow(r.x,i.offset.x),ow(r.y,i.offset.y)),r}var fw={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},pw=Hb.length;function mw(e,t,n){let r=``,i=!0;for(let a=0;a<pw;a++){let o=Hb[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=IS(s,DS[o]);if(!c){i=!1;let t=fw[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${IS(a,DS.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function hw(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Ub.has(e)){o=!0;continue}else if(Kv(e)){i[e]=n;continue}else{let t=IS(n,DS[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=mw(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function gw(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function _w(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var vw={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(J.test(e))e=parseFloat(e);else return e;return`${_w(e,t.target.x)}% ${_w(e,t.target.y)}%`}},yw={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Ny.parse(e);if(i.length>5)return r;let a=Ny.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=X(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},bw={borderRadius:{...vw,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:vw,borderTopRightRadius:vw,borderBottomLeftRadius:vw,borderBottomRightRadius:vw,boxShadow:yw};function xw(e,{layout:t,layoutId:n}){return Ub.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!bw[e]||e===`opacity`)}function Sw(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Q(r[t])||i&&Q(i[t])||xw(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Cw(e){return window.getComputedStyle(e)}var ww=class extends UC{constructor(){super(...arguments),this.type=`html`,this.renderInstance=gw}readValueFromInstance(e,t){if(Ub.has(t))return this.projection?.isProjecting?Rb(t):Bb(e,t);{let n=Cw(e),r=(Kv(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return uw(e,t)}build(e,t,n){hw(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Sw(e,t,n)}},Tw={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Ew={offset:`strokeDashoffset`,array:`strokeDasharray`};function Dw(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Tw:Ew;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Ow=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function kw(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(hw(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Ow)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Dw(d,i,a,o,!1)}var Aw=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),jw=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Mw(e,t,n,r){gw(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Aw.has(n)?n:cS(n),t.attrs[n])}function Nw(e,t,n){let r=Sw(e,t,n);for(let n in e)if(Q(e[n])||Q(t[n])){let t=Hb.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Pw=class extends UC{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=$}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ub.has(t)){let e=kS(t);return e&&e.default||0}return t=Aw.has(t)?t:cS(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Nw(e,t,n)}build(e,t,n){kw(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Mw(e,t,n,r)}mount(e){this.isSVGTag=jw(e.tagName),super.mount(e)}},Fw=AC.length;function Iw(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Iw(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Fw;n++){let r=AC[n],i=e.props[r];(OC(i)||i===!1)&&(t[r]=i)}return t}function Lw(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Rw=[...kC].reverse(),zw=kC.length;function Bw(e){return t=>Promise.all(t.map(({animation:t,options:n})=>hS(e,t,n)))}function Vw(e){let t=Bw(e),n=Ww(),r=!0,i=!1,a=t=>(n,r)=>{let i=eS(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Iw(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<zw;t++){let p=Rw[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=OC(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||DC(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=Hw(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=nS(t)&&nS(n)?!Lw(t,n)||y:t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=eS(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Nx(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=eS(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Ww(),i=!0}}}function Hw(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Lw(t,e):!1}function Uw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ww(){return{animate:Uw(!0),whileInView:Uw(),whileHover:Uw(),whileTap:Uw(),whileDrag:Uw(),whileFocus:Uw(),exit:Uw()}}function Gw(e,t){e.min=t.min,e.max=t.max}function Kw(e,t){Gw(e.x,t.x),Gw(e.y,t.y)}function qw(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Jw=.9999,Yw=1.0001,Xw=-.01,Zw=.01;function Qw(e){return e.max-e.min}function $w(e,t,n){return Math.abs(e-t)<=n}function eT(e,t,n,r=.5){e.origin=r,e.originPoint=X(t.min,t.max,e.origin),e.scale=Qw(n)/Qw(t),e.translate=X(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Jw&&e.scale<=Yw||isNaN(e.scale))&&(e.scale=1),(e.translate>=Xw&&e.translate<=Zw||isNaN(e.translate))&&(e.translate=0)}function tT(e,t,n,r){eT(e.x,t.x,n.x,r?r.originX:void 0),eT(e.y,t.y,n.y,r?r.originY:void 0)}function nT(e,t,n,r=0){e.min=(r?X(n.min,n.max,r):n.min)+t.min,e.max=e.min+Qw(t)}function rT(e,t,n,r){nT(e.x,t.x,n.x,r?.x),nT(e.y,t.y,n.y,r?.y)}function iT(e,t,n,r=0){let i=r?X(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Qw(t)}function aT(e,t,n,r){iT(e.x,t.x,n.x,r?.x),iT(e.y,t.y,n.y,r?.y)}function oT(e,t,n,r,i){return e-=t,e=$C(e,1/n,r),i!==void 0&&(e=$C(e,1/i,r)),e}function sT(e,t=0,n=1,r=.5,i,a=e,o=e){if(py.test(t)&&(t=parseFloat(t),t=X(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=X(a.min,a.max,r);e===a&&(s-=t),e.min=oT(e.min,t,n,s,i),e.max=oT(e.max,t,n,s,i)}function cT(e,t,[n,r,i],a,o){sT(e,t[n],t[r],t[i],t.scale,a,o)}var lT=[`x`,`scaleX`,`originX`],uT=[`y`,`scaleY`,`originY`];function dT(e,t,n,r){cT(e.x,t,lT,n?n.x:void 0,r?r.x:void 0),cT(e.y,t,uT,n?n.y:void 0,r?r.y:void 0)}function fT(e){return e.translate===0&&e.scale===1}function pT(e){return fT(e.x)&&fT(e.y)}function mT(e,t){return e.min===t.min&&e.max===t.max}function hT(e,t){return mT(e.x,t.x)&&mT(e.y,t.y)}function gT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function _T(e,t){return gT(e.x,t.x)&&gT(e.y,t.y)}function vT(e){return Qw(e.x)/Qw(e.y)}function yT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bT(e){return[e(`x`),e(`y`)]}function xT(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var ST=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],CT=ST.length,wT=e=>typeof e==`string`?parseFloat(e):e,TT=e=>typeof e==`number`||J.test(e);function ET(e,t,n,r,i,a){i?(e.opacity=X(0,n.opacity??1,OT(r)),e.opacityExit=X(t.opacity??1,0,kT(r))):a&&(e.opacity=X(t.opacity??1,n.opacity??1,r));for(let i=0;i<CT;i++){let a=ST[i],o=DT(t,a),s=DT(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||TT(o)===TT(s)?(e[a]=Math.max(X(wT(o),wT(s),r),0),(py.test(s)||py.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=X(t.rotate||0,n.rotate||0,r))}function DT(e,t){return e[t]===void 0?e.borderRadius:e[t]}var OT=AT(0,.5,wv),kT=AT(.5,.95,av);function AT(e,t,n){return r=>r<e?0:r>t?1:n(sv(e,t,r))}function jT(e,t,n){let r=Q(e)?e:Rx(e);return r.start(Jx(``,r,t,n)),r.animation}function MT(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var NT=(e,t)=>e.depth-t.depth,PT=class{constructor(){this.children=[],this.isDirty=!1}add(e){Z_(this.children,e),this.isDirty=!0}remove(e){Q_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(NT),this.isDirty=!1,this.children.forEach(e)}};function FT(e,t){let n=Uv.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(zv(r),e(a-t))};return K.setup(r,!0),()=>zv(r)}function IT(e){return Q(e)?e.get():e}var LT=class{constructor(){this.members=[]}add(e){Z_(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Q_(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Q_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},RT={hasAnimatedSinceResize:!0,hasEverUpdated:!1},zT={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},BT=[``,`X`,`Y`,`Z`],VT=1e3,HT=0;function UT(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function WT(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=uS(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,K,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&WT(r)}function GT({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=HT++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Fv.value&&(zT.nodes=zT.calculatedTargetDeltas=zT.calculatedProjections=0),this.nodes.forEach(JT),this.nodes.forEach(rE),this.nodes.forEach(iE),this.nodes.forEach(YT),Fv.addProjectionMetrics&&Fv.addProjectionMetrics(zT)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new PT)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cv),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=aC(t)&&!bC(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;K.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=FT(i,250),RT.hasAnimatedSinceResize&&(RT.hasAnimatedSinceResize=!1,this.nodes.forEach(nE)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||dE,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!_T(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Bx(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||nE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),zv(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(aE),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&WT(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(QT),this.nodes.forEach(ZT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($T);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(eE),this.nodes.forEach(tE),this.nodes.forEach(KT),this.nodes.forEach(qT)):this.nodes.forEach($T),this.clearAllSnapshots();let e=Uv.now();q.delta=$_(0,1e3/60,e-q.timestamp),q.timestamp=e,q.isProcessing=!0,Bv.update.process(q),Bv.preRender.process(q),Bv.render.process(q),q.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,RS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(XT),this.sharedNodes.forEach(oE)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,K.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){K.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Qw(this.snapshot.measuredBox.x)&&!Qw(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=$(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!pT(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||XC(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),hE(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return $();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(_E))){let{scroll:e}=this.root;e&&(ow(t.x,e.offset.x),ow(t.y,e.offset.y))}return t}removeElementScroll(e){let t=$();if(Kw(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Kw(t,e),ow(t.x,i.offset.x),ow(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||$();Kw(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(ow(r.x,-n.scroll.offset.x),ow(r.y,-n.scroll.offset.y)),XC(n.latestValues)&&lw(r,n.latestValues,n.layout?.layoutBox)}return XC(this.latestValues)&&lw(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=$();Kw(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!XC(n.latestValues))continue;let r;n.instance&&(YC(n.latestValues)&&n.updateSnapshot(),r=$(),Kw(r,n.measurePageBox())),dT(t,n.latestValues,n.snapshot?.layoutBox,r)}return XC(this.latestValues)&&dT(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==q.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=q.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=$(),this.targetWithTransforms=$()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),rT(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Kw(this.target,this.layout.layoutBox),nw(this.target,this.targetDelta)):Kw(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Fv.value&&zT.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||YC(this.parent.latestValues)||ZC(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=$(),this.relativeTargetOrigin=$(),aT(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Kw(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===q.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Kw(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;aw(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=$());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(qw(this.prevProjectionDelta.x,this.projectionDelta.x),qw(this.prevProjectionDelta.y,this.projectionDelta.y)),tT(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!yT(this.projectionDelta.x,this.prevProjectionDelta.x)||!yT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Fv.value&&zT.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=wC(),this.projectionDelta=wC(),this.projectionDeltaWithTransform=wC()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=wC();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=$(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(uE));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=X(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=X(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(sE(o.x,e.x,n),sE(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(aT(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),lE(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&hT(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=$(),Kw(f,this.relativeTarget)),c&&(this.animationValues=a,ET(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(zv(this.pendingAnimation),void 0),this.pendingAnimation=K.update(()=>{RT.hasAnimatedSinceResize=!0,Wv.layout++,this.motionValue||=Rx(0),this.motionValue.jump(0,!1),this.currentAnimation=jT(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{Wv.layout--},onComplete:()=>{Wv.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VT),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&gE(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||$();let t=Qw(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Qw(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Kw(t,n),lw(t,i),tT(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new LT),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&UT(`z`,e,r,this.animationValues);for(let t=0;t<BT.length;t++)UT(`rotate${BT[t]}`,e,r,this.animationValues),UT(`skew${BT[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=IT(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=IT(t?.pointerEvents)||``),this.hasProjected&&!XC(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=xT(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in bw){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=bw[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?IT(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(ZT),this.root.sharedNodes.clear()}}}function KT(e){e.updateLayout()}function qT(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)bT(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Qw(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Gw(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else gE(i,t.layoutBox,n)&&bT(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Qw(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=wC();tT(o,n,t.layoutBox);let s=wC();a?tT(s,e.applyTransform(r,!0),t.measuredBox):tT(s,n,t.layoutBox);let c=!pT(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=$();aT(s,t.layoutBox,i.layoutBox,o);let c=$();aT(c,n,a.layoutBox,o),_T(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function JT(e){Fv.value&&zT.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function YT(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function XT(e){e.clearSnapshot()}function ZT(e){e.clearMeasurements()}function QT(e){e.isLayoutDirty=!0,e.updateLayout()}function $T(e){e.isLayoutDirty=!1}function eE(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function tE(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function nE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function rE(e){e.resolveTargetDelta()}function iE(e){e.calcProjection()}function aE(e){e.resetSkewAndRotation()}function oE(e){e.removeLeadSnapshot()}function sE(e,t,n){e.translate=X(t.translate,0,n),e.scale=X(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function cE(e,t,n,r){e.min=X(t.min,n.min,r),e.max=X(t.max,n.max,r)}function lE(e,t,n,r){cE(e.x,t.x,n.x,r),cE(e.y,t.y,n.y,r)}function uE(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dE={duration:.45,ease:[.4,0,.1,1]},fE=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),pE=fE(`applewebkit/`)&&!fE(`chrome/`)?Math.round:av;function mE(e){e.min=pE(e.min),e.max=pE(e.max)}function hE(e){mE(e.x),mE(e.y)}function gE(e,t,n){return e===`position`||e===`preserve-aspect`&&!$w(vT(t),vT(n),.2)}function _E(e){return e!==e.root&&e.scroll?.wasRoot}var vE=GT({attachResizeListener:(e,t)=>MT(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),yE={current:void 0},bE=GT({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yE.current){let e=new vE({});e.mount(window),e.setOptions({layoutScroll:!0}),yE.current=e}return yE.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xE=(0,I.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function SE(e=!0){let t=(0,I.useContext)(X_);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,I.useId)();(0,I.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,I.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var CE=(0,I.createContext)({strict:!1}),wE={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},TE=!1;function EE(){if(TE)return;let e={};for(let t in wE)e[t]={isEnabled:e=>wE[t].some(t=>!!e[t])};BC(e),TE=!0}function DE(){return EE(),VC()}function OE(e){let t=DE();for(let n in e)t[n]={...t[n],...e[n]};BC(t)}var kE=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function AE(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||kE.has(e)}var jE=r({default:()=>ME}),ME,NE=t((()=>{throw ME={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),PE=e=>!AE(e);function FE(e){typeof e==`function`&&(PE=t=>t.startsWith(`on`)?!AE(t):e(t))}try{FE((NE(),e(jE)).default)}catch{}function IE(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Q(e[i])||(PE(i)||n===!0&&AE(i)||!t&&!AE(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var LE=(0,I.createContext)({});function RE(e,t){if(jC(e)){let{initial:t,animate:n}=e;return{initial:t===!1||OC(t)?t:void 0,animate:OC(n)?n:void 0}}return e.inherit===!1?{}:t}function zE(e){let{initial:t,animate:n}=RE(e,(0,I.useContext)(LE));return(0,I.useMemo)(()=>({initial:t,animate:n}),[BE(t),BE(n)])}function BE(e){return Array.isArray(e)?e.join(` `):e}var VE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function HE(e,t,n){for(let r in t)!Q(t[r])&&!xw(r,n)&&(e[r]=t[r])}function UE({transformTemplate:e},t){return(0,I.useMemo)(()=>{let n=VE();return hw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function WE(e,t){let n=e.style||{},r={};return HE(r,n,e),Object.assign(r,UE(e,t)),r}function GE(e,t){let n={},r=WE(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var KE=()=>({...VE(),attrs:{}});function qE(e,t,n,r){let i=(0,I.useMemo)(()=>{let n=KE();return kw(n,t,jw(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};HE(t,e.style,e),i.style={...t,...i.style}}return i}var JE=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function YE(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(JE.indexOf(e)>-1||/[A-Z]/u.test(e))}function XE(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??YE(e)?qE:GE)(t,r,i,e),c=IE(t,typeof e==`string`,a),l=e===I.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,I.useMemo)(()=>Q(u)?u.get():u,[u]);return(0,I.createElement)(e,{...l,children:d})}function ZE({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:QE(n,r,i,e),renderState:t()}}function QE(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=IT(a[e]);let{initial:o,animate:s}=e,c=jC(e),l=MC(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!DC(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=$x(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var $E=e=>(t,n)=>{let r=(0,I.useContext)(LE),i=(0,I.useContext)(X_),a=()=>ZE(e,t,r,i);return n?a():J_(a)},eD=$E({scrapeMotionValuesFromProps:Sw,createRenderState:VE}),tD=$E({scrapeMotionValuesFromProps:Nw,createRenderState:KE}),nD=Symbol.for(`motionComponentSymbol`);function rD(e,t,n){let r=(0,I.useRef)(n);(0,I.useInsertionEffect)(()=>{r.current=n});let i=(0,I.useRef)(null);return(0,I.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var iD=(0,I.createContext)({});function aD(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function oD(e,t,n,r,i,a){let{visualElement:o}=(0,I.useContext)(LE),s=(0,I.useContext)(CE),c=(0,I.useContext)(X_),l=(0,I.useContext)(xE),u=l.reducedMotion,d=l.skipAnimations,f=(0,I.useRef)(null),p=(0,I.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,I.useContext)(iD);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&sD(f.current,n,i,h);let g=(0,I.useRef)(!1);(0,I.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[lS],v=(0,I.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Y_(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,I.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function sD(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:cD(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&aD(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function cD(e){if(e)return e.options.allowProjection===!1?cD(e.parent):e.projection}function lD(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&OE(r);let a=n?n===`svg`:YE(e),o=a?tD:eD;function s(n,s){let c,l={...(0,I.useContext)(xE),...n,layoutId:uD(n)},{isStatic:u}=l,d=zE(n),f=o(n,u);if(!u&&typeof window<`u`){dD(l,r);let t=fD(l);c=t.MeasureLayout,d.visualElement=oD(e,f,l,i,t.ProjectionNode,a)}return(0,R.jsxs)(LE.Provider,{value:d,children:[c&&d.visualElement?(0,R.jsx)(c,{visualElement:d.visualElement,...l}):null,XE(e,n,rD(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,I.forwardRef)(s);return c[nD]=e,c}function uD({layoutId:e}){let t=(0,I.useContext)(q_).id;return t&&e!==void 0?t+`-`+e:e}function dD(e,t){(0,I.useContext)(CE).strict}function fD(e){let{drag:t,layout:n}=DE();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function pD(e,t){if(typeof Proxy>`u`)return lD;let n=new Map,r=(n,r)=>lD(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,lD(a,void 0,e,t)),n.get(a))})}var mD=(e,t)=>t.isSVG??YE(e)?new Pw(t):new ww(t,{allowProjection:e!==I.Fragment}),hD=class extends WC{constructor(e){super(e),e.animationState||=Vw(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();DC(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},gD=0,_D={animation:{Feature:hD},exit:{Feature:class extends WC{constructor(){super(...arguments),this.id=gD++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=eS(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function vD(e){return{point:{x:e.pageX,y:e.pageY}}}var yD=e=>t=>qS(t)&&e(t,vD(t));function bD(e,t,n,r){return MT(e,t,yD(n),r)}var xD=({current:e})=>e?e.ownerDocument.defaultView:null,SD=(e,t)=>Math.abs(e-t);function CD(e,t){let n=SD(e.x,t.x),r=SD(e.y,t.y);return Math.sqrt(n**2+r**2)}var wD=new Set([`auto`,`scroll`]),TD=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=ED(this.lastRawMoveEventInfo,this.transformPagePoint));let e=OD(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=CD(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=q;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=ED(t,this.transformPagePoint),K.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=OD(e.type===`pointercancel`?this.lastMoveEventInfo:ED(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!qS(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=ED(vD(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=q;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,OD(s,this.history)),this.removeListeners=ov(bD(this.contextWindow,`pointermove`,this.handlePointerMove),bD(this.contextWindow,`pointerup`,this.handlePointerUp),bD(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(wD.has(e.overflowX)||wD.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),K.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),zv(this.updatePoint)}};function ED(e,t){return t?{point:t(e.point)}:e}function DD(e,t){return{x:e.x-t.x,y:e.y-t.y}}function OD({point:e},t){return{point:e,delta:DD(e,AD(t)),offset:DD(e,kD(t)),velocity:jD(t,.1)}}function kD(e){return e[0]}function AD(e){return e[e.length-1]}function jD(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=AD(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>lv(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>lv(t)*2&&(r=e[1]);let a=uv(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function MD(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?X(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?X(n,e,r.max):Math.min(e,n)),e}function ND(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function PD(e,{top:t,left:n,bottom:r,right:i}){return{x:ND(e.x,n,i),y:ND(e.y,t,r)}}function FD(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function ID(e,t){return{x:FD(e.x,t.x),y:FD(e.y,t.y)}}function LD(e,t){let n=.5,r=Qw(e),i=Qw(t);return i>r?n=sv(t.min,t.max-r,e.min):r>i&&(n=sv(e.min,e.max-i,t.min)),$_(0,1,n)}function RD(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var zD=.35;function BD(e=zD){return e===!1?e=0:e===!0&&(e=zD),{x:VD(e,`left`,`right`),y:VD(e,`top`,`bottom`)}}function VD(e,t,n){return{min:HD(e,t),max:HD(e,n)}}function HD(e,t){return typeof e==`number`?e:e[t]||0}var UD=new WeakMap,WD=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(vD(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=HS(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bT(e=>{let t=this.getAxisMotionValue(e).get()||0;if(py.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=Qw(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&K.update(()=>i(e,t),!1,!0),sS(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=JD(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&K.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new TD(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:xD(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&K.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!qD(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=MD(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&aD(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=PD(n.layoutBox,e):this.constraints=!1,this.elastic=BD(t),r!==this.constraints&&!aD(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&bT(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=RD(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!aD(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=dw(n,r.root,this.visualElement.getTransformPagePoint()),a=ID(r.layout.layoutBox,i);if(t){let e=t(KC(a));this.hasMutatedConstraints=!!e,e&&(a=GC(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=bT(o=>{if(!qD(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return sS(this.visualElement,e),n.start(Jx(e,n,0,t,this.visualElement,!1))}stopAnimation(){bT(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){bT(t=>{let{drag:n}=this.getProps();if(!qD(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-X(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!aD(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};bT(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=LD({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),bT(t=>{if(!qD(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(X(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;UD.set(this.visualElement,this);let e=this.visualElement.current,t=bD(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&ZS(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();aD(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=KD(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),K.read(r);let o=MT(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(bT(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=zD,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function GD(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function KD(e,t,n){let r=yC(e,GD(n)),i=yC(t,GD(n));return()=>{r(),i()}}function qD(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function JD(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var YD=class extends WC{constructor(e){super(e),this.removeGroupControls=av,this.removeListeners=av,this.controls=new WD(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||av}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},XD=e=>(t,n)=>{e&&K.update(()=>e(t,n),!1,!0)},ZD=class extends WC{constructor(){super(...arguments),this.removePointerDownListener=av}onPointerDown(e){this.session=new TD(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:xD(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:XD(e),onStart:XD(t),onMove:XD(n),onEnd:(e,t)=>{delete this.session,r&&K.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=bD(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},QD=!1,$D=class extends I.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),QD&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),RT.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),QD=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||K.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),RS.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;QD=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function eO(e){let[t,n]=SE(),r=(0,I.useContext)(q_);return(0,R.jsx)($D,{...e,layoutGroup:r,switchLayoutGroup:(0,I.useContext)(iD),isPresent:t,safeToRemove:n})}var tO={pan:{Feature:ZD},drag:{Feature:YD,ProjectionNode:bE,MeasureLayout:eO}};function nO(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&K.postRender(()=>i(t,vD(t)))}var rO=class extends WC{mount(){let{current:e}=this.node;e&&(this.unmount=GS(e,(e,t)=>(nO(this.node,t,`Start`),e=>nO(this.node,e,`End`))))}unmount(){}},iO=class extends WC{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=ov(MT(this.node.current,`focus`,()=>this.onFocus()),MT(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function aO(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&K.postRender(()=>i(t,vD(t)))}var oO=class extends WC{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=iC(e,(e,t)=>(aO(this.node,t,`Start`),(e,{success:t})=>aO(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},sO=new WeakMap,cO=new WeakMap,lO=e=>{let t=sO.get(e.target);t&&t(e)},uO=e=>{e.forEach(lO)};function dO({root:e,...t}){let n=e||document;cO.has(n)||cO.set(n,{});let r=cO.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(uO,{root:e,...t})),r[i]}function fO(e,t,n){let r=dO(t);return sO.set(e,n),r.observe(e),()=>{sO.delete(e),r.unobserve(e)}}var pO={some:0,all:1},mO=class extends WC{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:pO[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=fO(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(hO(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function hO({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var gO={inView:{Feature:mO},tap:{Feature:oO},focus:{Feature:iO},hover:{Feature:rO}},_O={layout:{ProjectionNode:bE,MeasureLayout:eO}},vO=pD({..._D,...gO,...tO,..._O},mD),yO=(0,I.memo)(({children:e,as:t=`p`,className:n,duration:r=2,spread:i=2})=>{let a=vO.create(t),o=(0,I.useMemo)(()=>(e?.length??0)*i,[e,i]);return(0,R.jsx)(a,{animate:{backgroundPosition:`0% center`},className:A(`relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent`,`[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]`,n),initial:{backgroundPosition:`100% center`},style:{"--spread":`${o}px`,backgroundImage:`var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))`},transition:{repeat:1/0,duration:r,ease:`linear`},children:e})}),bO=(0,I.createContext)(null),xO=()=>{let e=(0,I.useContext)(bO);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},SO=1e3,CO=1e3,wO=(0,I.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[c,l]=Rt({prop:n,defaultProp:r,onChange:i}),[u,d]=Rt({prop:a,defaultProp:void 0}),[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(null);return(0,I.useEffect)(()=>{t?m===null&&h(Date.now()):m!==null&&(d(Math.ceil((Date.now()-m)/CO)),h(null))},[t,m,d]),(0,I.useEffect)(()=>{if(r&&!t&&c&&!f){let e=setTimeout(()=>{l(!1),p(!0)},SO);return()=>clearTimeout(e)}},[t,c,r,l,f]),(0,R.jsx)(bO.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:l,duration:u},children:(0,R.jsx)(Ne,{className:A(`not-prose mb-4`,e),onOpenChange:e=>{l(e)},open:c,...s,children:o})})}),TO=(e,t)=>e||t===0?(0,R.jsx)(yO,{duration:1,children:`Thinking...`}):t===void 0?(0,R.jsx)(`p`,{children:`Thought for a few seconds`}):(0,R.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),EO=(0,I.memo)(({className:e,children:t,getThinkingMessage:n=TO,...r})=>{let{isStreaming:i,isOpen:a,duration:o}=xO();return(0,R.jsx)(Pe,{className:A(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...r,children:t??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ct,{className:`size-4`}),n(i,o),(0,R.jsx)(Ee,{className:A(`size-4 transition-transform`,a?`rotate-180`:`rotate-0`)})]})})}),DO=(0,I.memo)(({className:e,children:t,...n})=>(0,R.jsx)(Ae,{className:A(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,R.jsx)(Bf,{children:t})}));wO.displayName=`Reasoning`,EO.displayName=`ReasoningTrigger`,DO.displayName=`ReasoningContent`;var OO=({className:e,...t})=>(0,R.jsx)(Ne,{className:A(`not-prose mb-4 text-primary text-xs`,e),...t}),kO=({className:e,count:t,children:n,...r})=>(0,R.jsx)(Pe,{className:A(`flex items-center gap-2`,e),...r,children:n??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`font-medium`,children:[`Used `,t,` sources`]}),(0,R.jsx)(Ee,{className:`h-4 w-4`})]})}),AO=({className:e,...t})=>(0,R.jsx)(Ae,{className:A(`mt-3 flex w-fit flex-col gap-2`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),jO=({href:e,title:t,children:n,...r})=>(0,R.jsx)(`a`,{className:`flex items-center gap-2`,href:e,rel:`noreferrer`,target:`_blank`,...r,children:n??(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Be,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`block font-medium`,children:t})]})});function MO(e){let t=e??{},n=t.data&&typeof t.data==`object`?t.data:t,r=n.seedApplied,i=n.probes;if(!r&&!i)return;let a={};return r&&(r.success===!1?a.seedError=r.error??(Array.isArray(r.errors)&&r.errors.length?String(r.errors[0]):`Sample data failed to load.`):a.seededRows=(r.inserted??0)+(r.updated??0)),i&&(a.checked={seeds:i.checked?.seeds??0,views:i.checked?.views??0,widgets:i.checked?.widgets??0},a.issues=(i.issues??[]).filter(e=>e&&typeof e.message==`string`).map(e=>({severity:e.severity===`error`?`error`:`warning`,code:String(e.code??`runtime_issue`),message:String(e.message)}))),a}function NO(e){return e===`user`?`user`:`assistant`}function PO(e){let t=e.trim();if(t.length<2||!(t.startsWith(`{`)||t.startsWith(`[`))||!(t.endsWith(`}`)||t.endsWith(`]`)))return!1;try{return JSON.parse(t),!0}catch{return!1}}function FO(e){let t=e.state??(e.errorText?`output-error`:e.result===void 0?`input-available`:`output-available`);return t===`output-error`||t===`output-denied`?`failed`:t===`approval-requested`||t===`approval-responded`?`awaiting`:t===`output-available`?`completed`:`running`}function IO(e){return[{create_object:`新建对象`,add_field:`新增字段`,modify_field:`修改字段`,delete_field:`删除字段`,create_metadata:`新建`,update_metadata:`修改`,create_seed:`生成示例数据`,create_package:`新建应用包`}[e.verb]??e.verb,`${e.field?`${e.object?`${e.object}.`:``}${e.field}`:e.object??e.name??``}${e.type?`(${e.type})`:``}`,e.details].filter(Boolean).join(` `)}function LO(e){return e.toolName===`propose_blueprint`}function RO(e){return LO(e)&&FO(e)===`completed`&&!e.proposedPlan&&!e.proposedChanges&&!e.draftReview?.items.length}var zO=[`待补`,`后续`,`将在`,`稍后`,`暂不`,`暂未`,`尚未`,`确认后一起补`,`一起补`,`另行`,`日后`,`not yet`,`will be implemented`,`will be added`,`to be added`,`to be implemented`,`later`,`deferred`,`follow-up`,`follow up`,`future`,`subsequent`,`coming soon`,`tbd`];function BO(e){let t=[],n=[];for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();if(!e)continue;let i=e.toLowerCase();zO.some(e=>i.includes(e))?n.push(e):t.push(e)}return{designNotes:t,deferred:n}}function VO(e){let t=FO(e);return t===`awaiting`||t===`failed`||!!e.pendingActionId||!!e.draftReview?.items.length||!!e.proposedPlan||!!e.proposedChanges||RO(e)}function HO(e){switch(e){case`failed`:return 4;case`awaiting`:return 3;case`running`:return 2;case`completed`:return 1}}function UO(e){let t=new Map;for(let n of e){let e=FO(n),r=`${n.toolName}:${e}`,i=t.get(r);if(i){i.count+=1,i.errorText=i.errorText??n.errorText;continue}t.set(r,{key:r,title:po(n.toolName)||n.toolName,rawName:n.toolName,count:1,state:e,errorText:n.errorText})}return Array.from(t.values()).sort((e,t)=>{let n=HO(t.state)-HO(e.state);return n===0?e.title.localeCompare(t.title):n})}function WO({health:e}){if(!e)return null;let t=e.issues??[],n=t.filter(e=>e.severity===`error`),r=t.filter(e=>e.severity!==`error`),i=e.checked,a=!!i&&i.seeds+i.views+i.widgets>0,o=[];if(typeof e.seededRows==`number`&&e.seededRows>0&&!e.seedError&&o.push(`${e.seededRows} sample row${e.seededRows===1?``:`s`} live`),a&&n.length===0){let e=[];i.views>0&&e.push(`${i.views} view${i.views===1?``:`s`}`),i.widgets>0&&e.push(`${i.widgets} widget${i.widgets===1?``:`s`}`),i.seeds>0&&e.push(`${i.seeds} seed${i.seeds===1?``:`s`}`),e.length&&o.push(`${e.join(` · `)} verified`)}return o.length===0&&!e.seedError&&t.length===0?null:(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`publish-health`,children:[o.length>0?(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-emerald-700`,children:[(0,R.jsx)(k,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:o.join(` · `)})]}):null,e.seedError?(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.seedError})]}):null,n.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`e${t}`)),r.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-amber-600`,children:[(0,R.jsx)(_e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`w${t}`))]})}var GO=I.forwardRef(({className:e,messages:t=[],placeholder:n=`Type your message...`,onSendMessage:r,onClear:i,onStop:a,onReload:o,onUpgrade:s,disabled:c=!1,readOnly:u=!1,isLoading:d=!1,error:f,showTimestamp:p=!1,showAvatars:m=!1,userAvatarUrl:h,userAvatarFallback:g=`You`,assistantAvatarUrl:_,assistantAvatarFallback:v=`AI`,hideClearBar:y=!1,maxHeight:b=`500px`,enableMarkdown:x=!0,enableFileUpload:S=!1,acceptedFileTypes:C=`image/*,.pdf,.doc,.docx,.txt`,maxFileSize:w=10*1024*1024,suggestions:T,labels:E,models:D,selectedModelId:ee,onModelChange:O,headerSlot:te,promptOverlaySlot:ne,onInputChange:re,onToolApprove:ie,toolApproveLabel:ae=`Approve`,toolDenyLabel:oe=`Deny`,toolDenyReason:se=`User denied the operation`,toolDecisions:de,onReviewDraft:fe,toolReviewLabel:pe=e=>`Review ${e} change${e===1?``:`s`}`,onPublishDrafts:he,onOpenBuiltApp:ge,openBuiltAppLabel:ve=`Open app`,onPreviewDraftApp:ye,previewDraftLabel:be=`Preview`,onDraftArtifacts:Ce,onBuildMaterialized:we,publishDraftsLabel:Ee=`Publish`,publishedLabel:De=`Published`,verifiedLabel:Oe=`Verified`,nextStepsLabel:ke=`What's next`,planTitleLabel:Ae=`Proposed plan`,planExtendLabel:je=`Adding to existing app`,planQuestionsLabel:Me=`Confirm before building`,planAssumptionsLabel:Ne=`Assumptions`,planDeferredLabel:Pe=`Not yet built`,planApproveHintLabel:Fe=`Reply to approve or adjust this plan.`,planApproveLabel:Ie=`Build it`,planAdjustLabel:Le=`Adjust`,planBuiltLabel:Re=`Built`,planReadyLabel:ze=`The plan is ready. Build it now, or tell me what to adjust.`,planApproveMessage:Be=`Looks good — build it as proposed.`,planApproveDefaultsMessage:Ve=`Build it with your best assumptions; use sensible defaults for the open questions.`,planAnswerMessage:He=(e,t)=>`For "${e}", go with: ${t}.`,fetchPendingDraftCount:Ue,autoPublishDrafts:We=!1,processVisibility:Ge=`summary`,surface:Ke=`card`,...qe},Je)=>{let Ye=d?`streaming`:`ready`,Xe=Ke===`plain`,[Ze,Qe]=I.useState(null),$e=I.useRef(``),et=I.useRef(null),j=I.useMemo(()=>({emptyTitle:E?.emptyTitle??`Start a conversation`,emptyDescription:E?.emptyDescription??`Ask anything — the assistant has access to your current app context.`,clear:E?.clear??`Clear`,sendHint:E?.sendHint??`to send`,agentActivity:E?.agentActivity??`Agent activity`,toolCompleted:E?.toolCompleted??`Completed`,toolRunning:E?.toolRunning??`Running`,toolAwaitingApproval:E?.toolAwaitingApproval??`Awaiting approval`,toolFailed:E?.toolFailed??`Failed`,toolDetailsHidden:E?.toolDetailsHidden??`Detailed tool inputs and outputs are hidden in this view.`,copy:E?.copy??`Copy`,copied:E?.copied??`Copied`,regenerate:E?.regenerate??`Regenerate`,model:E?.model??`Model`,submit:E?.submit??`Submit`,uploadFiles:E?.uploadFiles??`Upload files`,stopResponse:E?.stopResponse??`Stop response`,sendFailedRateLimited:E?.sendFailedRateLimited??`You're sending messages too quickly. Your message is kept below — wait a moment and try again.`,sendFailedGeneric:E?.sendFailedGeneric??`Couldn't send your message. It's kept below — please try again.`,trace:E?.trace??`trace`,viewTrace:E?.viewTrace??`View trace`,connectionWaiting:E?.connectionWaiting??`Waiting for server…`,connectionStalledLabel:E?.connectionStalledLabel??`Still working…`,connectionOfflineLabel:E?.connectionOfflineLabel??`Connection lost — reconnecting…`,designingPlanLabel:E?.designingPlanLabel??`Designing your app…`,designingPlanHints:E?.designingPlanHints??ek}),[E]),[nt,rt]=I.useState(()=>new Set),[it,at]=I.useState(()=>new Map),[ot,st]=I.useState(()=>new Map),ct=I.useRef(new Set),lt=I.useCallback(async e=>{if(Ue)try{let t=await Ue(e);st(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}catch{}},[Ue]);I.useEffect(()=>{if(!Ue||d)return;let e=new Set;for(let n of t)for(let t of n.toolInvocations??[]){let n=t.draftReview?.packageId,r=t.toolCallId;n&&r&&!ct.current.has(r)&&(ct.current.add(r),e.add(n))}for(let t of e)lt(t)},[t,d,Ue,lt]);let ut=I.useCallback(async e=>{if(!he)return;let n=[];for(let r of t)for(let t of r.toolInvocations??[])t.draftReview?.packageId===e&&t.toolCallId&&n.push(t.toolCallId);let r=await he(e),i=r&&typeof r==`object`?r:void 0;if((i?i.ok!==!1:r!==!1)&&n.length>0){rt(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});let e=i?.health;e&&at(t=>{let r=new Map(t);for(let t of n)r.set(t,e);return r})}lt(e)},[he,t,lt]),ft=I.useRef(new Set),pt=I.useRef(!1);I.useEffect(()=>{let e=[];for(let n of t)for(let t of n.toolInvocations??[]){let n=t.draftReview;n?.autoPublishable&&n.packageId&&t.toolCallId&&n.items.length>0&&e.push({key:t.toolCallId,packageId:n.packageId})}if(!pt.current){pt.current=!0;for(let t of e)ft.current.add(t.key);return}if(!We||!he||d)return;let n=e.filter(e=>!ft.current.has(e.key));if(n.length!==0){for(let e of n)ft.current.add(e.key);for(let e of[...new Set(n.map(e=>e.packageId))])ut(e)}},[t,d,We,he,ut]);let mt=I.useRef(new Set);I.useEffect(()=>{if(!Ce)return;let e=new Map,n;for(let r of t){for(let t of r.buildProgress?.items??[])t?.type&&t?.name&&e.set(`${t.type}:${t.name}`,t);for(let t of r.toolInvocations??[]){let r=t.draftReview;for(let t of r?.items??[])t?.type&&t?.name&&e.set(`${t.type}:${t.name}`,t);r?.packageId&&r.items?.some(e=>e.type===`app`)&&(n=r.packageId)}}let r=mt.current,i=!1;for(let t of e.keys())r.has(t)||(r.add(t),i=!0);i&&Ce([...e.values()],n)},[t,Ce]);let ht=I.useRef(new Set);I.useEffect(()=>{if(we)for(let e of t)for(let t of e.toolInvocations??[]){let e=t.draftReview;if(!e?.materialized||!t.toolCallId)continue;let n=e.items.find(e=>e.type===`app`);!n||ht.current.has(t.toolCallId)||(ht.current.add(t.toolCallId),we(n.name))}},[t,we]);let gt=I.useCallback(e=>{let t=!!e.text?.trim(),n=e.files?.map(e=>e.file).filter(Boolean),i=!!(n&&n.length>0);if(!(t||i))return;let a=e.text?.trim()??``;$e.current=a,et.current=null,r?.(a,n)},[r]),vt=I.useCallback(e=>{r?.(e)},[r]),yt=I.useRef(null),bt=I.useCallback(e=>{r?.(e?Ve:Be)},[r,Be,Ve]),St=I.useCallback(()=>{let e=yt.current?.querySelector(`textarea`);e&&(e.focus(),e.scrollIntoView({block:`nearest`}))},[]);I.useEffect(()=>{if(!f||!vo(f)||et.current===f)return;et.current=f;let e=$e.current;if(!e)return;let t=yt.current?.querySelector(`textarea`);t&&t.value.trim()===``&&(t.value=e,t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.focus())},[f]);let Ct=I.useCallback(e=>{navigator.clipboard?.writeText(e.content),Qe(e.id),window.setTimeout(()=>Qe(t=>t===e.id?null:t),1500)},[]),wt=I.useMemo(()=>{let e=new Set,n=[],r=-1,i=0;for(let e of t)for(let t of e.toolInvocations??[])(t.proposedPlan||RO(t))&&t.toolCallId&&n.push({id:t.toolCallId,order:i}),t.toolName===`apply_blueprint`&&(r=i),i+=1;for(let t of n)t.order<r&&e.add(t.id);return e},[t]),Tt=I.useMemo(()=>{let e=new Set,n=[],r=new Map,i=0;for(let e of t)for(let t of e.toolInvocations??[])t.proposedChanges&&t.toolCallId?n.push({id:t.toolCallId,toolName:t.toolName??``,order:i}):t.toolName&&r.set(t.toolName,i),i+=1;for(let t of n){let n=r.get(t.toolName);n!==void 0&&n>t.order&&e.add(t.id)}return e},[t]),Dt=e=>{let t=e.state??(e.errorText?`output-error`:e.result===void 0?`input-available`:`output-available`),n=`tool-${e.toolName}`,i=de?.[e.toolCallId],a=t===`approval-requested`&&!!ie&&!i,o=t===`approval-requested`&&!!e.pendingActionId,s=po(e.toolName),c=mo(e.result),l=Ge===`debug`&&s&&s.toLowerCase()!==e.toolName.toLowerCase(),u=Ge===`debug`||a,d=e.draftReview?.packageId,f=d===void 0?void 0:ot.get(d),p=f===void 0?nt.has(e.toolCallId):f===0,m=t===`input-streaming`||t===`input-available`,h=(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`span`,{children:s||e.toolName}),l?(0,R.jsx)(`code`,{className:`rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground`,children:e.toolName}):null,m?LO(e)?(0,R.jsx)(rk,{label:j.designingPlanLabel,hints:j.designingPlanHints,offlineLabel:j.connectionOfflineLabel}):(0,R.jsx)(ik,{offlineLabel:j.connectionOfflineLabel}):null]});return(0,R.jsxs)(V_,{defaultOpen:t===`output-error`||t===`approval-requested`||!!(e.draftReview&&e.draftReview.items.length>0)||!!e.proposedPlan||!!e.proposedChanges||RO(e),children:[(0,R.jsx)(U_,{type:n,state:t,title:h}),(0,R.jsxs)(W_,{children:[u&&e.args!==void 0?(0,R.jsx)(G_,{input:e.args}):null,o?null:u||t===`output-error`?(0,R.jsx)(mk,{output:c,errorText:e.errorText}):null,i?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 p-3 border-t text-xs `+(i.state===`error`?`bg-destructive/10 text-destructive`:i.state===`success`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-400`:`bg-muted/30 text-muted-foreground`),children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,children:i.state===`pending`?`...`:i.state===`success`?`OK`:`X`}),(0,R.jsx)(`span`,{children:i.message??(i.state===`pending`?`Submitting decision...`:i.state===`success`?`Action approved and executed.`:`Decision failed.`)})]}):null,a?(0,R.jsxs)(`div`,{className:`flex gap-2 p-3 border-t bg-muted/30`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>ie?.(e.toolCallId,!0),className:`inline-flex h-7 items-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:ae}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>ie?.(e.toolCallId,!1,se),className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,children:oe})]}):null,e.draftReview&&e.draftReview.items.length>0&&(fe||he&&e.draftReview.packageId)?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 p-3 border-t bg-muted/30`,children:[he&&e.draftReview.packageId?p?(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700`,children:[(0,R.jsx)(k,{className:`size-3.5`}),De,e.draftReview.failedCount?` · ${e.draftReview.failedCount} need${e.draftReview.failedCount===1?`s`:``} attention`:``]}):(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void ut(e.draftReview.packageId),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`draft-publish`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ee,typeof f==`number`&&f>0?` (${f})`:``]}):null,fe?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>fe(e.draftReview.items),className:he&&e.draftReview.packageId?`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[(0,R.jsx)(jt,{className:`size-3.5`}),pe(e.draftReview.items.length)]}):null,ye&&!p?(()=>{let t=e.draftReview.items.find(e=>e.type===`app`);return t?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>ye(t.name,{materialized:e.draftReview.materialized===!0,appSegment:e.draftReview.packageId}),className:`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`,"data-testid":`draft-preview-app`,children:[(0,R.jsx)(ce,{className:`size-3.5`}),be]}):null})():null,e.draftReview.verification?e.draftReview.verification.errors>0?(0,R.jsxs)(`span`,{className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-200 bg-amber-50 px-2.5 text-xs font-medium text-amber-700`,"data-testid":`draft-verification-chip`,children:[(0,R.jsx)(le,{className:`size-3.5`}),`${e.draftReview.verification.errors} issue${e.draftReview.verification.errors===1?``:`s`}`]}):(0,R.jsxs)(`span`,{className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700`,"data-testid":`draft-verification-chip`,children:[(0,R.jsx)(xe,{className:`size-3.5`}),Oe]}):null,e.draftReview.summary?(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.draftReview.summary}):null]}),e.draftReview.issues&&e.draftReview.issues.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`draft-issues`,children:[e.draftReview.issues.filter(e=>e.severity===`error`).map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-red-600`,children:[(0,R.jsx)(At,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.fix?`${e.message} — ${e.fix}`:e.message})]},`e${t}`)),e.draftReview.issues.filter(e=>e.severity!==`error`).map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-amber-600`,children:[(0,R.jsx)(_e,{className:`mt-0.5 size-3.5 shrink-0`}),(0,R.jsx)(`span`,{children:e.message})]},`w${t}`))]}):null,nt.has(e.toolCallId)?(0,R.jsx)(WO,{health:it.get(e.toolCallId)}):null,e.draftReview.nextSteps&&e.draftReview.nextSteps.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 border-t bg-muted/20 px-3 py-2`,"data-testid":`draft-next-steps`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-foreground/80`,children:ke}),e.draftReview.nextSteps.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-foreground/40`,children:`→`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null]}):null,e.proposedPlan?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-plan`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),Ae]}),e.proposedPlan.targetApp?(0,R.jsxs)(`span`,{className:`inline-flex w-fit items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300`,"data-testid":`proposed-plan-extend`,children:[`+ `,je,` 「`,e.proposedPlan.targetApp,`」`]}):null,e.proposedPlan.summary?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.proposedPlan.summary}):null,e.proposedPlan.objects.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.proposedPlan.objects.map(e=>(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80`,title:e.name,children:[(0,R.jsx)(tt,{className:`size-3 text-foreground/40`}),e.label||e.name,e.fieldCount>0?(0,R.jsxs)(`span`,{className:`text-foreground/40`,children:[`· `,e.fieldCount]}):null]},e.name))}):null,(()=>{let t=e.proposedPlan.counts,n=[];return t.objects&&n.push(`${t.objects} object${t.objects===1?``:`s`}`),t.views&&n.push(`${t.views} view${t.views===1?``:`s`}`),t.dashboards&&n.push(`${t.dashboards} dashboard${t.dashboards===1?``:`s`}`),t.seedData&&n.push(`sample data`),n.length?(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n.join(` · `)}):null})(),(()=>{let{designNotes:t,deferred:n}=BO(e.proposedPlan.assumptions);return(0,R.jsxs)(R.Fragment,{children:[t.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`proposed-plan-assumptions`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-medium text-foreground/70`,children:Ne}),t.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-foreground/40`,children:`·`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null,n.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-dashed border-amber-300 bg-amber-50/60 px-2 py-1.5 dark:border-amber-800/60 dark:bg-amber-950/20`,"data-testid":`proposed-plan-deferred`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300`,children:[(0,R.jsx)(Et,{className:`size-3.5`}),Pe]}),n.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0 text-amber-500/80`,children:`·`}),(0,R.jsx)(`span`,{children:e})]},t))]}):null]})})(),e.proposedPlan.questions.length>0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-amber-200 bg-amber-50 px-2 py-1.5 dark:border-amber-900/50 dark:bg-amber-950/30`,"data-testid":`proposed-plan-questions`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300`,children:[(0,R.jsx)(Se,{className:`size-3.5`}),Me]}),e.proposedPlan.questions.map((t,n)=>{let i=e.proposedPlan.questionChoices?.find(e=>e.text===t);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90`,children:[(0,R.jsx)(`span`,{className:`mt-px shrink-0`,children:`?`}),(0,R.jsx)(`span`,{children:t})]}),r&&i&&i.options.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1 pl-3.5`,"data-testid":`proposed-plan-choice`,children:i.options.map((e,n)=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(He(t,e)),className:`inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40`,children:e},n))}):null]},n)})]}):null,r?wt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-plan-built`,children:[(0,R.jsx)(k,{className:`size-3.5`}),Re]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>bt(e.proposedPlan.questions.length>0),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-plan-approve`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ie]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-plan-adjust`,children:Le})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:Fe})]}):null,RO(e)?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-plan-fallback`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),Ae]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ze}),r?wt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-plan-built`,children:[(0,R.jsx)(k,{className:`size-3.5`}),Re]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-plan-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>bt(!1),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-plan-approve`,children:[(0,R.jsx)(me,{className:`size-3.5`}),Ie]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-plan-adjust`,children:Le})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:Fe})]}):null,e.proposedChanges?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5`,"data-testid":`proposed-changes`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80`,children:[(0,R.jsx)(Mt,{className:`size-3.5`}),`确认改动`]}),e.proposedChanges.summary?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.proposedChanges.summary}):null,(0,R.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.proposedChanges.changes.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80`,children:[(0,R.jsx)(tt,{className:`mt-px size-3 shrink-0 text-foreground/40`}),(0,R.jsx)(`span`,{children:IO(e)})]},t))}),r?Tt.has(e.toolCallId)?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-changes-actions`,children:(0,R.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300`,"data-testid":`proposed-changes-confirmed`,children:[(0,R.jsx)(k,{className:`size-3.5`}),`已确认`]})}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,"data-testid":`proposed-changes-actions`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`确认修改,应用你刚才提议的改动。`),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`proposed-changes-confirm`,children:[(0,R.jsx)(k,{className:`size-3.5`}),`确认修改`]}),(0,R.jsx)(`button`,{type:`button`,onClick:St,className:`inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent`,"data-testid":`proposed-changes-adjust`,children:`调整`})]}):(0,R.jsx)(`span`,{className:`text-[11px] italic text-muted-foreground/80`,children:`回复以确认或调整该改动。`})]}):null]})]},e.toolCallId)};return(0,R.jsxs)(`div`,{ref:Je,className:A(Xe?`flex min-h-0 flex-col overflow-hidden bg-background`:`flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background`,e),style:{maxHeight:b},...qe,children:[i&&!y&&t.length>0&&(0,R.jsx)(`div`,{className:A(`flex items-center justify-end px-4 py-2`,Xe?`bg-background`:`border-b bg-muted/30`),children:(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:j.clear})}),te?(0,R.jsx)(`div`,{className:A(`shrink-0`,!Xe&&`border-b bg-background/50`),children:te}):null,(0,R.jsxs)(Po,{className:`flex-1 min-h-0`,children:[(0,R.jsxs)(Fo,{className:A(`space-y-4`,Xe?`mx-auto w-full max-w-2xl px-4 py-8 sm:px-0`:`px-4 py-3`),children:[t.length===0?(0,R.jsxs)(Io,{className:`gap-3 px-0 py-8`,children:[(0,R.jsx)(`div`,{className:`flex size-9 items-center justify-center rounded-md bg-muted/70 text-muted-foreground`,children:_?(0,R.jsx)(`img`,{src:_,alt:``,className:`size-full rounded-md object-cover`}):(0,R.jsx)(_t,{className:`size-4`})}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`h3`,{className:`text-sm font-medium text-foreground/90`,children:j.emptyTitle}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j.emptyDescription})]}),T&&T.length>0?(0,R.jsx)(Cp,{className:`justify-center gap-2`,children:T.map(e=>(0,R.jsx)(wp,{className:`h-8 border-border/60 bg-background/80 px-3 text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60`,suggestion:e,onClick:vt},e))}):null]}):t.map(e=>{let t=e.role===`user`,n=e.toolInvocations??[],r=e.reasoning?.trim(),i=e.sources??[],a=t?void 0:e.buildProgress,s=!t&&!n.some(e=>!!e.proposedPlan)?e.blueprintProgress:void 0,c=!t&&!!e.streaming&&!e.content&&n.length===0&&!r&&!a&&!s,u=!t&&Ge===`summary`?n.filter(e=>!VO(e)&&!(s&&e.toolName===`propose_blueprint`)):[],d=!t&&Ge===`debug`?n:!t&&Ge!==`debug`?n.filter(VO):[];return(0,R.jsx)(Uf,{from:NO(e.role),children:(0,R.jsxs)(`div`,{className:A(`flex w-full gap-2.5`,m?t?`flex-row-reverse items-start`:`flex-row items-start`:`flex-col`),children:[m?(0,R.jsx)(KO,{isUser:t,url:t?h:_,fallback:t?g:v}):null,(0,R.jsxs)(`div`,{className:A(`flex min-w-0 flex-col gap-2`,m&&!t&&`flex-1`),children:[(0,R.jsxs)(Wf,{children:[s?(0,R.jsx)(sk,{progress:s,designingLabel:j.designingPlanLabel,extendLabel:je,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null,a?(0,R.jsx)(ck,{progress:a,onOpenBuiltApp:ge,openBuiltAppLabel:ve,onPreviewDraftApp:ye,previewDraftLabel:be,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null,!t&&Ge===`debug`&&r?(0,R.jsxs)(wO,{isStreaming:!!e.streaming&&!e.content,className:`mb-2`,children:[(0,R.jsx)(EO,{}),(0,R.jsx)(DO,{children:r})]}):null,!t&&Ge===`summary`&&u.length>0?(0,R.jsx)(lk,{groups:UO(u),labels:j}):null,!t&&d.length>0?d.map(Dt):null,t?e.content?(0,R.jsx)(`div`,{className:`whitespace-pre-wrap break-words`,children:e.content}):null:c?(0,R.jsx)(JO,{}):e.content?(0,R.jsx)(qf,{children:e.content}):null,e.streaming&&!c?(0,R.jsx)(`span`,{"aria-hidden":!0,className:`ml-0.5 inline-block w-[2px] h-4 align-middle bg-current animate-pulse`}):null,!t&&(e.charts?.length??0)>0?(0,R.jsx)(`div`,{className:`mt-2 flex flex-col gap-3`,"data-testid":`chat-charts`,children:e.charts.map((e,t)=>(0,R.jsxs)(`div`,{className:`rounded-lg border bg-background p-3`,style:{width:`min(520px, 80vw)`},"data-testid":`chat-chart`,children:[e.title?(0,R.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:e.title}):null,(0,R.jsx)(l,{schema:{type:`chart`,chartType:e.chartType??`bar`,data:e.data,xAxisKey:e.xAxisKey,series:e.series}})]},t))}):null,!t&&i.length>0?(0,R.jsxs)(OO,{children:[(0,R.jsx)(kO,{count:i.length}),(0,R.jsx)(AO,{children:i.map((e,t)=>(0,R.jsx)(jO,{href:e.url,title:e.title??e.url},e.id??e.url??t))})]}):null,p&&e.timestamp?(0,R.jsx)(`div`,{className:`text-[10px] opacity-70 mt-1`,children:e.timestamp}):null]}),!t&&!c?(0,R.jsxs)(Gf,{className:`opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100`,children:[(0,R.jsx)(Kf,{label:Ze===e.id?j.copied:j.copy,tooltip:Ze===e.id?j.copied:j.copy,onClick:()=>Ct(e),children:Ze===e.id?(0,R.jsx)(ue,{className:`size-3.5`}):(0,R.jsx)(xt,{className:`size-3.5`})}),o?(0,R.jsx)(Kf,{label:j.regenerate,tooltip:j.regenerate,onClick:o,children:(0,R.jsx)(Te,{className:`size-3.5`})}):null,Ge===`debug`&&e.traceId?(0,R.jsx)(`a`,{href:`#trace/${e.traceId}`,"data-trace-id":e.traceId,className:`text-[10px] text-muted-foreground hover:text-foreground ml-1 underline`,title:j.viewTrace,children:j.trace}):null]}):null]})]})},e.id)}),d&&!t.some(e=>e.streaming)?(0,R.jsx)(qO,{showAvatar:m,assistantAvatarUrl:_,assistantAvatarFallback:v,waitingLabel:j.connectionWaiting,stalledLabel:j.connectionStalledLabel,offlineLabel:j.connectionOfflineLabel}):null]}),(0,R.jsx)(Lo,{})]}),f?vo(f)&&!_o(f)?(0,R.jsx)(fk,{error:f,rateLimitedLabel:j.sendFailedRateLimited,genericLabel:j.sendFailedGeneric}):(0,R.jsx)(pk,{error:f,onReload:o,onUpgrade:s}):null,u?null:(0,R.jsxs)(`div`,{ref:yt,className:A(`relative`,Xe&&`mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0`),children:[ne?(0,R.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 z-10 px-3 pb-1`,children:ne}):null,(0,R.jsxs)(dp,{accept:C,fileInputLabel:j.uploadFiles,maxFileSize:w,onSubmit:gt,onError:e=>{console.warn(`[plugin-chatbot] prompt-input error`,e)},children:[S?(0,R.jsx)(fp,{children:(0,R.jsx)(lp,{children:e=>(0,R.jsx)(cp,{data:e})})}):null,(0,R.jsx)(pp,{placeholder:n,disabled:c||Ye===`streaming`,onChange:re?e=>re(e.currentTarget.value):void 0}),(0,R.jsxs)(mp,{children:[(0,R.jsxs)(hp,{children:[S?(0,R.jsxs)(_p,{children:[(0,R.jsx)(vp,{}),(0,R.jsx)(yp,{children:(0,R.jsx)(up,{})})]}):null,D&&D.length>1?(0,R.jsx)(`select`,{"aria-label":j.model,value:ee??D[0].id,onChange:e=>O?.(e.target.value),className:`h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:D.map(e=>(0,R.jsxs)(`option`,{value:e.id,children:[e.label??e.id,e.provider?` · ${e.provider}`:``]},e.id))}):null,(0,R.jsxs)(`span`,{className:`hidden items-center gap-1 text-[10px] text-muted-foreground sm:inline-flex`,"aria-hidden":`true`,children:[(0,R.jsx)(`kbd`,{className:`inline-flex h-4 items-center rounded border bg-muted px-1 font-mono text-[10px] leading-none`,children:`⌘`}),(0,R.jsx)(dt,{className:`h-3 w-3`}),(0,R.jsx)(`span`,{className:`opacity-70`,children:j.sendHint})]})]}),(0,R.jsx)(bp,{"aria-label":Ye===`streaming`?j.stopResponse:j.submit,status:Ye,disabled:c,onClick:Ye===`streaming`?a:void 0,type:Ye===`streaming`?`button`:`submit`})]})]})]})]})});GO.displayName=`ChatbotEnhanced`;function KO({isUser:e,url:t,fallback:n}){return(0,R.jsx)(`div`,{className:A(`mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium`,e?`bg-secondary text-secondary-foreground`:`bg-primary/10 text-primary`),"aria-hidden":`true`,children:t?(0,R.jsx)(`img`,{src:t,alt:``,className:`size-full object-cover`}):e?n?.trim()?.charAt(0)?.toUpperCase()||`U`:(0,R.jsx)(_t,{className:`size-4`})})}function qO({showAvatar:e,assistantAvatarUrl:t,assistantAvatarFallback:n,waitingLabel:r,stalledLabel:i,offlineLabel:a}){return(0,R.jsx)(Uf,{from:`assistant`,"aria-live":`polite`,children:(0,R.jsxs)(`div`,{className:A(`flex w-full gap-2.5`,e?`flex-row items-start`:`flex-col`),children:[e?(0,R.jsx)(KO,{isUser:!1,url:t,fallback:n}):null,(0,R.jsx)(Wf,{className:`rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(JO,{}),(0,R.jsx)($O,{active:!0,pending:!0,activityKey:0,waitingLabel:r,stalledLabel:i,offlineLabel:a})]})})]})})}function JO(){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`Assistant is responding`}),(0,R.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`}),(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`}),(0,R.jsx)(`span`,{className:`size-1.5 rounded-full bg-current animate-pulse`})]})]})}function YO(e){let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}var XO=6;function ZO(e,t){let n=I.useRef(0),r=I.useRef(0),[i,a]=I.useState({elapsed:0,quiet:0});return I.useEffect(()=>{let e=Date.now();n.current=e,r.current=e},[]),I.useEffect(()=>{let e=Date.now();r.current=e,a({elapsed:Math.floor((e-n.current)/1e3),quiet:0})},[t]),I.useEffect(()=>{if(!e)return;let t=()=>{let e=Date.now();a({elapsed:Math.floor((e-n.current)/1e3),quiet:Math.floor((e-r.current)/1e3)})};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),{elapsedSeconds:i.elapsed,quietSeconds:i.quiet,live:i.quiet<XO}}function QO(){let[e,t]=I.useState(()=>typeof navigator<`u`&&navigator.onLine===!1);return I.useEffect(()=>{if(typeof window>`u`)return;let e=()=>t(!1),n=()=>t(!0);return window.addEventListener(`online`,e),window.addEventListener(`offline`,n),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,n)}},[]),e}function $O({active:e,activityKey:t,pending:n=!1,waitingLabel:r,stalledLabel:i=`Still working…`,offlineLabel:a=`Connection lost — reconnecting…`}){let{elapsedSeconds:o,quietSeconds:s,live:c}=ZO(e,t),l=QO()?`offline`:c?n?`waiting`:`receiving`:`stalled`,u=YO(o);return(0,R.jsxs)(`span`,{className:A(`inline-flex items-center gap-1.5 text-xs tabular-nums`,l===`offline`?`text-red-600 font-medium`:l===`stalled`?`text-amber-600 font-medium`:`font-normal text-muted-foreground`),"aria-live":`polite`,"data-liveness-tier":l,title:l===`offline`?`${a} · ${u} elapsed`:l===`receiving`?`Receiving from server · ${u} elapsed`:l===`stalled`?`${i} (${s}s with no response) · ${u} elapsed`:`${r} · ${u} elapsed`,children:[l===`offline`?(0,R.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}):(0,R.jsx)(`span`,{"aria-hidden":!0,className:A(`size-1.5 shrink-0 rounded-full`,l===`receiving`?`bg-emerald-500 animate-pulse`:l===`stalled`?`bg-amber-500`:`bg-muted-foreground/50 animate-pulse`)}),(0,R.jsx)(Je,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,R.jsx)(`span`,{children:u}),l===`receiving`?null:(0,R.jsxs)(`span`,{children:[`· `,l===`offline`?a:l===`stalled`?i:r]})]})}var ek=[`Mapping out the data you’ll track…`,`Shaping objects and their fields…`,`Connecting related records…`,`Setting up relationships and lookups…`,`Planning the screens and views…`,`Laying out forms and lists…`,`Adding sensible defaults and validations…`,`Sketching a dashboard to track it…`,`Double-checking the structure hangs together…`,`Pulling the plan together…`],tk=3500;function nk(e,t,n=tk){if(t<=0)return-1;if(t===1)return 0;let r=Math.floor((Number.isFinite(e)&&e>0?e:0)/(n>0?n:tk));return Math.min(r,t-1)}function rk({label:e,hints:t,offlineLabel:n}){let[r,i]=I.useState(0);I.useEffect(()=>{if(t.length<=1)return;let e=Date.now(),n=setInterval(()=>i(Date.now()-e),tk);return()=>clearInterval(n)},[t.length]);let a=nk(r,t.length),o=a>=0?t[a]:void 0,s=t.length>1&&t.length<=12;return(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,"data-testid":`build-proposal-progress`,"aria-live":`polite`,children:[(0,R.jsx)(Xe,{className:`size-3 shrink-0 animate-pulse text-primary`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`font-medium text-foreground/80`,children:e}),o?(0,R.jsx)(`span`,{className:`truncate animate-in fade-in duration-500`,children:o},o):null,s?(0,R.jsx)(`span`,{className:`hidden shrink-0 items-center gap-0.5 sm:inline-flex`,"data-testid":`build-proposal-progress-dots`,"aria-hidden":!0,children:t.map((e,t)=>(0,R.jsx)(`span`,{className:A(`size-1 rounded-full transition-colors`,t<=a?`bg-primary/70`:`bg-muted-foreground/25`)},t))}):null,(0,R.jsx)(ik,{offlineLabel:n})]})}function ik({offlineLabel:e}){let[t,n]=I.useState(0),r=QO();return I.useEffect(()=>{let e=Date.now(),t=setInterval(()=>n(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[]),(0,R.jsxs)(`span`,{className:A(`inline-flex items-center gap-1 text-xs tabular-nums`,r?`text-red-600 font-medium`:`text-muted-foreground`),"aria-live":`polite`,"data-tool-running-timer":!0,children:[r?(0,R.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}):(0,R.jsx)(Je,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,R.jsx)(`span`,{children:YO(t)}),r?(0,R.jsxs)(`span`,{children:[`· `,e]}):null]})}var ak=[`object`,`view`,`dashboard`,`app`,`seed`],ok={object:`Objects`,view:`Views`,dashboard:`Dashboards`,app:`App`,seed:`Sample data`};function sk({progress:e,designingLabel:t=`Designing your app…`,extendLabel:n=`Adding to existing app`,waitingLabel:r=`Waiting for server…`,stalledLabel:i=`Still working…`,offlineLabel:a=`Connection lost — reconnecting…`}){let{phase:o,summary:s,appLabel:c,targetApp:l,objects:u,counts:d,seq:f}=e,p=o===`done`,m=f??`${o}:${u.length}`,h=p&&(s||c)||t,g=[];return d?.objects&&g.push(`${d.objects} object${d.objects===1?``:`s`}`),d?.views&&g.push(`${d.views} view${d.views===1?``:`s`}`),d?.dashboards&&g.push(`${d.dashboards} dashboard${d.dashboards===1?``:`s`}`),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,"data-testid":`blueprint-progress`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[p?(0,R.jsx)(k,{className:`size-4 shrink-0 text-emerald-600`}):(0,R.jsx)(Nt,{className:`size-4 shrink-0 animate-spin text-primary`}),(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:h}),l?(0,R.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-1.5 py-0.5 text-[10px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300`,"data-testid":`blueprint-progress-extend`,children:[`+ `,n,` 「`,l,`」`]}):null,p?null:(0,R.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,R.jsx)($O,{active:!0,activityKey:m,waitingLabel:r,stalledLabel:i,offlineLabel:a})})]}),!p&&(s||c)?(0,R.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:s||c}):null,u.length>0?(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,"data-testid":`blueprint-progress-objects`,children:u.map(e=>(0,R.jsxs)(`span`,{className:`inline-flex animate-in fade-in items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80 duration-500`,title:e.name,children:[(0,R.jsx)(tt,{className:`size-3 text-foreground/40`}),e.label||e.name,e.fields?(0,R.jsxs)(`span`,{className:`text-foreground/40`,children:[`· `,e.fields]}):null]},e.name))}):null,g.length>0?(0,R.jsx)(`span`,{className:`mt-2 block text-[11px] text-muted-foreground`,children:g.join(` · `)}):null]})}function ck({progress:e,onOpenBuiltApp:t,openBuiltAppLabel:n=`Open app`,onPreviewDraftApp:r,previewDraftLabel:i=`Preview`,waitingLabel:a=`Waiting for server…`,stalledLabel:o=`Still working…`,offlineLabel:s=`Connection lost — reconnecting…`}){let{phase:c,appLabel:l,items:u,done:d,total:f,seq:p}=e,m=c===`done`,h=p??`${c}:${d}:${u.length}`,g=u.find(e=>e.type===`app`),_=f>0?Math.min(100,Math.round(d/f*100)):m?100:6,v=new Map;for(let e of u){let t=v.get(e.type)??[];t.push(e.name.replace(/_sample$/,``)),v.set(e.type,t)}let y=[...ak.filter(e=>v.has(e)),...[...v.keys()].filter(e=>!ak.includes(e))];return(0,R.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,"data-testid":`build-progress`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium`,children:[m?(0,R.jsx)(k,{className:`size-4 shrink-0 text-emerald-600`}):(0,R.jsx)(Nt,{className:`size-4 shrink-0 animate-spin text-primary`}),(0,R.jsx)(`span`,{children:m?`Built ${l??`your app`}`:`Building ${l??`your app`}…`}),!m&&c===`data`?(0,R.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:`adding sample data`}):null,m?null:(0,R.jsx)(`span`,{className:`ml-auto`,children:(0,R.jsx)($O,{active:!0,activityKey:h,waitingLabel:a,stalledLabel:o,offlineLabel:s})})]}),(0,R.jsx)(`div`,{className:`mb-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:A(`h-full rounded-full transition-all duration-500`,m?`bg-emerald-500`:`bg-primary`),style:{width:`${_}%`}})}),(0,R.jsx)(`ul`,{className:`space-y-1`,children:y.map(e=>{let t=v.get(e);return(0,R.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(k,{className:`mt-0.5 size-3.5 shrink-0 text-emerald-600`}),(0,R.jsxs)(`span`,{className:`min-w-0 text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:ok[e]??e}),` `,t.slice(0,6).join(`, `),t.length>6?` +${t.length-6} more`:``]})]},e)})}),m&&g&&(t||r)?(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[t?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(g.name),className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90`,"data-testid":`build-progress-open-app`,children:[n,(0,R.jsx)(Re,{className:`size-3.5`})]}):null,r?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(g.name),className:`inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted`,"data-testid":`build-progress-preview-app`,children:[(0,R.jsx)(ce,{className:`size-3.5`}),i]}):null]}):null]})}function lk({groups:e,labels:t}){return e.length===0?null:(0,R.jsx)(`div`,{className:`not-prose mb-2 border-l border-border/70 pl-3`,children:(0,R.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex min-h-6 items-center justify-between gap-3 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(uk,{state:e.state}),(0,R.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.title}),e.count>1?(0,R.jsxs)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,children:[`x`,e.count]}):null]}),e.state===`running`?e.rawName===`propose_blueprint`?(0,R.jsx)(rk,{label:t.designingPlanLabel,hints:t.designingPlanHints,offlineLabel:t.connectionOfflineLabel}):(0,R.jsx)(ik,{offlineLabel:t.connectionOfflineLabel}):(0,R.jsx)(`span`,{className:A(`shrink-0 text-[10px] font-medium`,e.state===`failed`?`text-destructive`:e.state===`completed`?`text-emerald-700 dark:text-emerald-400`:`text-muted-foreground`),children:dk(e.state,t)})]},e.key))})})}function uk({state:e}){return e===`failed`?(0,R.jsx)(At,{className:`size-3.5 shrink-0 text-destructive`}):e===`completed`?(0,R.jsx)(k,{className:`size-3.5 shrink-0 text-emerald-600`}):(0,R.jsx)(Je,{className:`size-3.5 shrink-0 text-muted-foreground`})}function dk(e,t){switch(e){case`failed`:return t.toolFailed;case`awaiting`:return t.toolAwaitingApproval;case`running`:return t.toolRunning;case`completed`:return t.toolCompleted}}function fk({error:e,rateLimitedLabel:t,genericLabel:n}){let r=I.useMemo(()=>bo(e)?t:n,[e,t,n]);return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,"data-testid":`chat-send-error`,children:(0,R.jsx)(`div`,{className:`rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(le,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600`}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1 break-words leading-snug`,children:r})]})})})}function pk({error:e,onReload:t,onUpgrade:n}){let r=I.useMemo(()=>_o(e),[e]),{summary:i,details:a}=I.useMemo(()=>ho(e),[e]),[o,s]=I.useState(!1);if(r){let e=typeof navigator<`u`&&!!navigator.language?.toLowerCase().startsWith(`zh`),t=(e?r.message:r.messageEn??r.message)||(e?`AI 额度已用完。`:`You have reached your AI quota.`),i=r.topUp?e?`购买额度包`:`Buy a credit pack`:e?`升级方案`:`Upgrade plan`;return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,children:(0,R.jsx)(`div`,{className:`rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium leading-snug text-foreground`,children:e?`需要升级`:`Upgrade needed`}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words leading-snug text-muted-foreground`,children:t})]}),n?(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex h-7 shrink-0 items-center rounded-md border border-amber-400/50 bg-background px-2 text-xs font-medium text-amber-700 hover:bg-amber-100/60 dark:text-amber-300`,children:i}):null]})})})}return(0,R.jsx)(`div`,{className:`border-t bg-background px-3 py-2 text-sm`,role:`alert`,children:(0,R.jsxs)(`div`,{className:`rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-foreground`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(_e,{className:`mt-0.5 h-4 w-4 shrink-0 text-destructive`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium leading-snug text-destructive`,children:`Response failed`}),(0,R.jsx)(`div`,{className:`mt-0.5 break-words leading-snug text-muted-foreground`,children:i||`Something went wrong. Please try again.`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[a?(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`inline-flex h-7 items-center rounded-md px-2 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-foreground`,"aria-expanded":o,children:o?`Hide`:`Details`}):null,t?(0,R.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex h-7 items-center rounded-md border border-destructive/30 bg-background px-2 text-xs font-medium text-destructive hover:bg-destructive/10`,children:[(0,R.jsx)(Te,{className:`mr-1 h-3 w-3`}),`Retry`]}):null]})]}),o&&a?(0,R.jsx)(`pre`,{className:`mt-2 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded border bg-background px-2 py-1 font-mono text-[11px] leading-snug text-muted-foreground`,children:a}):null]})})}function mk({output:e,errorText:t}){return t?(0,R.jsx)(K_,{output:void 0,errorText:t}):e==null||e===``?null:typeof e==`string`&&!PO(e)?(0,R.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,R.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Result`}),(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground`,children:(0,R.jsx)(qf,{children:e})})]}):(0,R.jsx)(K_,{output:e,errorText:void 0})}function hk({floatingConfig:e,headerExtra:t,headerActions:n,...r}){let{position:i=`bottom-right`,defaultOpen:a=!1,panelWidth:o=400,panelHeight:s=520,title:c=`Chat`,triggerSize:l=56}=e??{},[u,d]=I.useState(null);I.useEffect(()=>{let e=document.getElementById(`floating-chatbot-portal`);return e||(e=document.createElement(`div`),e.id=`floating-chatbot-portal`,document.body.appendChild(e)),d(e),()=>{e&&e.parentNode&&!e.hasChildNodes()&&e.parentNode.removeChild(e)}},[]);let f=(0,R.jsxs)(Qa,{defaultOpen:a,children:[(0,R.jsx)(io,{position:i,size:l}),(0,R.jsx)(uo,{title:c,position:i,width:o,height:s,headerExtra:t,headerActions:n,children:(0,R.jsx)(GO,{...r,maxHeight:`100%`,className:`h-full border-0 rounded-none`})})]});return u?Gl.createPortal(f,u):f}d.register(`chatbot`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,sendMessage:a}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(Nk,{messages:r,placeholder:e.placeholder,onSendMessage:e=>{a(e)},disabled:e.disabled||i,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,maxHeight:e.maxHeight,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot`,inputs:[{name:`messages`,type:`array`,label:`Initial Messages`,description:`Array of message objects with id, role, content, and optional timestamp`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`showTimestamp`,type:`boolean`,label:`Show Timestamps`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`userAvatarUrl`,type:`string`,label:`User Avatar URL`,description:`URL of the user avatar image`},{name:`userAvatarFallback`,type:`string`,label:`User Avatar Fallback`,defaultValue:`You`,description:`Fallback text shown when user avatar image is not available`},{name:`assistantAvatarUrl`,type:`string`,label:`Assistant Avatar URL`,description:`URL of the assistant avatar image`},{name:`assistantAvatarFallback`,type:`string`,label:`Assistant Avatar Fallback`,defaultValue:`AI`,description:`Fallback text shown when assistant avatar image is not available`},{name:`maxHeight`,type:`string`,label:`Max Height`,defaultValue:`500px`},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint (e.g., /api/v1/ai/chat). When set, enables streaming AI mode.`},{name:`conversationId`,type:`string`,label:`Conversation ID`,description:`Multi-turn conversation identifier`},{name:`systemPrompt`,type:`string`,label:`System Prompt`,description:`System prompt to configure assistant behavior`},{name:`model`,type:`string`,label:`AI Model`,description:`AI model identifier (e.g., gpt-4o)`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1,description:`Automatically send a response after user message (for demo purposes, ignored when API is set)`},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,showTimestamp:!1,disabled:!1,userAvatarFallback:`You`,assistantAvatarFallback:`AI`,maxHeight:`500px`,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3,className:`w-full max-w-2xl`}}),d.register(`chatbot-enhanced`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,error:a,sendMessage:o,stop:s,reload:c,clear:l,isApiMode:u}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(GO,{messages:r,placeholder:e.placeholder,onSendMessage:(e,t)=>{o(e,t)},onClear:()=>{l(),e.onClear?.()},onStop:u&&i?s:void 0,onReload:u?c:void 0,disabled:e.disabled,isLoading:i,error:a,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,maxHeight:e.maxHeight,enableMarkdown:e.enableMarkdown??!0,enableFileUpload:e.enableFileUpload??!1,processVisibility:e.processVisibility,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot (Enhanced)`,inputs:[{name:`messages`,type:`array`,label:`Initial Messages`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`showTimestamp`,type:`boolean`,label:`Show Timestamps`,defaultValue:!1},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`enableMarkdown`,type:`boolean`,label:`Enable Markdown`,defaultValue:!0},{name:`enableFileUpload`,type:`boolean`,label:`Enable File Upload`,defaultValue:!1},{name:`processVisibility`,type:`enum`,label:`Agent Process Visibility`,defaultValue:`summary`},{name:`userAvatarUrl`,type:`string`,label:`User Avatar URL`},{name:`userAvatarFallback`,type:`string`,label:`User Avatar Fallback`,defaultValue:`You`},{name:`assistantAvatarUrl`,type:`string`,label:`Assistant Avatar URL`},{name:`assistantAvatarFallback`,type:`string`,label:`Assistant Avatar Fallback`,defaultValue:`AI`},{name:`maxHeight`,type:`string`,label:`Max Height`,defaultValue:`500px`},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint for streaming AI mode`},{name:`conversationId`,type:`string`,label:`Conversation ID`},{name:`systemPrompt`,type:`string`,label:`System Prompt`},{name:`model`,type:`string`,label:`AI Model`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,showTimestamp:!1,disabled:!1,enableMarkdown:!0,enableFileUpload:!1,userAvatarFallback:`You`,assistantAvatarFallback:`AI`,maxHeight:`500px`,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3,className:`w-full max-w-2xl`}}),d.register(`chatbot-floating`,({schema:e,className:t,...n})=>{let{messages:r,isLoading:i,error:a,sendMessage:o,stop:s,reload:c,clear:l,isApiMode:u}=Ra({api:e.api,initialMessages:e.messages,conversationId:e.conversationId,systemPrompt:e.systemPrompt,model:e.model,streamingEnabled:e.streamingEnabled,headers:e.headers,body:e.requestBody,maxToolRoundtrips:e.maxToolRoundtrips,onError:e.onError,showTimestamp:e.showTimestamp,autoResponse:e.autoResponse,autoResponseText:e.autoResponseText,autoResponseDelay:e.autoResponseDelay,onSend:e.onSend});return(0,R.jsx)(hk,{floatingConfig:e.floatingConfig,messages:r,placeholder:e.placeholder,onSendMessage:(e,t)=>{o(e,t)},onClear:()=>{l(),e.onClear?.()},onStop:u&&i?s:void 0,onReload:u?c:void 0,disabled:e.disabled,isLoading:i,error:a,showTimestamp:e.showTimestamp,userAvatarUrl:e.userAvatarUrl,userAvatarFallback:e.userAvatarFallback,assistantAvatarUrl:e.assistantAvatarUrl,assistantAvatarFallback:e.assistantAvatarFallback,enableMarkdown:e.enableMarkdown??!0,enableFileUpload:e.enableFileUpload??!1,className:t,...n})},{namespace:`plugin-chatbot`,label:`Chatbot (Floating)`,inputs:[{name:`displayMode`,type:`string`,label:`Display Mode`,defaultValue:`floating`,description:`Set to "floating" for FAB widget`},{name:`floatingConfig.position`,type:`string`,label:`FAB Position`,defaultValue:`bottom-right`,description:`bottom-right or bottom-left`},{name:`floatingConfig.defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!1},{name:`floatingConfig.panelWidth`,type:`number`,label:`Panel Width`,defaultValue:400},{name:`floatingConfig.panelHeight`,type:`number`,label:`Panel Height`,defaultValue:520},{name:`floatingConfig.title`,type:`string`,label:`Panel Title`,defaultValue:`Chat`},{name:`floatingConfig.triggerSize`,type:`number`,label:`Trigger Size`,defaultValue:56},{name:`messages`,type:`array`,label:`Initial Messages`},{name:`placeholder`,type:`string`,label:`Input Placeholder`,defaultValue:`Type your message...`},{name:`enableMarkdown`,type:`boolean`,label:`Enable Markdown`,defaultValue:!0},{name:`enableFileUpload`,type:`boolean`,label:`Enable File Upload`,defaultValue:!1},{name:`api`,type:`string`,label:`API Endpoint`,description:`Backend SSE endpoint for streaming AI mode`},{name:`conversationId`,type:`string`,label:`Conversation ID`},{name:`systemPrompt`,type:`string`,label:`System Prompt`},{name:`model`,type:`string`,label:`AI Model`},{name:`streamingEnabled`,type:`boolean`,label:`Enable Streaming`,defaultValue:!0},{name:`autoResponse`,type:`boolean`,label:`Enable Auto Response (Demo)`,defaultValue:!1},{name:`autoResponseText`,type:`string`,label:`Auto Response Text`,defaultValue:`Thank you for your message!`},{name:`autoResponseDelay`,type:`number`,label:`Auto Response Delay (ms)`,defaultValue:1e3},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{displayMode:`floating`,floatingConfig:{position:`bottom-right`,defaultOpen:!1,panelWidth:400,panelHeight:520,title:`Chat`,triggerSize:56},messages:[{id:`welcome`,role:`assistant`,content:`Hello! How can I help you today?`}],placeholder:`Type your message...`,enableMarkdown:!0,enableFileUpload:!1,autoResponse:!0,autoResponseText:`Thank you for your message! This is an automated response.`,autoResponseDelay:1e3}});var gk=`/api/v1/ai`;function _k(e,t,n){let r=e.replace(/\/$/,``),i=new URLSearchParams;if(n)for(let[e,t]of Object.entries(n))t==null||t===``||i.set(e,String(t));let a=i.toString();return`${r}${t}${a?`?${a}`:``}`}async function vk(e,t,n){let r=await fetch(e,{credentials:`include`,...t,headers:{Accept:`application/json`,"Content-Type":`application/json`,...n??{},...t.headers??{}}}),i=null;try{i=await r.json()}catch{}if(!r.ok){let e=i?.error?.message??i?.message??i?.error??`${r.status} ${r.statusText}`,t=Error(typeof e==`string`?e:JSON.stringify(e));throw t.status=r.status,t.body=i,t}return i}function yk(e={}){let{apiBase:t=gk,status:n=`pending`,conversationId:r,limit:i,headers:a,pollInterval:o=5e3,enabled:s=!0}=e,[c,l]=I.useState([]),[u,d]=I.useState(0),[f,p]=I.useState(!1),[m,h]=I.useState(void 0),g=I.useRef({apiBase:t,status:n,conversationId:r,limit:i,headers:a});g.current={apiBase:t,status:n,conversationId:r,limit:i,headers:a};let _=I.useCallback(async()=>{let{apiBase:e,status:t,conversationId:n,limit:r,headers:i}=g.current;p(!0),h(void 0);try{let a=await vk(_k(e,`/pending-actions`,{status:t&&t!==`all`?t:void 0,conversationId:n,limit:r}),{method:`GET`},i);l(Array.isArray(a.items)?a.items:[]),d(typeof a.total==`number`?a.total:a.items?.length??0)}catch(e){h(e instanceof Error?e:Error(String(e)))}finally{p(!1)}},[]),v=I.useCallback(async e=>{let{apiBase:t,headers:n}=g.current,r=_k(t,`/pending-actions/${encodeURIComponent(e)}/approve`);try{return await vk(r,{method:`POST`,body:`{}`},n)}finally{_()}},[_]),y=I.useCallback(async(e,t)=>{let{apiBase:n,headers:r}=g.current,i=_k(n,`/pending-actions/${encodeURIComponent(e)}/reject`);try{return await vk(i,{method:`POST`,body:JSON.stringify(t?{reason:t}:{})},r)}finally{_()}},[_]);return I.useEffect(()=>{if(!s||(_(),!o||o<=0))return;let e=setInterval(()=>{_()},o);return()=>clearInterval(e)},[s,o,_,t,n,r,i]),{items:c,total:u,isLoading:f,error:m,refresh:_,approve:v,reject:y}}var bk={pending:{variant:`secondary`,label:`Pending`},approved:{variant:`default`,label:`Approved`},executed:{variant:`default`,label:`Executed`},failed:{variant:`destructive`,label:`Failed`},rejected:{variant:`outline`,label:`Rejected`}};function xk({status:e}){let t=bk[e]??{variant:`outline`,label:e};return(0,R.jsx)(Le,{variant:t.variant,children:t.label})}function Sk(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=Date.now()-t,r=Math.round(n/1e3);if(r<45)return`just now`;let i=Math.round(r/60);if(i<60)return`${i}m ago`;let a=Math.round(i/60);if(a<24)return`${a}h ago`;let o=Math.round(a/24);if(o<30)return`${o}d ago`;try{return new Date(e).toLocaleDateString()}catch{return e}}function Ck(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function wk({value:e,max:t=320}){let n=typeof e==`string`?e:JSON.stringify(e,null,2);return n==null||n===``?(0,R.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`—`}):(0,R.jsx)(`pre`,{className:`bg-muted/40 rounded text-xs p-2 overflow-auto whitespace-pre-wrap break-all`,style:{maxHeight:t},children:n})}function Tk(e){switch(e){case`pending`:return`pending`;case`all`:return`all`;case`decided`:return`all`}}function Ek({apiBase:e,headers:t,pollInterval:n=5e3,conversationId:r,variant:i=`card`,title:a=`AI Approvals`,description:o=`Actions an AI agent proposed that need a human review before execution.`,className:s}){let[c,l]=I.useState(`pending`),[u,d]=I.useState(null),[f,p]=I.useState(null),[m,h]=I.useState(``),[g,_]=I.useState(null),[v,y]=I.useState(null),[b,x]=I.useState(null),{items:S,isLoading:C,error:w,refresh:T,approve:E,reject:D}=yk({apiBase:e,headers:t,pollInterval:n,conversationId:r,status:Tk(c)}),ee=I.useMemo(()=>c===`decided`?S.filter(e=>e.status!==`pending`):S,[S,c]),O=I.useMemo(()=>u?S.find(e=>e.id===u)??null:null,[u,S]),re=I.useCallback(async e=>{_(e),y(null);try{let t=await E(e),n=t.status===`executed`;x({id:e,kind:`approve`,ok:n,message:n?`Executed`:t.error??`Action failed during execution`})}catch(t){let n=t instanceof Error?t.message:String(t);y(n),x({id:e,kind:`approve`,ok:!1,message:n})}finally{_(null)}},[E]),ie=I.useCallback(async(e,t)=>{_(e),y(null);try{await D(e,t.trim()||void 0),x({id:e,kind:`reject`,ok:!0,message:`Rejected`}),p(null),h(``)}catch(t){let n=t instanceof Error?t.message:String(t);y(n),x({id:e,kind:`reject`,ok:!1,message:n})}finally{_(null)}},[D]),ae=(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(St,{value:c,onValueChange:e=>l(e),children:(0,R.jsxs)(ot,{children:[(0,R.jsx)(Ot,{value:`pending`,children:`Pending`}),(0,R.jsx)(Ot,{value:`decided`,children:`Decided`}),(0,R.jsx)(Ot,{value:`all`,children:`All`})]})}),(0,R.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void T(),disabled:C,"data-testid":`ai-inbox-refresh`,children:[(0,R.jsx)(Te,{className:`h-3.5 w-3.5 mr-1.5 ${C?`animate-spin`:``}`}),`Refresh`]})]}),w?(0,R.jsxs)(at,{variant:`destructive`,children:[(0,R.jsx)(_e,{className:`h-4 w-4`}),(0,R.jsx)(Dt,{children:w.message})]}):null,v?(0,R.jsxs)(at,{variant:`destructive`,children:[(0,R.jsx)(_e,{className:`h-4 w-4`}),(0,R.jsx)(Dt,{children:v})]}):null,b&&!v?(0,R.jsxs)(at,{variant:b.ok?`default`:`destructive`,children:[b.ok?(0,R.jsx)(k,{className:`h-4 w-4`}):(0,R.jsx)(At,{className:`h-4 w-4`}),(0,R.jsxs)(Dt,{children:[b.kind===`approve`?`Approve`:`Reject`,` for`,` `,(0,R.jsxs)(`code`,{className:`text-xs`,children:[b.id.slice(0,8),`…`]}),`:`,` `,b.message??(b.ok?`OK`:`Failed`)]})]}):null,C&&ee.length===0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(he,{className:`h-10 w-full`}),(0,R.jsx)(he,{className:`h-10 w-full`}),(0,R.jsx)(he,{className:`h-10 w-full`})]}):ee.length===0?(0,R.jsx)(Ce,{children:(0,R.jsxs)(se,{children:[(0,R.jsx)(pe,{children:(0,R.jsx)(Ie,{className:`h-8 w-8 text-muted-foreground`})}),(0,R.jsx)(ht,{children:`No actions waiting`}),(0,R.jsx)(Oe,{children:`When the AI proposes a sensitive action it will appear here for review.`})]})}):(0,R.jsx)(`div`,{className:`rounded-md border`,children:(0,R.jsxs)(We,{children:[(0,R.jsx)($e,{children:(0,R.jsxs)(Ye,{children:[(0,R.jsx)(st,{className:`w-[140px]`,children:`Tool`}),(0,R.jsx)(st,{className:`w-[140px]`,children:`Action`}),(0,R.jsx)(st,{className:`w-[120px]`,children:`Object`}),(0,R.jsx)(st,{className:`w-[110px]`,children:`Status`}),(0,R.jsx)(st,{className:`w-[110px]`,children:`Proposed`}),(0,R.jsx)(st,{className:`w-[260px] text-right`,children:`Decision`})]})}),(0,R.jsx)(qe,{children:ee.map(e=>{let t=e.status===`pending`,n=g===e.id;return(0,R.jsxs)(Ye,{children:[(0,R.jsx)(mt,{className:`font-mono text-xs`,children:e.tool_name}),(0,R.jsx)(mt,{className:`text-sm`,children:e.action_name}),(0,R.jsx)(mt,{className:`text-sm`,children:e.object_name}),(0,R.jsx)(mt,{children:(0,R.jsx)(xk,{status:e.status})}),(0,R.jsx)(mt,{className:`text-xs text-muted-foreground`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,R.jsx)(Qe,{className:`h-3 w-3`}),` `,Sk(e.proposed_at)]})}),(0,R.jsx)(mt,{className:`text-right`,children:(0,R.jsxs)(`div`,{className:`inline-flex gap-1.5`,children:[(0,R.jsxs)(M,{size:`sm`,variant:`ghost`,onClick:()=>d(e.id),"data-testid":`ai-inbox-view-${e.id}`,children:[(0,R.jsx)(ce,{className:`h-3.5 w-3.5 mr-1`}),` View`]}),t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(M,{size:`sm`,variant:`default`,disabled:n,onClick:()=>void re(e.id),"data-testid":`ai-inbox-approve-${e.id}`,children:[(0,R.jsx)(k,{className:`h-3.5 w-3.5 mr-1`}),n?`Working…`:`Approve`]}),(0,R.jsxs)(M,{size:`sm`,variant:`destructive`,disabled:n,onClick:()=>{p(e.id),h(``)},"data-testid":`ai-inbox-reject-${e.id}`,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]}):null]})})]},e.id)})})]})})]});return(0,R.jsxs)(R.Fragment,{children:[i===`card`?(0,R.jsxs)(te,{className:s,children:[(0,R.jsxs)(lt,{className:`pb-3`,children:[(0,R.jsxs)(gt,{className:`flex items-center gap-2`,children:[(0,R.jsx)(_t,{className:`h-4 w-4`}),` `,a]}),o?(0,R.jsx)(Ct,{children:o}):null]}),(0,R.jsx)(Ge,{children:ae})]}):(0,R.jsx)(`div`,{className:s,children:ae}),(0,R.jsx)(Pt,{open:!!u,onOpenChange:e=>{e||d(null)},children:(0,R.jsxs)(ne,{className:`sm:max-w-[560px] overflow-y-auto`,children:[(0,R.jsxs)(de,{children:[(0,R.jsxs)(we,{className:`flex items-center gap-2`,children:[(0,R.jsx)(_t,{className:`h-4 w-4`}),O?O.action_name:`Pending action`]}),(0,R.jsx)(De,{children:O?(0,R.jsxs)(R.Fragment,{children:[`Tool `,(0,R.jsx)(`code`,{className:`text-xs`,children:O.tool_name}),` on`,` `,(0,R.jsx)(`code`,{className:`text-xs`,children:O.object_name})]}):`Loading…`})]}),O?(0,R.jsxs)(`div`,{className:`px-4 space-y-4 mt-4`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Status`}),(0,R.jsx)(`div`,{className:`mt-1`,children:(0,R.jsx)(xk,{status:O.status})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Proposed`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs`,children:Sk(O.proposed_at)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Proposed by`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.proposed_by??`—`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Decided by`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.decided_by??`—`})]}),O.conversation_id?(0,R.jsxs)(`div`,{className:`col-span-2`,children:[(0,R.jsx)(Ue,{className:`text-xs text-muted-foreground`,children:`Conversation`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs font-mono break-all`,children:O.conversation_id})]}):null]}),(0,R.jsx)(ke,{}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Tool input`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:Ck(O.tool_input)})})]}),O.result?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Result`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:Ck(O.result)})})]}):null,O.error?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs text-destructive`,children:`Error`}),(0,R.jsx)(`div`,{className:`mt-1.5`,children:(0,R.jsx)(wk,{value:O.error})})]}):null,O.rejection_reason?(0,R.jsxs)(`div`,{children:[(0,R.jsx)(Ue,{className:`text-xs`,children:`Rejection reason`}),(0,R.jsx)(`div`,{className:`mt-1.5 text-sm`,children:O.rejection_reason})]}):null,O.status===`pending`?(0,R.jsxs)(`div`,{className:`pt-2 flex gap-2`,children:[(0,R.jsxs)(M,{size:`sm`,onClick:()=>void re(O.id),disabled:g===O.id,children:[(0,R.jsx)(k,{className:`h-3.5 w-3.5 mr-1`}),`Approve & Execute`]}),(0,R.jsxs)(M,{size:`sm`,variant:`destructive`,onClick:()=>{p(O.id),h(``)},disabled:g===O.id,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]}):null]}):null]})}),(0,R.jsx)(Pt,{open:!!f,onOpenChange:e=>{e||(p(null),h(``))},children:(0,R.jsxs)(ne,{side:`bottom`,className:`max-h-[40vh]`,children:[(0,R.jsxs)(de,{children:[(0,R.jsx)(we,{children:`Reject this action?`}),(0,R.jsx)(De,{children:`The reason is shown back to the AI so it can adjust its next response.`})]}),(0,R.jsxs)(`div`,{className:`px-4 mt-3 space-y-3`,children:[(0,R.jsx)(ft,{value:m,onChange:e=>h(e.target.value),placeholder:`Optional reason (e.g. 'Wrong record id — please confirm with the user first.')`,rows:4,"data-testid":`ai-inbox-reject-reason`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>{p(null),h(``)},children:`Cancel`}),(0,R.jsxs)(M,{variant:`destructive`,size:`sm`,onClick:()=>f&&void ie(f,m),disabled:!f||g===f,"data-testid":`ai-inbox-reject-confirm`,children:[(0,R.jsx)(At,{className:`h-3.5 w-3.5 mr-1`}),`Reject`]})]})]})]})})]})}function Dk(e){return!e||e.length===0?`/api/v1/ai`:e.endsWith(`/`)?e.slice(0,-1):e}function Ok(e,t){let n={...e??{}};return t&&(n[`Content-Type`]=`application/json`),n}async function kk(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return{raw:t}}}function Ak(e){let{messages:t,apiBase:n,headers:r,onDecided:i,continueConversation:a}=e,o=Dk(n),s=I.useMemo(()=>{let e=new Map;for(let n of t){let t=n.toolInvocations??[];for(let n of t)n.pendingActionId&&n.toolCallId&&e.set(n.toolCallId,{pendingActionId:n.pendingActionId,toolName:n.toolName})}return e},[t]),[c,l]=I.useState({}),u=I.useRef(0),[d,f]=I.useState(!1),p=I.useCallback((e,t)=>{l(n=>{if(!t){if(!(e in n))return n;let{[e]:t,...r}=n;return r}return{...n,[e]:t}})},[]);return{decisions:c,decide:I.useCallback(async(e,t,n)=>{let c=s.get(e);if(!c){p(e,{state:`error`,message:`No pending-action id found for this tool call. The tool result may not be a HITL proposal.`});return}let{pendingActionId:l,toolName:d}=c;p(e,{state:`pending`,message:t?`Approving…`:`Rejecting…`}),u.current+=1,f(!0);try{let s=`${o}/pending-actions/${encodeURIComponent(l)}/${t?`approve`:`reject`}`,c=t?`{}`:JSON.stringify({reason:n??``}),u=await fetch(s,{method:`POST`,credentials:`include`,headers:Ok(r,!0),body:c}),f=await kk(u)??{};if(!u.ok){let t=typeof f.error==`string`?f.error:`Approval failed: HTTP ${u.status}`;p(e,{state:`error`,message:t}),i?.(e,{id:l,status:`failed`,error:t});return}let m=f.status??(t?`executed`:`rejected`),h=!1;if(m===`executed`?(p(e,{state:`success`,message:`Approved — action executed.`}),h=!0):m===`rejected`?(p(e,{state:`success`,message:n?`Rejected: ${n}`:`Rejected.`}),h=!0):m===`failed`?p(e,{state:`error`,message:f.error??`Action approved but execution failed.`}):(p(e,{state:`success`,message:`Status: ${m}`}),h=!0),i?.(e,f),h&&a){let r=jk({approved:t,status:m,toolName:d,pendingActionId:l,outcome:f,reason:n});r&&a(r,{toolCallId:e,pendingActionId:l,decision:t?`approved`:`rejected`,outcome:f,toolName:d})}}catch(t){p(e,{state:`error`,message:t instanceof Error?t.message:String(t)})}finally{--u.current,u.current<=0&&(u.current=0,f(!1))}},[o,r,s,i,a,p]),isDeciding:d}}function jk(e){let{approved:t,status:n,toolName:r,pendingActionId:i,outcome:a,reason:o}=e,s=`[HITL ${i}]`;if(t&&n===`executed`){let e=a.result;return`${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e==null?`(no payload)`:typeof e==`string`?e:Mk(JSON.stringify(e),800)}. Acknowledge the outcome concisely and continue the user's task.`}if(!t&&n===`rejected`)return`${s} The operator rejected the \`${r}\` call.${o&&o.trim().length>0?` Reason: ${o}.`:``} Acknowledge the rejection and ask whether to try a different approach.`;if(n===`failed`){let e=a.error;return`${s} The \`${r}\` call was approved but execution failed: ${typeof e==`string`?e:Mk(JSON.stringify(e??{}),400)}. Apologize concisely and offer alternatives.`}}function Mk(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}var Nk=I.forwardRef(({className:e,messages:t=[],placeholder:n=`Type your message...`,onSendMessage:r,disabled:i=!1,showTimestamp:a=!1,userAvatarUrl:o,userAvatarFallback:s=`You`,assistantAvatarUrl:c,assistantAvatarFallback:l=`AI`,maxHeight:u=`500px`,...d},f)=>{let[p,m]=I.useState(``),h=I.useRef(null),g=I.useRef(null);I.useEffect(()=>{if(h.current){let e=h.current.querySelector(`[data-radix-scroll-area-viewport]`);e&&(e.scrollTop=e.scrollHeight)}},[t]);let _=()=>{p.trim()&&r&&(r(p.trim()),m(``),g.current?.focus())},v=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())};return(0,R.jsxs)(`div`,{ref:f,className:A(`flex flex-col border rounded-lg bg-background overflow-hidden`,e),style:{maxHeight:u},...d,children:[(0,R.jsx)(je,{ref:h,className:`flex-1 p-4`,children:(0,R.jsx)(`div`,{className:`space-y-4`,children:t.length===0?(0,R.jsx)(`div`,{className:`flex items-center justify-center h-32 text-muted-foreground text-sm`,children:`No messages yet. Start a conversation!`}):t.map(e=>(0,R.jsx)(Pk,{message:e,showTimestamp:a,userAvatarUrl:o,userAvatarFallback:s,assistantAvatarUrl:c,assistantAvatarFallback:l},e.id))})}),(0,R.jsx)(`div`,{className:`border-t p-4`,children:(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(vt,{ref:g,value:p,onChange:e=>m(e.target.value),onKeyDown:v,placeholder:n,disabled:i,className:`flex-1`}),(0,R.jsx)(M,{onClick:_,disabled:i||!p.trim(),size:`icon`,children:(0,R.jsx)(ie,{className:`h-4 w-4`})})]})})]})});Nk.displayName=`Chatbot`;var Pk=({message:e,showTimestamp:t,userAvatarUrl:n,userAvatarFallback:r,assistantAvatarUrl:i,assistantAvatarFallback:a})=>{let o=e.role===`user`;if(e.role===`system`)return(0,R.jsx)(`div`,{className:`flex justify-center`,children:(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted px-3 py-1 rounded-full`,children:e.content})});let s=o?e.avatar||n:e.avatar||i,c=o?e.avatarFallback||r:e.avatarFallback||a;return(0,R.jsxs)(`div`,{className:A(`flex gap-3`,o?`flex-row-reverse`:`flex-row`),children:[(0,R.jsxs)(ut,{className:`h-8 w-8`,children:[(0,R.jsx)(He,{src:s}),(0,R.jsx)(bt,{className:`text-xs`,children:c})]}),(0,R.jsxs)(`div`,{className:A(`flex flex-col gap-1`,o?`items-end`:`items-start`),children:[(0,R.jsx)(`div`,{className:A(`rounded-lg px-4 py-2 max-w-[70%] break-words`,o?`bg-primary text-primary-foreground`:`bg-muted`),children:(0,R.jsx)(`p`,{className:`text-sm whitespace-pre-wrap`,children:e.content})}),t&&e.timestamp&&(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.timestamp})]})]})},Fk=I.forwardRef(({className:e,avatarSrc:t,avatarFallback:n=`AI`,...r},i)=>(0,R.jsxs)(`div`,{ref:i,className:A(`flex gap-3`,e),...r,children:[(0,R.jsxs)(ut,{className:`h-8 w-8`,children:[(0,R.jsx)(He,{src:t}),(0,R.jsx)(bt,{className:`text-xs`,children:n})]}),(0,R.jsx)(`div`,{className:`flex items-center bg-muted rounded-lg px-4 py-2`,children:(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce [animation-delay:-0.3s]`}),(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce [animation-delay:-0.15s]`}),(0,R.jsx)(`span`,{className:`w-2 h-2 bg-muted-foreground rounded-full animate-bounce`})]})})]}));Fk.displayName=`TypingIndicator`;export{Pa as C,Ca as S,Ua as _,MO as a,Da as b,Rf as c,Ka as d,Ja as f,Wa as g,Ga as h,GO as i,Hf as l,Va as m,Ek as n,gu as o,Ba as p,hk as r,Wu as s,Ak as t,Xa as u,Ha as v,Ta as x,Ra as y};
|