From 2e9ccc81fd58e6f915c0db0da54b410085ac4bc1 Mon Sep 17 00:00:00 2001 From: Ramon Reichert Date: Wed, 7 Oct 2026 10:05:03 -0300 Subject: [PATCH 1/2] malina invetigating --- .../api/frontends/bui/package-lock.json | 30 ++++++++ .../api/services/kronk/static/assets/index.js | 6 +- examples/go.mod | 22 +++--- examples/go.sum | 44 ++++++------ go.mod | 24 +++---- go.sum | 48 ++++++------- sdk/bucky/init.go | 14 ++-- sdk/kronk/init.go | 39 ++++------- sdk/kronk/library_search_other.go | 12 ---- sdk/kronk/library_search_windows.go | 68 ------------------- sdk/malina/init.go | 21 +++--- zarf/nix/gomod2nix.toml | 48 ++++++------- 12 files changed, 161 insertions(+), 215 deletions(-) delete mode 100644 sdk/kronk/library_search_other.go delete mode 100644 sdk/kronk/library_search_windows.go diff --git a/cmd/server/api/frontends/bui/package-lock.json b/cmd/server/api/frontends/bui/package-lock.json index 9e7095213..c297eb6d6 100644 --- a/cmd/server/api/frontends/bui/package-lock.json +++ b/cmd/server/api/frontends/bui/package-lock.json @@ -144,6 +144,9 @@ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -161,6 +164,9 @@ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -178,6 +184,9 @@ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -195,6 +204,9 @@ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -212,6 +224,9 @@ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -229,6 +244,9 @@ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1231,6 +1249,9 @@ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1252,6 +1273,9 @@ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1273,6 +1297,9 @@ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1294,6 +1321,9 @@ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/cmd/server/api/services/kronk/static/assets/index.js b/cmd/server/api/services/kronk/static/assets/index.js index caadd2862..f57c0d5b4 100644 --- a/cmd/server/api/services/kronk/static/assets/index.js +++ b/cmd/server/api/services/kronk/static/assets/index.js @@ -181,7 +181,7 @@ kronk server start`})]})]})}function Ls(e){let t=/^([\d.]+)\s*(MB|GB|KB|B)?$/i.e `)}function wc({isOpen:e,onClose:t,onLoadChat:n}){let{history:r,deleteChats:i}=bc(),[a,o]=(0,S.useState)(new Set),[s,c]=(0,S.useState)(!1),l=(0,S.useMemo)(()=>[...r],[r]),u=(0,S.useCallback)(e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=l.length>0&&a.size===l.length,f=(0,S.useCallback)(()=>{o(d?new Set:new Set(l.map(e=>e.id)))},[d,l]),p=(0,S.useCallback)(()=>{a.size!==0&&c(!0)},[a]),m=(0,S.useCallback)(()=>{i(Array.from(a)),o(new Set),c(!1)},[a,i]),h=(0,S.useCallback)(e=>{n(e.messages),t()},[n,t]),g=(0,S.useCallback)((e,t)=>{e.stopPropagation();let n=Cc(t.messages);navigator.clipboard.writeText(n)},[]);return(0,G.jsxs)(`div`,{className:`chat-history-panel${e?` chat-history-panel-open`:``}`,children:[(0,G.jsxs)(`div`,{className:`chat-history-header`,children:[(0,G.jsx)(`span`,{children:`Chat History`}),(0,G.jsx)(`button`,{onClick:t,"aria-label":`Close chat history`,children:`×`})]}),l.length>0&&(0,G.jsxs)(`div`,{className:`chat-history-toolbar`,children:[(0,G.jsxs)(`label`,{className:`chat-history-select-all`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:d,onChange:f}),`Select All`]}),a.size>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{children:[a.size,` selected`]}),(0,G.jsx)(`button`,{className:`chat-history-delete-btn`,onClick:p,children:`Delete`})]})]}),l.length===0?(0,G.jsx)(`div`,{className:`chat-history-empty`,children:`No saved chats`}):(0,G.jsx)(`div`,{className:`chat-history-list`,children:l.map(e=>{let t=a.has(e.id);return(0,G.jsxs)(`div`,{className:`chat-history-item${t?` chat-history-item-selected`:``}`,onClick:()=>h(e),children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`chat-history-item-checkbox`,checked:t,onChange:()=>u(e.id),onClick:e=>e.stopPropagation()}),(0,G.jsxs)(`div`,{className:`chat-history-item-info`,children:[(0,G.jsx)(`div`,{className:`chat-history-item-title`,children:e.title}),(0,G.jsx)(`div`,{className:`chat-history-item-model`,children:e.model}),(0,G.jsx)(`div`,{className:`chat-history-item-date`,children:Sc(e.savedAt)})]}),(0,G.jsx)(`button`,{className:`chat-history-item-copy`,onClick:t=>g(t,e),title:`Copy chat to clipboard`,children:`Copy`})]},e.id)})}),(0,G.jsx)(xc,{isOpen:s,message:`Delete ${a.size} selected chat(s)?`,confirmLabel:`Delete`,cancelLabel:`Cancel`,onConfirm:m,onCancel:()=>c(!1)})]})}function Tc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ec=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oc={};function kc(e,t){return((t||Oc).jsx?Dc:Ec).test(e)}var Ac=/[ \t\n\f\r]/g;function jc(e){return typeof e==`object`?e.type===`text`&&Mc(e.value):Mc(e)}function Mc(e){return e.replace(Ac,``)===``}var Nc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Nc.prototype.normal={},Nc.prototype.property={},Nc.prototype.space=void 0;function Pc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Nc(n,r,t)}function Fc(e){return e.toLowerCase()}var Ic=class{constructor(e,t){this.attribute=t,this.property=e}};Ic.prototype.attribute=``,Ic.prototype.booleanish=!1,Ic.prototype.boolean=!1,Ic.prototype.commaOrSpaceSeparated=!1,Ic.prototype.commaSeparated=!1,Ic.prototype.defined=!1,Ic.prototype.mustUseProperty=!1,Ic.prototype.number=!1,Ic.prototype.overloadedBoolean=!1,Ic.prototype.property=``,Ic.prototype.spaceSeparated=!1,Ic.prototype.space=void 0;var Lc=s({boolean:()=>zc,booleanish:()=>Bc,commaOrSpaceSeparated:()=>Wc,commaSeparated:()=>Uc,number:()=>$,overloadedBoolean:()=>Vc,spaceSeparated:()=>Hc}),Rc=0,zc=Gc(),Bc=Gc(),Vc=Gc(),$=Gc(),Hc=Gc(),Uc=Gc(),Wc=Gc();function Gc(){return 2**++Rc}var Kc=Object.keys(Lc),qc=class extends Ic{constructor(e,t,n,r){let i=-1;if(super(e,t),Jc(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&sl.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ol,ul);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ol.test(e)){let n=e.replace(al,ll);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=qc}return new i(r,t)}function ll(e){return`-`+e.toLowerCase()}function ul(e){return e.charAt(1).toUpperCase()}var dl=Pc([Xc,$c,tl,nl,rl],`html`),fl=Pc([Xc,el,tl,nl,rl],`svg`);function pl(e){return e.join(` `).trim()}var ml=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),hl=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(ml());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),gl=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),_l=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(hl()),r=gl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),vl=bl(`end`),yl=bl(`start`);function bl(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function xl(e){let t=yl(e),n=vl(e);if(t&&n)return{start:t,end:n}}function Sl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?wl(e.position):`start`in e||`end`in e?wl(e):`line`in e||`column`in e?Cl(e):``}function Cl(e){return Tl(e&&e.line)+`:`+Tl(e&&e.column)}function wl(e){return Cl(e&&e.start)+`-`+Cl(e&&e.end)}function Tl(e){return e&&typeof e==`number`?e:1}var El=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Sl(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};El.prototype.file=``,El.prototype.name=``,El.prototype.reason=``,El.prototype.message=``,El.prototype.stack=``,El.prototype.column=void 0,El.prototype.line=void 0,El.prototype.ancestors=void 0,El.prototype.cause=void 0,El.prototype.fatal=void 0,El.prototype.place=void 0,El.prototype.ruleId=void 0,El.prototype.source=void 0;var Dl=l(_l(),1),Ol={}.hasOwnProperty,kl=new Map,Al=/[A-Z]/g,jl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Ml=new Set([`td`,`th`]),Nl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Pl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Gl(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Wl(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?fl:dl,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Fl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Fl(e,t,n){if(t.type===`element`)return Il(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ll(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return zl(e,t,n);if(t.type===`mdxjsEsm`)return Rl(e,t);if(t.type===`root`)return Bl(e,t,n);if(t.type===`text`)return Vl(e,t)}function Il(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=fl,e.schema=i),e.ancestors.push(t);let a=Zl(e,t.tagName,!1),o=Kl(e,t),s=Jl(e,t);return jl.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!jc(e)})),Hl(e,o,a,t),Ul(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ll(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ql(e,t.position)}function Rl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ql(e,t.position)}function zl(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=fl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Zl(e,t.name,!0),o=ql(e,t),s=Jl(e,t);return Hl(e,o,a,t),Ul(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Bl(e,t,n){let r={};return Ul(r,Jl(e,t)),e.create(t,e.Fragment,r,n)}function Vl(e,t){return t.value}function Hl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ul(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Wl(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Gl(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=yl(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Kl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ol.call(t.properties,i)){let a=Yl(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Ml.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ql(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ql(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ql(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Jl(e,t){let n=[],r=-1,i=e.passKeys?new Map:kl;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(uu(e,e.length,0,t),e):t}var fu={}.hasOwnProperty;function pu(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function _u(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var vu=Au(/[A-Za-z]/),yu=Au(/[\dA-Za-z]/),bu=Au(/[#-'*+\--9=?A-Z^-~]/);function xu(e){return e!==null&&(e<32||e===127)}var Su=Au(/\d/),Cu=Au(/[\dA-Fa-f]/),wu=Au(/[!-/:-@[-`{-~]/);function Tu(e){return e!==null&&e<-2}function Eu(e){return e!==null&&(e<0||e===32)}function Du(e){return e===-2||e===-1||e===32}var Ou=Au(/\p{P}|\p{S}/u),ku=Au(/\s/);function Au(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ju(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Mu(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Du(r)?(e.enter(n),s(r)):t(r)}function s(r){return Du(r)&&a++0&&Du(t)?(e.enter(r),c(t)):l(t)}function c(t){return Du(t)&&o=i?t(e):n(e)}}var Pu={tokenize:Fu};function Fu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Mu(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Tu(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Iu=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Lu(this,e,t,n,!1)}addBefore(e,t,n){Lu(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Lu(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var Ru={tokenize:Bu},zu={tokenize:Vu};function Bu(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Vu(e,t,n){return Mu(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Hu(e){if(e===null||Eu(e)||ku(e))return 1;if(Ou(e))return 2}function Uu(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};qu(o,-a),qu(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=du(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=du(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=du(r,Uu(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=du(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=du(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),uu(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&Du(t)?Mu(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Tu(t)?e.check(od,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Tu(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Du(t)?Mu(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Du(t)?Mu(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Tu(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var ud={name:`codeIndented`,tokenize:fd},dd={partial:!0,tokenize:pd};function fd(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Nu(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):Tu(t)?e.attempt(dd,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||Tu(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function pd(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Tu(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Nu(e,t,a,`linePrefix`,4,4)(o)}function a(e){return Tu(e)?i(e):n(e)}}var md={name:`codeText`,previous:gd,resolve:hd,tokenize:_d};function hd(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&yd(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),yd(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),yd(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Dd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||xu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Tu(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Eu(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Tu(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Tu(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Du(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function kd(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Tu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Mu(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Tu(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ad(e,t){let n;return r;function r(i){return Tu(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Du(i)?Mu(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var jd={name:`definition`,tokenize:Nd},Md={partial:!0,tokenize:Pd};function Nd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Od.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=_u(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Eu(t)?Ad(e,l)(t):l(t)}function l(t){return Dd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Md,d,d)(t)}function d(t){return Du(t)?Mu(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Tu(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Pd(e,t,n){return r;function r(t){return Eu(t)?Ad(e,i)(t):n(t)}function i(t){return kd(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Du(t)?Mu(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Tu(e)?t(e):n(e)}}var Fd={name:`hardBreakEscape`,tokenize:Id};function Id(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Tu(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Ld={name:`headingAtx`,resolve:Rd,tokenize:zd};function Rd(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};uu(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function zd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Eu(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Tu(n)?(e.exit(`atxHeading`),t(n)):Du(n)?Mu(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Eu(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Bd=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Vd=[`pre`,`script`,`style`,`textarea`],Hd={concrete:!0,name:`htmlFlow`,resolveTo:Wd,tokenize:Gd},Ud={partial:!0,tokenize:Kd};function Wd(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Gd(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):vu(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):vu(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return vu(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Eu(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Vd.includes(l)?(i=1,r.interrupt?t(s):O(s)):Bd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||yu(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Du(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||vu(t)?(e.consume(t),b):Du(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||yu(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Du(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Du(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Tu(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Eu(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Du(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Tu(t)?O(t):Du(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Tu(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ud,R,k)(t)):t===null||Tu(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(od,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Tu(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Vd.includes(n)?(e.consume(t),L):O(t)}return vu(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Tu(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function Kd(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Xu,t,n)}}var qd={name:`htmlText`,tokenize:Jd};function Jd(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):vu(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):vu(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Tu(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Tu(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Tu(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Tu(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return vu(t)?(e.consume(t),S):n(t)}function S(t){return t===45||yu(t)?(e.consume(t),S):C(t)}function C(t){return Tu(t)?(o=C,N(t)):Du(t)?(e.consume(t),C):M(t)}function w(t){return t===45||yu(t)?(e.consume(t),w):t===47||t===62||Eu(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||vu(t)?(e.consume(t),E):Tu(t)?(o=T,N(t)):Du(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||yu(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Tu(t)?(o=D,N(t)):Du(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Tu(t)?(o=O,N(t)):Du(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Tu(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Eu(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Eu(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Du(t)?Mu(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Yd={name:`labelEnd`,resolveAll:$d,resolveTo:ef,tokenize:tf},Xd={tokenize:nf},Zd={tokenize:rf},Qd={tokenize:af};function $d(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(_u(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Xd,u,o?u:d)(t):t===91?e.attempt(Zd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Qd,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function nf(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Eu(t)?Ad(e,a)(t):a(t)}function a(t){return t===41?u(t):Dd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Eu(t)?Ad(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?kd(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Eu(t)?Ad(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function rf(e,t,n){let r=this;return i;function i(t){return Od.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(_u(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function af(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var of={name:`labelStartImage`,resolveAll:Yd.resolveAll,tokenize:sf};function sf(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var cf={name:`labelStartLink`,resolveAll:Yd.resolveAll,tokenize:lf};function lf(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var uf={name:`lineEnding`,tokenize:df};function df(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Mu(e,t,`linePrefix`)}}var ff={name:`thematicBreak`,tokenize:pf};function pf(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Tu(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Du(t)?Mu(e,s,`whitespace`)(t):s(t))}}var mf={continuation:{tokenize:vf},exit:bf,name:`list`,tokenize:_f},hf={partial:!0,tokenize:xf},gf={partial:!0,tokenize:yf};function _f(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Su(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ff,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Su(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Xu,r.interrupt?n:u,e.attempt(hf,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Du(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function vf(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Xu,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Mu(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Du(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gf,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Mu(e,e.attempt(mf,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function yf(e,t,n){let r=this;return Mu(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function bf(e){e.exit(this.containerState.type)}function xf(e,t,n){let r=this;return Mu(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Du(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Sf={name:`setextUnderline`,resolveTo:Cf,tokenize:wf};function Cf(e,t){let n=new Iu,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function wf(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Du(t)?Mu(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Tu(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Tf={tokenize:Ef};function Ef(e){let t=this,n=e.attempt(Xu,r,e.attempt(this.parser.constructs.flowInitial,i,Mu(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Sd,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Df={resolveAll:jf()},Of=Af(`string`),kf=Af(`text`);function Af(e){return{resolveAll:jf(e===`text`?Mf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iVf,contentInitial:()=>Ff,disable:()=>Hf,document:()=>Pf,flow:()=>Lf,flowInitial:()=>If,insideSpan:()=>Bf,string:()=>Rf,text:()=>zf}),Pf={42:mf,43:mf,45:mf,48:mf,49:mf,50:mf,51:mf,52:mf,53:mf,54:mf,55:mf,56:mf,57:mf,62:Qu},Ff={91:jd},If={[-2]:ud,[-1]:ud,32:ud},Lf={35:Ld,42:ff,45:[Sf,ff],60:Hd,61:Sf,95:ff,96:cd,126:cd},Rf={38:id,92:nd},zf={[-5]:uf,[-4]:uf,[-3]:uf,33:of,38:id,42:Wu,60:[Ju,qd],91:cf,92:[Fd,nd],93:Yd,95:Wu,96:md},Bf={null:[Wu,Df]},Vf={null:[42,95]},Hf={null:[]};function Uf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=du(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Uu(a,l.events,l),l.events):[]}function f(e,t){return Gf(p(e),t)}function p(e){return Wf(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Gf(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||ap).call(a,void 0,e[0])}for(r.position={start:np(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:np(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&i(t.beforeEnter,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),$f.call(n,e[p][1].type)&&n[e[p][1].type].call({...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1]),e[p][0]===`exit`&&t.afterExit.length>0&&i(t.afterExit,{...o,sliceSerialize:e[p][2].sliceSerialize},e[p][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||ap).call(o,void 0,e[0])}for(r.position={start:np(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:np(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},p=-1;++p0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function up(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dp(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fp(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ju(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function pp(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mp(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function hp(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function gp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hp(e,t);let i={src:ju(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function _p(e,t){let n={src:ju(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function vp(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function yp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return hp(e,t);let i={href:ju(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function bp(e,t){let n={href:ju(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function xp(e,t,n){let r=e.all(t),i=n?Sp(n):Cp(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s0&&n.push({type:`text`,value:` `}),n}function xm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sm(e,t){let n=gm(e,t),r=n.one(e,void 0),i=tm(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` -`},i)),a}function Cm(e,t){return e&&`run`in e?async function(n,r){let i=Sm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Sm(n,{file:r,...e||t})}}function wm(e){if(e)throw e}var Tm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var km={basename:Am,dirname:jm,extname:Mm,join:Nm,sep:`/`};function Am(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Im(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jm(e){if(Im(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Mm(e){Im(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Nm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Fm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Im(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Lm={cwd:Rm};function Rm(){return`/`}function zm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Bm(e){if(typeof e==`string`)e=new URL(e);else if(!zm(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Vm(e)}function Vm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];Em(o)&&Em(r)&&(r=(0,Ym.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Qm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function $m(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function eh(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function th(e){if(!Em(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function nh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rh(e){return ih(e)?e:new Um(e)}function ih(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function ah(e){return typeof e==`string`||oh(e)}function oh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sh=[],ch={allowDangerousHtml:!0},lh=/^(https?|ircs?|mailto|xmpp)$/i,uh=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function dh(e){let t=fh(e),n=ph(e);return mh(t.runSync(t.parse(n),n),e)}function fh(e){let t=e.rehypePlugins||sh,n=e.remarkPlugins||sh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ch}:ch;return Zm().use(op).use(n).use(Cm,r).use(t)}function ph(e){let t=e.children||``,n=new Um;return typeof t==`string`?n.value=t:``+t,n}function mh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||hh;for(let e of uh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return pm(e,l),Pl(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in nu)if(Object.hasOwn(nu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=nu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function hh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||lh.test(e.slice(0,t))?e:``}function gh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function _h(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function vh(e,t,n){let r=nm((n||{}).ignore||[]),i=yh(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=gh(e,`(`),a=gh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Lh(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ku(n)||Ou(n))&&(!t||n!==47)}qh.peek=Kh;function Rh(){this.buffer()}function zh(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Bh(){this.buffer()}function Vh(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Hh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_u(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Uh(e){this.exit(e)}function Wh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_u(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gh(e){this.exit(e)}function Kh(){return`[`}function qh(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Jh(){return{enter:{gfmFootnoteCallString:Rh,gfmFootnoteCall:zh,gfmFootnoteDefinitionLabelString:Bh,gfmFootnoteDefinition:Vh},exit:{gfmFootnoteCallString:Hh,gfmFootnoteCall:Uh,gfmFootnoteDefinitionLabelString:Wh,gfmFootnoteDefinition:Gh}}}function Yh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qh},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` +`},i)),a}function Cm(e,t){return e&&`run`in e?async function(n,r){let i=Sm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Sm(n,{file:r,...e||t})}}function wm(e){if(e)throw e}var Tm=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var km={basename:Am,dirname:jm,extname:Mm,join:Nm,sep:`/`};function Am(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Im(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jm(e){if(Im(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Mm(e){Im(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Nm(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Fm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Im(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Lm={cwd:Rm};function Rm(){return`/`}function zm(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Bm(e){if(typeof e==`string`)e=new URL(e);else if(!zm(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Vm(e)}function Vm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];Em(o)&&Em(r)&&(r=(0,Ym.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Qm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function $m(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function eh(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function th(e){if(!Em(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function nh(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rh(e){return ih(e)?e:new Um(e)}function ih(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function ah(e){return typeof e==`string`||oh(e)}function oh(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sh=[],ch={allowDangerousHtml:!0},lh=/^(https?|ircs?|mailto|xmpp)$/i,uh=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function dh(e){let t=fh(e),n=ph(e);return mh(t.runSync(t.parse(n),n),e)}function fh(e){let t=e.rehypePlugins||sh,n=e.remarkPlugins||sh,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ch}:ch;return Zm().use(op).use(n).use(Cm,r).use(t)}function ph(e){let t=e.children||``,n=new Um;return typeof t==`string`?n.value=t:``+t,n}function mh(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||hh;for(let e of uh)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return pm(e,l),Pl(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in nu)if(Object.hasOwn(nu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=nu[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function hh(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||lh.test(e.slice(0,t))?e:``}function gh(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function _h(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function vh(e,t,n){let r=nm((n||{}).ignore||[]),i=yh(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1)r.lastIndex=n+1;else{if(s!==n&&f({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a))for(let e of a)f(e);else a&&f(a);s=n+d[0].length,l=!0}if(!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=gh(e,`(`),a=gh(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Lh(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ku(n)||Ou(n))&&(!t||n!==47)}qh.peek=Kh;function Rh(){this.buffer()}function zh(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Bh(){this.buffer()}function Vh(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Hh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_u(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Uh(e){this.exit(e)}function Wh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_u(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gh(e){this.exit(e)}function Kh(){return`[`}function qh(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Jh(){return{enter:{gfmFootnoteCallString:Rh,gfmFootnoteCall:zh,gfmFootnoteDefinitionLabelString:Bh,gfmFootnoteDefinition:Vh},exit:{gfmFootnoteCallString:Hh,gfmFootnoteCall:Uh,gfmFootnoteDefinitionLabelString:Wh,gfmFootnoteDefinition:Gh}}}function Yh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qh},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Zh:Xh))),s(),o}}function Xh(e,t,n){return t===0?e:Zh(e,t,n)}function Zh(e,t,n){return(n?``:` `)+e}var Qh=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];rg.attention=ig,rg.peek=ag;function $h(){return{canContainEols:[`delete`],enter:{strikethrough:tg},exit:{strikethrough:ng}}}function eg(){return{handlers:{delete:rg},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Qh}]}}function tg(e){this.enter({type:`delete`,children:[],position:void 0},e)}function ng(e){this.exit(e)}function rg(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function ig(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function ag(){return`~`}function og(e){return e.length}function sg(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||og,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),fg);return i(),o}function fg(e,t,n){return`>`+(n?``:` `)+e}function pg(e,t){return mg(e,t.inConstruct,!0)&&!mg(e,t.notInConstruct,!1)}function mg(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Ng(){return`!`}Pg.peek=Fg;function Pg(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Fg(){return`!`}Ig.peek=Lg;function Ig(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}zg.peek=Bg;function zg(e,t,n,r){let i=xg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Rg(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Bg(e,t,n){return Rg(e,n)?`<`:`[`}Vg.peek=Hg;function Vg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Hg(){return`[`}function Ug(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Wg(e){let t=Ug(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Gg(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Kg(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function qg(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Gg(n):Ug(n),s=e.ordered?o===`.`?`)`:`.`:Wg(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Kg(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Xg(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Zg(e,t,n,r){if(!e.children.some(function(e){return ug(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function Qg(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$g.attention=e_,$g.peek=t_;function $g(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function e_(e,t){return{construct:`strong`,markers:Qg(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function t_(e,t,n){return n.options.strong||`*`}function n_(e,t,n,r){return n.safe(e.value,r)}function r_(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function i_(e,t,n){let r=(Kg(n)+(n.options.ruleSpaces?` `:``)).repeat(r_(n));return n.options.ruleSpaces?r.slice(0,-1):r}var a_={blockquote:dg,break:hg,code:yg,definition:Sg,emphasis:wg,hardBreak:hg,heading:kg,html:Ag,image:Mg,imageReference:Pg,inlineCode:Ig,link:zg,linkReference:Vg,list:qg,listItem:Yg,paragraph:Xg,root:Zg,strong:$g,text:n_,thematicBreak:i_};function o_(){return{enter:{table:s_,tableData:d_,tableHeader:d_,tableRow:l_},exit:{codeText:f_,table:c_,tableData:u_,tableHeader:u_,tableRow:u_}}}function s_(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function c_(e){this.exit(e),this.data.inTable=void 0}function l_(e){this.enter({type:`tableRow`,children:[]},e)}function u_(e){this.exit(e)}function d_(e){this.enter({type:`tableCell`,children:[]},e)}function f_(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,p_));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function p_(e,t){return t===`|`?t:e}function m_(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` +`,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=Dg(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Ag.peek=jg;function Ag(e){return e.value||``}function jg(){return`<`}Mg.peek=Ng;function Mg(e,t,n,r){let i=xg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Ng(){return`!`}Pg.peek=Fg;function Pg(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Fg(){return`!`}Ig.peek=Lg;function Ig(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}zg.peek=Bg;function zg(e,t,n,r){let i=xg(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Rg(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Bg(e,t,n){return Rg(e,n)?`<`:`[`}Vg.peek=Hg;function Vg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Hg(){return`[`}function Ug(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Wg(e){let t=Ug(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Gg(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Kg(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function qg(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Gg(n):Ug(n),s=e.ordered?o===`.`?`)`:`.`:Wg(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Kg(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Xg(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Zg(e,t,n,r){if(!e.children.some(function(e){return ug(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function Qg(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$g.attention=e_,$g.peek=t_;function $g(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function e_(e,t){return{construct:`strong`,markers:Qg(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function t_(e,t,n){return n.options.strong||`*`}function n_(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function r_(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function i_(e,t,n){let r=(Kg(n)+(n.options.ruleSpaces?` `:``)).repeat(r_(n));return n.options.ruleSpaces?r.slice(0,-1):r}var a_={blockquote:dg,break:hg,code:yg,definition:Sg,emphasis:wg,hardBreak:hg,heading:kg,html:Ag,image:Mg,imageReference:Pg,inlineCode:Ig,link:zg,linkReference:Vg,list:qg,listItem:Yg,paragraph:Xg,root:Zg,strong:$g,text:n_,thematicBreak:i_};function o_(){return{enter:{table:s_,tableData:d_,tableHeader:d_,tableRow:l_},exit:{codeText:f_,table:c_,tableData:u_,tableHeader:u_,tableRow:u_}}}function s_(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function c_(e){this.exit(e),this.data.inTable=void 0}function l_(e){this.enter({type:`tableRow`,children:[]},e)}function u_(e){this.exit(e)}function d_(e){this.enter({type:`tableCell`,children:[]},e)}function f_(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,p_));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function p_(e,t){return t===`|`?t:e}function m_(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return sg(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var K_={tokenize:ev,partial:!0};function q_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Z_,continuation:{tokenize:Q_},exit:$_}},text:{91:{name:`gfmFootnoteCall`,tokenize:X_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:J_,resolveTo:Y_}}}}function J_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=_u(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Y_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function X_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Eu(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(_u(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Eu(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Z_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Eu(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=_u(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Eu(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Mu(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Q_(e,t,n){return e.check(Xu,t,e.attempt(K_,t,n))}function $_(e){e.exit(`gfmFootnoteDefinition`)}function ev(e,t,n){let r=this;return Mu(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function tv(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Hu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var nv=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){rv(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function rv(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function iv(e,t){let n=!1,r=[];for(;t-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Tu(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Du(t)?Mu(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Eu(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Du(t)?Mu(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Du(t)?Mu(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Tu(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Du(t)?Mu(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Tu(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Tu(n)?(e.exit(`tableRow`),t(n)):Du(n)?Mu(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Eu(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function sv(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new nv;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},uv(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function lv(e,t,n,r,i){let a=[],o=uv(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function uv(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var dv={name:`tasklistCheck`,tokenize:pv};function fv(){return{text:{91:dv}}}function pv(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Eu(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Tu(r)?t(r):Du(r)?e.check({tokenize:mv},t,n)(r):n(r)}}function mv(e,t,n){return Mu(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function hv(e){return pu([j_(),q_(),tv(e),av(),fv()])}var gv={};function _v(e){let t=this,n=e||gv,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(hv(n)),a.push(b_()),o.push(x_(n))}function vv({usage:e}){let t=e.completion_tokens_details?.reasoning_tokens??0,n=Math.max(0,e.completion_tokens-t),r=e.prompt_tokens_details?.cached_tokens??0,i=e.draft_tokens??0,a=e.draft_accepted_tokens??0,o=e.draft_acceptance_rate??(i>0?a/i:0),s=i>0||a>0||e.draft_acceptance_rate!==void 0||e.draft_coverage!==void 0||!!e.draft_disable_reason;return(0,G.jsxs)(`div`,{className:`chat-message-usage`,children:[(0,G.jsxs)(`span`,{title:`Tokens in the rendered prompt, including cached tokens`,children:[`Input: `,e.prompt_tokens]}),(0,G.jsxs)(`span`,{title:`Prompt tokens restored from the incremental message cache`,children:[`Cached: `,r]}),(0,G.jsxs)(`span`,{title:`All generated tokens, including reasoning and visible output`,children:[`Completion: `,e.completion_tokens]}),(0,G.jsxs)(`span`,{title:`Reasoning-token subset of completion tokens`,children:[`Reasoning: `,t]}),(0,G.jsxs)(`span`,{title:`Visible output tokens derived as completion minus reasoning`,children:[`Visible: `,n]}),(0,G.jsxs)(`span`,{title:`Input plus completion tokens`,children:[`Total: `,e.total_tokens]}),(0,G.jsxs)(`span`,{title:`Post-first-token decode throughput`,children:[`Decode TPS: `,e.tokens_per_second.toFixed(2)]}),e.time_to_first_token_ms!==void 0&&(0,G.jsxs)(`span`,{title:`Time from slot prefill start to the first sampled token`,children:[`Prefill TTFT: `,e.time_to_first_token_ms.toFixed(0),`ms`]}),s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{title:`Tokens proposed by the draft model`,children:[`MTP Drafted: `,i]}),(0,G.jsxs)(`span`,{title:`Draft-model tokens accepted by the target model`,children:[`MTP Accepted: `,a]}),(0,G.jsxs)(`span`,{title:`Accepted draft tokens divided by drafted tokens`,children:[`MTP Acceptance: `,(o*100).toFixed(2),`%`]}),(0,G.jsxs)(`span`,{title:`Fraction of output positions covered by speculative decoding`,children:[`MTP Coverage: `,((e.draft_coverage??0)*100).toFixed(2),`%`]}),(0,G.jsxs)(`span`,{title:`Whether MTP remained enabled for the request`,children:[`MTP Status: `,e.draft_disable_reason?`disabled (${e.draft_disable_reason})`:`enabled`]})]})]})}function yv(e){return(e.match(/```/g)||[]).length%2==0?e:e+"\n```"}var bv={code({node:e,className:t,children:n,...r}){let i=/language-(\w+)/.exec(t||``);if(!i&&!t)return(0,G.jsx)(`code`,{className:`inline-code`,...r,children:n});let a=i?i[1]:`text`,o=String(n).replace(/\n$/,``);return(0,G.jsx)(`div`,{className:`chat-code-block-wrapper`,children:(0,G.jsx)(ba,{code:o,language:a,collapsible:!0})})},h1:({children:e})=>(0,G.jsx)(`h1`,{className:`markdown-h1`,children:e}),h2:({children:e})=>(0,G.jsx)(`h2`,{className:`markdown-h2`,children:e}),h3:({children:e})=>(0,G.jsx)(`h3`,{className:`markdown-h3`,children:e}),ul:({children:e})=>(0,G.jsx)(`ul`,{className:`markdown-list`,children:e}),ol:({children:e})=>(0,G.jsx)(`ol`,{className:`markdown-list markdown-list-ordered`,children:e}),li:({children:e})=>(0,G.jsx)(`li`,{className:`markdown-list-item`,children:e}),p:({children:e})=>(0,G.jsx)(`p`,{className:`markdown-paragraph`,children:e}),strong:({children:e})=>(0,G.jsx)(`strong`,{className:`markdown-bold`,children:e}),em:({children:e})=>(0,G.jsx)(`em`,{className:`markdown-italic`,children:e}),blockquote:({children:e})=>(0,G.jsx)(`blockquote`,{className:`markdown-blockquote`,children:e}),a:({href:e,children:t})=>(0,G.jsx)(`a`,{href:e,className:`markdown-link`,target:`_blank`,rel:`noopener noreferrer`,children:t})};function xv(e){let t=yv(e);return(0,G.jsx)(dh,{remarkPlugins:[_v],components:bv,children:t})}function Sv({messages:e,setMessages:t,onClear:n,sampling:r,setSampling:i,modelBaseline:a,transport:o,modelVRAM:s,isMoE:c,disabled:l=!1,disabledPlaceholder:u,headerLeft:d,headerRight:f}){let[p,m]=(0,S.useState)(``),[h,g]=(0,S.useState)(!1),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(!1),[x,C]=(0,S.useState)([]),[w,T]=(0,S.useState)(!1),[E,D]=(0,S.useState)(null),[O,k]=(0,S.useState)(``),[A,j]=(0,S.useState)(`none`),M=(0,S.useRef)(null),N=(0,S.useRef)(null),P=(0,S.useRef)(null),F=(0,S.useRef)(null),I=(0,S.useRef)(null),L=(0,S.useRef)(!0),R=(0,S.useRef)(!1),z=(0,S.useRef)(!1),[ee,B]=(0,S.useState)(!1),V=(0,S.useCallback)(e=>{if(e.deltaY<0){let e=N.current;if(!e)return;e.scrollHeight>e.clientHeight&&(z.current=!0,L.current=!1,B(!0))}},[]),te=(0,S.useCallback)(()=>{if(R.current||!z.current)return;let e=N.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<100&&(L.current=!0,B(!1))},[]),H=(0,S.useCallback)(()=>{let e=N.current;e&&(R.current=!0,e.scrollTop=e.scrollHeight,L.current=!0,B(!1),requestAnimationFrame(()=>{R.current=!1}))},[]);(0,S.useEffect)(()=>{if(L.current){let e=N.current;if(!e)return;R.current=!0,e.scrollTop=e.scrollHeight,requestAnimationFrame(()=>{R.current=!1})}},[e]),(0,S.useEffect)(()=>{!h&&!l&&P.current?.focus()},[h,l]),(0,S.useEffect)(()=>()=>{I.current?.()},[]),(0,S.useEffect)(()=>{l&&h&&(I.current?.(),I.current=null,g(!1))},[l,h]);let ne=(0,S.useCallback)((e,t)=>{if(t.length===0)return e;let n=[];e&&n.push({type:`text`,text:e});for(let e of t)if(e.type===`image`)n.push({type:`image_url`,image_url:{url:e.dataUrl}});else if(e.type===`audio`){let t=e.dataUrl.match(/^data:audio\/(\w+);base64,(.+)$/);t&&n.push({type:`input_audio`,input_audio:{data:t[2],format:t[1]}})}return n},[]),re=(0,S.useCallback)(e=>{v(null),g(!0);let n=``,i=``,a,s=[];t(e=>[...e,{role:`assistant`,content:``,reasoning:``}]),I.current=o({messages:e,sampling:r,onMessage:e=>{let r=e.choices?.[0];if(r?.delta?.content&&(n+=r.delta.content),r?.delta?.reasoning_content&&(i+=r.delta.reasoning_content),r?.delta?.tool_calls&&r.delta.tool_calls.length>0)for(let e of r.delta.tool_calls){let t=e.index??(s.length>0?s[s.length-1].index:0),n=s.find(e=>e.index===t);n?(e.id&&!n.id&&(n.id=e.id),e.function?.name&&!n.function.name&&(n.function.name=e.function.name),e.function?.arguments&&(n.function.arguments+=e.function.arguments)):s.push({id:e.id||``,index:t,type:e.type||`function`,function:{name:e.function?.name||``,arguments:e.function?.arguments||``}})}e.usage&&(a=e.usage),t(e=>{let t=[...e];return t[t.length-1]={role:`assistant`,content:n,reasoning:i,usage:a,toolCalls:s.length?s:void 0},t})},onError:e=>{v(e),g(!1)},onComplete:()=>{g(!1)}})},[r,t,o]),ie=n=>{if(n.preventDefault(),!p.trim()&&x.length===0||l||h)return;let i={role:`user`,content:p.trim(),attachments:x.length>0?[...x]:void 0};t(e=>[...e,i]),m(``),C([]);let a=[...r.systemPrompt?[{role:`system`,content:r.systemPrompt}]:[],...e.map(e=>({role:e.role,content:e.attachments?ne(e.content,e.attachments):e.content})),{role:`user`,content:ne(p.trim(),x)}];re(a)},ae=t=>{D(t),k(e[t].content)},oe=()=>{D(null),k(``)},se=e=>{t(t=>t.map((t,n)=>n===e?{...t,content:O,originalContent:t.originalContent??t.content}:t)),D(null),k(``)},ce=e=>{t(t=>t.map((t,n)=>n===e&&t.originalContent!=null?{...t,content:t.originalContent,originalContent:void 0}:t))},le=n=>{if(l||h)return;let i=e.slice(0,n+1).map((e,t)=>t===n?{...e,content:O}:e);t(i),D(null),k(``);let a=[...r.systemPrompt?[{role:`system`,content:r.systemPrompt}]:[],...i.map(e=>({role:e.role,content:e.attachments?ne(e.content,e.attachments):e.content}))];re(a)},ue=()=>{I.current&&(I.current(),I.current=null,g(!1))},de=()=>{I.current&&(I.current(),I.current=null,g(!1)),n(),v(null),C([])},fe=e=>{let t=e.target.files;t&&(Array.from(t).forEach(e=>{let t=new FileReader;t.onload=()=>{let n=t.result,r=e.type.startsWith(`image/`)?`image`:`audio`;C(t=>[...t,{type:r,name:e.name,dataUrl:n}])},t.readAsDataURL(e)}),e.target.value=``)},pe=e=>{C(t=>t.filter((t,n)=>n!==e))};return(0,G.jsxs)(`div`,{className:`chat-container`,children:[(0,G.jsxs)(`div`,{className:`chat-header`,children:[(0,G.jsx)(`div`,{className:`chat-header-left`,children:d}),(0,G.jsxs)(`div`,{className:`chat-header-right`,children:[f,(0,G.jsxs)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>b(!y),children:[`Settings`,pc(r,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,children:`●`})]}),(0,G.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:de,disabled:h||e.length===0,children:`Clear chat`})]})]}),y&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`chat-system-prompt`,children:[(0,G.jsx)(`label`,{children:`System Prompt`}),(0,G.jsx)(`textarea`,{value:r.systemPrompt,onChange:e=>i({systemPrompt:e.target.value}),placeholder:`Enter a system prompt to set the model's behavior...`,className:`chat-system-prompt-input`,rows:3})]}),(0,G.jsxs)(`div`,{className:`chat-settings`,children:[(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`maxTokens`,r.maxTokens,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`max_tokens`,after:Z(`maxTokens`,r.maxTokens,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`maxTokens`,a)}`,children:`●`}),children:`Max Tokens`}),(0,G.jsx)(`input`,{type:`number`,value:r.maxTokens,onChange:e=>i({maxTokens:Number(e.target.value)}),min:1,max:32768})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`temperature`,r.temperature,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`temperature`,after:Z(`temperature`,r.temperature,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`temperature`,a)}`,children:`●`}),children:`Temperature`}),(0,G.jsx)(`input`,{type:`number`,value:r.temperature,onChange:e=>i({temperature:Number(e.target.value)}),min:0,max:2,step:.1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`topP`,r.topP,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`top_p`,after:Z(`topP`,r.topP,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`topP`,a)}`,children:`●`}),children:`Top P`}),(0,G.jsx)(`input`,{type:`number`,value:r.topP,onChange:e=>i({topP:Number(e.target.value)}),min:0,max:1,step:.05})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`topK`,r.topK,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`top_k`,after:Z(`topK`,r.topK,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`topK`,a)}`,children:`●`}),children:`Top K`}),(0,G.jsx)(`input`,{type:`number`,value:r.topK,onChange:e=>i({topK:Number(e.target.value)}),min:1,max:100})]}),(0,G.jsxs)(`div`,{className:`chat-setting chat-setting-grammar`,children:[(0,G.jsx)(`label`,{children:`Grammar`}),(0,G.jsxs)(`select`,{value:A,onChange:e=>{let t=e.target.value;j(t),i({grammar:``})},children:[(0,G.jsx)(`option`,{value:`none`,children:`None`}),(0,G.jsx)(`option`,{value:`custom`,children:`Custom`})]})]}),(0,G.jsx)(`div`,{className:`chat-setting chat-setting-button`,children:(0,G.jsxs)(`button`,{type:`button`,className:`chat-advanced-toggle`,onClick:()=>T(!w),children:[`Advanced `,w?`▲`:`▼`,mc(r,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,children:`●`})]})}),(0,G.jsx)(`div`,{className:`chat-setting chat-setting-button`,children:pc(r,a)&&a&&(0,G.jsx)(`button`,{type:`button`,className:`chat-reset-defaults`,onClick:()=>i(a),title:`Reset all sampling values to model defaults`,children:`Reset to default`})})]}),A===`custom`&&(0,G.jsx)(`div`,{className:`chat-grammar-editor`,children:(0,G.jsx)(`textarea`,{value:r.grammar,onChange:e=>i({grammar:e.target.value}),rows:4,placeholder:`Enter GBNF grammar...`,className:`chat-system-prompt-input`,style:{fontFamily:`monospace`,fontSize:`12px`}})}),w&&(0,G.jsx)(`div`,{className:`chat-settings`,children:(0,G.jsxs)(`div`,{className:`chat-advanced-settings`,children:[(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`minP`,r.minP,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`min_p`,after:Z(`minP`,r.minP,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`minP`,a)}`,children:`●`}),children:`Min P`}),(0,G.jsx)(`input`,{type:`number`,value:r.minP,onChange:e=>i({minP:Number(e.target.value)}),min:0,max:1,step:.01})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`repeatPenalty`,r.repeatPenalty,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`repeat_penalty`,after:Z(`repeatPenalty`,r.repeatPenalty,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`repeatPenalty`,a)}`,children:`●`}),children:`Repeat Penalty`}),(0,G.jsx)(`input`,{type:`number`,value:r.repeatPenalty,onChange:e=>i({repeatPenalty:Number(e.target.value)}),min:0,max:2,step:.1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`repeatLastN`,r.repeatLastN,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`repeat_last_n`,after:Z(`repeatLastN`,r.repeatLastN,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`repeatLastN`,a)}`,children:`●`}),children:`Repeat Last N`}),(0,G.jsx)(`input`,{type:`number`,value:r.repeatLastN,onChange:e=>i({repeatLastN:Number(e.target.value)}),min:-1,max:512})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`frequencyPenalty`,r.frequencyPenalty,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`frequency_penalty`,after:Z(`frequencyPenalty`,r.frequencyPenalty,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`frequencyPenalty`,a)}`,children:`●`}),children:`Frequency Penalty`}),(0,G.jsx)(`input`,{type:`number`,value:r.frequencyPenalty,onChange:e=>i({frequencyPenalty:Number(e.target.value)}),min:0,max:2,step:.1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`presencePenalty`,r.presencePenalty,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`presence_penalty`,after:Z(`presencePenalty`,r.presencePenalty,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`presencePenalty`,a)}`,children:`●`}),children:`Presence Penalty`}),(0,G.jsx)(`input`,{type:`number`,value:r.presencePenalty,onChange:e=>i({presencePenalty:Number(e.target.value)}),min:0,max:2,step:.1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`dryMultiplier`,r.dryMultiplier,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`dry_multiplier`,after:Z(`dryMultiplier`,r.dryMultiplier,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`dryMultiplier`,a)}`,children:`●`}),children:`DRY Multiplier`}),(0,G.jsx)(`input`,{type:`number`,value:r.dryMultiplier,onChange:e=>i({dryMultiplier:Number(e.target.value)}),min:0,step:.1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`dryBase`,r.dryBase,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`dry_base`,after:Z(`dryBase`,r.dryBase,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`dryBase`,a)}`,children:`●`}),children:`DRY Base`}),(0,G.jsx)(`input`,{type:`number`,value:r.dryBase,onChange:e=>i({dryBase:Number(e.target.value)}),min:1,step:.05})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`dryAllowedLen`,r.dryAllowedLen,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`dry_allowed_length`,after:Z(`dryAllowedLen`,r.dryAllowedLen,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`dryAllowedLen`,a)}`,children:`●`}),children:`DRY Allowed Length`}),(0,G.jsx)(`input`,{type:`number`,value:r.dryAllowedLen,onChange:e=>i({dryAllowedLen:Number(e.target.value)}),min:0})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`dryPenaltyLast`,r.dryPenaltyLast,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`dry_penalty_last_n`,after:Z(`dryPenaltyLast`,r.dryPenaltyLast,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`dryPenaltyLast`,a)}`,children:`●`}),children:`DRY Penalty Last N`}),(0,G.jsx)(`input`,{type:`number`,value:r.dryPenaltyLast,onChange:e=>i({dryPenaltyLast:Number(e.target.value)}),min:-1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`xtcProbability`,r.xtcProbability,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`xtc_probability`,after:Z(`xtcProbability`,r.xtcProbability,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`xtcProbability`,a)}`,children:`●`}),children:`XTC Probability`}),(0,G.jsx)(`input`,{type:`number`,value:r.xtcProbability,onChange:e=>i({xtcProbability:Number(e.target.value)}),min:0,max:1,step:.01})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`xtcThreshold`,r.xtcThreshold,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`xtc_threshold`,after:Z(`xtcThreshold`,r.xtcThreshold,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`xtcThreshold`,a)}`,children:`●`}),children:`XTC Threshold`}),(0,G.jsx)(`input`,{type:`number`,value:r.xtcThreshold,onChange:e=>i({xtcThreshold:Number(e.target.value)}),min:0,max:1,step:.01})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`xtcMinKeep`,r.xtcMinKeep,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`xtc_min_keep`,after:Z(`xtcMinKeep`,r.xtcMinKeep,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`xtcMinKeep`,a)}`,children:`●`}),children:`XTC Min Keep`}),(0,G.jsx)(`input`,{type:`number`,value:r.xtcMinKeep,onChange:e=>i({xtcMinKeep:Number(e.target.value)}),min:1})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`enableThinking`,r.enableThinking,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`enable_thinking`,after:Z(`enableThinking`,r.enableThinking,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`enableThinking`,a)}`,children:`●`}),children:`Enable Thinking`}),(0,G.jsxs)(`select`,{value:r.enableThinking,onChange:e=>i({enableThinking:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:`Default`}),(0,G.jsx)(`option`,{value:`true`,children:`Enabled`}),(0,G.jsx)(`option`,{value:`false`,children:`Disabled`})]})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`reasoningEffort`,r.reasoningEffort,a)?`chat-setting-changed`:``}`,children:[(0,G.jsx)(X,{tooltipKey:`reasoning_effort`,after:Z(`reasoningEffort`,r.reasoningEffort,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`reasoningEffort`,a)}`,children:`●`}),children:`Reasoning Effort`}),(0,G.jsxs)(`select`,{value:r.reasoningEffort,onChange:e=>i({reasoningEffort:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:`Default`}),(0,G.jsx)(`option`,{value:`low`,children:`Low`}),(0,G.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,G.jsx)(`option`,{value:`high`,children:`High`})]})]}),(0,G.jsxs)(`div`,{className:`chat-setting ${Z(`topLogprobs`,r.topLogprobs,a)?`chat-setting-changed`:``}`,children:[(0,G.jsxs)(`label`,{children:[`Top Logprobs`,Z(`topLogprobs`,r.topLogprobs,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`topLogprobs`,a)}`,children:`●`})]}),(0,G.jsx)(`input`,{type:`number`,value:r.topLogprobs,onChange:e=>i({topLogprobs:Number(e.target.value)}),min:0,max:20})]}),(0,G.jsx)(`div`,{className:`chat-setting chat-setting-checkbox ${Z(`includeUsage`,r.includeUsage,a)?`chat-setting-changed`:``}`,children:(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:r.includeUsage,onChange:e=>i({includeUsage:e.target.checked})}),`Include Usage`,Z(`includeUsage`,r.includeUsage,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`includeUsage`,a)}`,children:`●`})]})}),(0,G.jsx)(`div`,{className:`chat-setting chat-setting-checkbox ${Z(`logprobs`,r.logprobs,a)?`chat-setting-changed`:``}`,children:(0,G.jsxs)(`label`,{children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:r.logprobs,onChange:e=>i({logprobs:e.target.checked})}),`Logprobs`,Z(`logprobs`,r.logprobs,a)&&(0,G.jsx)(`span`,{className:`chat-setting-default`,title:`Default: ${dc(`logprobs`,a)}`,children:`●`})]})})]})})]}),c&&s&&(0,G.jsxs)(`details`,{className:`chat-moe-info`,children:[(0,G.jsxs)(`summary`,{style:{fontWeight:600,fontSize:`13px`,cursor:`pointer`,padding:`6px 12px`,background:`var(--color-gray-50)`,borderRadius:`6px`,margin:`0 0 8px`,listStyle:`revert`},children:[`🧩 MoE Model`,s.moe&&(0,G.jsxs)(`span`,{style:{fontWeight:400,fontSize:`12px`,color:`var(--color-text-secondary)`,marginLeft:`6px`},children:[`(`,s.moe.expert_count,` experts, top-`,s.moe.expert_used_count,` active`,s.moe.has_shared_experts?`, shared experts`:``,`)`]})]}),(0,G.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,padding:`12px`,background:`var(--color-gray-50)`,borderRadius:`6px`,margin:`0 0 8px`},children:[s.weights&&(0,G.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`4px 16px`,fontSize:`12px`,color:`var(--color-text-secondary)`},children:[(0,G.jsx)(`span`,{children:`Always-active weights (GPU):`}),(0,G.jsx)(`span`,{style:{fontWeight:500},children:J(s.always_active_gpu_bytes??0)}),(s.always_active_cpu_bytes??0)>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Always-active weights (CPU):`}),(0,G.jsx)(`span`,{style:{fontWeight:500},children:J(s.always_active_cpu_bytes??0)})]}),(s.expert_gpu_bytes??0)>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Expert weights (GPU):`}),(0,G.jsx)(`span`,{style:{fontWeight:500},children:J(s.expert_gpu_bytes??0)})]}),(s.expert_cpu_bytes??0)>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Expert weights (CPU):`}),(0,G.jsx)(`span`,{style:{fontWeight:500},children:J(s.expert_cpu_bytes??0)})]}),(0,G.jsx)(`span`,{children:`KV cache:`}),(0,G.jsx)(`span`,{style:{fontWeight:500},children:J(s.slot_memory)}),(s.compute_buffer_est??0)>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{children:`Compute buffer (est.):`}),(0,G.jsxs)(`span`,{style:{fontWeight:500},children:[`~`,J(s.compute_buffer_est??0)]})]}),(0,G.jsx)(`span`,{style:{fontWeight:600},children:`Total estimated VRAM:`}),(0,G.jsx)(`span`,{style:{fontWeight:600},children:J(s.total_vram)})]}),!s.weights&&s.total_vram>0&&(0,G.jsxs)(`div`,{style:{fontSize:`12px`,color:`var(--color-text-secondary)`},children:[`Total VRAM: `,J(s.total_vram)]}),(0,G.jsxs)(`div`,{style:{fontSize:`11px`,color:`var(--color-text-secondary)`,lineHeight:1.4,marginTop:`4px`},children:[`💡 `,aa.moeTipBatch,` `,aa.moeTipFlashAttention]})]})]}),_&&(0,G.jsx)(`div`,{className:`alert alert-error`,children:_}),(0,G.jsxs)(`div`,{className:`chat-messages-wrapper`,children:[(0,G.jsxs)(`div`,{className:`chat-messages`,ref:N,onScroll:te,onWheel:V,children:[e.length===0&&(0,G.jsxs)(`div`,{className:`chat-empty`,children:[(0,G.jsx)(`p`,{children:u||`Select a model and start chatting`}),(0,G.jsx)(`p`,{className:`chat-empty-hint`,children:`Type a message below to begin`})]}),e.map((t,n)=>(0,G.jsxs)(`div`,{className:`chat-message chat-message-${t.role}`,children:[(0,G.jsxs)(`div`,{className:`chat-message-header`,children:[(0,G.jsx)(`span`,{children:t.role===`user`?`USER`:`MODEL`}),!h&&E===null&&(0,G.jsxs)(`span`,{className:`chat-header-actions`,children:[t.originalContent!=null&&(0,G.jsx)(`button`,{className:`chat-edit-btn`,onClick:()=>ce(n),title:`Revert to original message`,children:`Undo`}),(0,G.jsx)(`button`,{className:`chat-edit-btn`,onClick:()=>ae(n),title:`Edit message`,children:`Edit`})]})]}),t.attachments&&t.attachments.length>0&&(0,G.jsx)(`div`,{className:`chat-message-attachments`,children:t.attachments.map((e,t)=>(0,G.jsx)(`div`,{className:`chat-attachment-preview`,children:e.type===`image`?(0,G.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`chat-attachment-image`}):(0,G.jsx)(`div`,{className:`chat-attachment-audio`,children:(0,G.jsxs)(`span`,{children:[`🔊 `,e.name]})})},t))}),t.reasoning&&(0,G.jsxs)(`details`,{className:`chat-message-reasoning`,open:h&&n===e.length-1,children:[(0,G.jsxs)(`summary`,{className:`chat-reasoning-summary`,children:[`Reasoning (`,t.reasoning.length.toLocaleString(),` chars)`]}),(0,G.jsx)(`div`,{className:`chat-reasoning-content`,children:xv(t.reasoning)})]}),(0,G.jsx)(`div`,{className:`chat-message-content`,children:E===n?(0,G.jsxs)(`div`,{className:`chat-edit-area`,children:[(0,G.jsx)(`textarea`,{className:`chat-edit-textarea`,value:O,onChange:e=>k(e.target.value),rows:Math.max(4,O.split(` `).length),autoFocus:!0}),(0,G.jsxs)(`div`,{className:`chat-edit-actions`,children:[(0,G.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>t.role===`assistant`?se(n):le(n),disabled:!O.trim(),children:t.role===`assistant`?`Save`:`Send`}),(0,G.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:oe,children:`Cancel`})]})]}):t.content?xv(t.content):h&&n===e.length-1?`...`:``}),t.toolCalls&&t.toolCalls.length>0&&(0,G.jsx)(`div`,{className:`chat-message-tool-calls`,children:t.toolCalls.map(e=>(0,G.jsxs)(`div`,{className:`chat-tool-call`,children:[`Tool call `,e.id,`: `,e.function.name,`(`,e.function.arguments,`)`]},e.id))}),t.usage&&(0,G.jsx)(vv,{usage:t.usage})]},n)),(0,G.jsx)(`div`,{ref:M})]}),ee&&(0,G.jsx)(`button`,{className:`chat-scroll-bottom-btn`,onClick:H,title:`Scroll to bottom`,children:`↓`})]}),(0,G.jsx)(`form`,{onSubmit:ie,className:`chat-input-form`,children:(0,G.jsxs)(`div`,{className:`chat-input-row`,children:[x.length>0&&(0,G.jsx)(`div`,{className:`chat-attachments-bar`,children:x.map((e,t)=>(0,G.jsxs)(`div`,{className:`chat-attachment-chip`,children:[e.type===`image`?(0,G.jsx)(`img`,{src:e.dataUrl,alt:e.name,className:`chat-attachment-chip-image`}):(0,G.jsx)(`span`,{className:`chat-attachment-chip-audio`,children:`🔊`}),(0,G.jsx)(`span`,{className:`chat-attachment-chip-name`,children:e.name}),(0,G.jsx)(`button`,{type:`button`,className:`chat-attachment-chip-remove`,onClick:()=>pe(t),children:`×`})]},t))}),(0,G.jsx)(`textarea`,{ref:P,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ie(e))},placeholder:l?u||`Chat is disabled`:`Type your message... (Enter to send, Shift+Enter for new line)`,disabled:h||l,className:`chat-input`,rows:3}),(0,G.jsxs)(`div`,{className:`chat-input-buttons`,children:[(0,G.jsx)(`input`,{ref:F,type:`file`,accept:`image/*,audio/*`,multiple:!0,onChange:fe,style:{display:`none`}}),(0,G.jsx)(`button`,{type:`button`,className:`btn btn-secondary chat-attach-btn`,onClick:()=>F.current?.click(),disabled:h||l,children:`📎`}),h?(0,G.jsx)(`button`,{type:`button`,className:`btn btn-danger`,onClick:ue,children:`Stop`}):(0,G.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,disabled:!p.trim()&&x.length===0||l,children:`Send`})]})]})})]})}var Cv=`kronk_chat_history_enabled`;function wv(){let{models:e,loading:t,loadModels:n}=Ln(),{messages:r,setMessages:i,clearMessages:a}=ac(),{sampling:o,setSampling:s}=uc(),{saveChat:c}=bc(),[l,u]=(0,S.useState)(()=>localStorage.getItem(`kronk_chat_model`)||``),[d,f]=(0,S.useState)(!1),[p,m]=(0,S.useState)(()=>{let e=localStorage.getItem(Cv);return e===null||e===`true`}),[h,g]=(0,S.useState)(null),[_,v]=(0,S.useState)(null),[y,b]=(0,S.useState)(void 0),x=eo(h,y),[C,w]=(0,S.useState)(null),T=(0,S.useRef)(null),[E,D]=(0,S.useState)(void 0),O=(0,S.useCallback)(()=>{m(e=>{let t=!e;try{localStorage.setItem(Cv,String(t))}catch{}return t})},[]),k=(0,S.useCallback)(e=>({temperature:e.temperature??sc.temperature,topK:e.top_k??sc.topK,topP:e.top_p??sc.topP,minP:e.min_p??sc.minP,presencePenalty:e.presence_penalty??sc.presencePenalty,maxTokens:e.max_tokens??sc.maxTokens,repeatPenalty:e.repeat_penalty??sc.repeatPenalty,repeatLastN:e.repeat_last_n??sc.repeatLastN,dryMultiplier:e.dry_multiplier??sc.dryMultiplier,dryBase:e.dry_base??sc.dryBase,dryAllowedLen:e.dry_allowed_length??sc.dryAllowedLen,dryPenaltyLast:e.dry_penalty_last_n??sc.dryPenaltyLast,xtcProbability:e.xtc_probability??sc.xtcProbability,xtcThreshold:e.xtc_threshold??sc.xtcThreshold,xtcMinKeep:e.xtc_min_keep??sc.xtcMinKeep,frequencyPenalty:e.frequency_penalty??sc.frequencyPenalty,enableThinking:e.enable_thinking??sc.enableThinking,reasoningEffort:e.reasoning_effort??sc.reasoningEffort,includeUsage:sc.includeUsage,logprobs:sc.logprobs,topLogprobs:sc.topLogprobs,grammar:e.grammar??sc.grammar,systemPrompt:sc.systemPrompt}),[]),A=(0,S.useCallback)(e=>{if(e){let t=k(e),n=t.grammar?.endsWith(`.grm`)?{...t,grammar:``}:t;s(n),w(n)}else w(null)},[s,k]);(0,S.useEffect)(()=>{n()},[n]),(0,S.useEffect)(()=>{if(e?.data&&e.data.length>0){let t=e.data.filter(e=>{let t=e.id.toLowerCase();return!t.includes(`embed`)&&!t.includes(`rerank`)});!t.some(e=>e.id===l)&&t.length>0&&u(t[0].id)}},[e,l]),(0,S.useEffect)(()=>{if(!l){g(null),v(null),b(void 0),D(void 0);return}g(null),v(null),b(void 0),D(void 0);let e=!1;return W.showModel(l).then(t=>{e||(g(t.vram||null),v(t.template??``),b(t.metadata),D(t.model_config?.[`draft-model`]?.[`model-id`]),T.current!==l&&A(t.model_config?.[`sampling-parameters`]),T.current=l,localStorage.setItem(`kronk_chat_model`,l))}).catch(()=>{e||(g(null),v(null),b(void 0),D(void 0))}),()=>{e=!0}},[l,A]);let j=(0,S.useCallback)(({messages:e,sampling:t,onMessage:n,onError:r,onComplete:i})=>W.streamChat({model:l,messages:e,max_tokens:t.maxTokens,temperature:t.temperature,top_p:t.topP,top_k:t.topK,min_p:t.minP,presence_penalty:t.presencePenalty,repeat_penalty:t.repeatPenalty,repeat_last_n:t.repeatLastN,dry_multiplier:t.dryMultiplier,dry_base:t.dryBase,dry_allowed_length:t.dryAllowedLen,dry_penalty_last_n:t.dryPenaltyLast,xtc_probability:t.xtcProbability,xtc_threshold:t.xtcThreshold,xtc_min_keep:t.xtcMinKeep,frequency_penalty:t.frequencyPenalty,enable_thinking:t.enableThinking||void 0,reasoning_effort:t.reasoningEffort||void 0,stream_options:{include_usage:t.includeUsage},logprobs:t.logprobs,top_logprobs:t.topLogprobs,grammar:t.grammar||void 0},n,r,i),[l]),M=(0,S.useCallback)(()=>{p&&r.length>0&&c(l,r),a()},[p,r,l,c,a]),N=(0,S.useCallback)(e=>{let t=e.map(e=>({role:e.role,content:e.content,reasoning:e.reasoning}));i(t)},[i]),P=(0,S.useCallback)(e=>{let t=e.target.value;r.length>0&&(p&&c(l,r),a()),u(t)},[r,p,l,c,a]);return(0,G.jsxs)(`div`,{className:`chat-layout`,children:[(0,G.jsx)(wc,{isOpen:d,onClose:()=>f(!1),onLoadChat:N}),(0,G.jsx)(Sv,{messages:r,setMessages:i,onClear:M,sampling:o,setSampling:s,modelBaseline:C,transport:j,modelVRAM:h,isMoE:x,disabled:!l,headerLeft:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{children:`Chat`}),(0,G.jsxs)(`div`,{className:`chat-model-selector-group`,children:[(0,G.jsxs)(`select`,{value:l,onChange:P,disabled:t,className:`chat-model-select`,children:[t&&(0,G.jsx)(`option`,{children:`Loading models...`}),!t&&e?.data?.length===0&&(0,G.jsx)(`option`,{children:`No models available`}),e?.data?.filter(e=>{let t=e.id.toLowerCase();return!t.includes(`embed`)&&!t.includes(`rerank`)}).map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.id},e.id))]}),(E||_!==null)&&(0,G.jsxs)(`div`,{className:`chat-model-info`,children:[E&&(0,G.jsxs)(`span`,{className:`chat-draft-label`,title:`Draft model for speculative decoding`,children:[`⚡ `,E]}),_!==null&&(0,G.jsxs)(`span`,{className:`chat-template-label`,title:`Chat template`,children:[`Template: `,_===``?`builtin`:_]})]})]})]}),headerRight:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,className:`chat-history-toggle ${p?`chat-history-toggle-on`:`chat-history-toggle-off`}`,onClick:O,title:p?`Chat history auto-save is on`:`Chat history auto-save is off`,children:[`Chat History: `,p?`ON`:`OFF`]}),(0,G.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:()=>f(!d),children:`History`})]})})]})}var Tv=`kronk_decision_model`,Ev={route:{type:`choice`,instructions:`Which team should handle this request?`,criteria:{billing:`Payments, invoices, refunds, and duplicate charges`,technical_support:`Product bugs and technical problems`,sales:`Plans, pricing, and new purchases`}},urgency:{type:`score`,instructions:`How urgent is this request?`,criteria:[`not urgent`,`normal`,`urgent`,`critical`]},requires_human:{type:`noul`,instructions:`Should a human review this request?`}},Dv={route:`Route`,urgency:`Urgency`,requires_human:`Human review`};function Ov(e=0){return`${(e*100).toFixed(1)}%`}function kv({probabilities:e}){if(!e)return null;let t=Object.entries(e).sort((e,t)=>t[1]-e[1]);return(0,G.jsx)(`div`,{className:`decision-probabilities`,children:t.map(([e,t])=>(0,G.jsxs)(`div`,{className:`decision-probability`,children:[(0,G.jsxs)(`div`,{className:`decision-probability-label`,children:[(0,G.jsx)(`span`,{children:e.replaceAll(`_`,` `)}),(0,G.jsx)(`strong`,{children:Ov(t)})]}),(0,G.jsx)(`div`,{className:`decision-probability-track`,children:(0,G.jsx)(`span`,{style:{width:`${Math.max(0,Math.min(100,t*100))}%`}})})]},e))})}function Av({id:e,answer:t}){let n=``,r=``;switch(t.type){case`choice`:n=t.choice?.replaceAll(`_`,` `)??`No choice`,r=`${Ov(t.confidence)} confidence`;break;case`score`:{n=t.score?.toFixed(2)??`No score`;let e=t.legend?.[String(Math.round(t.score??0))];r=typeof e==`string`?e:`${Ov(t.confidence)} confidence`;break}case`noul`:n=Ov(t.noul),r=(t.noul??0)>=.5?`Human review recommended`:`Automation recommended`}return(0,G.jsxs)(`article`,{className:`decision-answer-card`,children:[(0,G.jsxs)(`div`,{className:`decision-answer-heading`,children:[(0,G.jsx)(`span`,{className:`decision-answer-type decision-answer-type-${t.type}`,children:t.type}),(0,G.jsx)(`h4`,{children:Dv[e]??e})]}),(0,G.jsx)(`div`,{className:`decision-answer-primary`,children:n}),(0,G.jsx)(`p`,{children:r}),(0,G.jsx)(kv,{probabilities:t.probabilities})]})}function jv(){let[e,t]=(0,S.useState)(()=>localStorage.getItem(Tv)||``),[n,r]=(0,S.useState)([]),[i,a]=(0,S.useState)(new Map),[o,s]=(0,S.useState)(!0),[c,l]=(0,S.useState)(null),[u,d]=(0,S.useState)(`I was charged twice and need this fixed today.`),[f,p]=(0,S.useState)(`business`),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(null),[v,y]=(0,S.useState)(null),b=(0,S.useMemo)(()=>Object.entries(Ev),[]),x=n.find(t=>t.id===e),C=i.get(e),w=C===`loaded`,T=x?.downloaded===!0&&x.validated===!0,E=(w||T)&&u.trim()!==``&&!m;(0,S.useEffect)(()=>{let e=!1;return Promise.allSettled([W.listCatalog(),W.listRunningModels()]).then(([n,i])=>{if(e)return;if(n.status===`rejected`)throw n.reason;let o=n.value.filter(e=>e.capabilities?.decision===!0||e.capabilities?.endpoint===`decision`);r(o),i.status===`fulfilled`&&a(new Map(i.value.map(e=>[e.id,e.status]))),t(e=>o.some(t=>t.id===e)?e:o[0]?.id??``)}).catch(t=>{e||l(t.message)}).finally(()=>{e||s(!1)}),()=>{e=!0}},[]);let D=e=>{t(e),localStorage.setItem(Tv,e),_(null),y(null)};return(0,G.jsxs)(`div`,{className:`decision-page`,children:[(0,G.jsxs)(`div`,{className:`page-header`,children:[(0,G.jsx)(`h2`,{children:`Decision`}),(0,G.jsx)(`p`,{children:`Evaluate structured questions against shared state with an installed decision model.`})]}),(0,G.jsxs)(`div`,{className:`decision-grid`,children:[(0,G.jsxs)(`form`,{className:`decision-card decision-form`,onSubmit:async t=>{if(t.preventDefault(),!E)return;let n=e.trim();localStorage.setItem(Tv,n),h(!0),_(null),y(null);try{let e=await W.decide({model:n,state:{customer_message:u.trim(),account_tier:f},questions:Ev});y(e),a(e=>new Map(e).set(n,`loaded`))}catch(e){_(e.message)}finally{h(!1)}},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`decision-eyebrow`,children:`Customer support example`}),(0,G.jsx)(`h3`,{children:`Request state`})]}),(0,G.jsx)(X,{htmlFor:`decision-model`,tooltipKey:`decisionModel`,children:`Model`}),(0,G.jsxs)(`select`,{id:`decision-model`,className:`form-select`,value:e,onChange:e=>D(e.target.value),disabled:o||m||n.length===0,children:[o&&(0,G.jsx)(`option`,{value:``,children:`Loading decision models…`}),!o&&n.length===0&&(0,G.jsx)(`option`,{value:``,children:`No decision models in catalog`}),n.map(e=>(0,G.jsxs)(`option`,{value:e.id,children:[e.id,i.get(e.id)===`loaded`?` — loaded`:e.downloaded?e.validated?` — ready`:` — validation failed`:` — download required`]},e.id))]}),(0,G.jsx)(`div`,{className:`decision-model-status`,"aria-live":`polite`,children:o?(0,G.jsx)(`span`,{children:`Checking model availability…`}):c?(0,G.jsxs)(`span`,{className:`decision-model-status-error`,children:[`Unable to verify model availability: `,c]}):x?w?(0,G.jsx)(`span`,{className:`decision-model-status-ready`,children:`● Loaded and ready`}):C===`loading`?(0,G.jsx)(`span`,{className:`decision-model-status-ready`,children:`● Loading into memory`}):T?(0,G.jsx)(`span`,{className:`decision-model-status-ready`,children:`● Downloaded and ready`}):x.downloaded?(0,G.jsxs)(`span`,{className:`decision-model-status-required`,children:[`This model did not pass integrity validation. Re-download it from `,(0,G.jsx)(`strong`,{children:`Kronk → Catalog`}),` before evaluating a decision.`]}):(0,G.jsxs)(`span`,{className:`decision-model-status-required`,children:[`Download this model from `,(0,G.jsx)(`strong`,{children:`Kronk → Catalog`}),` before evaluating a decision.`]}):(0,G.jsx)(`span`,{className:`decision-model-status-required`,children:`No decision models are available in the catalog.`})}),(0,G.jsx)(X,{htmlFor:`decision-message`,tooltipKey:`decisionState`,children:`Customer message`}),(0,G.jsx)(`textarea`,{id:`decision-message`,className:`decision-message`,rows:5,value:u,onChange:e=>d(e.target.value),disabled:m}),(0,G.jsx)(X,{htmlFor:`decision-account-tier`,tooltipKey:`decisionAccountTier`,children:`Account tier`}),(0,G.jsxs)(`select`,{id:`decision-account-tier`,className:`form-select`,value:f,onChange:e=>p(e.target.value),disabled:m,children:[(0,G.jsx)(`option`,{value:`free`,children:`Free`}),(0,G.jsx)(`option`,{value:`pro`,children:`Pro`}),(0,G.jsx)(`option`,{value:`business`,children:`Business`}),(0,G.jsx)(`option`,{value:`enterprise`,children:`Enterprise`})]}),(0,G.jsx)(`button`,{className:`btn btn-primary decision-submit`,type:`submit`,disabled:!E,children:m?`Evaluating…`:`Evaluate decision`})]}),(0,G.jsxs)(`section`,{className:`decision-card decision-questions`,"aria-labelledby":`decision-questions-title`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`decision-eyebrow`,children:`Fixed for this example`}),(0,G.jsx)(`h3`,{id:`decision-questions-title`,children:`Questions`})]}),b.map(([e,t])=>(0,G.jsxs)(`div`,{className:`decision-question`,children:[(0,G.jsxs)(`div`,{className:`decision-question-heading`,children:[(0,G.jsx)(`strong`,{children:Dv[e]}),(0,G.jsx)(`span`,{children:t.type})]}),(0,G.jsx)(`p`,{children:t.instructions}),t.type===`choice`&&!Array.isArray(t.criteria)&&(0,G.jsx)(`div`,{className:`decision-option-list`,children:Object.keys(t.criteria??{}).map(e=>(0,G.jsx)(`span`,{children:e.replaceAll(`_`,` `)},e))}),t.type===`score`&&Array.isArray(t.criteria)&&(0,G.jsx)(`div`,{className:`decision-scale`,children:t.criteria.map((e,t)=>(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`b`,{children:t}),String(e)]},String(e)))})]},e))]})]}),g&&(0,G.jsxs)(`div`,{className:`alert alert-error decision-alert`,children:[`Decision failed: `,g]}),(0,G.jsxs)(`section`,{className:`decision-results`,"aria-live":`polite`,children:[(0,G.jsxs)(`div`,{className:`decision-results-header`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`decision-eyebrow`,children:`Model output`}),(0,G.jsx)(`h3`,{children:`Answers`})]}),v&&(0,G.jsxs)(`span`,{children:[v.usage.input_tokens,` input tokens`]})]}),v?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`decision-answer-grid`,children:b.map(([e])=>{let t=v.answers[e];return t?(0,G.jsx)(Av,{id:e,answer:t},e):null})}),(0,G.jsxs)(`details`,{className:`decision-raw`,children:[(0,G.jsx)(`summary`,{children:`Raw response`}),(0,G.jsx)(`pre`,{children:JSON.stringify(v,null,2)})]})]}):(0,G.jsxs)(`div`,{className:`decision-empty`,children:[(0,G.jsx)(`div`,{className:`decision-empty-icon`,children:`◇`}),(0,G.jsx)(`strong`,{children:`No decision yet`}),(0,G.jsx)(`span`,{children:`Run the example to see typed answers and calibrated probabilities.`})]})]})]})}var Mv=[{code:``,label:`Auto-detect`},{code:`en`,label:`English`},{code:`es`,label:`Spanish`},{code:`fr`,label:`French`},{code:`de`,label:`German`},{code:`it`,label:`Italian`},{code:`pt`,label:`Portuguese`},{code:`nl`,label:`Dutch`},{code:`pl`,label:`Polish`},{code:`ru`,label:`Russian`},{code:`uk`,label:`Ukrainian`},{code:`tr`,label:`Turkish`},{code:`ar`,label:`Arabic`},{code:`he`,label:`Hebrew`},{code:`hi`,label:`Hindi`},{code:`ja`,label:`Japanese`},{code:`ko`,label:`Korean`},{code:`zh`,label:`Chinese`},{code:`vi`,label:`Vietnamese`},{code:`th`,label:`Thai`},{code:`id`,label:`Indonesian`},{code:`sv`,label:`Swedish`},{code:`no`,label:`Norwegian`},{code:`da`,label:`Danish`},{code:`fi`,label:`Finnish`},{code:`cs`,label:`Czech`},{code:`el`,label:`Greek`},{code:`ro`,label:`Romanian`},{code:`hu`,label:`Hungarian`}],Nv=30,Pv=`kronk_translator_model`;function Fv(e){return/\.en\b|-en\b/i.test(e)}function Iv(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function Lv(e){if(!isFinite(e)||e<0)return`0s`;let t=Math.floor(e/60),n=e-t*60;return t>0?`${t}m ${n.toFixed(1)}s`:`${n.toFixed(1)}s`}function Rv(e){let t=Math.max(0,Math.round(e*1e3)),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=Math.floor(t%6e4/1e3),a=t%1e3;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)},${String(a).padStart(3,`0`)}`}function zv(e){return Rv(e).replace(`,`,`.`)}function Bv(e){return e.segments.map((e,t)=>`${t+1}\n${Rv(e.start)} --> ${Rv(e.end)}\n${e.text.trim()}\n`).join(` diff --git a/examples/go.mod b/examples/go.mod index a4c7e3483..e34b05539 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -9,7 +9,7 @@ require ( github.com/ardanlabs/kronk v1.32.8 github.com/duckdb/duckdb-go/v2 v2.10506.0 github.com/gen2brain/malgo v0.11.26 - github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b + github.com/hybridgroup/yzma v1.29.1 golang.org/x/image v0.46.0 golang.org/x/sys v0.48.0 ) @@ -30,8 +30,8 @@ require ( github.com/ardanlabs/malina v1.1.5 // indirect github.com/aws/aws-sdk-go-v2 v1.47.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 // indirect - github.com/aws/aws-sdk-go-v2/config v1.33.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/config v1.33.7 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.20.7 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.4 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.4 // indirect @@ -40,12 +40,12 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.5 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.10.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.38.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.51.1 // indirect - github.com/aws/smithy-go v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.10.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.38.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.51.2 // indirect + github.com/aws/smithy-go v1.28.4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect @@ -69,13 +69,13 @@ require ( github.com/google/flatbuffers v25.12.19+incompatible // indirect github.com/google/s2a-go v0.1.11 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.22 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect github.com/googleapis/gax-go/v2 v2.26.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.31.0 // indirect github.com/hajimehoshi/go-mp3 v0.3.4 // indirect github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.8.9 // indirect + github.com/hashicorp/go-getter v1.8.10 // indirect github.com/hashicorp/go-version v1.9.0 // indirect github.com/icza/bitio v1.1.0 // indirect github.com/icza/mjpeg v0.0.0-20230330134156-38318e5ab8f4 // indirect diff --git a/examples/go.sum b/examples/go.sum index 3685af514..5be6c8888 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -42,10 +42,10 @@ github.com/aws/aws-sdk-go-v2 v1.47.1 h1:uOIZnp4PK3ZhKI0dNrJrhTEsLxbpXHTAJlwoS1pv github.com/aws/aws-sdk-go-v2 v1.47.1/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 h1:GPRlPwz40I2B2VrBEASOA3Bi77NyeqejNLkifosX0rs= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20/go.mod h1:g7PNzKcsOKWb4fkSRBA7BZVAS6Y8IcxzN+nRohhQ1Q8= -github.com/aws/aws-sdk-go-v2/config v1.33.6 h1:MBjkSTLczek/UgiK+EYPIoRTqE7gP8vtW3OFbFo7Nug= -github.com/aws/aws-sdk-go-v2/config v1.33.6/go.mod h1:grRAFzdAZJrwcbasJRg2MPvIrVjtlfXllHssN6+E1JE= -github.com/aws/aws-sdk-go-v2/credentials v1.20.6 h1:NpAFXCU7NzXNkdGK3zQTtsRJ+3v9tZQV0xcdRw8uBdw= -github.com/aws/aws-sdk-go-v2/credentials v1.20.6/go.mod h1:mcZCoiPnyMvP8VMNbygNX5lLqSlkYJIMPODylQMurOk= +github.com/aws/aws-sdk-go-v2/config v1.33.7 h1:vgG8uuhm7vNsxr6BsXNG+Ciesh9iLdNPzarAAu/dB6A= +github.com/aws/aws-sdk-go-v2/config v1.33.7/go.mod h1:5KWNY38altxnd5cxcNoOTrFtJ7asFEiCiWfb2m+M2pE= +github.com/aws/aws-sdk-go-v2/credentials v1.20.7 h1:mit8rRVnmt+wvT4U6putiWSlwe3eKD2n6ElgyfcP/Mw= +github.com/aws/aws-sdk-go-v2/credentials v1.20.7/go.mod h1:/2pPi2qhPug21z6l3M0+AKUqAT1zn2MhRCtnQv8R5Zg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1 h1:8gALAAmacnIXh+z6VkdDanv4/IkG5APdg4DZLDTmLog= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1/go.mod h1:Z7IJhJU+poOdJjUR2wpyY21ossQ1XS/R3Lk9Msq5kM4= github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.4 h1:CLq4+8UHCI+ZZYl/EuJxXovaIVN2xeeT8JV+dsApQ5E= @@ -62,18 +62,18 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4 h1:29SvnfGhX github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4/go.mod h1:wm04I5DMuNVvZHFe/dHnUxincvNbbK7AiNBbYsQivek= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4 h1:pPiWfgeNxqluKEph7hvU88kuGKBPOWzO+Dk9t2zqqNs= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4/go.mod h1:YlwGoIUDG/3kBQbdNOVs/xKZ9J01G8e/6D1mRBj9uTk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0 h1:VMAdYqr4Jn/8ATs9BHC5riwrs0d6m1Z2ohFriSwZwm0= -github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0/go.mod h1:9APRWGLFITKD+xzWSIyT9V7QV4bNlEuIieWlzXgGFlI= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.1 h1:DzCCWLzcIRQ77F3DEUljud7bEjTgFOIKXP52NmVRyhU= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.1/go.mod h1:xpo/geVldu8payT375WekctUzopG/hBU7miiqItMUlw= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.1 h1:Umtl/0YZhng4xndfW3lKJrYYP7NLEjI6bGXVomwLcs0= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.1/go.mod h1:rRD/dnm7q0HYE/I5TMaPgkWyyUGLcwuxHLABsLnQ3e0= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1 h1:orIWdNiLgzrhu/11RcPPKO/SBzUUymbUQuZbSPImghg= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1/go.mod h1:skwM/xsbR/1ReUTesv9BhpJp1VjajR7DWQnuVLwiXsQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.51.1 h1:0HOqZXRvMytH6bFHVIc0oJX07sZjfhz0zXtjs6gdE8s= -github.com/aws/aws-sdk-go-v2/service/sts v1.51.1/go.mod h1:26zA0GhDrLo+yiLI2yXWxqB1PdsShfLikoI7GOEgugM= -github.com/aws/smithy-go v1.28.2 h1:myhcykQcatTul2B/zITjDk203G7t0awUAs1hVry5Bvg= -github.com/aws/smithy-go v1.28.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1 h1:9T6eO8/WXhij4PQaa2WaYsdekSCmT9Hw66Pw0S8do0Q= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1/go.mod h1:9APRWGLFITKD+xzWSIyT9V7QV4bNlEuIieWlzXgGFlI= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.2 h1:vrPP4O9VABnquYrDHfU+Fu0Fp6TuzaqPUu9Fh7VBBVY= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.2/go.mod h1:xpo/geVldu8payT375WekctUzopG/hBU7miiqItMUlw= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.2 h1:I8F/K5ahKJ4npqeGBBmMPftQy3/o1A55VRq2eUcP9Ts= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.2/go.mod h1:rRD/dnm7q0HYE/I5TMaPgkWyyUGLcwuxHLABsLnQ3e0= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2 h1:i5nn7Ri5CgFfNRzwlUiZOIIUA+5Vgg+unNEC0PzF1+s= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2/go.mod h1:skwM/xsbR/1ReUTesv9BhpJp1VjajR7DWQnuVLwiXsQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.2 h1:AWSPqynwEJV8J2pl/p7aizCf7a23/NGHR+rK/KLOxi4= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.2/go.mod h1:26zA0GhDrLo+yiLI2yXWxqB1PdsShfLikoI7GOEgugM= +github.com/aws/smithy-go v1.28.4 h1:vzBmFpcRUtotqGPfmnro2W2Pgg3mk103n9sZhNJY9YU= +github.com/aws/smithy-go v1.28.4/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= @@ -135,8 +135,8 @@ github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.22 h1:NU4XpII6jD+Dxcot94fqjE+AfJoE/lQP9q3faYGzC/c= -github.com/googleapis/enterprise-certificate-proxy v0.3.22/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= github.com/grpc-ecosystem/grpc-gateway/v2 v2.31.0 h1:Bd7KaOxzULLxtZ/K5s1aLbWhR0+5RToO65TXHsf3bqQ= @@ -148,12 +148,12 @@ github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74 h1:mymLUKThnV9wFvogOK8Nns github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74/go.mod h1:Bh9qYL8ehmDxSg14Tk8oxFCP90XHfs6NxV1D84884xA= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.8.9 h1:1AOTMUmz/S/GuqOTE6+bg6nwPXTEbKr3Tc/T/lVS7is= -github.com/hashicorp/go-getter v1.8.9/go.mod h1:qI7vH/m552bXutKe4UkWptOJl4bo2KeO/CSOoh4s0ps= +github.com/hashicorp/go-getter v1.8.10 h1:uufJp+uacA0fSDRxclsHkiE6yUQTKgwv5b25QexgVM8= +github.com/hashicorp/go-getter v1.8.10/go.mod h1:5HyKGCQmT+I3MGAM76vk/fWpktjwxn7xruCUr9CrVuo= github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b h1:aEUm17H2LYxfHaVR3flGG0IKRWEnX1gAPpTWxus/EjM= -github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b/go.mod h1:ovV3WQ5v3X53vqo9Izg/28QHEXaVasW9b4Kgkhk05T0= +github.com/hybridgroup/yzma v1.29.1 h1:i3VjlzfUL4CcbMm232ehHou9RTfeiiaFD+3/21qlAvk= +github.com/hybridgroup/yzma v1.29.1/go.mod h1:ovV3WQ5v3X53vqo9Izg/28QHEXaVasW9b4Kgkhk05T0= github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0= github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= diff --git a/go.mod b/go.mod index 362f7871a..b054ba2d5 100644 --- a/go.mod +++ b/go.mod @@ -11,9 +11,9 @@ require ( github.com/dgraph-io/badger/v4 v4.9.6 github.com/golang-jwt/jwt/v5 v5.3.1 github.com/google/go-cmp v0.7.0 - github.com/hashicorp/go-getter v1.8.9 + github.com/hashicorp/go-getter v1.8.10 github.com/hashicorp/go-version v1.9.0 - github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b + github.com/hybridgroup/yzma v1.29.1 github.com/icza/mjpeg v0.0.0-20230330134156-38318e5ab8f4 github.com/maypok86/otter/v2 v2.3.0 github.com/modelcontextprotocol/go-sdk v1.8.0 @@ -50,8 +50,8 @@ require ( github.com/agnivade/levenshtein v1.2.1 // indirect github.com/aws/aws-sdk-go-v2 v1.47.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 // indirect - github.com/aws/aws-sdk-go-v2/config v1.33.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/config v1.33.7 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.20.7 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.4 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.4 // indirect @@ -60,12 +60,12 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.5 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.10.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.38.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.51.1 // indirect - github.com/aws/smithy-go v1.28.2 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.10.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.38.2 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.51.2 // indirect + github.com/aws/smithy-go v1.28.4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect @@ -87,7 +87,7 @@ require ( github.com/google/jsonschema-go v0.4.3 // indirect github.com/google/s2a-go v0.1.11 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.22 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect github.com/googleapis/gax-go/v2 v2.26.2 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.31.0 // indirect @@ -123,7 +123,7 @@ require ( github.com/tchap/go-patricia/v2 v2.3.3 // indirect github.com/ulikunitz/xz v0.5.17 // indirect github.com/valyala/fastjson v1.6.10 // indirect - github.com/vektah/gqlparser/v2 v2.5.60 // indirect + github.com/vektah/gqlparser/v2 v2.5.61 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/yashtewari/glob-intersection v0.2.0 // indirect diff --git a/go.sum b/go.sum index 705b9f40e..39b3095e2 100644 --- a/go.sum +++ b/go.sum @@ -44,10 +44,10 @@ github.com/aws/aws-sdk-go-v2 v1.47.1 h1:uOIZnp4PK3ZhKI0dNrJrhTEsLxbpXHTAJlwoS1pv github.com/aws/aws-sdk-go-v2 v1.47.1/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 h1:GPRlPwz40I2B2VrBEASOA3Bi77NyeqejNLkifosX0rs= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20/go.mod h1:g7PNzKcsOKWb4fkSRBA7BZVAS6Y8IcxzN+nRohhQ1Q8= -github.com/aws/aws-sdk-go-v2/config v1.33.6 h1:MBjkSTLczek/UgiK+EYPIoRTqE7gP8vtW3OFbFo7Nug= -github.com/aws/aws-sdk-go-v2/config v1.33.6/go.mod h1:grRAFzdAZJrwcbasJRg2MPvIrVjtlfXllHssN6+E1JE= -github.com/aws/aws-sdk-go-v2/credentials v1.20.6 h1:NpAFXCU7NzXNkdGK3zQTtsRJ+3v9tZQV0xcdRw8uBdw= -github.com/aws/aws-sdk-go-v2/credentials v1.20.6/go.mod h1:mcZCoiPnyMvP8VMNbygNX5lLqSlkYJIMPODylQMurOk= +github.com/aws/aws-sdk-go-v2/config v1.33.7 h1:vgG8uuhm7vNsxr6BsXNG+Ciesh9iLdNPzarAAu/dB6A= +github.com/aws/aws-sdk-go-v2/config v1.33.7/go.mod h1:5KWNY38altxnd5cxcNoOTrFtJ7asFEiCiWfb2m+M2pE= +github.com/aws/aws-sdk-go-v2/credentials v1.20.7 h1:mit8rRVnmt+wvT4U6putiWSlwe3eKD2n6ElgyfcP/Mw= +github.com/aws/aws-sdk-go-v2/credentials v1.20.7/go.mod h1:/2pPi2qhPug21z6l3M0+AKUqAT1zn2MhRCtnQv8R5Zg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1 h1:8gALAAmacnIXh+z6VkdDanv4/IkG5APdg4DZLDTmLog= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.1/go.mod h1:Z7IJhJU+poOdJjUR2wpyY21ossQ1XS/R3Lk9Msq5kM4= github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.4 h1:CLq4+8UHCI+ZZYl/EuJxXovaIVN2xeeT8JV+dsApQ5E= @@ -64,18 +64,18 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4 h1:29SvnfGhX github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.4/go.mod h1:wm04I5DMuNVvZHFe/dHnUxincvNbbK7AiNBbYsQivek= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4 h1:pPiWfgeNxqluKEph7hvU88kuGKBPOWzO+Dk9t2zqqNs= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.4/go.mod h1:YlwGoIUDG/3kBQbdNOVs/xKZ9J01G8e/6D1mRBj9uTk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0 h1:VMAdYqr4Jn/8ATs9BHC5riwrs0d6m1Z2ohFriSwZwm0= -github.com/aws/aws-sdk-go-v2/service/s3 v1.114.0/go.mod h1:9APRWGLFITKD+xzWSIyT9V7QV4bNlEuIieWlzXgGFlI= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.1 h1:DzCCWLzcIRQ77F3DEUljud7bEjTgFOIKXP52NmVRyhU= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.1/go.mod h1:xpo/geVldu8payT375WekctUzopG/hBU7miiqItMUlw= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.1 h1:Umtl/0YZhng4xndfW3lKJrYYP7NLEjI6bGXVomwLcs0= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.1/go.mod h1:rRD/dnm7q0HYE/I5TMaPgkWyyUGLcwuxHLABsLnQ3e0= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1 h1:orIWdNiLgzrhu/11RcPPKO/SBzUUymbUQuZbSPImghg= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.1/go.mod h1:skwM/xsbR/1ReUTesv9BhpJp1VjajR7DWQnuVLwiXsQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.51.1 h1:0HOqZXRvMytH6bFHVIc0oJX07sZjfhz0zXtjs6gdE8s= -github.com/aws/aws-sdk-go-v2/service/sts v1.51.1/go.mod h1:26zA0GhDrLo+yiLI2yXWxqB1PdsShfLikoI7GOEgugM= -github.com/aws/smithy-go v1.28.2 h1:myhcykQcatTul2B/zITjDk203G7t0awUAs1hVry5Bvg= -github.com/aws/smithy-go v1.28.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1 h1:9T6eO8/WXhij4PQaa2WaYsdekSCmT9Hw66Pw0S8do0Q= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.1/go.mod h1:9APRWGLFITKD+xzWSIyT9V7QV4bNlEuIieWlzXgGFlI= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.2 h1:vrPP4O9VABnquYrDHfU+Fu0Fp6TuzaqPUu9Fh7VBBVY= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.2/go.mod h1:xpo/geVldu8payT375WekctUzopG/hBU7miiqItMUlw= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.2 h1:I8F/K5ahKJ4npqeGBBmMPftQy3/o1A55VRq2eUcP9Ts= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.2/go.mod h1:rRD/dnm7q0HYE/I5TMaPgkWyyUGLcwuxHLABsLnQ3e0= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2 h1:i5nn7Ri5CgFfNRzwlUiZOIIUA+5Vgg+unNEC0PzF1+s= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.2/go.mod h1:skwM/xsbR/1ReUTesv9BhpJp1VjajR7DWQnuVLwiXsQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.2 h1:AWSPqynwEJV8J2pl/p7aizCf7a23/NGHR+rK/KLOxi4= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.2/go.mod h1:26zA0GhDrLo+yiLI2yXWxqB1PdsShfLikoI7GOEgugM= +github.com/aws/smithy-go v1.28.4 h1:vzBmFpcRUtotqGPfmnro2W2Pgg3mk103n9sZhNJY9YU= +github.com/aws/smithy-go v1.28.4/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= @@ -143,8 +143,8 @@ github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.22 h1:NU4XpII6jD+Dxcot94fqjE+AfJoE/lQP9q3faYGzC/c= -github.com/googleapis/enterprise-certificate-proxy v0.3.22/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= @@ -158,12 +158,12 @@ github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74 h1:mymLUKThnV9wFvogOK8Nns github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74/go.mod h1:Bh9qYL8ehmDxSg14Tk8oxFCP90XHfs6NxV1D84884xA= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.8.9 h1:1AOTMUmz/S/GuqOTE6+bg6nwPXTEbKr3Tc/T/lVS7is= -github.com/hashicorp/go-getter v1.8.9/go.mod h1:qI7vH/m552bXutKe4UkWptOJl4bo2KeO/CSOoh4s0ps= +github.com/hashicorp/go-getter v1.8.10 h1:uufJp+uacA0fSDRxclsHkiE6yUQTKgwv5b25QexgVM8= +github.com/hashicorp/go-getter v1.8.10/go.mod h1:5HyKGCQmT+I3MGAM76vk/fWpktjwxn7xruCUr9CrVuo= github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b h1:aEUm17H2LYxfHaVR3flGG0IKRWEnX1gAPpTWxus/EjM= -github.com/hybridgroup/yzma v1.28.1-0.20261006125350-87450fc2f90b/go.mod h1:ovV3WQ5v3X53vqo9Izg/28QHEXaVasW9b4Kgkhk05T0= +github.com/hybridgroup/yzma v1.29.1 h1:i3VjlzfUL4CcbMm232ehHou9RTfeiiaFD+3/21qlAvk= +github.com/hybridgroup/yzma v1.29.1/go.mod h1:ovV3WQ5v3X53vqo9Izg/28QHEXaVasW9b4Kgkhk05T0= github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0= github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= @@ -255,8 +255,8 @@ github.com/ulikunitz/xz v0.5.17 h1:flR0y/x1hgM8EGV1AW3Xll6T413G0glV8UfBwR617V4= github.com/ulikunitz/xz v0.5.17/go.mod h1:H9Rt/W6/Qj27PGauhQc6nfCDy7vHpzsOThBSaYDoEhw= github.com/valyala/fastjson v1.6.10 h1:/yjJg8jaVQdYR3arGxPE2X5z89xrlhS0eGXdv+ADTh4= github.com/valyala/fastjson v1.6.10/go.mod h1:e6FubmQouUNP73jtMLmcbxS6ydWIpOfhz34TSfO3JaE= -github.com/vektah/gqlparser/v2 v2.5.60 h1:2ML8Zwt/NFXzbW3kc+r7ecjfm9GdnwAjj2cFlKRcHJY= -github.com/vektah/gqlparser/v2 v2.5.60/go.mod h1:JNK+plRwKdXLsF/qPFPe5tE0z4s1WeroD9S5LR8um/Q= +github.com/vektah/gqlparser/v2 v2.5.61 h1:imeD27U4toS9itZS2S67LZsAlTxCZfGB4teSHBZCqwc= +github.com/vektah/gqlparser/v2 v2.5.61/go.mod h1:JNK+plRwKdXLsF/qPFPe5tE0z4s1WeroD9S5LR8um/Q= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= diff --git a/sdk/bucky/init.go b/sdk/bucky/init.go index 07148b4d0..1a9160eb6 100644 --- a/sdk/bucky/init.go +++ b/sdk/bucky/init.go @@ -146,12 +146,14 @@ func Init(opts ...InitOption) error { o.logLevel = LogSilent } - switch o.logLevel { - case LogSilent: - whisper.LogSet(whisper.LogSilent()) - default: - whisper.LogSet(whisper.LogNormal) - } + // switch o.logLevel { + // case LogSilent: + // whisper.LogSet(whisper.LogSilent()) + // default: + // whisper.LogSet(whisper.LogNormal) + // } + + whisper.LogSet(whisper.LogNormal) libraryLocation = libPath initDone = true diff --git a/sdk/kronk/init.go b/sdk/kronk/init.go index 76499d87d..4982a0a0d 100644 --- a/sdk/kronk/init.go +++ b/sdk/kronk/init.go @@ -95,23 +95,9 @@ func Init(opts ...InitOption) error { // needs the support in this case as well. libPath := libs.Path(o.libPath) - // Windows uses PATH for DLL discovery, Unix uses LD_LIBRARY_PATH. - switch runtime.GOOS { - case "windows": - if v := os.Getenv("PATH"); !strings.Contains(v, libPath) { - os.Setenv("PATH", fmt.Sprintf("%s;%s", libPath, v)) - } - - // PATH alone is not enough on Windows: the system directory (System32) - // is searched before PATH, so a stale same-named copy of a bundled - // dependency (e.g. libomp140.x86_64.dll) shadows ours and fails the - // load with "the specified procedure could not be found". Preload our - // libraries from libPath so they (and their dependency tree) win. - // Best-effort: on failure the PATH entry above remains the fallback, so - // the error is intentionally non-fatal. - preloadLibraries(libPath) - - default: + // Yzma handles bundled DLL discovery on Windows without modifying PATH. + // Preserve the existing library search path setup on other platforms. + if runtime.GOOS != "windows" { if v := os.Getenv("LD_LIBRARY_PATH"); !strings.Contains(v, libPath) { os.Setenv("LD_LIBRARY_PATH", fmt.Sprintf("%s:%s", libPath, v)) } @@ -135,14 +121,17 @@ func Init(opts ...InitOption) error { o.logLevel = LogSilent } - switch o.logLevel { - case LogSilent: - llama.LogSet(llama.LogSilent()) - mtmd.LogSet(llama.LogSilent()) - default: - llama.LogSet(llama.LogNormal) - mtmd.LogSet(llama.LogNormal) - } + // switch o.logLevel { + // case LogSilent: + // llama.LogSet(llama.LogSilent()) + // mtmd.LogSet(llama.LogSilent()) + // default: + // llama.LogSet(llama.LogNormal) + // mtmd.LogSet(llama.LogNormal) + // } + + llama.LogSet(llama.LogNormal) + mtmd.LogSet(llama.LogNormal) // Inline of llama.Init so we can gate GGMLBackendLoadAllFromPath on // the registry being empty. If bucky/whisper was initialized first diff --git a/sdk/kronk/library_search_other.go b/sdk/kronk/library_search_other.go deleted file mode 100644 index 92416bb58..000000000 --- a/sdk/kronk/library_search_other.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build !windows - -package kronk - -// preloadLibraries is a no-op on non-Windows platforms. Linux uses -// LD_LIBRARY_PATH and macOS uses dylib install names / @rpath, both of which -// already let the bundled library directory take precedence over system -// locations, so no DLL-search-order fixup is required. See the Windows build -// of this function for the full rationale. -func preloadLibraries(_ string) error { - return nil -} diff --git a/sdk/kronk/library_search_windows.go b/sdk/kronk/library_search_windows.go deleted file mode 100644 index e42817b04..000000000 --- a/sdk/kronk/library_search_windows.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build windows - -package kronk - -import ( - "path/filepath" - - "golang.org/x/sys/windows" -) - -// preloadLibraries loads kronk's bundled top-level DLLs (and their transitive -// static dependencies) from libPath BEFORE yzma loads them, so they resolve to -// our copies instead of an older, same-named DLL that happens to live in the -// Windows system directory (System32). -// -// Why this is needed only on Windows: yzma loads the top-level libraries -// (llama.dll, mtmd.dll) by absolute path, but the OS resolves their transitive -// dependencies by bare file name using the standard search order, in which -// System32 is searched BEFORE the directories on PATH. A stale system-wide copy -// of a bundled dependency therefore shadows ours and the load fails with "The -// specified procedure could not be found" (a newer llama.cpp build imports a -// symbol the old system DLL does not export). Appending libPath to PATH cannot -// win that race. Linux (LD_LIBRARY_PATH) and macOS (install names / @rpath) -// already let the bundled directory take precedence, so they need no equivalent. -// -// Mechanism: each top-level DLL is loaded with LoadLibraryEx and -// LOAD_WITH_ALTERED_SEARCH_PATH, which makes the directory containing that DLL -// (libPath) the first directory searched for it AND its dependency tree — -// ggml.dll, ggml-base.dll, libomp140.x86_64.dll, and so on. This fixes the -// whole class of System32-shadowing for everything kronk ships, not just -// libomp. yzma's later plain LoadLibrary of the same absolute path simply -// reuses the already-resident module. The ggml-cpu-*.dll backends loaded later -// by GGMLBackendLoadAllFromPath are covered indirectly: their shared -// dependencies (ggml-base, libomp) are already resident, and loaded modules are -// the first thing the loader checks. -// -// This is deliberately scoped to kronk's own load. It does NOT alter the -// process-global DLL search order, so it cannot break or cross-contaminate a -// sibling backend (e.g. bucky/whisper) that loads its own libraries from a -// different directory in the same process. -// -// libomp140.x86_64.dll is preloaded explicitly first as a deterministic leaf -// guard, in case LOAD_WITH_ALTERED_SEARCH_PATH does not propagate to that deep -// a transitive dependency on some Windows versions; an absolute path ignores -// the search order entirely. Every load here is best-effort: handles are -// intentionally leaked for the process lifetime (these libraries are never -// unloaded), and the first error is returned for the caller to treat as -// non-fatal, leaving the PATH entry as the fallback. -func preloadLibraries(libPath string) error { - names := []string{ - "libomp140.x86_64.dll", // leaf dependency: load first by absolute path - "llama.dll", - "mtmd.dll", - } - - var firstErr error - for _, name := range names { - full := filepath.Join(libPath, name) - - if _, err := windows.LoadLibraryEx(full, 0, windows.LOAD_WITH_ALTERED_SEARCH_PATH); err != nil { - if firstErr == nil { - firstErr = err - } - } - } - - return firstErr -} diff --git a/sdk/malina/init.go b/sdk/malina/init.go index a4c7af438..e55b38479 100644 --- a/sdk/malina/init.go +++ b/sdk/malina/init.go @@ -100,14 +100,19 @@ func Init(opts ...InitOption) error { if o.logLevel < LogSilent || o.logLevel > LogNormal { o.logLevel = LogSilent } - switch o.logLevel { - case LogSilent: - sd.SetLogCallback(func(sd.LogLevel, string) {}) - default: - sd.SetLogCallback(func(_ sd.LogLevel, text string) { - fmt.Fprintln(os.Stderr, text) - }) - } + // switch o.logLevel { + // case LogSilent: + // sd.SetLogCallback(func(sd.LogLevel, string) {}) + // default: + // sd.SetLogCallback(func(_ sd.LogLevel, text string) { + // fmt.Fprintln(os.Stderr, text) + // }) + // } + + sd.SetLogCallback(func(_ sd.LogLevel, text string) { + fmt.Fprintln(os.Stderr, text) + }) + if o.progress == nil { sd.SetProgressCallback(nil) } else { diff --git a/zarf/nix/gomod2nix.toml b/zarf/nix/gomod2nix.toml index 4ffe93a23..e1a8c4ef2 100644 --- a/zarf/nix/gomod2nix.toml +++ b/zarf/nix/gomod2nix.toml @@ -56,11 +56,11 @@ schema = 3 version = "v1.7.20" hash = "sha256-ICB2yD83Gl628LRkg3HhYlDtsL4xgGhOmphZ5D0bJXI=" [mod."github.com/aws/aws-sdk-go-v2/config"] - version = "v1.33.6" - hash = "sha256-bQ30SzNYrU5KWynlN6v+PcrHhtSx5p7kEnyqPDZGPPk=" + version = "v1.33.7" + hash = "sha256-ngFONjY26PObjPENavMM7iPITestuB74cBYISrgtPQY=" [mod."github.com/aws/aws-sdk-go-v2/credentials"] - version = "v1.20.6" - hash = "sha256-EL0ar1ZP+ApWJxBVd2aZRKQbx8ae7YzJoD/J9gYnPS0=" + version = "v1.20.7" + hash = "sha256-ZvtWgfWQMkUtkxe+6RXLCOfXqnFtc6H+R4zTS8QygYA=" [mod."github.com/aws/aws-sdk-go-v2/feature/ec2/imds"] version = "v1.20.1" hash = "sha256-vtzYW/VyJB79OjVrIb/CBtjoCBW/eiafTjL99Vr8P0Q=" @@ -86,23 +86,23 @@ schema = 3 version = "v1.20.4" hash = "sha256-mYOJSelYLof0NpRwUsKlfe51lCVmWdBURIsSnx8+iPA=" [mod."github.com/aws/aws-sdk-go-v2/service/s3"] - version = "v1.114.0" - hash = "sha256-JWdnxlie6dabdihB1XLdb8o2NFEt31jjeFf5FJxRffk=" + version = "v1.114.1" + hash = "sha256-Ao/BhAJiurWVlN2tFZLPf98DeE2O1nZXqvx+VE1MghU=" [mod."github.com/aws/aws-sdk-go-v2/service/signin"] - version = "v1.10.1" - hash = "sha256-VmbLKrQRnMl+2SlbJy/i8Ngm31vZIJ5bFhtA5E01TqA=" + version = "v1.10.2" + hash = "sha256-rpGDwgXPwaQcmzssmy1WCKIIM9Uvmum/W3XbPrw3bQ0=" [mod."github.com/aws/aws-sdk-go-v2/service/sso"] - version = "v1.38.1" - hash = "sha256-BgwGLeeeUIA/beyk4DnLJ3HA70bUaO5fgTLhJ6xfJOw=" + version = "v1.38.2" + hash = "sha256-PTh0u1NTEzK+NVi2cPG771eJc8apZ4t+QWe78StsZ1E=" [mod."github.com/aws/aws-sdk-go-v2/service/ssooidc"] - version = "v1.43.1" - hash = "sha256-mj/7Tt1+L+FpvRLl/CC7kSiZPSE18lhi+iDGn2+wRvQ=" + version = "v1.43.2" + hash = "sha256-S9jd3c2lqt5HQXCa8ZjPcw0XRUW3wAW2W9xAulIX45s=" [mod."github.com/aws/aws-sdk-go-v2/service/sts"] - version = "v1.51.1" - hash = "sha256-Z3heejHlZSijeaj/3AHDVcEmC8387BDczbXDr34Gi7c=" + version = "v1.51.2" + hash = "sha256-2DlQ5DLhjI4rubqy6e1mwTSVOBhHAyv6GpsWHmqEBbw=" [mod."github.com/aws/smithy-go"] - version = "v1.28.2" - hash = "sha256-ZLpb1GteVVDTF8zIyK8p0esbbepH1S865UIw11D66rg=" + version = "v1.28.4" + hash = "sha256-9faJActQPrK8Pofa/2nl4pTHUEOK1WqId+KMCEMdvbU=" [mod."github.com/beorn7/perks"] version = "v1.0.1" hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4=" @@ -176,8 +176,8 @@ schema = 3 version = "v1.6.0" hash = "sha256-VWl9sqUzdOuhW0KzQlv0gwwUQClYkmZwSydHG2sALYw=" [mod."github.com/googleapis/enterprise-certificate-proxy"] - version = "v0.3.22" - hash = "sha256-dwB4hqVky3TKmEyh9jj/lcwGVu4ZQwFIQA+IbpvsP3g=" + version = "v0.3.23" + hash = "sha256-xK//FqCyKVq7SOhzRequjXG7OC0MlwIV0lHmWMwLTZY=" [mod."github.com/googleapis/gax-go/v2"] version = "v2.26.2" hash = "sha256-LP5j4BMt132nmi2fhRh0JBR7pTmsyo4Y+ZaCZGPswkc=" @@ -197,14 +197,14 @@ schema = 3 version = "v0.5.2" hash = "sha256-N9GOKYo7tK6XQUFhvhImtL7PZW/mr4C4Manx/yPVvcQ=" [mod."github.com/hashicorp/go-getter"] - version = "v1.8.9" - hash = "sha256-Non3LDJ8LXWAxeQQN2PmMGaRQjnQ56KVzudx2X0jH08=" + version = "v1.8.10" + hash = "sha256-Vzf+5LaN3EjtUroaNdW9SQLhA/ouW03afpbf9LdBLMY=" [mod."github.com/hashicorp/go-version"] version = "v1.9.0" hash = "sha256-sRr/50k8Wra0PJLCJgSkIxvR+ce3PItx4HpFvVijGYk=" [mod."github.com/hybridgroup/yzma"] - version = "v1.28.1-0.20261006125350-87450fc2f90b" - hash = "sha256-BwuBe11NXdmVBdWqdfhMfUzIVmg1SeCsX8ArMhinSc0=" + version = "v1.29.1" + hash = "sha256-J/LLT6VNHtyhAEYwChStk0vQzvzBFtJqdkNjLNCbAbU=" [mod."github.com/icza/bitio"] version = "v1.1.0" hash = "sha256-CtV/dr1L46cZ65EnK9DrBduZCaMnTGf4N2MnElCymtM=" @@ -314,8 +314,8 @@ schema = 3 version = "v1.6.10" hash = "sha256-D2lL4FnkeL/eRLiRW6ihhqQkzEqHVvhbEvZoYTVNmbU=" [mod."github.com/vektah/gqlparser/v2"] - version = "v2.5.60" - hash = "sha256-kki+oeLmChfbCy0nwK8PHiQMyUfNRaCvZISbxZMWP0U=" + version = "v2.5.61" + hash = "sha256-TRwxW+hkQ6XnRKhX544Lztbd9RvnWlnTIVMk9rbPIsc=" [mod."github.com/xeipuuv/gojsonpointer"] version = "v0.0.0-20190905194746-02993c407bfb" hash = "sha256-/u+qznDY8cnECZYIgSMRpKVWs04yAkW6EoGhqt+t73g=" From e09fa8d6e29d3b14cfd027a7b6fa644208a221d5 Mon Sep 17 00:00:00 2001 From: Ramon Reichert Date: Wed, 7 Oct 2026 10:46:17 -0300 Subject: [PATCH 2/2] remove kronk windows workarounds --- examples/yzma/internal/yzmainit/path.go | 16 -------------- examples/yzma/internal/yzmainit/path_other.go | 7 ------- .../yzma/internal/yzmainit/path_windows.go | 21 ------------------- examples/yzma/step1/main.go | 9 +++----- examples/yzma/step2/main.go | 9 +++----- examples/yzma/step3/main.go | 9 +++----- examples/yzma/step4/main.go | 9 +++----- examples/yzma/step5/main.go | 9 +++----- examples/yzma/step6/main.go | 7 ++----- examples/yzma/step7/main.go | 7 ++----- examples/yzma/step8/main.go | 7 ++----- examples/yzma/step9/main.go | 7 ++----- sdk/bucky/init.go | 14 ++++++------- sdk/kronk/init.go | 19 +++++++---------- sdk/malina/init.go | 21 ++++++++----------- 15 files changed, 46 insertions(+), 125 deletions(-) delete mode 100644 examples/yzma/internal/yzmainit/path.go delete mode 100644 examples/yzma/internal/yzmainit/path_other.go delete mode 100644 examples/yzma/internal/yzmainit/path_windows.go diff --git a/examples/yzma/internal/yzmainit/path.go b/examples/yzma/internal/yzmainit/path.go deleted file mode 100644 index daf62be3d..000000000 --- a/examples/yzma/internal/yzmainit/path.go +++ /dev/null @@ -1,16 +0,0 @@ -// Package yzmainit prepares Kronk's llama.cpp installation for direct use by -// the raw Yzma examples. -package yzmainit - -import "github.com/ardanlabs/kronk/sdk/tools/libs" - -// LibraryPath returns the selected llama.cpp installation after configuring -// platform-specific shared-library discovery for the current process. -func LibraryPath() (string, error) { - libPath := libs.Path("") - if err := prepareLibraryPath(libPath); err != nil { - return "", err - } - - return libPath, nil -} diff --git a/examples/yzma/internal/yzmainit/path_other.go b/examples/yzma/internal/yzmainit/path_other.go deleted file mode 100644 index fc0ce33d4..000000000 --- a/examples/yzma/internal/yzmainit/path_other.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build !windows - -package yzmainit - -func prepareLibraryPath(string) error { - return nil -} diff --git a/examples/yzma/internal/yzmainit/path_windows.go b/examples/yzma/internal/yzmainit/path_windows.go deleted file mode 100644 index a3bb8b107..000000000 --- a/examples/yzma/internal/yzmainit/path_windows.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build windows - -package yzmainit - -import ( - "path/filepath" - - "golang.org/x/sys/windows" -) - -// prepareLibraryPath preloads llama.dll with its directory at the front of -// the dependency search path. Yzma's later loads reuse the resident bundle. -func prepareLibraryPath(libPath string) error { - filename, err := filepath.Abs(filepath.Join(libPath, "llama.dll")) - if err != nil { - return err - } - - _, err = windows.LoadLibraryEx(filename, 0, windows.LOAD_WITH_ALTERED_SEARCH_PATH) - return err -} diff --git a/examples/yzma/step1/main.go b/examples/yzma/step1/main.go index dec285f82..ff4f155da 100644 --- a/examples/yzma/step1/main.go +++ b/examples/yzma/step1/main.go @@ -4,7 +4,7 @@ // chat example first. // // Run the example like this from the root of the project: -// $ make example-yzma +// $ make example-yzma-step1 package main @@ -15,7 +15,7 @@ import ( "os" "path/filepath" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -184,10 +184,7 @@ func run() error { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step2/main.go b/examples/yzma/step2/main.go index 640a1bac6..fd64ede1e 100644 --- a/examples/yzma/step2/main.go +++ b/examples/yzma/step2/main.go @@ -5,7 +5,7 @@ // https://github.com/ggml-org/llama.cpp/blob/master/examples/parallel/parallel.cpp // // Run the example like this from the root of the project: -// $ make example-yzma-parallel +// $ make example-yzma-step2 package main @@ -19,7 +19,7 @@ import ( "strings" "time" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -423,10 +423,7 @@ func batchAdd(batch llama.BatchExt, token llama.Token, pos llama.Pos, seqIDs []l } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step3/main.go b/examples/yzma/step3/main.go index 037264c15..d1c1237a3 100644 --- a/examples/yzma/step3/main.go +++ b/examples/yzma/step3/main.go @@ -7,7 +7,7 @@ // (chan) (single goroutine) // // Run the example like this from the root of the project: -// $ go run examples/yzma-parallel/step2/main.go -model /path/to/model.gguf +// $ make example-yzma-step3 package main @@ -26,7 +26,7 @@ import ( "syscall" "time" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -760,10 +760,7 @@ func batchAdd(batch llama.BatchExt, token llama.Token, pos llama.Pos, seqIDs []l } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step4/main.go b/examples/yzma/step4/main.go index 2d0906ab5..e70f48e8e 100644 --- a/examples/yzma/step4/main.go +++ b/examples/yzma/step4/main.go @@ -3,7 +3,7 @@ // parallel media inference. // // Run the example like this from the root of the project: -// $ go run ./examples/yzma-parallel/step1-media -model -proj -image +// $ make example-yzma-step4 package main @@ -14,7 +14,7 @@ import ( "os" "path/filepath" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/hybridgroup/yzma/pkg/llama" "github.com/hybridgroup/yzma/pkg/mtmd" ) @@ -261,10 +261,7 @@ func run() error { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step5/main.go b/examples/yzma/step5/main.go index d6429155c..7d48037f8 100644 --- a/examples/yzma/step5/main.go +++ b/examples/yzma/step5/main.go @@ -8,7 +8,7 @@ // 4. Batched decoding of text tokens and image embeddings // // Run the example like this from the root of the project: -// $ go run ./examples/yzma/step5 -image examples/samples/giraffe.jpg +// $ make example-yzma-step5 package main @@ -19,7 +19,7 @@ import ( "os" "path/filepath" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" yzmaspec "github.com/hybridgroup/yzma/exp/speculative" "github.com/hybridgroup/yzma/pkg/llama" "github.com/hybridgroup/yzma/pkg/mtmd" @@ -544,10 +544,7 @@ func processBatch(lctx llama.Context, batch llama.BatchExt, useNonCausal bool) e } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step6/main.go b/examples/yzma/step6/main.go index dc9625b56..2479d5bb0 100644 --- a/examples/yzma/step6/main.go +++ b/examples/yzma/step6/main.go @@ -17,7 +17,7 @@ import ( "os" "path/filepath" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -196,10 +196,7 @@ func run() error { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step7/main.go b/examples/yzma/step7/main.go index 6b1926323..1dd5c661b 100644 --- a/examples/yzma/step7/main.go +++ b/examples/yzma/step7/main.go @@ -22,8 +22,8 @@ import ( "strconv" "time" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" "github.com/ardanlabs/kronk/sdk/kronk" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/ardanlabs/kronk/sdk/tools/models" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -360,10 +360,7 @@ func modelMetadata(mdl llama.Model, wanted string) string { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("unable to load library: %w", err) diff --git a/examples/yzma/step8/main.go b/examples/yzma/step8/main.go index 118311dd3..967dcc556 100644 --- a/examples/yzma/step8/main.go +++ b/examples/yzma/step8/main.go @@ -24,8 +24,8 @@ import ( "strconv" "time" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" "github.com/ardanlabs/kronk/sdk/kronk" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/ardanlabs/kronk/sdk/tools/models" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -380,10 +380,7 @@ func modelMetadata(mdl llama.Model, wanted string) string { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("load library: %w", err) diff --git a/examples/yzma/step9/main.go b/examples/yzma/step9/main.go index 3b50f0a1b..fb2135af7 100644 --- a/examples/yzma/step9/main.go +++ b/examples/yzma/step9/main.go @@ -23,8 +23,8 @@ import ( "sync/atomic" "time" - "github.com/ardanlabs/kronk/examples/yzma/internal/yzmainit" "github.com/ardanlabs/kronk/sdk/kronk" + "github.com/ardanlabs/kronk/sdk/tools/libs" "github.com/ardanlabs/kronk/sdk/tools/models" "github.com/hybridgroup/yzma/pkg/llama" ) @@ -234,10 +234,7 @@ func installModel() (string, error) { } func initYzma() error { - libPath, err := yzmainit.LibraryPath() - if err != nil { - return fmt.Errorf("prepare library path: %w", err) - } + libPath := libs.Path("") if err := llama.Load(libPath); err != nil { return fmt.Errorf("load library: %w", err) diff --git a/sdk/bucky/init.go b/sdk/bucky/init.go index 1a9160eb6..07148b4d0 100644 --- a/sdk/bucky/init.go +++ b/sdk/bucky/init.go @@ -146,14 +146,12 @@ func Init(opts ...InitOption) error { o.logLevel = LogSilent } - // switch o.logLevel { - // case LogSilent: - // whisper.LogSet(whisper.LogSilent()) - // default: - // whisper.LogSet(whisper.LogNormal) - // } - - whisper.LogSet(whisper.LogNormal) + switch o.logLevel { + case LogSilent: + whisper.LogSet(whisper.LogSilent()) + default: + whisper.LogSet(whisper.LogNormal) + } libraryLocation = libPath initDone = true diff --git a/sdk/kronk/init.go b/sdk/kronk/init.go index 4982a0a0d..b6670222d 100644 --- a/sdk/kronk/init.go +++ b/sdk/kronk/init.go @@ -121,17 +121,14 @@ func Init(opts ...InitOption) error { o.logLevel = LogSilent } - // switch o.logLevel { - // case LogSilent: - // llama.LogSet(llama.LogSilent()) - // mtmd.LogSet(llama.LogSilent()) - // default: - // llama.LogSet(llama.LogNormal) - // mtmd.LogSet(llama.LogNormal) - // } - - llama.LogSet(llama.LogNormal) - mtmd.LogSet(llama.LogNormal) + switch o.logLevel { + case LogSilent: + llama.LogSet(llama.LogSilent()) + mtmd.LogSet(llama.LogSilent()) + default: + llama.LogSet(llama.LogNormal) + mtmd.LogSet(llama.LogNormal) + } // Inline of llama.Init so we can gate GGMLBackendLoadAllFromPath on // the registry being empty. If bucky/whisper was initialized first diff --git a/sdk/malina/init.go b/sdk/malina/init.go index e55b38479..5a08f95e0 100644 --- a/sdk/malina/init.go +++ b/sdk/malina/init.go @@ -100,18 +100,15 @@ func Init(opts ...InitOption) error { if o.logLevel < LogSilent || o.logLevel > LogNormal { o.logLevel = LogSilent } - // switch o.logLevel { - // case LogSilent: - // sd.SetLogCallback(func(sd.LogLevel, string) {}) - // default: - // sd.SetLogCallback(func(_ sd.LogLevel, text string) { - // fmt.Fprintln(os.Stderr, text) - // }) - // } - - sd.SetLogCallback(func(_ sd.LogLevel, text string) { - fmt.Fprintln(os.Stderr, text) - }) + + switch o.logLevel { + case LogSilent: + sd.SetLogCallback(func(sd.LogLevel, string) {}) + default: + sd.SetLogCallback(func(_ sd.LogLevel, text string) { + fmt.Fprintln(os.Stderr, text) + }) + } if o.progress == nil { sd.SetProgressCallback(nil)