@kitn.ai/ui 0.23.0 → 0.25.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/{create-tween-vA7upv0h.js → create-tween-4z1XYLkR.js} +1 -1
- package/dist/{create-tween-CTT5l1bo.js → create-tween-B5Y4Im8G.js} +1 -1
- package/dist/{create-tween-BmBnlg25.js → create-tween-CUzOlaMS.js} +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/chunks/artifact-BSuPYFHY.js +1 -0
- package/dist/elements/chunks/{card-renderer-aNA0WRFH.js → card-renderer-CSoTL_e1.js} +1 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +1 -0
- package/dist/elements/chunks/{chat-thread-DN9evldr.js → chat-thread-DxoKaStk.js} +1 -1
- package/dist/elements/chunks/{choice-card-kNsjU2m8.js → choice-card-CGMc3kek.js} +1 -1
- package/dist/elements/chunks/{confirm-card-CEvFmVhz.js → confirm-card-BWjf2-xo.js} +1 -1
- package/dist/elements/chunks/{form-lUuJjz6s.js → form-Cp8Y00Wn.js} +1 -1
- package/dist/elements/chunks/link-preview-Cf5KOP-i.js +1 -0
- package/dist/elements/chunks/link-preview-DNILK391.js +1 -0
- package/dist/elements/chunks/{markdown-BpAHnBJz.js → markdown-DbozyYqa.js} +16 -16
- package/dist/elements/chunks/{message-CoqLuLkd.js → message-CE4k-qaj.js} +1 -1
- package/dist/elements/chunks/{message-_oYx5mk1.js → message-DtXKPqiR.js} +1 -1
- package/dist/elements/chunks/{reasoning-D26Bb4p6.js → reasoning-BrxQfpfI.js} +1 -1
- package/dist/elements/chunks/source-w9V0NnBn.js +1 -0
- package/dist/elements/chunks/{tasks-card-CfqrkoVO.js → tasks-card-lPxoodlA.js} +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/embed.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/source.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/index.js +4011 -3936
- package/dist/index.server.js +3302 -3228
- package/dist/kai.es.js +1 -1
- package/dist/primitives/card-routing.d.ts +33 -0
- package/dist/{register-impl-C96AnOJn.js → register-impl-DGmGzrEM.js} +15 -15
- package/dist/{solid-C76UXJuy.js → solid-BMuDmFo_.js} +4427 -4352
- package/dist/{solid-BuqWLn6x.js → solid-CGYNdLRR.js} +3738 -3664
- package/dist/solid.js +1 -1
- package/dist/solid.server.js +1 -1
- package/dist/state/stream.d.ts +22 -4
- package/dist/{variant-aurora-CD35fdJF.js → variant-aurora-DwSOfraQ.js} +2 -2
- package/dist/{variant-aurora-Dau5Z4yR.js → variant-aurora-XEkPT0_z.js} +1 -1
- package/dist/{variant-aurora-Dc-2RVH9.js → variant-aurora-wKvAQ5wp.js} +2 -2
- package/dist/{variant-custom-CHr_jbMU.js → variant-custom-BhS9wIpU.js} +2 -2
- package/dist/{variant-custom-Df7QvXyZ.js → variant-custom-MkTNTycd.js} +1 -1
- package/dist/{variant-custom-Cyu8zx4A.js → variant-custom-eFIg2XWQ.js} +2 -2
- package/dist/{variant-wave-CXcaP_9W.js → variant-wave-BwzrHD1s.js} +1 -1
- package/dist/{variant-wave-BkVpxkVF.js → variant-wave-CUWGx9Bn.js} +2 -2
- package/dist/{variant-wave-DcGqjVnK.js → variant-wave-CbVsmgwT.js} +2 -2
- package/dist/wire.js +112 -105
- package/package.json +6 -6
- package/src/components/artifact.tsx +110 -24
- package/src/components/markdown.tsx +83 -5
- package/src/components/source.tsx +35 -3
- package/src/primitives/card-routing.ts +54 -2
- package/src/state/stream.ts +92 -3
- package/src/wire/formats/openai.ts +38 -2
- package/dist/elements/chunks/artifact-BhJIuh3D.js +0 -1
- package/dist/elements/chunks/card-routing-C986KuUA.js +0 -1
- package/dist/elements/chunks/link-preview-C9-jNJBf.js +0 -1
- package/dist/elements/chunks/source-eJurW_-L.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",
|
|
1
|
+
var Le=Object.defineProperty,Ie=(n,e,t)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e,t)=>Ie(n,typeof e!="symbol"?e+"":e,t);import{s as Ce,y as Ee,l as ie,i as qe,c as z,r as Be,M as ae,F as Ze,a as oe,O as De,d as Me,b as Qe,t as Oe}from"./define-B_tXMYRm.js";import{c as je}from"./cn-CU7UAWzk.js";import{C as He,a as Ne}from"./code-block-ClhQO9RW.js";import{a as ce}from"./card-routing-BK09BdmL.js";function W(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var v=W();function he(n){v=n}var A={exec:()=>null};function _(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=n(s),e[s]=r),r}}function k(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:(r,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(w.caret,"$1"),t=t.replace(r,a),s},getRegex:()=>new RegExp(t,e)};return s}var Ge=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),w={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:_(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:_(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:_(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:_(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:_(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:_(n=>new RegExp(`^ {0,${n}}>`))},Xe=/^(?:[ \t]*(?:\n|$))+/,Fe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,We=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ue=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,U=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,pe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ue=k(pe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Je=k(pe).replace(/bull/g,U).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),J=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ke=/^[^\n]+/,K=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ve=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",K).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ye=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,U).getRegex(),D="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",V=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,et=k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",V).replace("tag",D).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge=k(J).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),tt=k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ge).getRegex(),Y={blockquote:tt,code:Fe,def:Ve,fences:We,heading:Ue,hr:C,html:et,lheading:ue,list:Ye,newline:Xe,paragraph:ge,table:A,text:Ke},ke=k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),nt={...Y,lheading:Je,table:ke,paragraph:k(J).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ke).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex()},rt={...Y,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",V).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(J).replace("hr",C).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",ue).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},st=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,de=/^( {2,}|\\)\n(?!\s*$)/,it=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,L=/[\p{P}\p{S}]/u,M=/[\s\p{P}\p{S}]/u,ee=/[^\s\p{P}\p{S}]/u,at=k(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,M).getRegex(),fe=/(?!~)[\p{P}\p{S}]/u,ot=/(?!~)[\s\p{P}\p{S}]/u,ct=/(?:[^\s\p{P}\p{S}]|~)/u,ht=k(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ge?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xe=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pt=k(xe,"u").replace(/punct/g,L).getRegex(),ut=k(xe,"u").replace(/punct/g,fe).getRegex(),be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gt=k(be,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,M).replace(/punct/g,L).getRegex(),kt=k(be,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,ot).replace(/punct/g,fe).getRegex(),dt=k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,M).replace(/punct/g,L).getRegex(),ft=k(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,L).getRegex(),xt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",bt=k(xt,"gu").replace(/notPunctSpace/g,ee).replace(/punctSpace/g,M).replace(/punct/g,L).getRegex(),wt=k(/\\(punct)/,"gu").replace(/punct/g,L).getRegex(),mt=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),yt=k(V).replace("(?:-->|$)","-->").getRegex(),$t=k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",yt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,St=k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),we=k(/^!?\[(label)\]\[(ref)\]/).replace("label",Q).replace("ref",K).getRegex(),me=k(/^!?\[(ref)\](?:\[\])?/).replace("ref",K).getRegex(),Rt=k("reflink|nolink(?!\\()","g").replace("reflink",we).replace("nolink",me).getRegex(),ye=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,te={_backpedal:A,anyPunctuation:wt,autolink:mt,blockSkip:ht,br:de,code:lt,del:A,delLDelim:A,delRDelim:A,emStrongLDelim:pt,emStrongRDelimAst:gt,emStrongRDelimUnd:dt,escape:st,link:St,nolink:me,punctuation:at,reflink:we,reflinkSearch:Rt,tag:$t,text:it,url:A},Tt={...te,link:k(/^!?\[(label)\]\((.*?)\)/).replace("label",Q).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q).getRegex()},ne={...te,emStrongRDelimAst:kt,emStrongLDelim:ut,delLDelim:ft,delRDelim:bt,url:k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ye).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ye).getRegex()},zt={...ne,br:k(de).replace("{2,}","*").getRegex(),text:k(ne.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},O={normal:Y,gfm:nt,pedantic:rt},E={normal:te,gfm:ne,breaks:zt,pedantic:Tt},vt={"&":"&","<":"<",">":">",'"':""","'":"'"},$e=n=>vt[n];function S(n,e){if(e){if(w.escapeTest.test(n))return n.replace(w.escapeReplace,$e)}else if(w.escapeTestNoEncode.test(n))return n.replace(w.escapeReplaceNoEncode,$e);return n}function Se(n){try{n=encodeURI(n).replace(w.percentDecode,"%")}catch{return null}return n}function Re(n,e){var t;let s=n.replace(w.findPipe,(a,o,l)=>{let h=!1,c=o;for(;--c>=0&&l[c]==="\\";)h=!h;return h?"|":" |"}),r=s.split(w.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((t=r.at(-1))!=null&&t.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(w.slashPipe,"|");return r}function R(n,e,t){let s=n.length;if(s===0)return"";let r=0;for(;r<s&&n.charAt(s-r-1)===e;)r++;return n.slice(0,s-r)}function Te(n){let e=n.split(`
|
|
3
3
|
`),t=e.length-1;for(;t>=0&&w.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
4
|
-
`)}function
|
|
4
|
+
`)}function At(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function Pt(n,e=0){let t=e,s="";for(let r of n)if(r===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=r,t++;return s}function ze(n,e,t,s,r){let i=e.href,a=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function _t(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
5
5
|
`).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[o]=a;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
6
|
-
`)}var
|
|
6
|
+
`)}var j=class{constructor(n){f(this,"options"),f(this,"rules"),f(this,"lexer"),this.options=n||v}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:Te(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=_t(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=R(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:R(e[0],`
|
|
7
7
|
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:R(e[0],`
|
|
8
8
|
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=R(e[0],`
|
|
9
9
|
`).split(`
|
|
@@ -16,19 +16,19 @@ ${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
16
16
|
`),m=this.blockquote(p);i[i.length-1]=m,s=s.substring(0,s.length-b.raw.length)+m.raw,r=r.substring(0,r.length-b.text.length)+m.text;break}else if(g?.type==="list"){let b=g,p=b.raw+`
|
|
17
17
|
`+t.join(`
|
|
18
18
|
`),m=this.list(p);i[i.length-1]=m,s=s.substring(0,s.length-g.raw.length)+m.raw,r=r.substring(0,r.length-b.raw.length)+m.raw,t=p.substring(i.at(-1).raw.length).split(`
|
|
19
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),a=!1;for(;n;){let l=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let u=
|
|
19
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),a=!1;for(;n;){let l=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let u=Pt(e[2].split(`
|
|
20
20
|
`,1)[0],e[1].length),g=n.split(`
|
|
21
21
|
`,1)[0],b=!u.trim(),p=0;if(this.options.pedantic?(p=2,c=u.trimStart()):b?p=e[1].length+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,c=u.slice(p),p+=e[1].length),b&&this.rules.other.blankLine.test(g)&&(h+=g+`
|
|
22
|
-
`,n=n.substring(g.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(p),x=this.rules.other.hrRegex(p),
|
|
23
|
-
`,1)[0],I;if(g=
|
|
24
|
-
`+I.slice(p);else{if(b||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||
|
|
25
|
-
`+g}b=!g.trim(),h+=
|
|
26
|
-
`,n=n.substring(
|
|
27
|
-
`),href:s,title:r}}}table(n){var e;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=
|
|
22
|
+
`,n=n.substring(g.length+1),l=!0),!l){let m=this.rules.other.nextBulletRegex(p),x=this.rules.other.hrRegex(p),Z=this.rules.other.fencesBeginRegex(p),T=this.rules.other.headingBeginRegex(p),X=this.rules.other.htmlBeginRegex(p),_e=this.rules.other.blockquoteBeginRegex(p);for(;n;){let F=n.split(`
|
|
23
|
+
`,1)[0],I;if(g=F,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),I=g):I=g.replace(this.rules.other.tabCharGlobal," "),Z.test(g)||T.test(g)||X.test(g)||_e.test(g)||m.test(g)||x.test(g))break;if(I.search(this.rules.other.nonSpaceChar)>=p||!g.trim())c+=`
|
|
24
|
+
`+I.slice(p);else{if(b||u.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Z.test(u)||T.test(u)||x.test(u))break;c+=`
|
|
25
|
+
`+g}b=!g.trim(),h+=F+`
|
|
26
|
+
`,n=n.substring(F.length+1),u=I.slice(p)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l of r.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let h=l.tokens[0];if(l.task&&(h?.type==="text"||h?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let u={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=u.checked,r.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=u.raw+l.tokens[0].raw,l.tokens[0].text=u.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(u)):l.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):l.tokens.unshift(u)}}else l.task&&(l.task=!1);if(!r.loose){let c=l.tokens.filter(g=>g.type==="space"),u=c.length>0&&c.some(g=>this.rules.other.anyLine.test(g.raw));r.loose=u}}if(r.loose)for(let l of r.items){l.loose=!0;for(let h of l.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=Te(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:R(e[0],`
|
|
27
|
+
`),href:s,title:r}}}table(n){var e;let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let s=Re(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(e=t[3])!=null&&e.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
28
28
|
`):[],a={type:"table",raw:R(t[0],`
|
|
29
|
-
`),header:[],align:[],rows:[]};if(s.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<s.length;o++)a.header.push({text:s[o],tokens:this.lexer.inline(s[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(
|
|
29
|
+
`),header:[],align:[],rows:[]};if(s.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?a.align.push("right"):this.rules.other.tableAlignCenter.test(o)?a.align.push("center"):this.rules.other.tableAlignLeft.test(o)?a.align.push("left"):a.align.push(null);for(let o=0;o<s.length;o++)a.header.push({text:s[o],tokens:this.lexer.inline(s[o]),header:!0,align:a.align[o]});for(let o of i)a.rows.push(Re(o,a.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[h]})));return a}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:R(e[0],`
|
|
30
30
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
31
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=R(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=
|
|
31
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=R(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=At(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],r="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],r=i[3])}else r=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),ze(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[s.toLowerCase()];if(!r){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return ze(t,r,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,a,o=r,l=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+r);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){o+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let c=[...s[0]][0].length,u=n.slice(0,r+s.index+c+a);if(Math.min(r,a)%2){let b=u.slice(1,-1);return{type:"em",raw:u,text:b,tokens:this.lexer.inlineTokens(b)}}let g=u.slice(2,-2);return{type:"strong",raw:u,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,a,o=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+r);(s=l.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==r))continue;if(s[3]||s[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let h=[...s[0]][0].length,c=n.slice(0,r+s.index+h+a),u=c.slice(r,-r);return{type:"del",raw:c,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var e;let t;if(t=this.rules.inline.url.exec(n)){let s,r;if(t[2]==="@")s=t[0],r="mailto:"+s;else{let i;do i=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(i!==t[0]);s=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0]}return{type:"link",raw:t[0],text:s,href:r,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},y=class se{constructor(e){f(this,"tokens"),f(this,"options"),f(this,"state"),f(this,"inlineQueue"),f(this,"tokenizer"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||v,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:w,block:O.normal,inline:E.normal};this.options.pedantic?(t.block=O.pedantic,t.inline=E.pedantic):this.options.gfm&&(t.block=O.gfm,this.options.breaks?t.inline=E.breaks:t.inline=E.gfm),this.tokenizer.rules=t}static get rules(){return{block:O,inline:E}}static lex(e,t){return new se(t).lex(e)}static lexInline(e,t){return new se(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
|
|
32
32
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){var r,i,a;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(w.tabCharGlobal," ").replace(w.spaceLine,""));let o=1/0;for(;e;){if(e.length<o)o=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let l;if((i=(r=this.options.extensions)==null?void 0:r.block)!=null&&i.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let c=t.at(-1);l.raw.length===1&&c!==void 0?c.raw+=`
|
|
33
33
|
`:t.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
34
34
|
`)?"":`
|
|
@@ -42,7 +42,7 @@ ${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
42
42
|
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(l),s=h.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let c=t.at(-1);c?.type==="text"?(c.raw+=(c.raw.endsWith(`
|
|
43
43
|
`)?"":`
|
|
44
44
|
`)+l.raw,c.text+=`
|
|
45
|
-
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var s,r,i,a,o;this.tokenizer.lexer=this;let l=e,h=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(h=this.tokenizer.rules.inline.reflinkSearch.exec(l))!==null;)p.includes(h[0].slice(h[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,h.index)+"["+"a".repeat(h[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(h=this.tokenizer.rules.inline.anyPunctuation.exec(l))!==null;)l=l.slice(0,h.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let c;for(;(h=this.tokenizer.rules.inline.blockSkip.exec(l))!==null;)c=h[2]?h[2].length:0,l=l.slice(0,h.index+c)+"["+"a".repeat(h[0].length-c-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=((r=(s=this.options.hooks)==null?void 0:s.emStrongMask)==null?void 0:r.call({lexer:this},l))??l;let u=!1,g="",b=1/0;for(;e;){if(e.length<b)b=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}u||(g=""),u=!1;let p;if((a=(i=this.options.extensions)==null?void 0:i.inline)!=null&&a.some(x=>(p=x.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let x=t.at(-1);p.type==="text"&&x?.type==="text"?(x.raw+=p.raw,x.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,l,g)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e,l,g)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let m=e;if((o=this.options.extensions)!=null&&o.startInline){let x=1/0,
|
|
45
|
+
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var s,r,i,a,o;this.tokenizer.lexer=this;let l=e,h=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(h=this.tokenizer.rules.inline.reflinkSearch.exec(l))!==null;)p.includes(h[0].slice(h[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,h.index)+"["+"a".repeat(h[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(h=this.tokenizer.rules.inline.anyPunctuation.exec(l))!==null;)l=l.slice(0,h.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let c;for(;(h=this.tokenizer.rules.inline.blockSkip.exec(l))!==null;)c=h[2]?h[2].length:0,l=l.slice(0,h.index+c)+"["+"a".repeat(h[0].length-c-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=((r=(s=this.options.hooks)==null?void 0:s.emStrongMask)==null?void 0:r.call({lexer:this},l))??l;let u=!1,g="",b=1/0;for(;e;){if(e.length<b)b=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}u||(g=""),u=!1;let p;if((a=(i=this.options.extensions)==null?void 0:i.inline)!=null&&a.some(x=>(p=x.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let x=t.at(-1);p.type==="text"&&x?.type==="text"?(x.raw+=p.raw,x.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,l,g)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e,l,g)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let m=e;if((o=this.options.extensions)!=null&&o.startInline){let x=1/0,Z=e.slice(1),T;this.options.extensions.startInline.forEach(X=>{T=X.call({lexer:this},Z),typeof T=="number"&&T>=0&&(x=Math.min(x,T))}),x<1/0&&x>=0&&(m=e.substring(0,x+1))}if(p=this.tokenizer.inlineText(m)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(g=p.raw.slice(-1)),u=!0;let x=t.at(-1);x?.type==="text"?(x.raw+=p.raw,x.text+=p.text):t.push(p);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},H=class{constructor(n){f(this,"options"),f(this,"parser"),this.options=n||v}space(n){return""}code({text:n,lang:e,escaped:t}){var s;let r=(s=(e||"").match(w.notSpaceStart))==null?void 0:s[0],i=n.replace(w.endingNewline,"")+`
|
|
46
46
|
`;return r?'<pre><code class="language-'+S(r)+'">'+(t?i:S(i,!0))+`</code></pre>
|
|
47
47
|
`:"<pre><code>"+(t?i:S(i,!0))+`</code></pre>
|
|
48
48
|
`}blockquote({tokens:n}){return`<blockquote>
|
|
@@ -60,5 +60,5 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
60
60
|
`}tablerow({text:n}){return`<tr>
|
|
61
61
|
${n}</tr>
|
|
62
62
|
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
63
|
-
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${S(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),r=
|
|
64
|
-
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},
|
|
63
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${S(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let s=this.parser.parseInline(t),r=Se(n);if(r===null)return s;n=r;let i='<a href="'+n+'"';return e&&(i+=' title="'+S(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=Se(n);if(r===null)return S(t);n=r;let i=`<img src="${n}" alt="${S(t)}"`;return e&&(i+=` title="${S(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:S(n.text)}},re=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},$=class le{constructor(e){f(this,"options"),f(this,"renderer"),f(this,"textRenderer"),this.options=e||v,this.options.renderer=this.options.renderer||new H,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new re}static parse(e,t){return new le(t).parse(e)}static parseInline(e,t){return new le(t).parseInline(e)}parse(e){var t,s;this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let a=e[i];if((s=(t=this.options.extensions)==null?void 0:t.renderers)!=null&&s[a.type]){let l=a,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){r+=h||"";continue}}let o=a;switch(o.type){case"space":{r+=this.renderer.space(o);break}case"hr":{r+=this.renderer.hr(o);break}case"heading":{r+=this.renderer.heading(o);break}case"code":{r+=this.renderer.code(o);break}case"table":{r+=this.renderer.table(o);break}case"blockquote":{r+=this.renderer.blockquote(o);break}case"list":{r+=this.renderer.list(o);break}case"checkbox":{r+=this.renderer.checkbox(o);break}case"html":{r+=this.renderer.html(o);break}case"def":{r+=this.renderer.def(o);break}case"paragraph":{r+=this.renderer.paragraph(o);break}case"text":{r+=this.renderer.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,t=this.renderer){var s,r;this.renderer.parser=this;let i="";for(let a=0;a<e.length;a++){let o=e[a];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=h||"";continue}}let l=o;switch(l.type){case"escape":{i+=t.text(l);break}case"html":{i+=t.html(l);break}case"link":{i+=t.link(l);break}case"image":{i+=t.image(l);break}case"checkbox":{i+=t.checkbox(l);break}case"strong":{i+=t.strong(l);break}case"em":{i+=t.em(l);break}case"codespan":{i+=t.codespan(l);break}case"br":{i+=t.br(l);break}case"del":{i+=t.del(l);break}case"text":{i+=t.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},N,q=(N=class{constructor(n){f(this,"options"),f(this,"block"),this.options=n||v}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?y.lex:y.lexInline}provideParser(n=this.block){return n?$.parse:$.parseInline}},f(N,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),f(N,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),N),ve=class{constructor(...n){f(this,"defaults",W()),f(this,"options",this.setOptions),f(this,"parse",this.parseMarkdown(!0)),f(this,"parseInline",this.parseMarkdown(!1)),f(this,"Parser",$),f(this,"Renderer",H),f(this,"TextRenderer",re),f(this,"Lexer",y),f(this,"Tokenizer",j),f(this,"Hooks",q),this.use(...n)}walkTokens(n,e){var t,s;let r=[];for(let i of n)switch(r=r.concat(e.call(this,i)),i.type){case"table":{let a=i;for(let o of a.header)r=r.concat(this.walkTokens(o.tokens,e));for(let o of a.rows)for(let l of o)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let a=i;r=r.concat(this.walkTokens(a.items,e));break}default:{let a=i;(s=(t=this.defaults.extensions)==null?void 0:t.childTokens)!=null&&s[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let l=a[o].flat(1/0);r=r.concat(this.walkTokens(l,e))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,e)))}}return r}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...a){let o=r.renderer.apply(this,a);return o===!1&&(o=i.apply(this,a)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new H(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,o=t.renderer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new j(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,o=t.tokenizer[a],l=r[a];r[a]=(...h)=>{let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new q;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,o=t.hooks[a],l=r[a];q.passThroughHooks.has(i)?r[a]=h=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(i))return(async()=>{let u=await o.call(r,h);return l.call(r,u)})();let c=o.call(r,h);return l.call(r,c)}:r[a]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await o.apply(r,h);return u===!1&&(u=await l.apply(r,h)),u})();let c=o.apply(r,h);return c===!1&&(c=l.apply(r,h)),c}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let o=[];return o.push(i.call(this,a)),r&&(o=o.concat(r.call(this,a))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return y.lex(n,e??this.defaults)}parser(n,e){return $.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new 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 e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=n),r.async)return(async()=>{let a=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?y.lex:y.lexInline)(a,r),l=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let h=await(r.hooks?await r.hooks.provideParser(n):n?$.parse:$.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(h):h})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer(n):n?y.lex:y.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?$.parse:$.parseInline)(a,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(a){return i(a)}}}onError(n,e){return t=>{if(t.message+=`
|
|
64
|
+
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},P=new ve;function d(n,e){return P.parse(n,e)}d.options=d.setOptions=function(n){return P.setOptions(n),d.defaults=P.defaults,he(d.defaults),d},d.getDefaults=W,d.defaults=v,d.use=function(...n){return P.use(...n),d.defaults=P.defaults,he(d.defaults),d},d.walkTokens=function(n,e){return P.walkTokens(n,e)},d.parseInline=P.parseInline,d.Parser=$,d.parser=$.parse,d.Renderer=H,d.TextRenderer=re,d.Lexer=y,d.lexer=y.lex,d.Tokenizer=j,d.Hooks=q,d.parse=d,d.options,d.setOptions,d.use,d.walkTokens,d.parseInline,$.parse,y.lex;var Ae=Oe("<div>");function G(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function B(n){return G(n).replace(/"/g,""")}const Pe=new ve({gfm:!0,breaks:!0,renderer:{html({text:n}){return G(n)},link({href:n,title:e,tokens:t}){const s=this.parser.parseInline(t);if(!ce(n))return s;const r=e?` title="${B(e)}"`:"";return`<a href="${B(n)}"${r}>${s}</a>`},image({href:n,title:e,text:t}){if(!ce(n))return G(t);const s=e?` title="${B(e)}"`:"";return`<img src="${B(n)}" alt="${B(t)}"${s}>`}}});function Lt(n){return Pe.lexer(n).map(e=>e.type==="code"?{type:"code",content:e.text,language:e.lang||void 0}:{type:"markdown",content:e.raw})}function It(n){const e=ie(()=>{try{return Pe.parse(n.content,{async:!1})}catch{return G(n.content)}});return(()=>{var t=Ae();return oe(()=>t.innerHTML=e()),t})()}function Ct(n){const[e]=Ce(n,["content","id","class","codeTheme","part"]),t=Ee(),s=ie(()=>Lt(e.content));return(()=>{var r=Ae();return qe(r,z(Ze,{get each(){return s()},children:i=>z(Be,{get children(){return[z(ae,{get when(){return i.type==="code"},get children(){return z(He,{class:"my-4",get children(){return z(Ne,{get code(){return i.content},get language(){return i.language},get theme(){return e.codeTheme??t.codeTheme()}})}})}}),z(ae,{get when(){return i.type==="markdown"},get children(){return z(It,{get content(){return i.content}})}})]}})})),oe(i=>{var a=e.part,o=je("chat-markdown max-w-none break-words whitespace-normal [&>div:first-child>p:first-child]:mt-0 [&>div:last-child>p:last-child]:mb-0",De(t.proseSize()),e.class);return a!==i.e&&Me(r,"part",i.e=a),o!==i.t&&Qe(r,i.t=o),i},{e:void 0,t:void 0}),r})()}export{Ct as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as w,q as k,m as y,j as z,i as g,l as q,c as t,S as c,r as R,M as o,F as x,I as L,a as S,d as B,b as T,t as h,y as P,O as D,e as E}from"./define-B_tXMYRm.js";import{T as G}from"./tooltip-BqwnFWhn.js";import{c as u}from"./cn-CU7UAWzk.js";import{M as H}from"./markdown-
|
|
1
|
+
import{s as w,q as k,m as y,j as z,i as g,l as q,c as t,S as c,r as R,M as o,F as x,I as L,a as S,d as B,b as T,t as h,y as P,O as D,e as E}from"./define-B_tXMYRm.js";import{T as G}from"./tooltip-BqwnFWhn.js";import{c as u}from"./cn-CU7UAWzk.js";import{M as H}from"./markdown-DbozyYqa.js";import{B as J}from"./button-B9okqG73.js";import{B as K,a as U}from"./action-icons-DW9muWrY.js";import{R as N,a as O,b as Q}from"./reasoning-BrxQfpfI.js";import{T as V}from"./tool-C1YtxwPu.js";import{A as W,a as X,d as Y,e as Z}from"./attachments-CL6TaqIb.js";import{S as _,a as $,b as ee,c as re}from"./source-w9V0NnBn.js";import{a as te}from"./card-renderer-CSoTL_e1.js";import{c as ne}from"./check-MdLzbxrm.js";var ae=h("<div part=row>"),se=h('<img class="h-full w-full object-cover">'),ie=h("<div part=avatar>"),le=h('<div class="flex h-full w-full items-center justify-center bg-muted text-xs font-medium text-muted-foreground">'),C=h("<div>"),ce=h('<span class="px-1 text-xs">'),oe=h('<span><span class="min-w-0 overflow-hidden">');const ue={user:"User message",assistant:"Assistant message",system:"System message"};function de(e){const[r,n]=w(e,["children","class","role"]);return(()=>{var a=ae();return k(a,y({get class(){return u("flex items-start gap-3",r.class)},get"data-role"(){return r.role},get role(){return r.role?"article":void 0},get"aria-label"(){return z(()=>!!r.role)()?ue[r.role]:void 0}},n),!1,!0),g(a,()=>r.children),a})()}function ge(e){return(()=>{var r=ie();return g(r,t(c,{get when(){return e.src},get fallback(){return t(c,{get when(){return e.fallback},get children(){var n=le();return g(n,()=>e.fallback),n}})},get children(){var n=se();return S(a=>{var s=e.src,l=e.alt??"";return s!==a.e&&B(n,"src",a.e=s),l!==a.t&&B(n,"alt",a.t=l),a},{e:void 0,t:void 0}),n}})),S(()=>T(r,u("h-8 w-8 shrink-0 overflow-hidden rounded-full",e.class))),r})()}function he(e){const[r,n]=w(e,["children","markdown","class","part"]),a=P(),s=()=>u("min-w-0 rounded-lg p-2 text-foreground bg-secondary max-w-none break-words whitespace-normal",D(a.proseSize()),r.class);return t(c,{get when(){return r.markdown},get fallback(){return(()=>{var l=C();return k(l,y({get part(){return r.part},get class(){return s()}},n),!1,!0),g(l,()=>r.children),l})()},get children(){return t(H,{get part(){return r.part},get content(){return r.children},get class(){return s()}})}})}function fe(e){const[r,n]=w(e,["children","class"]);return(()=>{var a=C();return k(a,y({get class(){return u("flex items-center gap-0.5 mt-0.5",r.class)}},n),!1,!0),g(a,()=>r.children),a})()}function pe(e){return typeof e=="string"?{id:e,label:K[e],Icon:U(e)}:{id:e.id,label:e.label,Icon:U(e.icon)}}function me(e){return e==="like"||e==="dislike"?e:void 0}function ve(e){return t(fe,{part:"actions",get class(){return u("mt-1 flex gap-0",e.reveal==="hover"&&"opacity-0 transition-opacity group-hover:opacity-100",e.class)},get children(){return t(x,{get each(){return e.actions},children:r=>{const n=pe(r),a=()=>typeof r!="string"&&r.tooltip?r.tooltip:n.label,s=me(r),l=()=>s!==void 0&&e.activeFeedback===s,b=n.id==="copy",m=()=>b&&e.copied===!0,i=()=>t(J,{variant:"ghost",size:"icon-sm",get class(){return u("rounded-full",l()&&"text-primary")},get"data-action"(){return n.id},get"aria-label"(){return z(()=>!!m())()?"Copied":n.label},get"aria-pressed"(){return s!==void 0?l():void 0},onClick:()=>e.onAction(n.id),get children(){return t(c,{get when(){return m()},get fallback(){return t(c,{get when(){return n.Icon},get fallback(){return(()=>{var d=ce();return g(d,()=>n.label),d})()},children:d=>{const f=d();return t(f,{get class(){return u("size-3.5",l()&&"fill-current")}})}})},get children(){return t(ne,{class:"size-3.5 text-emerald-400"})}})}}),j=()=>t(c,{get when(){return n.Icon},get fallback(){return i()},get children(){return t(G,{get content(){return a()},get children(){return i()}})}});return t(c,{when:s!==void 0,get fallback(){return j()},get children(){return(()=>{const d=()=>e.activeFeedback===void 0||e.activeFeedback===s;return(()=>{var f=oe(),M=f.firstChild;return g(M,j),S(p=>{var A=d()?void 0:"",I=u("grid transition-[grid-template-columns,opacity] duration-300 ease-out",d()?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0");return A!==p.e&&B(f,"data-feedback-collapsed",p.e=A),I!==p.t&&T(f,p.t=I),p},{e:void 0,t:void 0}),f})()})()}})}})}})}function be(e){const r=[];for(const n of e){if(n.type==="file"){const a=r[r.length-1];if(a?.kind==="files"){r[r.length-1]={kind:"files",parts:[...a.parts,n]};continue}r.push({kind:"files",parts:[n]});continue}if(n.type==="source"){const a=r[r.length-1];if(a?.kind==="sources"){r[r.length-1]={kind:"sources",parts:[...a.parts,n]};continue}r.push({kind:"sources",parts:[n]});continue}r.push({kind:"single",part:n})}return r}function we(e){if(e.index!==void 0)return e.index;if(!e.url)return e.title||"Source"}function ke(e){return e.title||e.url||"Source"}function F(e,r){return e.kind===r?e:!1}function v(e,r){return e.type===r?e:!1}function ye(e){const r=q(()=>be(e.parts));return[t(c,{get when(){return e.beforeBody},get children(){return e.beforeBody}}),t(L,{get each(){return r()},children:n=>t(R,{fallback:null,get children(){return[t(o,{get when(){return F(n(),"files")},children:a=>t(W,{variant:"inline",get class(){return e.isUser?"mb-2 justify-end":"mb-2"},get children(){return t(x,{get each(){return a().parts},children:s=>t(X,{get data(){return s.attachment},get children(){return[t(Y,{}),t(Z,{})]}})})}})}),t(o,{get when(){return F(n(),"sources")},children:a=>t(_,{part:"citations",get class(){return e.isUser?"justify-end":void 0},get children(){return t(x,{get each(){return a().parts},children:s=>t($,{get href(){return s.source.url},get children(){return[t(ee,{get label(){return we(s.source)}}),t(re,{get title(){return ke(s.source)},get description(){return s.source.snippet??""}})]}})})}})}),t(o,{get when(){return F(n(),"single")},children:a=>{const s=()=>a().part,l=()=>v(s(),"reasoning"),b=()=>{const i=l();return i!==!1&&i.text===""},m=()=>{const i=l();return i!==!1&&i.text!==""&&i};return t(R,{fallback:null,get children(){return[t(o,{get when(){return v(s(),"text")},children:i=>t(he,{part:"bubble content",get markdown(){return e.markdown},get class(){return e.isUser?"bg-muted text-primary max-w-[85%] rounded-2xl px-4 py-2":"bg-transparent p-0"},get children(){return i().text}})}),t(o,{get when(){return b()},children:null}),t(o,{get when(){return m()},children:i=>t(N,{class:"mb-2 w-full",get children(){return[t(O,{get children(){return i().label??"Reasoning"}}),t(Q,{markdown:!0,get children(){return i().text}})]}})}),t(o,{get when(){return v(s(),"tool")},children:i=>t(V,{get toolPart(){return i().tool},class:"mb-2 w-full"})}),t(o,{get when(){return v(s(),"card")},children:i=>t(te,{get envelope(){return i().envelope},get types(){return e.cardTypes},get schemas(){return e.cardSchemas}})})]}})}})]}})}),t(c,{get when(){var n;return(((n=e.actions)==null?void 0:n.length)??0)>0},get children(){return t(ve,{get actions(){return e.actions},get reveal(){return e.actionsReveal==="hover"?"hover":"always"},get activeFeedback(){return e.activeFeedback},get copied(){return e.copied},onAction:n=>{var a;return(a=e.onAction)==null?void 0:a.call(e,n)}})}}),t(c,{get when(){return e.afterBody},get children(){return e.afterBody}})]}E(["click"]);export{ye as M,de as a,ge as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as k,h as x,f as K,c as g,k as N,D as P,y as Q,o as H,C as V,S as w,j as T,i as X,a as Y,b as Z,u as $,t as A}from"./define-B_tXMYRm.js";import{r as ee,M as te}from"./slots-CIw9RlAe.js";import{a as z,M as re,b as ae}from"./message-
|
|
1
|
+
import{g as k,h as x,f as K,c as g,k as N,D as P,y as Q,o as H,C as V,S as w,j as T,i as X,a as Y,b as Z,u as $,t as A}from"./define-B_tXMYRm.js";import{r as ee,M as te}from"./slots-CIw9RlAe.js";import{a as z,M as re,b as ae}from"./message-CE4k-qaj.js";import{t as B}from"./toast-store-VUZZBhzH.js";import{B as O}from"./card-renderer-CSoTL_e1.js";import{m as ne,B as oe}from"./card-tags-D8lZ-C_U.js";function se(e){return e.filter(a=>a.type==="text").map(a=>a.text).join("")}const ie=2e3;function R(e){const[a,c]=k({}),[s,i]=k(new Set),v=e.copiedDuration??ie,n=new Map;x(()=>{n.forEach(r=>clearTimeout(r)),n.clear()});const u=r=>r.feedback??a()[r.id],h=r=>s().has(r),f=r=>{i(d=>{const l=new Set(d);return l.add(r),l});const o=n.get(r);o&&clearTimeout(o),n.set(r,setTimeout(()=>{n.delete(r),i(d=>{if(!d.has(r))return d;const l=new Set(d);return l.delete(r),l})},v))},b=(r,o)=>{c(d=>{const l={...d};return o===void 0?delete l[r]:l[r]=o,l})};return{resolveFeedback:u,isCopied:h,handleAction:(r,o)=>{var d,l,p;if(o==="copy"){try{(d=navigator.clipboard)==null||d.writeText(se(r.parts))}catch{}f(r.id),B("Copied to clipboard",{target:(l=e.target)==null?void 0:l.call(e)}),e.emit({messageId:r.id,action:o});return}if(o==="like"||o==="dislike"){u(r)===o?(b(r.id,void 0),e.emit({messageId:r.id,action:o,state:"off"})):(b(r.id,o),B("Thanks for your feedback",{target:(p=e.target)==null?void 0:p.call(e)}),e.emit({messageId:r.id,action:o,state:"on"}));return}e.emit({messageId:r.id,action:o})}}}function S(e){return!!e&&typeof e=="object"&&Array.isArray(e.parts)}const le="each entry needs a 'parts' array (e.g. parts: [{ type: 'text', text: 'Hi' }]). The 'content' string field was removed in 0.20.0.",ce=[];function de(e){const a=new WeakSet;let c=!1,s=!1;return i=>{if(!Array.isArray(i))return i!=null&&!s&&(s=!0,console.error(`<${e}>: 'messages' must be an array. Ignoring it.`)),ce;if(i.every(S))return i;let v=0,n=0;for(const u of i)if(!S(u)){if(v++,u!==null&&typeof u=="object"){if(a.has(u))continue;a.add(u)}else{if(c)continue;c=!0}n++}return n>0&&console.error(`<${e}>: skipped ${v} of ${i.length} messages: ${le}`),i.filter(S)}}var ue=A("<slot name=before-body>"),ge=A("<slot name=after-body>"),ve=A("<div part=avatar class=shrink-0><slot name=avatar>"),me=A("<div>");function _(e,a="auto"){const c=ne(e),s={};for(const i of Object.keys(c)){const v=c[i];s[i]=v===oe[i]&&O[i]?O[i]:n=>g(fe,{tag:v,get envelope(){return n.envelope},theme:a})}return s}function fe(e){let a;return N(()=>{a&&(a.data=e.envelope.data,a.cardId=e.envelope.id,e.envelope.title!=null&&(a.heading=e.envelope.title),a.resolution=e.envelope.resolution,a.setAttribute("theme",e.theme),a.setAttribute("data-card-id",e.envelope.id))}),g(P,{get component(){return e.tag},ref(c){var s=a;typeof s=="function"?s(c):a=c}})}function D(e){const a=e.getAttribute("role");a!==null&&(e.removeAttribute("role"),e.role=a)}K("kai-message",{message:void 0,role:"assistant",markdown:void 0,proseSize:"sm",codeTheme:"github-dark-dimmed",codeHighlight:!0,actionsReveal:"always",avatarSrc:void 0,avatarFallback:void 0,avatar:void 0,cardTypes:void 0,cardSchemas:void 0},(e,{dispatch:a,flag:c,element:s,expose:i})=>{const v=Q();D(s);const n=()=>e.message??{id:"message",role:e.role??"assistant",parts:[]};let u;const h=()=>{const t=n();return S(t)?!0:(t!==u&&(u=t,console.error("<kai-message>: 'message' must have a 'parts' array. The 'content' string field was removed in 0.20.0.")),!1)},f=R({emit:t=>a("kai-message-action",t)});i({copy:()=>{h()&&f.handleAction(n(),"copy")}});const[b,r]=k([]),[o,d]=k({});H(()=>{const t=()=>{const J=[...s.querySelectorAll("kai-action")];r(J.map(m=>{var j;return{id:m.id||m.getAttribute("action")||"",label:((j=m.textContent)==null?void 0:j.trim())||m.getAttribute("label")||m.id||"",icon:m.getAttribute("icon")??void 0,tooltip:m.getAttribute("tooltip")??void 0}})),d(ee(s,te))};t();const y=new MutationObserver(t);y.observe(s,{childList:!0,attributes:!0,subtree:!0}),x(()=>y.disconnect())}),H(()=>{const t=new MutationObserver(()=>D(s));t.observe(s,{attributes:!0,attributeFilter:["role"]}),x(()=>t.disconnect())});const l=()=>n().role==="user",p=()=>n().avatar??(e.avatarSrc||e.avatarFallback?{src:e.avatarSrc,fallback:e.avatarFallback}:void 0),q=()=>e.avatar==="none",F=()=>!!o().avatar,E=()=>!q()&&(F()||!!p()),M=()=>e.actionsReveal==="hover"?"hover":"always",L=()=>s.hasAttribute("markdown")||e.markdown===!0||e.markdown===!1,U=()=>L()?c("markdown"):!l(),W=()=>[...n().actions??[],...b()],C=()=>g(re,{get parts(){return n().parts},get cardTypes(){return _(e.cardTypes,e.theme)},get cardSchemas(){return e.cardSchemas},get isUser(){return l()},get markdown(){return U()},get actions(){return W()},get actionsReveal(){return M()},get activeFeedback(){return f.resolveFeedback(n())},get copied(){return f.isCopied(n().id)},onAction:t=>f.handleAction(n(),t),get beforeBody(){return T(()=>!!o()["before-body"])()?(()=>{var t=ue();return t._$owner=$(),t})():void 0},get afterBody(){return T(()=>!!o()["after-body"])()?(()=>{var t=ge();return t._$owner=$(),t})():void 0}}),I=()=>M()==="hover"?"group ":"",G=()=>g(w,{get when(){return F()},get fallback(){return g(w,{get when(){return p()},children:t=>g(ae,{get src(){return t().src??""},get alt(){return t().alt??""},get fallback(){return t().fallback}})})},get children(){var t=ve(),y=t.firstChild;return y._$owner=$(),t}});return g(w,{get when(){return h()},get children(){return g(V,{get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return c("codeHighlight")},get portalMount(){return v.portalMount()},get children(){return g(w,{get when(){return E()},get fallback(){return g(z,{get role(){return n().role},get class(){return`${I()}${l()?"flex-col items-end":"flex-col items-start"}`},get children(){return C()}})},get children(){return g(z,{get role(){return n().role},get class(){return I()},get children(){return[T(()=>G()),(()=>{var t=me();return X(t,C),Y(()=>Z(t,`flex min-w-0 flex-1 flex-col ${l()?"items-end":"items-start"}`)),t})()]}})}})}})}})});export{de as a,R as b,_ as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as v,g as w,k as R,w as A,c as f,i as h,a as x,b,v as O,d as k,q as H,m as S,S as I,t as y,z as E,A as M,h as T,e as q}from"./define-B_tXMYRm.js";import{c as m}from"./cn-CU7UAWzk.js";import{M as B}from"./markdown-
|
|
1
|
+
import{s as v,g as w,k as R,w as A,c as f,i as h,a as x,b,v as O,d as k,q as H,m as S,S as I,t as y,z as E,A as M,h as T,e as q}from"./define-B_tXMYRm.js";import{c as m}from"./cn-CU7UAWzk.js";import{M as B}from"./markdown-DbozyYqa.js";import{c as N}from"./chevron-down-MK7IzDqe.js";const P=1;function D(l,r){let t=-1;const s=new ResizeObserver(d=>{var u;const e=((u=d[d.length-1])==null?void 0:u.contentRect.height)??l.getBoundingClientRect().height;(t<0||Math.abs(e-t)>P)&&(t=e,r(e))});return s.observe(l),()=>s.disconnect()}var F=y("<div>"),J=y("<button type=button><span class=text-primary></span><div>"),K=y("<div style=max-height:0px><div>");const $=E();function z(){const l=M($);if(!l)throw new Error("useReasoningContext must be used within a Reasoning provider");return l}function L(l){var r;const[t]=v(l,["children","class","open","defaultOpen","onOpenChange","isStreaming","disabled","controllerRef"]),[s,d]=w(t.defaultOpen??!1),[u,e]=w(!1),a=()=>t.open!==void 0,i=()=>a()?t.open:s(),n=()=>!!t.disabled,o=c=>{var C;i()!==c&&(a()||d(c),(C=t.onOpenChange)==null||C.call(t,c))};R(()=>{const c=t.isStreaming;c&&!u()&&(a()||d(!0),e(!0)),!c&&u()&&(a()||d(!1),e(!1))}),(r=t.controllerRef)==null||r.call(t,{open:i,setOpen:o});const g=A();let p;return f($.Provider,{value:{isOpen:i,onOpenChange:o,disabled:n,contentId:g,registerTrigger:c=>{p=c},trigger:()=>p},get children(){var c=F();return h(c,()=>t.children),x(()=>b(c,t.class)),c}})}function Q(l){const[r,t]=v(l,["children","class","ref"]),{isOpen:s,onOpenChange:d,disabled:u,contentId:e,registerTrigger:a}=z();return(()=>{var i=J(),n=i.firstChild,o=n.nextSibling;return i.$$click=()=>{u()||d(!s())},O(g=>{a(g),typeof r.ref=="function"&&r.ref(g)},i),k(i,"aria-controls",e),H(i,S({get class(){return m("flex cursor-pointer items-center gap-2 text-meta",r.class)},get disabled(){return u()||void 0},get"aria-expanded"(){return s()},get"data-expanded"(){return s()?"":void 0},get"data-closed"(){return s()?void 0:""},get"data-state"(){return s()?"open":"closed"}},t),!1,!0),h(n,()=>r.children),h(o,f(N,{class:"size-4"})),x(()=>b(o,m("transform transition-transform",s()?"rotate-180":""))),i})()}function _(l){const[r,t]=v(l,["children","class","contentClass","markdown"]),{isOpen:s,contentId:d,trigger:u}=z();let e,a;const i=()=>{var n;if(!e)return;const o=e.getRootNode().activeElement;o&&e.contains(o)&&((n=u())==null||n.focus())};return R(()=>{if(!e||!a)return;const n=D(a,()=>{e&&a&&s()&&(e.style.maxHeight=`${a.scrollHeight}px`)});s()?(e.style.maxHeight=`${a.scrollHeight}px`,e.removeAttribute("inert")):(e.style.maxHeight="0px",i(),e.setAttribute("inert","")),T(n)}),(()=>{var n=K(),o=n.firstChild,g=e;typeof g=="function"?O(g,n):e=n,k(n,"id",d),H(n,S({get class(){return m("overflow-hidden transition-[max-height] duration-150 ease-out",r.class)},get"data-state"(){return s()?"open":"closed"}},t),!1,!0);var p=a;return typeof p=="function"?O(p,o):a=o,h(o,f(I,{get when(){return r.markdown},get fallback(){return r.children},get children(){return f(B,{get content(){return r.children}})}})),x(()=>b(o,m("text-muted-foreground text-body",r.contentClass))),n})()}q(["click"]);export{L as R,Q as a,_ as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as s,a as c,d as u,b as m,c as a,S as d,j as w,t as l,z as x,A as b}from"./define-B_tXMYRm.js";import{c as f}from"./cn-CU7UAWzk.js";import{H as y,a as z,b as S}from"./hover-card-6KtXpLwT.js";import{i as C}from"./link-preview-DNILK391.js";var _=l('<img alt=favicon width=14 height=14 class="size-3.5 rounded-full">'),k=l('<a target=_blank rel="noopener noreferrer"><span class="truncate tabular-nums text-center font-normal">'),R=l('<div class="flex items-center gap-1.5"><img alt=favicon class="size-4 rounded-full"width=16 height=16><div class="text-primary truncate text-sm">'),I=l('<div class="line-clamp-2 text-sm font-medium">'),U=l('<div class="text-muted-foreground line-clamp-2 text-sm">'),$=l('<a target=_blank rel="noopener noreferrer"class="flex flex-col gap-2 p-3">'),j=l("<div>");const p=x();function v(){const r=b(p);if(!r)throw new Error("Source.* must be used inside <Source>");return r}function D(r){const t=()=>r.href??"",n=()=>C(t())?t():"",e=()=>{const o=t();if(!o)return"";try{return new URL(o).hostname||o}catch{return o.split("/").pop()||o}};return a(p.Provider,{value:{get href(){return n()},get domain(){return e()}},get children(){return a(y,{openDelay:150,get children(){return r.children}})}})}function F(r){const t=v(),n=()=>r.label??t.domain.replace("www.","");return a(z,{get children(){var e=k(),o=e.firstChild;return s(e,a(d,{get when(){return w(()=>!!r.showFavicon)()&&t.href},get children(){var i=_();return c(()=>u(i,"src",`https://www.google.com/s2/favicons?sz=64&domain_url=${encodeURIComponent(t.href)}`)),i}}),o),s(o,n),c(i=>{var h=t.href||void 0,g=f("bg-muted text-foreground/80 hover:bg-muted-foreground/30 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background inline-flex h-5 max-w-32 items-center gap-1 overflow-hidden rounded-full py-0 text-xs no-underline transition-colors duration-150",r.showFavicon?"pr-2 pl-1":"px-2",r.class);return h!==i.e&&u(e,"href",i.e=h),g!==i.t&&m(e,i.t=g),i},{e:void 0,t:void 0}),e}})}function H(r){const t=v();return a(S,{get class(){return f("w-80 p-0 shadow-xs",r.class)},get children(){var n=$();return s(n,a(d,{get when(){return t.href},get children(){var e=R(),o=e.firstChild,i=o.nextSibling;return s(i,()=>t.domain.replace("www.","")),c(()=>u(o,"src",`https://www.google.com/s2/favicons?sz=64&domain_url=${encodeURIComponent(t.href)}`)),e}}),null),s(n,a(d,{get when(){return r.title},get children(){var e=I();return s(e,()=>r.title),e}}),null),s(n,a(d,{get when(){return r.description},get children(){var e=U();return s(e,()=>r.description),e}}),null),c(()=>u(n,"href",t.href||void 0)),n}})}function L(r){return(()=>{var t=j();return s(t,()=>r.children),c(n=>{var e=r.part,o=f("flex flex-wrap gap-1.5 mt-3",r.class);return e!==n.e&&u(t,"part",n.e=e),o!==n.t&&m(t,n.t=o),n},{e:void 0,t:void 0}),t})()}export{L as S,D as a,F as b,H as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as xe,s as ke,l as T,g as ye,k as M,x as _,o as we,c as u,E as Ce,S as k,j as G,i as c,v as Se,a as E,b as B,d as m,F as W,w as Ie,t as y,e as $e}from"./define-B_tXMYRm.js";import{c as D}from"./cn-CU7UAWzk.js";import{B as ue}from"./button-B9okqG73.js";import{P as Te}from"./progress-bar-D1_rzt6N.js";import{u as Re,a as Ee,C as X,D as ze}from"./use-card-resolution-DJg32jGH.js";import{e as Ae}from"./card-routing-C986KuUA.js";import{x as Le}from"./x-BOhjBeOd.js";import{c as Ne}from"./check-MdLzbxrm.js";import{c as je}from"./circle-check-GqvO2UBs.js";import{c as Ve}from"./circle-BG7VkPep.js";var Be=y('<p class="pt-1 text-xs text-muted-foreground">Up to <!> selected.'),De=y('<div role=group><div class="divide-y divide-border overflow-hidden rounded-lg border border-input">'),qe=y("<span class=sr-only>"),Me=y('<div class="flex w-full flex-wrap items-center justify-between gap-2"><span aria-live=polite class="text-xs text-muted-foreground"> selected</span><div class="ml-auto flex items-center gap-2">'),Ue=y("<label><input type=checkbox class=kai-checkbox><span>Select all"),ce=y('<span class="text-xs font-normal text-muted-foreground">'),Fe=y('<label><input type=checkbox class="kai-checkbox mt-0.5"><span class="flex flex-col gap-0.5"><span>'),Pe=y('<div class="flex items-center justify-between gap-3"><span class="text-sm font-medium text-foreground"></span><span aria-live=polite class="shrink-0 text-sm font-medium tabular-nums text-muted-foreground"> / '),Oe=y('<p class="text-xs text-muted-foreground">Up to <!> selected.'),_e=y('<div><ul class="flex flex-col gap-1">'),Ge=y('<div class="grid grid-rows-[0fr] group-hover:grid-rows-[1fr] group-focus-within:grid-rows-[1fr] motion-safe:transition-[grid-template-rows] motion-safe:duration-200"><span class="overflow-hidden text-xs font-normal text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 motion-safe:transition-opacity">'),He=y('<li><label><input type=checkbox class=sr-only><span aria-hidden=true></span><span class="flex min-w-0 flex-col gap-0.5"><span>'),Je=y('<ul class="list-disc pl-5 text-sm text-foreground">'),Ke=y('<div class="flex flex-col gap-2"><p class="flex items-center gap-2 text-sm font-medium text-foreground"><span>Selected <!> of '),Qe=y('<p class="text-sm text-muted-foreground">None selected'),We=y("<li>");const Xe="tasks";function Ye(e){if(!Array.isArray(e)||e.length===0)return{tasks:[],error:"This card couldn't be displayed."};const d=new Set,t=[];for(const s of e){if(!s||typeof s!="object")continue;const o=s;if(!(typeof o.id!="string"||o.id.length===0)&&!(typeof o.label!="string"||o.label.length===0)){if(d.has(o.id)){console.warn(`[kai-tasks] duplicate task id "${o.id}" ignored`);continue}d.add(o.id),t.push({id:o.id,label:o.label,description:typeof o.description=="string"?o.description:void 0,checked:o.checked===!0,disabled:o.disabled===!0})}}return t.length===0?{tasks:[],error:"This card couldn't be displayed."}:{tasks:t}}function Ze(e){return e.filter(d=>d.checked).map(d=>d.id)}function ge(e,d){return e.filter(t=>d.has(t.id)).map(t=>t.id)}function H(e){return e.filter(d=>!d.disabled).map(d=>d.id)}function et(e,d){const t=H(e);if(t.length===0)return"unchecked";const s=t.filter(o=>d.has(o)).length;return s===0?"unchecked":s===t.length?"checked":"indeterminate"}function tt(e,d){if(e.selectAll!==!0)return!1;const t=H(d).length;return!(e.max!==void 0&&t>e.max)}function rt(e){return e.mode==="progress"}function nt(e,d){return{done:e.filter(t=>d.has(t.id)).length,total:e.length}}function fe(e,d){const t=e.min??(e.allowEmpty?0:1);return!(d<t||e.max!==void 0&&d>e.max)}function Y(e,d){return e.max!==void 0&&d>=e.max}function it(e,d){if(fe(e,d))return;const t=e.min??(e.allowEmpty?0:1);if(d<t)return`Select at least ${t}.`;if(e.max!==void 0&&d>e.max)return`Select at most ${e.max}.`}const at={tasks:[]};function ot(e){const d=xe({cardId:"kai-tasks"},e),[t]=ke(d,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","readonly","onValueChange","controllerRef"]),s=Re(),o=Ie(),f=r=>{const a=t.host??s;a?a.emit(r):t.hostElement&&Ae(t.hostElement,r)},b=T(()=>{var r;return Ye((r=t.data)==null?void 0:r.tasks)}),$=T(()=>b().error===void 0),w=T(()=>b().error??""),h=T(()=>b().tasks),x=T(()=>t.data??at),[S,L]=ye(new Set),i=Ee({prop:()=>t.resolution,data:()=>t.data}),z=r=>{const a=new Set(h().map(n=>n.id));return r.filter(n=>a.has(n))};M(_(()=>t.data,()=>{const r=t.value??t.defaultValue??Ze(h());L(new Set(z(r)))})),M(_(()=>t.value,r=>{r&&L(new Set(z(r)))},{defer:!0})),M(_(S,r=>{var a;(a=t.onValueChange)==null||a.call(t,{value:ge(h(),r)})},{defer:!0})),M(_($,r=>{f(r?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:w()})}));const R=()=>t.disabled===!0,C=()=>t.readonly===!0,N=T(()=>S().size),j=T(()=>rt(x())),U=T(()=>nt(h(),S())),P=()=>x().confirmLabel??"Confirm",V=T(()=>et(h(),S())),O=T(()=>tt(x(),h())),q=T(()=>it(x(),N())),J=T(()=>fe(x(),N())&&!i.isResolved()&&!R()&&!C()),Z=(r,a,n)=>{if(n){if(Y(x(),r.size)&&!r.has(a))return r;r.add(a)}else r.delete(a);return r},K=(r,a)=>{i.isResolved()||R()||C()||L(Z(new Set(S()),r,a))},ee=r=>{if(i.isResolved()||R()||C())return;const a=new Set(S());for(const n of H(h()))r?a.add(n):a.delete(n);L(a)},Q=()=>{if(!J())return;const r={selected:ge(h(),S())};f({kind:"submit",cardId:t.cardId,data:r}),i.setLocal({kind:"submit",data:r})},te=()=>{i.isResolved()||(f({kind:"dismiss",cardId:t.cardId}),i.setLocal({kind:"dismissed"}))},re=()=>f({kind:"reopen",cardId:t.cardId});we(()=>{var r;(r=t.controllerRef)==null||r.call(t,{select:a=>{if(i.isResolved()||R()||C())return;if(a===void 0){ee(!0);return}const n=new Set,g=new Set(H(h()));for(const l of z(a))g.has(l)&&Z(n,l,!0);L(n)},toggle:(a,n)=>{const g=n??!S().has(a);K(a,g)},send:()=>Q(),focus:a=>{var n,g;const l=(((n=t.hostElement)==null?void 0:n.shadowRoot)??document).querySelector('[role="group"]');(g=l?.querySelector('input[type="checkbox"]')??l)==null||g.focus(a)},dismiss:()=>te(),reopen:()=>re()})}),M(()=>{var r;const a=t.hostElement;a&&(((r=i.resolution())==null?void 0:r.kind)==="submit"?a.setAttribute("data-kai-resolved","submitted"):a.removeAttribute("data-kai-resolved"))});const he=T(()=>{var r;const a=i.resolution();if(!a||a.kind!=="submit")return;const n=(r=a.data)==null?void 0:r.selected,g=Array.isArray(n)?n:[],l=h(),v=l.filter(I=>g.includes(I.id)).map(I=>I.label);return{count:v.length,total:l.length,labels:v}}),ne=`kai-tl-reason-${o}`,me=`kai-tl-count-${o}`,ve=`kai-tl-progress-${o}`,pe=`kai-tl-heading-${o}`,ie=()=>{var r;return t.heading??((r=t.data)==null?void 0:r.heading)};return u(k,{get when(){return $()},get fallback(){return u(X,{get heading(){return t.heading},get errorMessage(){return w()}})},get children(){return u(Ce,{fallback:()=>(f({kind:"error",cardId:t.cardId,message:"The card failed to render."}),u(X,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return u(k,{get when(){return!i.isDeferred()},get fallback(){return u(ze,{type:Xe,get title(){var r;return t.heading??((r=t.data)==null?void 0:r.heading)},onReopen:re})},get children(){return u(X,{get heading(){return G(()=>!!j())()?void 0:ie()},get actions(){return G(()=>!!(j()||i.isResolved()||C()))()?void 0:(()=>{var r=Me(),a=r.firstChild,n=a.firstChild,g=a.nextSibling;return c(r,u(k,{get when(){var l;return((l=t.data)==null?void 0:l.dismissible)===!0},get children(){return u(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:te,get children(){return u(Le,{size:16,"aria-hidden":"true"})}})}}),a),m(a,"id",me),c(a,N,n),c(g,u(k,{get when(){return q()},get children(){var l=qe();return m(l,"id",ne),c(l,q),l}}),null),c(g,u(ue,{type:"button",get disabled(){return!J()},get"aria-describedby"(){return q()?ne:void 0},onClick:Q,get children(){return P()}}),null),r})()},get children(){return u(k,{get when(){return!i.isResolved()},get fallback(){return u(st,{get summary(){return he()},get optimistic(){return i.isOptimistic()}})},get children(){return[u(k,{get when(){return j()},get children(){return u(dt,{get heading(){return ie()},headingId:pe,countId:ve,get done(){return U().done},get total(){return U().total},get tasks(){return h()},uid:o,isChecked:r=>S().has(r),isBlocked:r=>R()||r.disabled===!0||!S().has(r.id)&&Y(x(),N()),onToggle:(r,a)=>K(r,a),get groupClass(){return t.class},get maxNote(){return G(()=>x().max!==void 0)()?x().max:void 0},get readonly(){return C()}})}}),u(k,{get when(){return!j()},get children(){var r=De(),a=r.firstChild;return r.$$keydown=n=>{n.key!=="Enter"||n.target.tagName==="INPUT"||J()&&Q()},c(a,u(k,{get when(){return O()},get children(){return(()=>{const n=()=>V()==="indeterminate";return(()=>{var g=Ue(),l=g.firstChild;return l.addEventListener("change",v=>ee(v.currentTarget.checked)),Se(v=>{M(()=>{v.indeterminate=n()})},l),E(v=>{var I=D("flex items-center gap-3 px-3 py-2.5 text-sm font-medium transition-colors",C()?"cursor-default":"cursor-pointer",V()==="checked"?"bg-accent text-accent-foreground":C()?"text-foreground":"text-foreground hover:bg-muted/50"),A=R()||C(),F=n()?"mixed":V()==="checked";return I!==v.e&&B(g,v.e=I),A!==v.t&&(l.disabled=v.t=A),F!==v.a&&m(l,"aria-checked",v.a=F),v},{e:void 0,t:void 0,a:void 0}),E(()=>l.checked=V()==="checked"),g})()})()}}),null),c(a,u(W,{get each(){return h()},children:n=>{const g=()=>S().has(n.id),l=()=>R()||n.disabled||!g()&&Y(x(),N()),v=`kai-tl-desc-${o}-${n.id}`;return(()=>{var I=Fe(),A=I.firstChild,F=A.nextSibling,be=F.firstChild;return A.addEventListener("change",p=>K(n.id,p.currentTarget.checked)),c(be,()=>n.label),c(F,u(k,{get when(){return n.description},get children(){var p=ce();return m(p,"id",v),c(p,()=>n.description),p}}),null),E(p=>{var ae=D("flex items-start gap-3 px-3 py-2.5 text-sm transition-colors",C()?"cursor-default":l()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50",g()&&!l()?"bg-accent font-medium text-accent-foreground":"text-foreground"),oe=n.id,de=l()||C(),se=l()?"true":void 0,le=n.description?v:void 0;return ae!==p.e&&B(I,p.e=ae),oe!==p.t&&m(I,"data-task-id",p.t=oe),de!==p.a&&(A.disabled=p.a=de),se!==p.o&&m(A,"aria-disabled",p.o=se),le!==p.i&&m(A,"aria-describedby",p.i=le),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),E(()=>A.checked=g()),I})()}}),null),c(r,u(k,{get when(){return x().max!==void 0},get children(){var n=Be(),g=n.firstChild,l=g.nextSibling;return l.nextSibling,c(n,()=>x().max,l),n}}),null),E(n=>{var g,l=t.heading??((g=t.data)==null?void 0:g.heading)??"Tasks",v=C()?"true":void 0,I=D("flex flex-col",t.class);return l!==n.e&&m(r,"aria-label",n.e=l),v!==n.t&&m(r,"aria-readonly",n.t=v),I!==n.a&&B(r,n.a=I),n},{e:void 0,t:void 0,a:void 0}),r}})]}})}})}})}})}})}function dt(e){return(()=>{var d=_e(),t=d.firstChild;return c(d,u(k,{get when(){return e.heading},get children(){var s=Pe(),o=s.firstChild,f=o.nextSibling,b=f.firstChild;return c(o,()=>e.heading),c(f,()=>e.done,b),c(f,()=>e.total,null),E($=>{var w=e.headingId,h=e.countId;return w!==$.e&&m(o,"id",$.e=w),h!==$.t&&m(f,"id",$.t=h),$},{e:void 0,t:void 0}),s}}),t),c(d,u(Te,{get value(){return e.done},get max(){return e.total},tone:"success",get"aria-labelledby"(){return G(()=>!!e.heading)()?e.headingId:void 0},get"aria-label"(){return e.heading?void 0:"Task progress"}}),t),c(t,u(W,{get each(){return e.tasks},children:s=>{const o=()=>e.isChecked(s.id),f=()=>e.isBlocked(s),b=`kai-tl-pdesc-${e.uid}-${s.id}`;return(()=>{var $=He(),w=$.firstChild,h=w.firstChild,x=h.nextSibling,S=x.nextSibling,L=S.firstChild;return h.addEventListener("change",i=>e.onToggle(s.id,i.currentTarget.checked)),c(x,u(k,{get when(){return o()},get fallback(){return u(Ve,{size:18})},get children(){return u(je,{size:18,class:"text-foreground"})}})),c(L,()=>s.label),c(S,u(k,{get when(){return s.description},get children(){return u(k,{get when(){return o()},get fallback(){return(()=>{var i=ce();return m(i,"id",b),c(i,()=>s.description),i})()},get children(){var i=Ge(),z=i.firstChild;return m(z,"id",b),c(z,()=>s.description),i}})}}),null),E(i=>{var z=D("group flex items-start gap-3 rounded-lg px-2.5 py-2 text-sm transition-colors",!e.readonly&&"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",e.readonly?"cursor-default":f()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50"),R=s.id,C=!e.readonly&&o()?0:void 0,N=o()?s.label:void 0,j=o()&&s.description?b:void 0,U=f()||e.readonly,P=f()?"true":void 0,V=s.description?b:void 0,O=D("mt-0.5 shrink-0 text-muted-foreground",o()&&"motion-safe:transition-transform motion-safe:group-hover:scale-110"),q=D("font-medium text-foreground",o()&&"line-through opacity-70 motion-safe:transition-opacity motion-safe:group-hover:opacity-100");return z!==i.e&&B(w,i.e=z),R!==i.t&&m(w,"data-task-id",i.t=R),C!==i.a&&m(w,"tabindex",i.a=C),N!==i.o&&m(w,"aria-label",i.o=N),j!==i.i&&m(w,"aria-describedby",i.i=j),U!==i.n&&(h.disabled=i.n=U),P!==i.s&&m(h,"aria-disabled",i.s=P),V!==i.h&&m(h,"aria-describedby",i.h=V),O!==i.r&&B(x,i.r=O),q!==i.d&&B(L,i.d=q),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),E(()=>h.checked=o()),$})()}})),c(d,u(k,{get when(){return e.maxNote!==void 0},get children(){var s=Oe(),o=s.firstChild,f=o.nextSibling;return f.nextSibling,c(s,()=>e.maxNote,f),s}}),null),E(s=>{var o=D("flex flex-col gap-3",e.groupClass),f=e.heading?e.headingId:void 0,b=e.heading?void 0:"Checklist";return o!==s.e&&B(d,s.e=o),f!==s.t&&m(t,"aria-labelledby",s.t=f),b!==s.a&&m(t,"aria-label",s.a=b),s},{e:void 0,t:void 0,a:void 0}),d})()}function st(e){return(()=>{var d=Ke(),t=d.firstChild,s=t.firstChild,o=s.firstChild,f=o.nextSibling;return f.nextSibling,c(t,u(Ne,{size:16,"aria-hidden":"true"}),s),c(s,()=>e.summary.count,f),c(s,()=>e.summary.total,null),c(d,u(k,{get when(){return e.summary.labels.length>0},get fallback(){return Qe()},get children(){var b=Je();return c(b,u(W,{get each(){return e.summary.labels},children:$=>(()=>{var w=We();return c(w,$),w})()})),b}}),null),E(()=>m(d,"role",e.optimistic?"status":void 0)),d})()}$e(["keydown"]);export{ot as T};
|
|
1
|
+
import{m as xe,s as ke,l as T,g as ye,k as M,x as _,o as we,c as u,E as Ce,S as k,j as G,i as c,v as Se,a as E,b as B,d as m,F as W,w as Ie,t as y,e as $e}from"./define-B_tXMYRm.js";import{c as D}from"./cn-CU7UAWzk.js";import{B as ue}from"./button-B9okqG73.js";import{P as Te}from"./progress-bar-D1_rzt6N.js";import{u as Re,a as Ee,C as X,D as ze}from"./use-card-resolution-DJg32jGH.js";import{e as Ae}from"./card-routing-BK09BdmL.js";import{x as Le}from"./x-BOhjBeOd.js";import{c as Ne}from"./check-MdLzbxrm.js";import{c as je}from"./circle-check-GqvO2UBs.js";import{c as Ve}from"./circle-BG7VkPep.js";var Be=y('<p class="pt-1 text-xs text-muted-foreground">Up to <!> selected.'),De=y('<div role=group><div class="divide-y divide-border overflow-hidden rounded-lg border border-input">'),qe=y("<span class=sr-only>"),Me=y('<div class="flex w-full flex-wrap items-center justify-between gap-2"><span aria-live=polite class="text-xs text-muted-foreground"> selected</span><div class="ml-auto flex items-center gap-2">'),Ue=y("<label><input type=checkbox class=kai-checkbox><span>Select all"),ce=y('<span class="text-xs font-normal text-muted-foreground">'),Fe=y('<label><input type=checkbox class="kai-checkbox mt-0.5"><span class="flex flex-col gap-0.5"><span>'),Pe=y('<div class="flex items-center justify-between gap-3"><span class="text-sm font-medium text-foreground"></span><span aria-live=polite class="shrink-0 text-sm font-medium tabular-nums text-muted-foreground"> / '),Oe=y('<p class="text-xs text-muted-foreground">Up to <!> selected.'),_e=y('<div><ul class="flex flex-col gap-1">'),Ge=y('<div class="grid grid-rows-[0fr] group-hover:grid-rows-[1fr] group-focus-within:grid-rows-[1fr] motion-safe:transition-[grid-template-rows] motion-safe:duration-200"><span class="overflow-hidden text-xs font-normal text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 motion-safe:transition-opacity">'),He=y('<li><label><input type=checkbox class=sr-only><span aria-hidden=true></span><span class="flex min-w-0 flex-col gap-0.5"><span>'),Je=y('<ul class="list-disc pl-5 text-sm text-foreground">'),Ke=y('<div class="flex flex-col gap-2"><p class="flex items-center gap-2 text-sm font-medium text-foreground"><span>Selected <!> of '),Qe=y('<p class="text-sm text-muted-foreground">None selected'),We=y("<li>");const Xe="tasks";function Ye(e){if(!Array.isArray(e)||e.length===0)return{tasks:[],error:"This card couldn't be displayed."};const d=new Set,t=[];for(const s of e){if(!s||typeof s!="object")continue;const o=s;if(!(typeof o.id!="string"||o.id.length===0)&&!(typeof o.label!="string"||o.label.length===0)){if(d.has(o.id)){console.warn(`[kai-tasks] duplicate task id "${o.id}" ignored`);continue}d.add(o.id),t.push({id:o.id,label:o.label,description:typeof o.description=="string"?o.description:void 0,checked:o.checked===!0,disabled:o.disabled===!0})}}return t.length===0?{tasks:[],error:"This card couldn't be displayed."}:{tasks:t}}function Ze(e){return e.filter(d=>d.checked).map(d=>d.id)}function ge(e,d){return e.filter(t=>d.has(t.id)).map(t=>t.id)}function H(e){return e.filter(d=>!d.disabled).map(d=>d.id)}function et(e,d){const t=H(e);if(t.length===0)return"unchecked";const s=t.filter(o=>d.has(o)).length;return s===0?"unchecked":s===t.length?"checked":"indeterminate"}function tt(e,d){if(e.selectAll!==!0)return!1;const t=H(d).length;return!(e.max!==void 0&&t>e.max)}function rt(e){return e.mode==="progress"}function nt(e,d){return{done:e.filter(t=>d.has(t.id)).length,total:e.length}}function fe(e,d){const t=e.min??(e.allowEmpty?0:1);return!(d<t||e.max!==void 0&&d>e.max)}function Y(e,d){return e.max!==void 0&&d>=e.max}function it(e,d){if(fe(e,d))return;const t=e.min??(e.allowEmpty?0:1);if(d<t)return`Select at least ${t}.`;if(e.max!==void 0&&d>e.max)return`Select at most ${e.max}.`}const at={tasks:[]};function ot(e){const d=xe({cardId:"kai-tasks"},e),[t]=ke(d,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","readonly","onValueChange","controllerRef"]),s=Re(),o=Ie(),f=r=>{const a=t.host??s;a?a.emit(r):t.hostElement&&Ae(t.hostElement,r)},b=T(()=>{var r;return Ye((r=t.data)==null?void 0:r.tasks)}),$=T(()=>b().error===void 0),w=T(()=>b().error??""),h=T(()=>b().tasks),x=T(()=>t.data??at),[S,L]=ye(new Set),i=Ee({prop:()=>t.resolution,data:()=>t.data}),z=r=>{const a=new Set(h().map(n=>n.id));return r.filter(n=>a.has(n))};M(_(()=>t.data,()=>{const r=t.value??t.defaultValue??Ze(h());L(new Set(z(r)))})),M(_(()=>t.value,r=>{r&&L(new Set(z(r)))},{defer:!0})),M(_(S,r=>{var a;(a=t.onValueChange)==null||a.call(t,{value:ge(h(),r)})},{defer:!0})),M(_($,r=>{f(r?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:w()})}));const R=()=>t.disabled===!0,C=()=>t.readonly===!0,N=T(()=>S().size),j=T(()=>rt(x())),U=T(()=>nt(h(),S())),P=()=>x().confirmLabel??"Confirm",V=T(()=>et(h(),S())),O=T(()=>tt(x(),h())),q=T(()=>it(x(),N())),J=T(()=>fe(x(),N())&&!i.isResolved()&&!R()&&!C()),Z=(r,a,n)=>{if(n){if(Y(x(),r.size)&&!r.has(a))return r;r.add(a)}else r.delete(a);return r},K=(r,a)=>{i.isResolved()||R()||C()||L(Z(new Set(S()),r,a))},ee=r=>{if(i.isResolved()||R()||C())return;const a=new Set(S());for(const n of H(h()))r?a.add(n):a.delete(n);L(a)},Q=()=>{if(!J())return;const r={selected:ge(h(),S())};f({kind:"submit",cardId:t.cardId,data:r}),i.setLocal({kind:"submit",data:r})},te=()=>{i.isResolved()||(f({kind:"dismiss",cardId:t.cardId}),i.setLocal({kind:"dismissed"}))},re=()=>f({kind:"reopen",cardId:t.cardId});we(()=>{var r;(r=t.controllerRef)==null||r.call(t,{select:a=>{if(i.isResolved()||R()||C())return;if(a===void 0){ee(!0);return}const n=new Set,g=new Set(H(h()));for(const l of z(a))g.has(l)&&Z(n,l,!0);L(n)},toggle:(a,n)=>{const g=n??!S().has(a);K(a,g)},send:()=>Q(),focus:a=>{var n,g;const l=(((n=t.hostElement)==null?void 0:n.shadowRoot)??document).querySelector('[role="group"]');(g=l?.querySelector('input[type="checkbox"]')??l)==null||g.focus(a)},dismiss:()=>te(),reopen:()=>re()})}),M(()=>{var r;const a=t.hostElement;a&&(((r=i.resolution())==null?void 0:r.kind)==="submit"?a.setAttribute("data-kai-resolved","submitted"):a.removeAttribute("data-kai-resolved"))});const he=T(()=>{var r;const a=i.resolution();if(!a||a.kind!=="submit")return;const n=(r=a.data)==null?void 0:r.selected,g=Array.isArray(n)?n:[],l=h(),v=l.filter(I=>g.includes(I.id)).map(I=>I.label);return{count:v.length,total:l.length,labels:v}}),ne=`kai-tl-reason-${o}`,me=`kai-tl-count-${o}`,ve=`kai-tl-progress-${o}`,pe=`kai-tl-heading-${o}`,ie=()=>{var r;return t.heading??((r=t.data)==null?void 0:r.heading)};return u(k,{get when(){return $()},get fallback(){return u(X,{get heading(){return t.heading},get errorMessage(){return w()}})},get children(){return u(Ce,{fallback:()=>(f({kind:"error",cardId:t.cardId,message:"The card failed to render."}),u(X,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return u(k,{get when(){return!i.isDeferred()},get fallback(){return u(ze,{type:Xe,get title(){var r;return t.heading??((r=t.data)==null?void 0:r.heading)},onReopen:re})},get children(){return u(X,{get heading(){return G(()=>!!j())()?void 0:ie()},get actions(){return G(()=>!!(j()||i.isResolved()||C()))()?void 0:(()=>{var r=Me(),a=r.firstChild,n=a.firstChild,g=a.nextSibling;return c(r,u(k,{get when(){var l;return((l=t.data)==null?void 0:l.dismissible)===!0},get children(){return u(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:te,get children(){return u(Le,{size:16,"aria-hidden":"true"})}})}}),a),m(a,"id",me),c(a,N,n),c(g,u(k,{get when(){return q()},get children(){var l=qe();return m(l,"id",ne),c(l,q),l}}),null),c(g,u(ue,{type:"button",get disabled(){return!J()},get"aria-describedby"(){return q()?ne:void 0},onClick:Q,get children(){return P()}}),null),r})()},get children(){return u(k,{get when(){return!i.isResolved()},get fallback(){return u(st,{get summary(){return he()},get optimistic(){return i.isOptimistic()}})},get children(){return[u(k,{get when(){return j()},get children(){return u(dt,{get heading(){return ie()},headingId:pe,countId:ve,get done(){return U().done},get total(){return U().total},get tasks(){return h()},uid:o,isChecked:r=>S().has(r),isBlocked:r=>R()||r.disabled===!0||!S().has(r.id)&&Y(x(),N()),onToggle:(r,a)=>K(r,a),get groupClass(){return t.class},get maxNote(){return G(()=>x().max!==void 0)()?x().max:void 0},get readonly(){return C()}})}}),u(k,{get when(){return!j()},get children(){var r=De(),a=r.firstChild;return r.$$keydown=n=>{n.key!=="Enter"||n.target.tagName==="INPUT"||J()&&Q()},c(a,u(k,{get when(){return O()},get children(){return(()=>{const n=()=>V()==="indeterminate";return(()=>{var g=Ue(),l=g.firstChild;return l.addEventListener("change",v=>ee(v.currentTarget.checked)),Se(v=>{M(()=>{v.indeterminate=n()})},l),E(v=>{var I=D("flex items-center gap-3 px-3 py-2.5 text-sm font-medium transition-colors",C()?"cursor-default":"cursor-pointer",V()==="checked"?"bg-accent text-accent-foreground":C()?"text-foreground":"text-foreground hover:bg-muted/50"),A=R()||C(),F=n()?"mixed":V()==="checked";return I!==v.e&&B(g,v.e=I),A!==v.t&&(l.disabled=v.t=A),F!==v.a&&m(l,"aria-checked",v.a=F),v},{e:void 0,t:void 0,a:void 0}),E(()=>l.checked=V()==="checked"),g})()})()}}),null),c(a,u(W,{get each(){return h()},children:n=>{const g=()=>S().has(n.id),l=()=>R()||n.disabled||!g()&&Y(x(),N()),v=`kai-tl-desc-${o}-${n.id}`;return(()=>{var I=Fe(),A=I.firstChild,F=A.nextSibling,be=F.firstChild;return A.addEventListener("change",p=>K(n.id,p.currentTarget.checked)),c(be,()=>n.label),c(F,u(k,{get when(){return n.description},get children(){var p=ce();return m(p,"id",v),c(p,()=>n.description),p}}),null),E(p=>{var ae=D("flex items-start gap-3 px-3 py-2.5 text-sm transition-colors",C()?"cursor-default":l()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50",g()&&!l()?"bg-accent font-medium text-accent-foreground":"text-foreground"),oe=n.id,de=l()||C(),se=l()?"true":void 0,le=n.description?v:void 0;return ae!==p.e&&B(I,p.e=ae),oe!==p.t&&m(I,"data-task-id",p.t=oe),de!==p.a&&(A.disabled=p.a=de),se!==p.o&&m(A,"aria-disabled",p.o=se),le!==p.i&&m(A,"aria-describedby",p.i=le),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),E(()=>A.checked=g()),I})()}}),null),c(r,u(k,{get when(){return x().max!==void 0},get children(){var n=Be(),g=n.firstChild,l=g.nextSibling;return l.nextSibling,c(n,()=>x().max,l),n}}),null),E(n=>{var g,l=t.heading??((g=t.data)==null?void 0:g.heading)??"Tasks",v=C()?"true":void 0,I=D("flex flex-col",t.class);return l!==n.e&&m(r,"aria-label",n.e=l),v!==n.t&&m(r,"aria-readonly",n.t=v),I!==n.a&&B(r,n.a=I),n},{e:void 0,t:void 0,a:void 0}),r}})]}})}})}})}})}})}function dt(e){return(()=>{var d=_e(),t=d.firstChild;return c(d,u(k,{get when(){return e.heading},get children(){var s=Pe(),o=s.firstChild,f=o.nextSibling,b=f.firstChild;return c(o,()=>e.heading),c(f,()=>e.done,b),c(f,()=>e.total,null),E($=>{var w=e.headingId,h=e.countId;return w!==$.e&&m(o,"id",$.e=w),h!==$.t&&m(f,"id",$.t=h),$},{e:void 0,t:void 0}),s}}),t),c(d,u(Te,{get value(){return e.done},get max(){return e.total},tone:"success",get"aria-labelledby"(){return G(()=>!!e.heading)()?e.headingId:void 0},get"aria-label"(){return e.heading?void 0:"Task progress"}}),t),c(t,u(W,{get each(){return e.tasks},children:s=>{const o=()=>e.isChecked(s.id),f=()=>e.isBlocked(s),b=`kai-tl-pdesc-${e.uid}-${s.id}`;return(()=>{var $=He(),w=$.firstChild,h=w.firstChild,x=h.nextSibling,S=x.nextSibling,L=S.firstChild;return h.addEventListener("change",i=>e.onToggle(s.id,i.currentTarget.checked)),c(x,u(k,{get when(){return o()},get fallback(){return u(Ve,{size:18})},get children(){return u(je,{size:18,class:"text-foreground"})}})),c(L,()=>s.label),c(S,u(k,{get when(){return s.description},get children(){return u(k,{get when(){return o()},get fallback(){return(()=>{var i=ce();return m(i,"id",b),c(i,()=>s.description),i})()},get children(){var i=Ge(),z=i.firstChild;return m(z,"id",b),c(z,()=>s.description),i}})}}),null),E(i=>{var z=D("group flex items-start gap-3 rounded-lg px-2.5 py-2 text-sm transition-colors",!e.readonly&&"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",e.readonly?"cursor-default":f()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50"),R=s.id,C=!e.readonly&&o()?0:void 0,N=o()?s.label:void 0,j=o()&&s.description?b:void 0,U=f()||e.readonly,P=f()?"true":void 0,V=s.description?b:void 0,O=D("mt-0.5 shrink-0 text-muted-foreground",o()&&"motion-safe:transition-transform motion-safe:group-hover:scale-110"),q=D("font-medium text-foreground",o()&&"line-through opacity-70 motion-safe:transition-opacity motion-safe:group-hover:opacity-100");return z!==i.e&&B(w,i.e=z),R!==i.t&&m(w,"data-task-id",i.t=R),C!==i.a&&m(w,"tabindex",i.a=C),N!==i.o&&m(w,"aria-label",i.o=N),j!==i.i&&m(w,"aria-describedby",i.i=j),U!==i.n&&(h.disabled=i.n=U),P!==i.s&&m(h,"aria-disabled",i.s=P),V!==i.h&&m(h,"aria-describedby",i.h=V),O!==i.r&&B(x,i.r=O),q!==i.d&&B(L,i.d=q),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),E(()=>h.checked=o()),$})()}})),c(d,u(k,{get when(){return e.maxNote!==void 0},get children(){var s=Oe(),o=s.firstChild,f=o.nextSibling;return f.nextSibling,c(s,()=>e.maxNote,f),s}}),null),E(s=>{var o=D("flex flex-col gap-3",e.groupClass),f=e.heading?e.headingId:void 0,b=e.heading?void 0:"Checklist";return o!==s.e&&B(d,s.e=o),f!==s.t&&m(t,"aria-labelledby",s.t=f),b!==s.a&&m(t,"aria-label",s.a=b),s},{e:void 0,t:void 0,a:void 0}),d})()}function st(e){return(()=>{var d=Ke(),t=d.firstChild,s=t.firstChild,o=s.firstChild,f=o.nextSibling;return f.nextSibling,c(t,u(Ne,{size:16,"aria-hidden":"true"}),s),c(s,()=>e.summary.count,f),c(s,()=>e.summary.total,null),c(d,u(k,{get when(){return e.summary.labels.length>0},get fallback(){return Qe()},get children(){var b=Je();return c(b,u(W,{get each(){return e.summary.labels},children:$=>(()=>{var w=We();return c(w,$),w})()})),b}}),null),E(()=>m(d,"role",e.optimistic?"status":void 0)),d})()}$e(["keydown"]);export{ot as T};
|
package/dist/elements/compare.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as X,s as Y,w as Z,l as f,g as P,k as H,x as j,c as s,E as ee,i as u,S as v,d as R,I as U,a as k,b as C,v as te,t as m,j as re,e as ae,f as ne,y as oe,C as ie}from"./chunks/define-B_tXMYRm.js";import{c as T}from"./chunks/cn-CU7UAWzk.js";import{B as le}from"./chunks/button-B9okqG73.js";import{C as O}from"./chunks/use-card-resolution-DJg32jGH.js";import{M as q}from"./chunks/message-
|
|
1
|
+
import{m as X,s as Y,w as Z,l as f,g as P,k as H,x as j,c as s,E as ee,i as u,S as v,d as R,I as U,a as k,b as C,v as te,t as m,j as re,e as ae,f as ne,y as oe,C as ie}from"./chunks/define-B_tXMYRm.js";import{c as T}from"./chunks/cn-CU7UAWzk.js";import{B as le}from"./chunks/button-B9okqG73.js";import{C as O}from"./chunks/use-card-resolution-DJg32jGH.js";import{M as q}from"./chunks/message-CE4k-qaj.js";import{T as de}from"./chunks/text-shimmer-BY_rI3s5.js";import{c as se}from"./chunks/check-MdLzbxrm.js";function ce(e){if(!Array.isArray(e))return{candidates:null,error:"This comparison couldn't be displayed."};if(e.length!==2)return{candidates:null,error:`A comparison needs exactly two candidates (got ${e.length}).`};const i=[],l=new Set;for(const r of e){if(!r||typeof r!="object")return{candidates:null,error:"This comparison couldn't be displayed."};const a=r;if(typeof a.id!="string"||a.id.length===0)return{candidates:null,error:"Each candidate needs a non-empty id."};if(l.has(a.id))return{candidates:null,error:`Duplicate candidate id "${a.id}".`};l.add(a.id),i.push({id:a.id,content:typeof a.content=="string"?a.content:"",reasoning:a.reasoning,tools:Array.isArray(a.tools)?a.tools:void 0,attachments:Array.isArray(a.attachments)?a.attachments:void 0,label:typeof a.label=="string"?a.label:void 0,model:typeof a.model=="string"?a.model:void 0,streaming:a.streaming===!0})}return{candidates:[i[0],i[1]]}}function ue(e,i){const l=e.filter(r=>r.id!==i).map(r=>r.id);return{chosenId:i,rejectedIds:l,at:Date.now()}}function pe(e){return e?e.some(i=>i.streaming===!0):!1}function B(e){const i=[];e.reasoning&&i.push({type:"reasoning",text:e.reasoning.text,label:e.reasoning.label});for(const l of e.tools??[])i.push({type:"tool",tool:l});for(const l of e.attachments??[])i.push({type:"file",attachment:l});return e.content&&i.push({type:"text",text:e.content}),i}var ge=m('<p class="text-sm text-foreground">'),me=m('<div role=tablist aria-label="Switch response">'),fe=m("<div role=radiogroup>"),ve=m("<div>"),he=m("<button type=button role=tab>"),ye=m('<span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">'),be=m('<span class="text-xs text-muted-foreground">'),xe=m('<div class="flex items-center gap-2">'),ke=m('<div><div class="min-w-0 flex-1">'),we=m('<div class="flex flex-col gap-2 rounded-lg border border-input bg-accent/40 p-3"><div class="flex items-center gap-2 text-sm font-medium text-accent-foreground"><span>Selected'),Se=m('<p class="text-sm text-muted-foreground">Response selected.'),Ae=m("<div class=min-w-0>");function Re(e){const[i,l]=P(void 0);H(j(e.data,()=>l(void 0),{defer:!0}));const r=f(()=>e.prop()??i()),a=f(()=>r()!==void 0),c=f(()=>e.prop()===void 0&&i()!==void 0);return{value:r,isResolved:a,isOptimistic:c,setLocal:l}}function Ce(e){var i;const l=X({compareId:"kai-compare",layout:"auto"},e),[r]=Y(l,["data","compareId","selection","layout","class","controllerRef","onSelect","onReady","onError"]),a=Z(),c=f(()=>{var t;return ce((t=r.data)==null?void 0:t.candidates)}),h=f(()=>c().candidates!==null),g=f(()=>c().error??""),b=f(()=>c().candidates),x=Re({prop:()=>r.selection,data:()=>r.data}),E=f(()=>pe(b())),[I,w]=P(0),[D,z]=P(0);let $;H(j(()=>r.data,()=>{w(0),z(0)})),H(j([h,E],([t,n])=>{var d,o;if(!t){(d=r.onError)==null||d.call(r,g());return}n||(o=r.onReady)==null||o.call(r)}));const G=f(()=>{var t;return(t=x.value())==null?void 0:t.chosenId}),_=f(()=>{var t;const n=G();return n===void 0||(t=b())==null?void 0:t.find(d=>d.id===n)}),M=t=>{var n;if(x.isResolved()||E())return;const d=b();if(!d)return;const o=ue(d,t.id);(n=r.onSelect)==null||n.call(r,o),x.setLocal(o)},F=(t,n)=>{var d;const o=$?.querySelectorAll('[role="radio"]');(d=o?.[t])==null||d.focus(n)};(i=r.controllerRef)==null||i.call(r,{select:t=>{var n;const d=(n=b())==null?void 0:n.find(o=>o.id===t);d&&M(d)},focus:t=>F(I(),t)});const J=t=>{if(x.isResolved())return;const n=b();if(!n)return;const d=o=>{w(o),z(o),F(o)};if(t.key==="ArrowRight"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowUp")t.preventDefault(),d(I()===0?1:0);else if(t.key==="Home")t.preventDefault(),d(0);else if(t.key==="End")t.preventDefault(),d(1);else if(t.key===" "||t.key==="Enter"){t.preventDefault();const o=n[I()];o&&M(o)}},K=f(()=>{const t=r.layout;return t==="columns"?"grid grid-cols-2 gap-3":t==="tabs"?"grid grid-cols-1 gap-3":"grid grid-cols-1 gap-3 @[640px]/compare:grid-cols-2"}),N=()=>r.layout==="tabs"||r.layout==="auto",Q=()=>r.layout==="auto"?"@[640px]/compare:hidden":"",V=t=>{const n=r.layout;return n==="columns"||t===D()?"":n==="tabs"?"hidden":"hidden @[640px]/compare:block"},L=`kai-compare-prompt-${a}`,W=()=>{var t;return((t=r.data)==null?void 0:t.prompt)??"Compare two responses"};return s(v,{get when(){return h()},get fallback(){return s(O,{get errorMessage(){return g()||"This comparison couldn't be displayed."}})},get children(){return s(ee,{fallback:()=>{var t;return(t=r.onError)==null||t.call(r,"The comparison failed to render."),s(O,{errorMessage:"The comparison failed to render."})},get children(){var t=ve();return u(t,s(v,{get when(){var n;return(n=r.data)==null?void 0:n.prompt},get children(){var n=ge();return R(n,"id",L),u(n,()=>{var d;return(d=r.data)==null?void 0:d.prompt}),n}}),null),u(t,s(v,{get when(){return!x.isResolved()},get fallback(){return s($e,{get candidate(){return _()},get optimistic(){return x.isOptimistic()}})},get children(){return[s(v,{get when(){return N()},get children(){var n=me();return u(n,s(U,{get each(){return b()??[]},children:(d,o)=>(()=>{var p=he();return p.$$click=()=>{z(o),w(o)},u(p,()=>d().label??`Response ${d().id}`),k(y=>{var S=D()===o,A=T("rounded-md px-3 py-1 text-xs font-medium transition-colors",D()===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground");return S!==y.e&&R(p,"aria-selected",y.e=S),A!==y.t&&C(p,y.t=A),y},{e:void 0,t:void 0}),p})()})),k(()=>C(n,T("flex gap-1",Q()))),n}}),(()=>{var n=fe();n.$$keydown=J;var d=$;return typeof d=="function"?te(d,n):$=n,u(n,s(U,{get each(){return b()??[]},children:(o,p)=>s(Ie,{get candidate(){return o()},get tabStop(){return p===I()},get disabled(){return E()},hiddenClass:()=>V(p),onFocus:()=>w(p),onPick:()=>{w(p),M(o())}})})),k(o=>{var p,y=W(),S=(p=r.data)!=null&&p.prompt?L:void 0,A=K();return y!==o.e&&R(n,"aria-label",o.e=y),S!==o.t&&R(n,"aria-describedby",o.t=S),A!==o.a&&C(n,o.a=A),o},{e:void 0,t:void 0,a:void 0}),n})()]}}),null),k(()=>C(t,T("flex flex-col gap-3",r.layout==="auto"&&"@container/compare",r.class))),t}})}})}function Ie(e){const i=()=>e.candidate.label??e.candidate.model??e.candidate.id;return(()=>{var l=ke(),r=l.firstChild;return u(l,s(v,{get when(){return e.candidate.label||e.candidate.model},get children(){var a=xe();return u(a,s(v,{get when(){return e.candidate.label},get children(){var c=ye();return u(c,()=>e.candidate.label),c}}),null),u(a,s(v,{get when(){return e.candidate.model},get children(){var c=be();return u(c,()=>e.candidate.model),c}}),null),a}}),r),u(r,s(v,{get when(){return e.candidate.streaming},get fallback(){return s(q,{get parts(){return B(e.candidate)},isUser:!1,markdown:!0})},get children(){return s(de,{class:"text-sm",children:"Generating response\u2026"})}})),u(l,s(le,{type:"button",role:"radio","aria-checked":!1,get"aria-label"(){return`Pick ${i()}`},get"data-candidate-id"(){return e.candidate.id},variant:"outline",size:"sm",class:"mt-auto w-full",get disabled(){return e.disabled},get tabindex(){return e.tabStop?0:-1},get onFocus(){return e.onFocus},onClick:a=>{a.stopPropagation(),e.onPick()},children:"Pick this"}),null),k(()=>{var a;return C(l,T("flex min-w-0 flex-col gap-3 rounded-lg border border-input bg-background/40 p-3",(a=e.hiddenClass)==null?void 0:a.call(e)))}),l})()}function $e(e){return(()=>{var i=we(),l=i.firstChild,r=l.firstChild;return r.firstChild,u(l,s(se,{size:16,"aria-hidden":"true"}),r),u(r,(()=>{var a=re(()=>{var c;return!!((c=e.candidate)!=null&&c.label)});return()=>a()?`: ${e.candidate.label}`:""})(),null),u(i,s(v,{get when(){return e.candidate},get fallback(){return Se()},children:a=>(()=>{var c=Ae();return u(c,s(q,{get parts(){return B(a())},isUser:!1,markdown:!0})),c})()}),null),k(()=>R(i,"role",e.optimistic?"status":void 0)),i})()}ae(["keydown","click"]),ne("kai-compare",{data:void 0,compareId:void 0,selection:void 0,layout:"auto",proseSize:void 0,codeTheme:void 0,codeHighlight:void 0},(e,{element:i,dispatch:l,expose:r})=>{const a=()=>e.compareId??(i.id||"kai-compare"),c=oe();let h;return r({select:g=>h?.select(g),focus:g=>h?.focus(g)}),s(ie,{get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return e.codeHighlight},get portalMount(){return c.portalMount()},get children(){return s(Ce,{get data(){return e.data},get compareId(){return a()},get selection(){return e.selection},get layout(){return e.layout??"auto"},controllerRef:g=>h=g,onSelect:g=>l("kai-compare-select",g),onReady:()=>l("kai-ready",{compareId:a()}),onError:g=>l("kai-error",{compareId:a(),message:g})})}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as d,c as u}from"./chunks/define-B_tXMYRm.js";import{C as s}from"./chunks/confirm-card-
|
|
1
|
+
import{f as d,c as u}from"./chunks/define-B_tXMYRm.js";import{C as s}from"./chunks/confirm-card-BWjf2-xo.js";d("kai-confirm",{data:void 0,cardId:void 0,heading:void 0,autofocus:!1,resolution:void 0},(r,{element:i,flag:t,expose:n})=>{let o;return n({focus:e=>o?.focus(e),confirm:e=>o?.confirm(e),dismiss:()=>o?.dismiss(),reopen:()=>o?.reopen()}),u(s,{get data(){return r.data},get cardId(){return r.cardId??(i.id||"kai-confirm")},get heading(){return r.heading},get autofocus(){return t("autofocus")},get resolution(){return r.resolution},controllerRef:e=>o=e,hostElement:i})});
|
package/dist/elements/embed.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as t,c as e}from"./chunks/define-B_tXMYRm.js";import{E as o}from"./chunks/embed-CjAD2jSi.js";import{e as m}from"./chunks/card-routing-
|
|
1
|
+
import{f as t,c as e}from"./chunks/define-B_tXMYRm.js";import{E as o}from"./chunks/embed-CjAD2jSi.js";import{e as m}from"./chunks/card-routing-BK09BdmL.js";t("kai-embed",{cardId:void 0,data:void 0},(r,{element:a})=>e(o,{get cardId(){return r.cardId??""},get data(){return r.data??{provider:"generic"}},onEmit:d=>m(a,d)}));
|
package/dist/elements/form.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as o,c as s}from"./chunks/define-B_tXMYRm.js";import{F as n}from"./chunks/form-
|
|
1
|
+
import{f as o,c as s}from"./chunks/define-B_tXMYRm.js";import{F as n}from"./chunks/form-Cp8Y00Wn.js";o("kai-form",{data:void 0,cardId:void 0,heading:void 0,resolution:void 0,values:void 0,defaultValues:void 0,disabled:!1},(d,{element:a,dispatch:t,flag:i,expose:r})=>{let e;return r({focus:l=>e?.focus(l),send:()=>e?.send(),validate:()=>e?.validate()??{valid:!1},reset:()=>e?.reset(),dismiss:()=>e?.dismiss(),reopen:()=>e?.reopen()}),s(n,{get data(){return d.data},get cardId(){return d.cardId??(a.id||"kai-form")},get heading(){return d.heading},get resolution(){return d.resolution},get values(){return d.values},get defaultValues(){return d.defaultValues},get disabled(){return i("disabled")},onValuesChange:l=>t("kai-values-change",l),controllerRef:l=>e=l,hostElement:a})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as d,c as i}from"./chunks/define-B_tXMYRm.js";import{L as o}from"./chunks/link-preview-
|
|
1
|
+
import{f as d,c as i}from"./chunks/define-B_tXMYRm.js";import{L as o}from"./chunks/link-preview-Cf5KOP-i.js";import{e}from"./chunks/card-routing-BK09BdmL.js";d("kai-link-preview",{cardId:void 0,data:void 0},(r,{element:a})=>i(o,{get cardId(){return r.cardId??""},get data(){return r.data??{url:""}},onEmit:t=>e(a,t)}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as n,y as i,c as t,C as g}from"./chunks/define-B_tXMYRm.js";import{M as a}from"./chunks/markdown-
|
|
1
|
+
import{f as n,y as i,c as t,C as g}from"./chunks/define-B_tXMYRm.js";import{M as a}from"./chunks/markdown-DbozyYqa.js";n("kai-markdown",{content:"",proseSize:"sm",codeTheme:"github-dark-dimmed",codeHighlight:!0},(e,{flag:r})=>{const o=i();return t(g,{get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return r("codeHighlight")},get portalMount(){return o.portalMount()},get children(){return t(a,{get content(){return e.content}})}})});
|
package/dist/elements/message.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunks/define-B_tXMYRm.js";import"./chunks/slots-CIw9RlAe.js";import"./chunks/message-
|
|
1
|
+
import"./chunks/define-B_tXMYRm.js";import"./chunks/slots-CIw9RlAe.js";import"./chunks/message-CE4k-qaj.js";import{c as o}from"./chunks/message-DtXKPqiR.js";import"./chunks/card-renderer-CSoTL_e1.js";import"./chunks/card-tags-D8lZ-C_U.js";export{o as cardComponentsFromTags};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as d,y as i,c as r,C as s}from"./chunks/define-B_tXMYRm.js";import{R as g,a as u,b as m}from"./chunks/reasoning-
|
|
1
|
+
import{f as d,y as i,c as r,C as s}from"./chunks/define-B_tXMYRm.js";import{R as g,a as u,b as m}from"./chunks/reasoning-BrxQfpfI.js";import{w as f}from"./chunks/disclosure-DAoYOKew.js";d("kai-reasoning",{text:"",label:"Reasoning",open:void 0,defaultOpen:void 0,streaming:!1,markdown:!0,disabled:void 0},(t,n)=>{const{flag:e}=n,o=i();let a;return f(n,()=>a,()=>t.open),r(s,{get portalMount(){return o.portalMount()},get children(){return r(g,{get defaultOpen(){return e("defaultOpen")},get isStreaming(){return e("streaming")},get disabled(){return e("disabled")},controllerRef:l=>a=l,get children(){return[r(u,{get children(){return t.label}}),r(m,{get markdown(){return e("markdown")},get children(){return t.text}})]}})}})});
|