@ddrinnova/agentsgt-widget 0.1.13 → 0.1.15
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/widget.css +1 -1
- package/dist/widget.es.js +2 -2
- package/dist/widget.umd.js +1 -1
- package/package.json +1 -1
package/dist/widget.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--agt-primary: #FBB76B;--agt-bg: #ffffff;--agt-text: #1f2937;--agt-text-secondary: #6b7280;--agt-border: #e5e7eb;--agt-muted: #f3f4f6;--agt-user-bg: rgba(251, 183, 107, .1);--agt-assistant-bg: #f3f4f6;--agt-error-bg: #fef2f2;--agt-error-text: #b91c1c;--agt-radius: 1rem;--agt-shadow: 0 10px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1)}.agt-widget,.agt-popup,.agt-sidebar,.agt-trigger{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}.agt-widget *,.agt-popup *,.agt-sidebar *,.agt-trigger *{box-sizing:border-box;margin:0;padding:0}.agt-widget button,.agt-popup button,.agt-sidebar button,.agt-trigger{
|
|
1
|
+
:root{--agt-primary: #FBB76B;--agt-bg: #ffffff;--agt-text: #1f2937;--agt-text-secondary: #6b7280;--agt-border: #e5e7eb;--agt-muted: #f3f4f6;--agt-user-bg: rgba(251, 183, 107, .1);--agt-assistant-bg: #f3f4f6;--agt-error-bg: #fef2f2;--agt-error-text: #b91c1c;--agt-radius: 1rem;--agt-shadow: 0 10px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1)}.agt-widget,.agt-popup,.agt-sidebar,.agt-trigger{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}.agt-widget *,.agt-popup *,.agt-sidebar *,.agt-trigger *{box-sizing:border-box;margin:0;padding:0}.agt-widget button,.agt-popup button,.agt-sidebar button,.agt-trigger{-moz-appearance:none;appearance:none;-webkit-appearance:none;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;background:transparent;padding:0;margin:0;font:inherit;color:inherit;text-decoration:none;text-transform:none;letter-spacing:inherit;line-height:inherit;outline:none;box-shadow:none}.agt-widget textarea,.agt-popup textarea,.agt-sidebar textarea{-moz-appearance:none;appearance:none;-webkit-appearance:none;box-sizing:border-box;border:none;background:transparent;padding:0;margin:0;font:inherit;color:inherit;outline:none;box-shadow:none;resize:none}.agt-widget svg,.agt-popup svg,.agt-sidebar svg,.agt-trigger svg{display:block;flex-shrink:0}.agt-widget{display:flex;flex-direction:column;height:100%;width:100%;overflow:hidden;background:var(--agt-bg);color:var(--agt-text);font-size:14px;line-height:1.5}.agt-popup{position:fixed;bottom:24px;right:24px;z-index:9999;width:400px;height:520px;border-radius:var(--agt-radius);box-shadow:var(--agt-shadow);background:var(--agt-bg);border:1px solid var(--agt-border);display:flex;flex-direction:column;overflow:hidden;animation:agt-slide-up .3s ease-out}@media (max-width: 480px){.agt-popup{bottom:0;right:0;width:100%;height:100%;border-radius:0}}.agt-sidebar{position:fixed;top:0;right:0;z-index:9999;width:380px;height:100%;background:var(--agt-bg);border-left:1px solid var(--agt-border);box-shadow:-4px 0 16px #00000014;display:flex;flex-direction:column;animation:agt-slide-in-right .3s ease-out}@media (max-width: 480px){.agt-sidebar{width:100%}}.agt-trigger{position:fixed;bottom:24px;right:24px;z-index:9998;width:56px;height:56px;border-radius:50%;background:var(--agt-primary);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000026;transition:transform .2s ease,box-shadow .2s ease;animation:agt-scale-in .3s ease-out}.agt-trigger:hover{transform:scale(1.08);box-shadow:0 6px 16px #0003}.agt-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--agt-border);background:var(--agt-bg);flex-shrink:0}.agt-header__title{font-weight:600;font-size:14px;color:var(--agt-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agt-header__actions{display:flex;align-items:center;gap:4px}.agt-header__btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;background:transparent;border-radius:6px;cursor:pointer;color:var(--agt-text-secondary);transition:background-color .15s,color .15s}.agt-header__btn:hover{background:var(--agt-muted);color:var(--agt-text)}.agt-footer{padding:6px 16px;text-align:center;font-size:10px;color:var(--agt-text-secondary);border-top:1px solid var(--agt-border);flex-shrink:0}.agt-messages{flex:1;overflow-y:auto;padding:16px}.agt-messages__inner{display:flex;flex-direction:column;gap:12px}.agt-message{display:flex;width:100%}.agt-message--user{justify-content:flex-end}.agt-message--assistant{justify-content:flex-start}.agt-message__content{max-width:78%;border-radius:var(--agt-radius);padding:8px 12px;font-size:14px;line-height:1.5;word-break:break-word}.agt-message--user .agt-message__content{background:var(--agt-user-bg);color:var(--agt-text);border-bottom-right-radius:4px}.agt-message--assistant .agt-message__content{background:var(--agt-assistant-bg);color:var(--agt-text);border-bottom-left-radius:4px}.agt-message__content--error{background:var(--agt-error-bg)!important;color:var(--agt-error-text)!important;display:flex;align-items:flex-start;gap:8px;border:1px solid rgba(185,28,28,.15)}.agt-message__typing{display:flex;align-items:center;gap:4px;padding:4px 0}.agt-message__typing span{width:6px;height:6px;border-radius:50%;background:var(--agt-text-secondary);animation:agt-bounce 1.4s infinite ease-in-out both}.agt-message__typing span:nth-child(1){animation-delay:-.32s}.agt-message__typing span:nth-child(2){animation-delay:-.16s}.agt-input{padding:8px 16px 12px;flex-shrink:0}.agt-input__container{display:flex;align-items:flex-end;gap:8px;border:1px solid var(--agt-border);border-radius:var(--agt-radius);padding:8px 12px;background:var(--agt-bg);transition:border-color .15s}.agt-input__container:focus-within{border-color:var(--agt-primary)}.agt-input__textarea{flex:1;border:none;outline:none;background:transparent;font-size:14px;font-family:inherit;color:var(--agt-text);line-height:1.5;min-height:24px;padding:0}.agt-input__textarea::-moz-placeholder{color:var(--agt-text-secondary);opacity:.6}.agt-input__textarea::placeholder{color:var(--agt-text-secondary);opacity:.6}.agt-input__send{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:50%;background:var(--agt-text);color:var(--agt-bg);cursor:pointer;flex-shrink:0;transition:opacity .15s}.agt-input__send:disabled{opacity:.3;cursor:default}.agt-input__send:not(:disabled):hover{opacity:.8}.agt-tool{display:flex;align-items:center;gap:8px;padding:8px 12px;background:var(--agt-muted);border-radius:8px;margin:8px 0;font-size:13px;color:var(--agt-text-secondary)}.agt-tool--error{background:var(--agt-error-bg);color:var(--agt-error-text)}.agt-tool--sources{padding:6px 10px;font-size:13px;margin:6px 0;background:#00000008;border:1px solid rgba(0,0,0,.06);border-radius:8px}.agt-tool__label{color:var(--agt-text-secondary);font-weight:500;margin-right:4px}.agt-tool--sources a{color:var(--agt-primary);text-decoration:none}.agt-tool--sources a:hover{text-decoration:underline}.agt-tool__separator{color:var(--agt-text-secondary);margin:0 6px}.agt-tool__image{margin:8px 0}.agt-tool__image img{border-radius:8px;max-width:100%;max-height:300px;-o-object-fit:contain;object-fit:contain}.agt-spinner{display:inline-flex;align-items:center;gap:4px}.agt-spinner__dot{width:6px;height:6px;border-radius:50%;background:var(--agt-text-secondary);animation:agt-bounce 1.4s infinite ease-in-out both}.agt-spinner__dot:nth-child(1){animation-delay:-.32s}.agt-spinner__dot:nth-child(2){animation-delay:-.16s}.agt-markdown p{margin:.25em 0;line-height:1.6}.agt-markdown p:first-child{margin-top:0}.agt-markdown p:last-child{margin-bottom:0}.agt-markdown strong{font-weight:600}.agt-markdown em{font-style:italic}.agt-markdown code{background:#0000000f;padding:.1em .35em;border-radius:4px;font-size:.85em;font-family:SF Mono,Monaco,Cascadia Code,monospace}.agt-markdown pre{background:#0000000f;padding:12px;border-radius:8px;overflow-x:auto;margin:8px 0;font-size:13px}.agt-markdown pre code{background:none;padding:0;border-radius:0;font-size:inherit}.agt-markdown ul{list-style:disc;padding-left:1.25em;margin:.25em 0}.agt-markdown ol{list-style:decimal;padding-left:1.25em;margin:.25em 0}.agt-markdown li{margin:.1em 0}.agt-markdown a{color:var(--agt-primary);text-decoration:underline;text-decoration-color:#fbb76b66;text-underline-offset:2px}.agt-markdown a:hover{text-decoration-color:var(--agt-primary)}.agt-markdown table{width:100%;border-collapse:collapse;margin:8px 0;font-size:13px}.agt-markdown th,.agt-markdown td{padding:6px 10px;border:1px solid var(--agt-border);text-align:left}.agt-markdown th{background:var(--agt-muted);font-weight:600;font-size:12px;color:var(--agt-text-secondary)}.agt-markdown hr{border:none;border-top:1px solid var(--agt-border);margin:12px 0}.agt-markdown blockquote{border-left:3px solid var(--agt-border);margin:8px 0;padding:4px 12px;color:var(--agt-text-secondary)}@keyframes agt-slide-up{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}@keyframes agt-slide-in-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes agt-scale-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes agt-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.agt-messages::-webkit-scrollbar{width:6px}.agt-messages::-webkit-scrollbar-track{background:transparent}.agt-messages::-webkit-scrollbar-thumb{background:#00000026;border-radius:3px}.agt-messages::-webkit-scrollbar-thumb:hover{background:#00000040}
|
package/dist/widget.es.js
CHANGED
|
@@ -26233,7 +26233,7 @@ function OD({ toolPart: e }) {
|
|
|
26233
26233
|
}
|
|
26234
26234
|
function CD({ message: e, isStreaming: n }) {
|
|
26235
26235
|
const i = e.role === "user", o = e.parts.filter((c) => c.type === "text").map((c) => c.text).join(`
|
|
26236
|
-
`), s = e.parts.filter((c) => c.type
|
|
26236
|
+
`), s = e.parts.filter((c) => c.type.startsWith("tool-"));
|
|
26237
26237
|
return /* @__PURE__ */ P.jsx("div", { className: `agt-message ${i ? "agt-message--user" : "agt-message--assistant"}`, children: /* @__PURE__ */ P.jsxs("div", { className: "agt-message__content", children: [
|
|
26238
26238
|
o ? /* @__PURE__ */ P.jsx(AD, { content: o }) : n && s.length === 0 ? /* @__PURE__ */ P.jsxs("div", { className: "agt-message__typing", children: [
|
|
26239
26239
|
/* @__PURE__ */ P.jsx("span", { className: "agt-spinner__dot" }),
|
|
@@ -26442,7 +26442,7 @@ function J0({
|
|
|
26442
26442
|
if (!(!h || h.length === 0)) {
|
|
26443
26443
|
for (const te of he)
|
|
26444
26444
|
for (const ve of te.parts)
|
|
26445
|
-
if (ve.type
|
|
26445
|
+
if (ve.type.startsWith("tool-")) {
|
|
26446
26446
|
const z = ve;
|
|
26447
26447
|
if (z.state === "output-available" && !g.current.has(z.toolCallId)) {
|
|
26448
26448
|
const A = h.find((H) => H.name === z.toolName);
|
package/dist/widget.umd.js
CHANGED
|
@@ -177,4 +177,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
177
177
|
`,...s.current()});return/^[\t ]/.test(d)&&(d=Xa(d.charCodeAt(0))+d.slice(1)),d=d?c+" "+d:c,i.options.closeAtx&&(d+=" "+c),m(),h(),d}Dg.peek=HO;function Dg(e){return e.value||""}function HO(){return"<"}Mg.peek=qO;function Mg(e,n,i,l){const o=ac(i),s=o==='"'?"Quote":"Apostrophe",c=i.enter("image");let h=i.enter("label");const m=i.createTracker(l);let d=m.move("![");return d+=m.move(i.safe(e.alt,{before:d,after:"]",...m.current()})),d+=m.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=i.enter("destinationLiteral"),d+=m.move("<"),d+=m.move(i.safe(e.url,{before:d,after:">",...m.current()})),d+=m.move(">")):(h=i.enter("destinationRaw"),d+=m.move(i.safe(e.url,{before:d,after:e.title?" ":")",...m.current()}))),h(),e.title&&(h=i.enter(`title${s}`),d+=m.move(" "+o),d+=m.move(i.safe(e.title,{before:d,after:o,...m.current()})),d+=m.move(o),h()),d+=m.move(")"),c(),d}function qO(){return"!"}Rg.peek=$O;function Rg(e,n,i,l){const o=e.referenceType,s=i.enter("imageReference");let c=i.enter("label");const h=i.createTracker(l);let m=h.move("![");const d=i.safe(e.alt,{before:m,after:"]",...h.current()});m+=h.move(d+"]["),c();const y=i.stack;i.stack=[],c=i.enter("reference");const g=i.safe(i.associationId(e),{before:m,after:"]",...h.current()});return c(),i.stack=y,s(),o==="full"||!d||d!==g?m+=h.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function $O(){return"!"}jg.peek=VO;function jg(e,n,i){let l=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++s<i.unsafe.length;){const c=i.unsafe[s],h=i.compilePattern(c);let m;if(c.atBreak)for(;m=h.exec(l);){let d=m.index;l.charCodeAt(d)===10&&l.charCodeAt(d-1)===13&&d--,l=l.slice(0,d)+" "+l.slice(m.index+1)}}return o+l+o}function VO(){return"`"}function Ug(e,n){const i=Ns(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Zg.peek=YO;function Zg(e,n,i,l){const o=ac(i),s=o==='"'?"Quote":"Apostrophe",c=i.createTracker(l);let h,m;if(Ug(e,i)){const y=i.stack;i.stack=[],h=i.enter("autolink");let g=c.move("<");return g+=c.move(i.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),h(),i.stack=y,g}h=i.enter("link"),m=i.enter("label");let d=c.move("[");return d+=c.move(i.containerPhrasing(e,{before:d,after:"](",...c.current()})),d+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=i.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(i.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(m=i.enter("destinationRaw"),d+=c.move(i.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=i.enter(`title${s}`),d+=c.move(" "+o),d+=c.move(i.safe(e.title,{before:d,after:o,...c.current()})),d+=c.move(o),m()),d+=c.move(")"),h(),d}function YO(e,n,i){return Ug(e,i)?"<":"["}Lg.peek=GO;function Lg(e,n,i,l){const o=e.referenceType,s=i.enter("linkReference");let c=i.enter("label");const h=i.createTracker(l);let m=h.move("[");const d=i.containerPhrasing(e,{before:m,after:"]",...h.current()});m+=h.move(d+"]["),c();const y=i.stack;i.stack=[],c=i.enter("reference");const g=i.safe(i.associationId(e),{before:m,after:"]",...h.current()});return c(),i.stack=y,s(),o==="full"||!d||d!==g?m+=h.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function GO(){return"["}function lc(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function XO(e){const n=lc(e),i=e.options.bulletOther;if(!i)return n==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+i+"`) to be different");return i}function FO(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function Ig(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function JO(e,n,i,l){const o=i.enter("list"),s=i.bulletCurrent;let c=e.ordered?FO(i):lc(i);const h=e.ordered?c==="."?")":".":XO(i);let m=n&&i.bulletLastUsed?c===i.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&y&&(!y.children||!y.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(m=!0),Ig(i)===c&&y){let g=-1;for(;++g<e.children.length;){const _=e.children[g];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=h),i.bulletCurrent=c;const d=i.containerFlow(e,l);return i.bulletLastUsed=c,i.bulletCurrent=s,o(),d}function QO(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function PO(e,n,i,l){const o=QO(i);let s=i.bulletCurrent||lc(i);n&&n.type==="list"&&n.ordered&&(s=(typeof n.start=="number"&&n.start>-1?n.start:1)+(i.options.incrementListMarker===!1?0:n.children.indexOf(e))+s);let c=s.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(c=Math.ceil(c/4)*4);const h=i.createTracker(l);h.move(s+" ".repeat(c-s.length)),h.shift(c);const m=i.enter("listItem"),d=i.indentLines(i.containerFlow(e,h.current()),y);return m(),d;function y(g,_,b){return _?(b?"":" ".repeat(c))+g:(b?s:s+" ".repeat(c-s.length))+g}}function KO(e,n,i,l){const o=i.enter("paragraph"),s=i.enter("phrasing"),c=i.containerPhrasing(e,l);return s(),o(),c}const WO=mu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function eC(e,n,i,l){return(e.children.some(function(c){return WO(c)})?i.containerPhrasing:i.containerFlow).call(i,e,l)}function tC(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}Bg.peek=nC;function Bg(e,n,i,l){const o=tC(i),s=i.enter("strong"),c=i.createTracker(l),h=c.move(o+o);let m=c.move(i.containerPhrasing(e,{after:o,before:h,...c.current()}));const d=m.charCodeAt(0),y=vu(l.before.charCodeAt(l.before.length-1),d,o);y.inside&&(m=Xa(d)+m.slice(1));const g=m.charCodeAt(m.length-1),_=vu(l.after.charCodeAt(0),g,o);_.inside&&(m=m.slice(0,-1)+Xa(g));const b=c.move(o+o);return s(),i.attentionEncodeSurroundingInfo={after:_.outside,before:y.outside},h+m+b}function nC(e,n,i){return i.options.strong||"*"}function rC(e,n,i,l){return i.safe(e.value,l)}function iC(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function aC(e,n,i){const l=(Ig(i)+(i.options.ruleSpaces?" ":"")).repeat(iC(i));return i.options.ruleSpaces?l.slice(0,-1):l}const Hg={blockquote:AO,break:Cg,code:RO,definition:UO,emphasis:Ng,hardBreak:Cg,heading:BO,html:Dg,image:Mg,imageReference:Rg,inlineCode:jg,link:Zg,linkReference:Lg,list:JO,listItem:PO,paragraph:KO,root:eC,strong:Bg,text:rC,thematicBreak:aC};function lC(){return{enter:{table:uC,tableData:qg,tableHeader:qg,tableRow:sC},exit:{codeText:cC,table:oC,tableData:uc,tableHeader:uc,tableRow:uc}}}function uC(e){const n=e._align;this.enter({type:"table",align:n.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function oC(e){this.exit(e),this.data.inTable=void 0}function sC(e){this.enter({type:"tableRow",children:[]},e)}function uc(e){this.exit(e)}function qg(e){this.enter({type:"tableCell",children:[]},e)}function cC(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,fC));const i=this.stack[this.stack.length-1];i.type,i.value=n,this.exit(e)}function fC(e,n){return n==="|"?n:e}function hC(e){const n=e||{},i=n.tableCellPadding,l=n.tablePipeAlign,o=n.stringLength,s=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
178
178
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:c,tableCell:m,tableRow:h}};function c(b,E,T,j){return d(y(b,T,j),b.align)}function h(b,E,T,j){const C=g(b,T,j),B=d([C]);return B.slice(0,B.indexOf(`
|
|
179
179
|
`))}function m(b,E,T,j){const C=T.enter("tableCell"),B=T.enter("phrasing"),w=T.containerPhrasing(b,{...j,before:s,after:s});return B(),C(),w}function d(b,E){return wO(b,{align:E,alignDelimiters:l,padding:i,stringLength:o})}function y(b,E,T){const j=b.children;let C=-1;const B=[],w=E.enter("table");for(;++C<j.length;)B[C]=g(j[C],E,T);return w(),B}function g(b,E,T){const j=b.children;let C=-1;const B=[],w=E.enter("tableRow");for(;++C<j.length;)B[C]=m(j[C],b,E,T);return w(),B}function _(b,E,T){let j=Hg.inlineCode(b,E,T);return T.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function pC(){return{exit:{taskListCheckValueChecked:$g,taskListCheckValueUnchecked:$g,paragraph:mC}}}function dC(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:gC}}}function $g(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function mC(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const l=i.children[0];if(l&&l.type==="text"){const o=n.children;let s=-1,c;for(;++s<o.length;){const h=o[s];if(h.type==="paragraph"){c=h;break}}c===i&&(l.value=l.value.slice(1),l.value.length===0?i.children.shift():i.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,i.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function gC(e,n,i,l){const o=e.children[0],s=typeof e.checked=="boolean"&&o&&o.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",h=i.createTracker(l);s&&h.move(c);let m=Hg.listItem(e,n,i,{...l,...h.current()});return s&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),m;function d(y){return y+c}}function yC(){return[J2(),gO(),_O(),lC(),pC()]}function vC(e){return{extensions:[Q2(),yO(e),SO(),hC(e),dC()]}}const bC={tokenize:kC,partial:!0},Vg={tokenize:wC,partial:!0},Yg={tokenize:TC,partial:!0},Gg={tokenize:AC,partial:!0},_C={tokenize:OC,partial:!0},Xg={name:"wwwAutolink",tokenize:EC,previous:Jg},Fg={name:"protocolAutolink",tokenize:zC,previous:Qg},Bn={name:"emailAutolink",tokenize:xC,previous:Pg},Rn={};function SC(){return{text:Rn}}let Jr=48;for(;Jr<123;)Rn[Jr]=Bn,Jr++,Jr===58?Jr=65:Jr===91&&(Jr=97);Rn[43]=Bn,Rn[45]=Bn,Rn[46]=Bn,Rn[95]=Bn,Rn[72]=[Bn,Fg],Rn[104]=[Bn,Fg],Rn[87]=[Bn,Xg],Rn[119]=[Bn,Xg];function xC(e,n,i){const l=this;let o,s;return c;function c(g){return!oc(g)||!Pg.call(l,l.previous)||sc(l.events)?i(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(g))}function h(g){return oc(g)?(e.consume(g),h):g===64?(e.consume(g),m):i(g)}function m(g){return g===46?e.check(_C,y,d)(g):g===45||g===95||Nt(g)?(s=!0,e.consume(g),m):y(g)}function d(g){return e.consume(g),o=!0,m}function y(g){return s&&o&&Ut(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):i(g)}}function EC(e,n,i){const l=this;return o;function o(c){return c!==87&&c!==119||!Jg.call(l,l.previous)||sc(l.events)?i(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(bC,e.attempt(Vg,e.attempt(Yg,s),i),i)(c))}function s(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(c)}}function zC(e,n,i){const l=this;let o="",s=!1;return c;function c(g){return(g===72||g===104)&&Qg.call(l,l.previous)&&!sc(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),h):i(g)}function h(g){if(Ut(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),h;if(g===58){const _=o.toLowerCase();if(_==="http"||_==="https")return e.consume(g),m}return i(g)}function m(g){return g===47?(e.consume(g),s?d:(s=!0,m)):i(g)}function d(g){return g===null||lu(g)||Qe(g)||Fr(g)||uu(g)?i(g):e.attempt(Vg,e.attempt(Yg,y),i)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function kC(e,n,i){let l=0;return o;function o(c){return(c===87||c===119)&&l<3?(l++,e.consume(c),o):c===46&&l===3?(e.consume(c),s):i(c)}function s(c){return c===null?i(c):n(c)}}function wC(e,n,i){let l,o,s;return c;function c(d){return d===46||d===95?e.check(Gg,m,h)(d):d===null||Qe(d)||Fr(d)||d!==45&&uu(d)?m(d):(s=!0,e.consume(d),c)}function h(d){return d===95?l=!0:(o=l,l=void 0),e.consume(d),c}function m(d){return o||l||!s?i(d):n(d)}}function TC(e,n){let i=0,l=0;return o;function o(c){return c===40?(i++,e.consume(c),o):c===41&&l<i?s(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(Gg,n,s)(c):c===null||Qe(c)||Fr(c)?n(c):(e.consume(c),o)}function s(c){return c===41&&l++,e.consume(c),o}}function AC(e,n,i){return l;function l(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),l):h===38?(e.consume(h),s):h===93?(e.consume(h),o):h===60||h===null||Qe(h)||Fr(h)?n(h):i(h)}function o(h){return h===null||h===40||h===91||Qe(h)||Fr(h)?n(h):l(h)}function s(h){return Ut(h)?c(h):i(h)}function c(h){return h===59?(e.consume(h),l):Ut(h)?(e.consume(h),c):i(h)}}function OC(e,n,i){return l;function l(s){return e.consume(s),o}function o(s){return Nt(s)?i(s):n(s)}}function Jg(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function Qg(e){return!Ut(e)}function Pg(e){return!(e===47||oc(e))}function oc(e){return e===43||e===45||e===46||e===95||Nt(e)}function sc(e){let n=e.length,i=!1;for(;n--;){const l=e[n][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){i=!0;break}if(l._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const CC={tokenize:LC,partial:!0};function NC(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:jC,continuation:{tokenize:UC},exit:ZC}},text:{91:{name:"gfmFootnoteCall",tokenize:RC},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:DC,resolveTo:MC}}}}function DC(e,n,i){const l=this;let o=l.events.length;const s=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let c;for(;o--;){const m=l.events[o][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return h;function h(m){if(!c||!c._balanced)return i(m);const d=kn(l.sliceSerialize({start:c.end,end:l.now()}));return d.codePointAt(0)!==94||!s.includes(d.slice(1))?i(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function MC(e,n){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},h=[e[i+1],e[i+2],["enter",l,n],e[i+3],e[i+4],["enter",o,n],["exit",o,n],["enter",s,n],["enter",c,n],["exit",c,n],["exit",s,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(i,e.length-i+1,...h),e}function RC(e,n,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s=0,c;return h;function h(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?i(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(g){if(s>999||g===93&&!c||g===null||g===91||Qe(g))return i(g);if(g===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return o.includes(kn(l.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):i(g)}return Qe(g)||(c=!0),s++,e.consume(g),g===92?y:d}function y(g){return g===91||g===92||g===93?(e.consume(g),s++,d):d(g)}}function jC(e,n,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let s,c=0,h;return m;function m(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):i(E)}function y(E){if(c>999||E===93&&!h||E===null||E===91||Qe(E))return i(E);if(E===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return s=kn(l.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return Qe(E)||(h=!0),c++,e.consume(E),E===92?g:y}function g(E){return E===91||E===92||E===93?(e.consume(E),c++,y):y(E)}function _(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),o.includes(s)||o.push(s),Ze(e,b,"gfmFootnoteDefinitionWhitespace")):i(E)}function b(E){return n(E)}}function UC(e,n,i){return e.check(Ha,n,e.attempt(CC,n,i))}function ZC(e){e.exit("gfmFootnoteDefinition")}function LC(e,n,i){const l=this;return Ze(e,o,"gfmFootnoteDefinitionIndent",5);function o(s){const c=l.events[l.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?n(s):i(s)}}function IC(e){let i=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:s,resolveAll:o};return i==null&&(i=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(c,h){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let d=m;for(;d--;)if(c[d][0]==="exit"&&c[d][1].type==="strikethroughSequenceTemporary"&&c[d][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[d][1].end.offset-c[d][1].start.offset){c[m][1].type="strikethroughSequence",c[d][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},c[d][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[d][1].end),end:Object.assign({},c[m][1].start)},_=[["enter",y,h],["enter",c[d][1],h],["exit",c[d][1],h],["enter",g,h]],b=h.parser.constructs.insideSpan.null;b&&Wt(_,_.length,0,ou(b,c.slice(d+1,m),h)),Wt(_,_.length,0,[["exit",g,h],["enter",c[m][1],h],["exit",c[m][1],h],["exit",y,h]]),Wt(c,d-1,m-d+3,_),m=d+_.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function s(c,h,m){const d=this.previous,y=this.events;let g=0;return _;function _(E){return d===126&&y[y.length-1][1].type!=="characterEscape"?m(E):(c.enter("strikethroughSequenceTemporary"),b(E))}function b(E){const T=Ci(d);if(E===126)return g>1?m(E):(c.consume(E),g++,b);if(g<2&&!i)return m(E);const j=c.exit("strikethroughSequenceTemporary"),C=Ci(E);return j._open=!C||C===2&&!!T,j._close=!T||T===2&&!!C,h(E)}}}class BC{constructor(){this.map=[]}add(n,i,l){HC(this,n,i,l)}consume(n){if(this.map.sort(function(s,c){return s[0]-c[0]}),this.map.length===0)return;let i=this.map.length;const l=[];for(;i>0;)i-=1,l.push(n.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),n.length=this.map[i][0];l.push(n.slice()),n.length=0;let o=l.pop();for(;o;){for(const s of o)n.push(s);o=l.pop()}this.map.length=0}}function HC(e,n,i,l){let o=0;if(!(i===0&&l.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=i,e.map[o][2].push(...l);return}o+=1}e.map.push([n,i,l])}}function qC(e,n){let i=!1;const l=[];for(;n<e.length;){const o=e[n];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const s=l.length-1;l[s]=l[s]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);n+=1}return l}function $C(){return{flow:{null:{name:"table",tokenize:VC,resolveAll:YC}}}}function VC(e,n,i){const l=this;let o=0,s=0,c;return h;function h(L){let ie=l.events.length-1;for(;ie>-1;){const ae=l.events[ie][1].type;if(ae==="lineEnding"||ae==="linePrefix")ie--;else break}const re=ie>-1?l.events[ie][1].type:null,le=re==="tableHead"||re==="tableRow"?D:m;return le===D&&l.parser.lazy[l.now().line]?i(L):le(L)}function m(L){return e.enter("tableHead"),e.enter("tableRow"),d(L)}function d(L){return L===124||(c=!0,s+=1),y(L)}function y(L){return L===null?i(L):me(L)?s>1?(s=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),b):i(L):Te(L)?Ze(e,y,"whitespace")(L):(s+=1,c&&(c=!1,o+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),c=!0,y):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Qe(L)?(e.exit("data"),y(L)):(e.consume(L),L===92?_:g)}function _(L){return L===92||L===124?(e.consume(L),g):g(L)}function b(L){return l.interrupt=!1,l.parser.lazy[l.now().line]?i(L):(e.enter("tableDelimiterRow"),c=!1,Te(L)?Ze(e,E,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L))}function E(L){return L===45||L===58?j(L):L===124?(c=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),T):J(L)}function T(L){return Te(L)?Ze(e,j,"whitespace")(L):j(L)}function j(L){return L===58?(s+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),C):L===45?(s+=1,C(L)):L===null||me(L)?K(L):J(L)}function C(L){return L===45?(e.enter("tableDelimiterFiller"),B(L)):J(L)}function B(L){return L===45?(e.consume(L),B):L===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(L))}function w(L){return Te(L)?Ze(e,K,"whitespace")(L):K(L)}function K(L){return L===124?E(L):L===null||me(L)?!c||o!==s?J(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(L)):J(L)}function J(L){return i(L)}function D(L){return e.enter("tableRow"),X(L)}function X(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),X):L===null||me(L)?(e.exit("tableRow"),n(L)):Te(L)?Ze(e,X,"whitespace")(L):(e.enter("data"),ce(L))}function ce(L){return L===null||L===124||Qe(L)?(e.exit("data"),X(L)):(e.consume(L),L===92?he:ce)}function he(L){return L===92||L===124?(e.consume(L),ce):ce(L)}}function YC(e,n){let i=-1,l=!0,o=0,s=[0,0,0,0],c=[0,0,0,0],h=!1,m=0,d,y,g;const _=new BC;for(;++i<e.length;){const b=e[i],E=b[1];b[0]==="enter"?E.type==="tableHead"?(h=!1,m!==0&&(Kg(_,n,m,d,y),y=void 0,m=0),d={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},_.add(i,0,[["enter",d,n]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(l=!0,g=void 0,s=[0,0,0,0],c=[0,i+1,0,0],h&&(h=!1,y={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},_.add(i,0,[["enter",y,n]])),o=E.type==="tableDelimiterRow"?2:y?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(l=!1,c[2]===0&&(s[1]!==0&&(c[0]=c[1],g=bu(_,n,s,o,void 0,g),s=[0,0,0,0]),c[2]=i)):E.type==="tableCellDivider"&&(l?l=!1:(s[1]!==0&&(c[0]=c[1],g=bu(_,n,s,o,void 0,g)),s=c,c=[s[1],i,0,0])):E.type==="tableHead"?(h=!0,m=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(m=i,s[1]!==0?(c[0]=c[1],g=bu(_,n,s,o,i,g)):c[1]!==0&&(g=bu(_,n,c,o,i,g)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(c[3]=i)}for(m!==0&&Kg(_,n,m,d,y),_.consume(n.events),i=-1;++i<n.events.length;){const b=n.events[i];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=qC(n.events,i))}return e}function bu(e,n,i,l,o,s){const c=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",h="tableContent";i[0]!==0&&(s.end=Object.assign({},Di(n.events,i[0])),e.add(i[0],0,[["exit",s,n]]));const m=Di(n.events,i[1]);if(s={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(i[1],0,[["enter",s,n]]),i[2]!==0){const d=Di(n.events,i[2]),y=Di(n.events,i[3]),g={type:h,start:Object.assign({},d),end:Object.assign({},y)};if(e.add(i[2],0,[["enter",g,n]]),l!==2){const _=n.events[i[2]],b=n.events[i[3]];if(_[1].end=Object.assign({},b[1].end),_[1].type="chunkText",_[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,T=i[3]-i[2]-1;e.add(E,T,[])}}e.add(i[3]+1,0,[["exit",g,n]])}return o!==void 0&&(s.end=Object.assign({},Di(n.events,o)),e.add(o,0,[["exit",s,n]]),s=void 0),s}function Kg(e,n,i,l,o){const s=[],c=Di(n.events,i);o&&(o.end=Object.assign({},c),s.push(["exit",o,n])),l.end=Object.assign({},c),s.push(["exit",l,n]),e.add(i+1,0,s)}function Di(e,n){const i=e[n],l=i[0]==="enter"?"start":"end";return i[1][l]}const GC={name:"tasklistCheck",tokenize:FC};function XC(){return{text:{91:GC}}}function FC(e,n,i){const l=this;return o;function o(m){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?i(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),s)}function s(m){return Qe(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):i(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):i(m)}function h(m){return me(m)?n(m):Te(m)?e.check({tokenize:JC},n,i)(m):i(m)}}function JC(e,n,i){return Ze(e,l,"whitespace");function l(o){return o===null?i(o):n(o)}}function QC(e){return Mm([SC(),NC(),IC(e),$C(),XC()])}const PC={};function KC(e){const n=this,i=e||PC,l=n.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),s=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),c=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(QC(i)),s.push(yC()),c.push(vC(i))}function WC({content:e}){return P.jsx("div",{className:"agt-markdown",children:P.jsx(I2,{remarkPlugins:[KC],components:{a:({href:n,children:i})=>P.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:i})},children:e})})}function Mi({className:e=""}){return P.jsxs("span",{className:`agt-spinner ${e}`,role:"status","aria-label":"Loading",children:[P.jsx("span",{className:"agt-spinner__dot"}),P.jsx("span",{className:"agt-spinner__dot"}),P.jsx("span",{className:"agt-spinner__dot"})]})}function e4({toolPart:e}){const{state:n,input:i,output:l}=e,o=e.toolName||"unknown",s=n==="input-streaming"||n==="input-available",c=n==="output-available",h=n==="output-error";if(o==="webSearch"){if(s)return P.jsxs("div",{className:"agt-tool",children:[P.jsx(Mi,{}),P.jsx("span",{children:(i==null?void 0:i.statusText)||"Searching the web..."})]});if(c&&l&&typeof l=="string"){if(l.startsWith("Error"))return P.jsx("div",{className:"agt-tool agt-tool--error",children:l});const m=l.match(/\*\*Sources:\*\*\s*([\s\S]+?)(?=\n\n|$)/);if(m){const d=[],y=/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g;let g;for(;(g=y.exec(m[1]))!==null;)d.push({label:g[1],url:g[2]});if(d.length>0)return P.jsxs("div",{className:"agt-tool agt-tool--sources",children:[P.jsx("span",{className:"agt-tool__label",children:"Sources:"}),d.map((_,b)=>P.jsxs("span",{children:[P.jsx("a",{href:_.url,target:"_blank",rel:"noopener noreferrer",children:_.label}),b<d.length-1&&P.jsx("span",{className:"agt-tool__separator",children:"•"})]},b))]})}return null}if(h)return P.jsx("div",{className:"agt-tool agt-tool--error",children:e.errorText||"Search failed"})}if(o==="generateImage"){if(s)return P.jsxs("div",{className:"agt-tool",children:[P.jsx(Mi,{}),P.jsx("span",{children:(i==null?void 0:i.statusText)||"Generating image..."})]});if(c&&l&&typeof l=="string"){if(l.startsWith("Error"))return P.jsx("div",{className:"agt-tool agt-tool--error",children:l});if(l.startsWith("http"))return P.jsx("div",{className:"agt-tool__image",children:P.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:P.jsx("img",{src:l,alt:"Generated image"})})})}}return o==="interpretImage"?s?P.jsxs("div",{className:"agt-tool",children:[P.jsx(Mi,{}),P.jsx("span",{children:(i==null?void 0:i.statusText)||"Analyzing image..."})]}):null:o==="ragLookup"?s?P.jsxs("div",{className:"agt-tool",children:[P.jsx(Mi,{}),P.jsx("span",{children:"Searching documents..."})]}):null:s?P.jsxs("div",{className:"agt-tool",children:[P.jsx(Mi,{}),P.jsx("span",{children:"Processing..."})]}):null}function t4({message:e,isStreaming:n}){const i=e.role==="user",o=e.parts.filter(c=>c.type==="text").map(c=>c.text).join(`
|
|
180
|
-
`),s=e.parts.filter(c=>c.type
|
|
180
|
+
`),s=e.parts.filter(c=>c.type.startsWith("tool-"));return P.jsx("div",{className:`agt-message ${i?"agt-message--user":"agt-message--assistant"}`,children:P.jsxs("div",{className:"agt-message__content",children:[o?P.jsx(WC,{content:o}):n&&s.length===0?P.jsxs("div",{className:"agt-message__typing",children:[P.jsx("span",{className:"agt-spinner__dot"}),P.jsx("span",{className:"agt-spinner__dot"}),P.jsx("span",{className:"agt-spinner__dot"})]}):null,s.map(c=>P.jsx(e4,{toolPart:c},c.toolCallId))]})})}function n4({messages:e,status:n,isLoading:i,errorMessage:l}){const o=we.useRef(null);we.useEffect(()=>{var c;(c=o.current)==null||c.scrollIntoView({behavior:"smooth"})},[e,n]);const s=n==="streaming";return P.jsx("div",{className:"agt-messages",children:P.jsxs("div",{className:"agt-messages__inner",children:[e.map((c,h)=>{const m=c.role==="assistant"&&h===e.length-1;return P.jsx(t4,{message:c,isStreaming:m&&s},c.id)}),i&&n==="submitted"&&P.jsx("div",{className:"agt-message agt-message--assistant",children:P.jsx("div",{className:"agt-message__content",children:P.jsx(Mi,{})})}),l&&P.jsx("div",{className:"agt-message agt-message--assistant",children:P.jsxs("div",{className:"agt-message__content agt-message__content--error",children:[P.jsx(jk,{size:14,style:{flexShrink:0,marginTop:2}}),P.jsx("span",{children:l})]})}),P.jsx("div",{ref:o})]})})}const Wg=we.forwardRef(({maxRows:e=1,placeholder:n,value:i,onChange:l,onKeyDown:o,autoFocus:s,disabled:c,className:h,style:m,...d},y)=>{const g=we.useRef(null),[_,b]=we.useState(0);return we.useImperativeHandle(y,()=>g.current),we.useEffect(()=>{const E=g.current;if(E){E.style.height="auto";const T=E.scrollHeight;b(T*e),s&&E.focus()}},[e]),we.useEffect(()=>{const E=g.current;E&&(E.style.height="auto",E.style.height=`${Math.min(E.scrollHeight,_)}px`)},[i,_]),P.jsx("textarea",{ref:g,value:i,onChange:l,onKeyDown:o,placeholder:n,disabled:c,style:{overflow:"auto",resize:"none",maxHeight:`${_}px`,...m},className:h,rows:1,...d})});Wg.displayName="AutoResizingTextarea";function r4({onSubmit:e,isLoading:n,onStop:i,placeholder:l}){const[o,s]=we.useState(""),c=we.useRef(null),h=n||o.trim().length>0,m=()=>{var d;n||!o.trim()||(e(o),s(""),(d=c.current)==null||d.focus())};return P.jsx("div",{className:"agt-input",children:P.jsxs("div",{className:"agt-input__container",children:[P.jsx(Wg,{ref:c,placeholder:l||"Type a message...",autoFocus:!0,maxRows:5,value:o,onChange:d=>s(d.target.value),onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),h&&m())},className:"agt-input__textarea"}),P.jsx("button",{disabled:!h,onClick:n?i:m,className:"agt-input__send","aria-label":n?"Stop":"Send",children:n?P.jsx(Zk,{size:16}):P.jsx(Rk,{size:16})})]})})}function i4(e){try{const n=e.split("/");return n[n.length-1]||null}catch{return null}}function a4(e){try{return new URL(e).origin}catch{return e.split("/").slice(0,3).join("/")}}function cc({title:e,initialMessage:n,runtimeUrl:i,apiKey:l,uiMode:o="popup",identifier:s,context:c,actions:h,theme:m}){const[d,y]=we.useState(o==="chat"),g=we.useRef(new Set),[_,b]=we.useState(null),[E,T]=we.useState("english"),[j,C]=we.useState(null),B=we.useMemo(()=>i4(i),[i]),w=we.useMemo(()=>a4(i),[i]),K=B?`messages-${B}`:"messages",J=ys[E]||ys.english,D=n||"Need any help?",[X]=we.useState(()=>{const te=sessionStorage.getItem(K);if(te)try{const ve=JSON.parse(te);if(Array.isArray(ve)&&ve.length>0)return ve}catch{}return[{id:"greeting",role:"assistant",parts:[{type:"text",text:D}]}]}),ce=we.useMemo(()=>new Wd({api:i,headers:{authorization:`Bearer ${l}`,"X-Agent-Identifier":s||""},body:{...c?{context:c}:{},...h?{actions:h.map(({name:te,description:ve,parameters:z})=>({name:te,description:ve,parameters:z}))}:{}}}),[i,l,s,c,h]),{messages:he,sendMessage:L,status:ie,stop:re}=Ck({id:B||"widget",messages:X,transport:ce,onError:()=>{C("Agent not available. Please try again.")}});we.useEffect(()=>{he.length>0&&sessionStorage.setItem(K,JSON.stringify(he.map(te=>({id:te.id,role:te.role,parts:te.parts}))))},[he,K]),we.useEffect(()=>{if(!(!h||h.length===0)){for(const te of he)for(const ve of te.parts)if(ve.type.startsWith("tool-")){const z=ve;if(z.state==="output-available"&&!g.current.has(z.toolCallId)){const A=h.find(H=>H.name===z.toolName);if(A){g.current.add(z.toolCallId);try{A.handler(z.input)}catch(H){console.error(`[agentsgt-widget] Action "${A.name}" failed:`,H)}}}}}},[he,h]),we.useEffect(()=>{he.length>1&&C(null)},[he.length]),we.useEffect(()=>{B&&(async()=>{var te;try{const ve=await fetch(`${w}/api/v1/agents/agent/${B}`,{headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"}});if(ve.ok){const z=await ve.json();b(z.data);const A=((te=z.data.language)==null?void 0:te.toLowerCase())||"english",H=Object.keys(ys);T(H.includes(A)?A:"english")}}catch{T("english")}})()},[B,w,l]),we.useEffect(()=>{m!=null&&m.primaryColor&&document.documentElement.style.setProperty("--agt-primary",m.primaryColor)},[m]);const le=ie==="streaming"||ie==="submitted",ae=we.useCallback(te=>{C(null),L({text:te})},[L]),fe=e||(_==null?void 0:_.name)||(J==null?void 0:J.title)||"Assistant",Z=(J==null?void 0:J.placeholder)||"Type your message...",F=P.jsxs("div",{className:"agt-widget",children:[P.jsx(n4,{messages:he,status:ie,isLoading:le,errorMessage:j}),P.jsx(r4,{onSubmit:ae,isLoading:le,onStop:re,placeholder:Z})]});return o==="chat"?F:o==="sidebar"?P.jsxs(P.Fragment,{children:[d&&P.jsxs("div",{className:"agt-sidebar",children:[P.jsxs("div",{className:"agt-header",children:[P.jsx("span",{className:"agt-header__title",children:fe}),P.jsx("button",{className:"agt-header__btn",onClick:()=>y(!1),"aria-label":"Close",children:P.jsx(am,{size:16})})]}),F,P.jsx("div",{className:"agt-footer",children:"Powered by AgentsGT"})]}),!d&&P.jsx("button",{className:"agt-trigger",onClick:()=>y(!0),"aria-label":"Open chat",children:P.jsx(im,{size:24})})]}):P.jsxs(P.Fragment,{children:[d&&P.jsxs("div",{className:"agt-popup",children:[P.jsxs("div",{className:"agt-header",children:[P.jsx("span",{className:"agt-header__title",children:fe}),P.jsxs("div",{className:"agt-header__actions",children:[P.jsx("button",{className:"agt-header__btn",onClick:()=>y(!1),"aria-label":"Minimize",children:P.jsx(Uk,{size:16})}),P.jsx("button",{className:"agt-header__btn",onClick:()=>y(!1),"aria-label":"Close",children:P.jsx(am,{size:16})})]})]}),F,P.jsx("div",{className:"agt-footer",children:"Powered by AgentsGT"})]}),!d&&P.jsx("button",{className:"agt-trigger",onClick:()=>y(!0),"aria-label":"Open chat",children:P.jsx(im,{size:24})})]})}function l4(e,n={runtimeUrl:""}){const i=n.basePath||"";return new Promise((l,o)=>{try{const s=document.createElement("link");s.rel="stylesheet",s.href=`${i}/dist/widget.css`,document.head.appendChild(s);const c=document.createElement("script");c.src=`${i}/dist/widget.umd.js`,c.onload=()=>{const h=document.getElementById(e);if(h&&window.AgentSGTWidget){const m=window.AgentSGTWidget.mountApp(h,{title:n.name,initialMessage:n.initialMessage,runtimeUrl:n.runtimeUrl,apiKey:n.apiKey||"",uiMode:n.uiMode,identifier:n.identifier,context:n.context,actions:n.actions,theme:n.theme});l(m)}else o(new Error("Failed to initialize widget"))},c.onerror=h=>o(h),document.body.appendChild(c)}catch(s){o(s)}})}const u4=(e,n)=>{const i=Lh.createRoot(e);return i.render(P.jsx(cc,{...n})),()=>i.unmount()},o4=(e,n,i,l,o)=>{Lh.createRoot(document.getElementById("root")).render(P.jsx(cc,{title:e,initialMessage:n,runtimeUrl:i||"",apiKey:l||"",uiMode:o}))};In.App=cc,In.loadWidget=l4,In.mountApp=u4,In.renderApp=o4,Object.defineProperty(In,Symbol.toStringTag,{value:"Module"})});
|