turbollm 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cli.js +28 -9
  2. package/dist/webdist/assets/{ChatScreen-Omj31-b1.js → ChatScreen-DOn_DZb9.js} +2 -2
  3. package/dist/webdist/assets/{CustomizeScreen-3-JeggEQ.js → CustomizeScreen-DGojsyt3.js} +1 -1
  4. package/dist/webdist/assets/{DeveloperScreen-DPF-V0iQ.js → DeveloperScreen-Den6YJCd.js} +1 -1
  5. package/dist/webdist/assets/{EnginesScreen-DOuhRgoB.js → EnginesScreen-CY8Rx5yb.js} +1 -1
  6. package/dist/webdist/assets/ModelDetailDialog-B9XwOIZ1.js +1 -0
  7. package/dist/webdist/assets/{ModelDirs-BanIGLNL.js → ModelDirs-Dc-YpeRq.js} +1 -1
  8. package/dist/webdist/assets/{ModelsScreen-BCkhr-NC.js → ModelsScreen-C16M_nz8.js} +1 -1
  9. package/dist/webdist/assets/{SettingsScreen-LM-OXnFu.js → SettingsScreen-jOTEJsnP.js} +1 -1
  10. package/dist/webdist/assets/check-BfxrDSv2.js +1 -0
  11. package/dist/webdist/assets/{circle-x-nn8GPW_0.js → circle-x-DS6mPliy.js} +1 -1
  12. package/dist/webdist/assets/{common-BbPYnoqq.js → common-daa_TZVO.js} +1 -1
  13. package/dist/webdist/assets/{copy-button-BKEOGElI.js → copy-button-BGhg8Khu.js} +1 -1
  14. package/dist/webdist/assets/{dialog-DRRtzXcR.js → dialog-DZNAqEWA.js} +1 -1
  15. package/dist/webdist/assets/{index-iQ0Xd3d6.js → index-DGA-rUGx.js} +2 -2
  16. package/dist/webdist/assets/{pencil-yXapP66e.js → pencil-B6GM9rGh.js} +1 -1
  17. package/dist/webdist/assets/{personas-Ch12R3nU.js → personas-6VEsCmkv.js} +1 -1
  18. package/dist/webdist/assets/{plus-CwldxWKW.js → plus-DRWkUqro.js} +1 -1
  19. package/dist/webdist/assets/{refresh-cw-Bii-Kx0A.js → refresh-cw-C0HV0_ff.js} +1 -1
  20. package/dist/webdist/assets/{save-B6QW1US8.js → save-C_BZqFjv.js} +1 -1
  21. package/dist/webdist/assets/{skeleton-BBR-OXdB.js → skeleton-3ybK_JTt.js} +1 -1
  22. package/dist/webdist/assets/{sparkles-B5zw8rOc.js → sparkles-CMAmCCVI.js} +1 -1
  23. package/dist/webdist/assets/{trash-2-Cvm2LlD0.js → trash-2-Bwu1AKhQ.js} +1 -1
  24. package/dist/webdist/index.html +1 -1
  25. package/package.json +1 -1
  26. package/dist/webdist/assets/ModelDetailDialog-DEvT_TCN.js +0 -1
  27. package/dist/webdist/assets/check-CyrGNFl1.js +0 -1
package/dist/cli.js CHANGED
@@ -3310,6 +3310,24 @@ function walk(dir, out) {
3310
3310
  }
3311
3311
  }
3312
3312
  }
3313
+ function detectSafetensorsQuant(cfg2) {
3314
+ const qc = cfg2.quantization_config;
3315
+ if (qc?.quant_method) {
3316
+ const method = qc.quant_method.toLowerCase();
3317
+ const group0 = qc.config_groups ? Object.values(qc.config_groups)[0] : void 0;
3318
+ const wBits = group0?.weights?.num_bits ?? qc.bits;
3319
+ if (method === "compressed-tensors") {
3320
+ if (wBits) {
3321
+ const aBits = group0?.input_activations?.num_bits ?? 16;
3322
+ return `w${wBits}a${aBits}`;
3323
+ }
3324
+ return "compressed-tensors";
3325
+ }
3326
+ return wBits ? `${method}-${wBits}bit` : method;
3327
+ }
3328
+ const mlxBits = cfg2.quantization?.bits;
3329
+ return mlxBits ? `${mlxBits}bit` : "fp16";
3330
+ }
3313
3331
  function mlxEntryFor(dir) {
3314
3332
  let cfg2 = {};
3315
3333
  let parseError = null;
@@ -3350,10 +3368,10 @@ function mlxEntryFor(dir) {
3350
3368
  }
3351
3369
  } catch {
3352
3370
  }
3353
- const expertCount = cfg2.num_local_experts ?? cfg2.num_experts ?? 0;
3354
- const bits = cfg2.quantization?.bits;
3355
- const quant = bits ? `${bits}bit` : "fp16";
3356
- const arch2 = cfg2.model_type || cfg2.architectures?.[0] || "unknown";
3371
+ const lm = cfg2.text_config ?? {};
3372
+ const expertCount = cfg2.num_local_experts ?? cfg2.num_experts ?? lm.num_local_experts ?? lm.num_experts ?? 0;
3373
+ const quant = detectSafetensorsQuant(cfg2);
3374
+ const arch2 = cfg2.model_type || cfg2.architectures?.[0] || lm.model_type || "unknown";
3357
3375
  const name = basename(dir).replace(/[-_]/g, " ").replace(/\s+/g, " ").trim();
3358
3376
  return {
3359
3377
  key: `${name.toLowerCase()}|mlx-${quant}|${sizeBytes}`,
@@ -3365,9 +3383,9 @@ function mlxEntryFor(dir) {
3365
3383
  sizeLabel: "",
3366
3384
  arch: arch2,
3367
3385
  quant,
3368
- nativeCtx: cfg2.max_position_embeddings ?? 0,
3369
- blockCount: cfg2.num_hidden_layers ?? 0,
3370
- headCountKv: cfg2.num_key_value_heads ?? 0,
3386
+ nativeCtx: cfg2.max_position_embeddings ?? lm.max_position_embeddings ?? 0,
3387
+ blockCount: cfg2.num_hidden_layers ?? lm.num_hidden_layers ?? 0,
3388
+ headCountKv: cfg2.num_key_value_heads ?? lm.num_key_value_heads ?? 0,
3371
3389
  moe: expertCount > 0,
3372
3390
  expertCount,
3373
3391
  nextnLayers: 0,
@@ -7572,8 +7590,9 @@ async function runGeneration(d, stream, ctx) {
7572
7590
  reqBody.reasoning_budget = 0;
7573
7591
  reqBody.chat_template_kwargs = { enable_thinking: false };
7574
7592
  }
7575
- if (toolDefs.length > 0) reqBody.tools = toolDefs;
7576
- if (conv.toolPolicy === "force_web_search" && toolIter <= 2 && toolDefs.some((t) => t.function.name === "web_search")) {
7593
+ const toolsSupported = (d.registry.active()?.kind ?? "") !== "vllm" && toolDefs.length > 0;
7594
+ if (toolsSupported) reqBody.tools = toolDefs;
7595
+ if (toolsSupported && conv.toolPolicy === "force_web_search" && toolIter <= 2 && toolDefs.some((t) => t.function.name === "web_search")) {
7577
7596
  reqBody.tool_choice = { type: "function", function: { name: "web_search" } };
7578
7597
  }
7579
7598
  const res = await fetch(`${target}/v1/chat/completions`, {
@@ -1,4 +1,4 @@
1
- import{j as g}from"./radix-BFvMxQq9.js";import{j as Cr,r as X,k as os,l as ss}from"./vendor-D_-14Whs.js";import{u as Dn,a as ls,g as ri,b as cs,c as us,P as ua,d as ii,e as ds,f as ps,s as fs,h as gs}from"./personas-Ch12R3nU.js";import{c as gt,B as Be,L as da,D as fr,I as ms,t as De,C as hs,S as bs,A as Bt,u as xs,a as ys,b as Es,d as _s,e as ai,X as mn,g as ks,f as ws,h as Ns,i as Ss}from"./index-iQ0Xd3d6.js";import{C as gr,a as oi}from"./copy-button-BKEOGElI.js";import{P as pa}from"./pencil-yXapP66e.js";import{T as mr}from"./trash-2-Cvm2LlD0.js";import{R as vs}from"./refresh-cw-Bii-Kx0A.js";import{C as rn,a as Ar,b as Ts,D as Cs,c as As,d as Is,e as Os,f as Rs,g as Ms,h as Ds,i as Ls,j as Ps,k as Bs}from"./dialog-DRRtzXcR.js";import{C as Fs}from"./circle-x-nn8GPW_0.js";import{S as zs,a as Us,M as $s}from"./ModelDetailDialog-DEvT_TCN.js";import{C as js}from"./check-CyrGNFl1.js";import"./save-B6QW1US8.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ks=gt("arrow-down",Hs);const Gs=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],qs=gt("brain",Gs);const Ws=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vs=gt("chevron-left",Ws);const Ys=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zs=gt("file-text",Ys);const Xs=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],si=gt("message-square-plus",Xs);const Qs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Js=gt("paperclip",Qs);const el=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],tl=gt("send-horizontal",el);const nl=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],rl=gt("share-2",nl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],al=gt("square",il);const ol=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],sl=gt("user-round",ol);function ll(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ul=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dl={};function li(e,t){return(dl.jsx?ul:cl).test(e)}const pl=/[ \t\n\f\r]/g;function fl(e){return typeof e=="object"?e.type==="text"?ci(e.value):!1:ci(e)}function ci(e){return e.replace(pl,"")===""}class an{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}an.prototype.normal={};an.prototype.property={};an.prototype.space=void 0;function fa(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new an(n,r,t)}function hr(e){return e.toLowerCase()}class Ge{constructor(t,n){this.attribute=n,this.property=t}}Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let gl=0;const ne=It(),Se=It(),br=It(),R=It(),xe=It(),Ct=It(),We=It();function It(){return 2**++gl}const xr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:Se,commaOrSpaceSeparated:We,commaSeparated:Ct,number:R,overloadedBoolean:br,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),Wn=Object.keys(xr);class Ir extends Ge{constructor(t,n,r,i){let o=-1;if(super(t,n),ui(this,"space",i),typeof r=="number")for(;++o<Wn.length;){const a=Wn[o];ui(this,Wn[o],(r&xr[a])===xr[a])}}}Ir.prototype.defined=!0;function ui(e,t,n){n&&(e[t]=n)}function jt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Ir(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hr(r)]=r,n[hr(o.attribute)]=r}return new an(t,n,e.space)}const ga=jt({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:xe,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:R,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:xe,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:Se,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ma(e,t){return t in e?e[t]:t}function ha(e,t){return ma(e,t.toLowerCase())}const ml=jt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ct,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alpha:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:xe,autoFocus:ne,autoPlay:ne,blocking:xe,capture:null,charSet:null,checked:ne,cite:null,className:xe,closedBy:null,colorSpace:null,cols:R,colSpan:R,command:null,commandFor:null,content:null,contentEditable:Se,controls:ne,controlsList:xe,coords:R|Ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:br,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:xe,height:R,hidden:br,high:R,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:xe,itemRef:xe,itemScope:ne,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ne,optimum:R,pattern:null,ping:xe,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:xe,required:ne,reversed:ne,rows:R,rowSpan:R,sandbox:xe,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootCustomElementRegistry:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shadowRootSerializable:ne,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:Se,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ne,disablePictureInPicture:ne,disableRemotePlayback:ne,exportParts:Ct,part:xe,prefix:null,property:null,results:R,security:null,unselectable:null},space:"html",transform:ha}),hl=jt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:We,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:xe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ct,g2:Ct,glyphName:Ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ma}),ba=jt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xa=jt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ha}),ya=jt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bl={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xl=/[A-Z]/g,di=/-[a-z]/g,yl=/^data[-\w.:]+$/i;function El(e,t){const n=hr(t);let r=t,i=Ge;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yl.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(di,kl);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!di.test(o)){let a=o.replace(xl,_l);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ir}return new i(r,t)}function _l(e){return"-"+e.toLowerCase()}function kl(e){return e.charAt(1).toUpperCase()}const wl=fa([ga,ml,ba,xa,ya],"html"),Or=fa([ga,hl,ba,xa,ya],"svg");function Nl(e){return e.join(" ").trim()}var Lt={},Vn,pi;function Sl(){if(pi)return Vn;pi=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
1
+ import{j as g}from"./radix-BFvMxQq9.js";import{j as Cr,r as X,k as os,l as ss}from"./vendor-D_-14Whs.js";import{u as Dn,a as ls,g as ri,b as cs,c as us,P as ua,d as ii,e as ds,f as ps,s as fs,h as gs}from"./personas-6VEsCmkv.js";import{c as gt,B as Be,L as da,D as fr,I as ms,t as De,C as hs,S as bs,A as Bt,u as xs,a as ys,b as Es,d as _s,e as ai,X as mn,g as ks,f as ws,h as Ns,i as Ss}from"./index-DGA-rUGx.js";import{C as gr,a as oi}from"./copy-button-BGhg8Khu.js";import{P as pa}from"./pencil-B6GM9rGh.js";import{T as mr}from"./trash-2-Bwu1AKhQ.js";import{R as vs}from"./refresh-cw-C0HV0_ff.js";import{C as rn,a as Ar,b as Ts,D as Cs,c as As,d as Is,e as Os,f as Rs,g as Ms,h as Ds,i as Ls,j as Ps,k as Bs}from"./dialog-DZNAqEWA.js";import{C as Fs}from"./circle-x-DS6mPliy.js";import{S as zs,a as Us,M as $s}from"./ModelDetailDialog-B9XwOIZ1.js";import{C as js}from"./check-BfxrDSv2.js";import"./save-C_BZqFjv.js";const Hs=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ks=gt("arrow-down",Hs);const Gs=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],qs=gt("brain",Gs);const Ws=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vs=gt("chevron-left",Ws);const Ys=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zs=gt("file-text",Ys);const Xs=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],si=gt("message-square-plus",Xs);const Qs=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Js=gt("paperclip",Qs);const el=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],tl=gt("send-horizontal",el);const nl=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],rl=gt("share-2",nl);const il=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],al=gt("square",il);const ol=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],sl=gt("user-round",ol);function ll(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ul=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dl={};function li(e,t){return(dl.jsx?ul:cl).test(e)}const pl=/[ \t\n\f\r]/g;function fl(e){return typeof e=="object"?e.type==="text"?ci(e.value):!1:ci(e)}function ci(e){return e.replace(pl,"")===""}class an{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}an.prototype.normal={};an.prototype.property={};an.prototype.space=void 0;function fa(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new an(n,r,t)}function hr(e){return e.toLowerCase()}class Ge{constructor(t,n){this.attribute=n,this.property=t}}Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let gl=0;const ne=It(),Se=It(),br=It(),R=It(),xe=It(),Ct=It(),We=It();function It(){return 2**++gl}const xr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ne,booleanish:Se,commaOrSpaceSeparated:We,commaSeparated:Ct,number:R,overloadedBoolean:br,spaceSeparated:xe},Symbol.toStringTag,{value:"Module"})),Wn=Object.keys(xr);class Ir extends Ge{constructor(t,n,r,i){let o=-1;if(super(t,n),ui(this,"space",i),typeof r=="number")for(;++o<Wn.length;){const a=Wn[o];ui(this,Wn[o],(r&xr[a])===xr[a])}}}Ir.prototype.defined=!0;function ui(e,t,n){n&&(e[t]=n)}function jt(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Ir(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[hr(r)]=r,n[hr(o.attribute)]=r}return new an(t,n,e.space)}const ga=jt({properties:{ariaActiveDescendant:null,ariaAtomic:Se,ariaAutoComplete:null,ariaBusy:Se,ariaChecked:Se,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:xe,ariaCurrent:null,ariaDescribedBy:xe,ariaDetails:null,ariaDisabled:Se,ariaDropEffect:xe,ariaErrorMessage:null,ariaExpanded:Se,ariaFlowTo:xe,ariaGrabbed:Se,ariaHasPopup:null,ariaHidden:Se,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xe,ariaLevel:R,ariaLive:null,ariaModal:Se,ariaMultiLine:Se,ariaMultiSelectable:Se,ariaOrientation:null,ariaOwns:xe,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:Se,ariaReadOnly:Se,ariaRelevant:null,ariaRequired:Se,ariaRoleDescription:xe,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:Se,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ma(e,t){return t in e?e[t]:t}function ha(e,t){return ma(e,t.toLowerCase())}const ml=jt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ct,acceptCharset:xe,accessKey:xe,action:null,allow:null,allowFullScreen:ne,allowPaymentRequest:ne,allowUserMedia:ne,alpha:ne,alt:null,as:null,async:ne,autoCapitalize:null,autoComplete:xe,autoFocus:ne,autoPlay:ne,blocking:xe,capture:null,charSet:null,checked:ne,cite:null,className:xe,closedBy:null,colorSpace:null,cols:R,colSpan:R,command:null,commandFor:null,content:null,contentEditable:Se,controls:ne,controlsList:xe,coords:R|Ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ne,defer:ne,dir:null,dirName:null,disabled:ne,download:br,draggable:Se,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ne,formTarget:null,headers:xe,height:R,hidden:br,high:R,href:null,hrefLang:null,htmlFor:xe,httpEquiv:xe,id:null,imageSizes:null,imageSrcSet:null,inert:ne,inputMode:null,integrity:null,is:null,isMap:ne,itemId:null,itemProp:xe,itemRef:xe,itemScope:ne,itemType:xe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ne,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:ne,muted:ne,name:null,nonce:null,noModule:ne,noValidate:ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ne,optimum:R,pattern:null,ping:xe,placeholder:null,playsInline:ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ne,referrerPolicy:null,rel:xe,required:ne,reversed:ne,rows:R,rowSpan:R,sandbox:xe,scope:null,scoped:ne,seamless:ne,selected:ne,shadowRootClonable:ne,shadowRootCustomElementRegistry:ne,shadowRootDelegatesFocus:ne,shadowRootMode:null,shadowRootSerializable:ne,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:Se,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:ne,useMap:null,value:Se,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xe,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ne,declare:ne,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:ne,noHref:ne,noShade:ne,noWrap:ne,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:Se,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ne,disablePictureInPicture:ne,disableRemotePlayback:ne,exportParts:Ct,part:xe,prefix:null,property:null,results:R,security:null,unselectable:null},space:"html",transform:ha}),hl=jt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:We,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:xe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ct,g2:Ct,glyphName:Ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:We,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:We,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:We,rev:We,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:We,requiredFeatures:We,requiredFonts:We,requiredFormats:We,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:We,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:We,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:We,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ma}),ba=jt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xa=jt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ha}),ya=jt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),bl={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},xl=/[A-Z]/g,di=/-[a-z]/g,yl=/^data[-\w.:]+$/i;function El(e,t){const n=hr(t);let r=t,i=Ge;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yl.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(di,kl);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!di.test(o)){let a=o.replace(xl,_l);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=Ir}return new i(r,t)}function _l(e){return"-"+e.toLowerCase()}function kl(e){return e.charAt(1).toUpperCase()}const wl=fa([ga,ml,ba,xa,ya],"html"),Or=fa([ga,hl,ba,xa,ya],"svg");function Nl(e){return e.join(" ").trim()}var Lt={},Vn,pi;function Sl(){if(pi)return Vn;pi=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l=`
2
2
  `,c="/",u="*",d="",f="comment",p="declaration";function h(_,E){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];E=E||{};var T=1,S=1;function O(P){var I=P.match(t);I&&(T+=I.length);var J=P.lastIndexOf(l);S=~J?P.length-J:S+P.length}function L(){var P={line:T,column:S};return function(I){return I.position=new w(P),G(),I}}function w(P){this.start=P,this.end={line:T,column:S},this.source=E.source}w.prototype.content=_;function j(P){var I=new Error(E.source+":"+T+":"+S+": "+P);if(I.reason=P,I.filename=E.source,I.line=T,I.column=S,I.source=_,!E.silent)throw I}function K(P){var I=P.exec(_);if(I){var J=I[0];return O(J),_=_.slice(J.length),I}}function G(){K(n)}function N(P){var I;for(P=P||[];I=B();)I!==!1&&P.push(I);return P}function B(){var P=L();if(!(c!=_.charAt(0)||u!=_.charAt(1))){for(var I=2;d!=_.charAt(I)&&(u!=_.charAt(I)||c!=_.charAt(I+1));)++I;if(I+=2,d===_.charAt(I-1))return j("End of comment missing");var J=_.slice(2,I-2);return S+=2,O(J),_=_.slice(I),S+=2,P({type:f,comment:J})}}function U(){var P=L(),I=K(r);if(I){if(B(),!K(i))return j("property missing ':'");var J=K(o),se=P({type:p,property:y(I[0].replace(e,d)),value:J?y(J[0].replace(e,d)):d});return K(a),se}}function te(){var P=[];N(P);for(var I;I=U();)I!==!1&&(P.push(I),N(P));return P}return G(),te()}function y(_){return _?_.replace(s,d):d}return Vn=h,Vn}var fi;function vl(){if(fi)return Lt;fi=1;var e=Lt&&Lt.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.default=n;const t=e(Sl());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const a=(0,t.default)(r),s=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;s?i(c,u,l):u&&(o=o||{},o[c]=u)}),o}return Lt}var Wt={},gi;function Tl(){if(gi)return Wt;gi=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(c){return!c||n.test(c)||e.test(c)},a=function(c,u){return u.toUpperCase()},s=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),o(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(i,s):c=c.replace(r,s),c.replace(t,a))};return Wt.camelCase=l,Wt}var Vt,mi;function Cl(){if(mi)return Vt;mi=1;var e=Vt&&Vt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(vl()),n=Tl();function r(i,o){var a={};return!i||typeof i!="string"||(0,t.default)(i,function(s,l){s&&l&&(a[(0,n.camelCase)(s,o)]=l)}),a}return r.default=r,Vt=r,Vt}var Al=Cl();const Il=Cr(Al),Ea=_a("end"),Rr=_a("start");function _a(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Ol(e){const t=Rr(e),n=Ea(e);if(t&&n)return{start:t,end:n}}function Qt(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hi(e.position):"start"in e||"end"in e?hi(e):"line"in e||"column"in e?yr(e):""}function yr(e){return bi(e&&e.line)+":"+bi(e&&e.column)}function hi(e){return yr(e&&e.start)+"-"+yr(e&&e.end)}function bi(e){return e&&typeof e=="number"?e:1}class ze extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(a=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Qt(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ze.prototype.file="";ze.prototype.name="";ze.prototype.reason="";ze.prototype.message="";ze.prototype.stack="";ze.prototype.column=void 0;ze.prototype.line=void 0;ze.prototype.ancestors=void 0;ze.prototype.cause=void 0;ze.prototype.fatal=void 0;ze.prototype.place=void 0;ze.prototype.ruleId=void 0;ze.prototype.source=void 0;const Mr={}.hasOwnProperty,Rl=new Map,Ml=/[A-Z]/g,Dl=new Set(["table","tbody","thead","tfoot","tr"]),Ll=new Set(["td","th"]),ka="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Pl(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Kl(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Hl(n,t.jsx,t.jsxs)}const 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"?Or:wl,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=wa(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function wa(e,t,n){if(t.type==="element")return Bl(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Fl(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ul(e,t,n);if(t.type==="mdxjsEsm")return zl(e,t);if(t.type==="root")return $l(e,t,n);if(t.type==="text")return jl(e,t)}function Bl(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Or,e.schema=i),e.ancestors.push(t);const o=Sa(e,t.tagName,!1),a=Gl(e,t);let s=Lr(e,t);return Dl.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!fl(l):!0})),Na(e,a,o,t),Dr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function Fl(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}tn(e,t.position)}function zl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);tn(e,t.position)}function Ul(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Or,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:Sa(e,t.name,!0),a=ql(e,t),s=Lr(e,t);return Na(e,a,o,t),Dr(a,s),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function $l(e,t,n){const r={};return Dr(r,Lr(e,t)),e.create(t,e.Fragment,r,n)}function jl(e,t){return t.value}function Na(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Dr(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Hl(e,t,n){return r;function r(i,o,a,s){const c=Array.isArray(a.children)?n:t;return s?c(o,a,s):c(o,a)}}function Kl(e,t){return n;function n(r,i,o,a){const s=Array.isArray(o.children),l=Rr(r);return t(i,o,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Gl(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Mr.call(t.properties,i)){const o=Wl(e,i,t.properties[i]);if(o){const[a,s]=o;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&Ll.has(t.tagName)?r=s:n[a]=s}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ql(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else tn(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else tn(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Lr(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Rl;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const s=wa(e,o,a);s!==void 0&&n.push(s)}return n}function Wl(e,t,n){const r=El(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?ll(n):Nl(n)),r.property==="style"){let i=typeof n=="object"?n:Vl(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Yl(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?bl[r.property]||r.property:r.attribute,n]}}function Vl(e,t){try{return Il(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ze("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=ka+"#cannot-parse-style-attribute",i}}function Sa(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,a;for(;++o<i.length;){const s=li(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}r=a}else r=li(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Mr.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);tn(e)}function tn(e,t){const n=new ze("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ka+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Yl(e){const t={};let n;for(n in e)Mr.call(e,n)&&(t[Zl(n)]=e[n]);return t}function Zl(e){let t=e.replace(Ml,Xl);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Xl(e){return"-"+e.toLowerCase()}const Yn={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Ql={};function Pr(e,t){const n=Ql,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return va(e,r,i)}function va(e,t,n){if(Jl(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return xi(e.children,t,n)}return Array.isArray(e)?xi(e,t,n):""}function xi(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=va(e[i],t,n);return r.join("")}function Jl(e){return!!(e&&typeof e=="object")}const yi=document.createElement("i");function Br(e){const t="&"+e+";";yi.innerHTML=t;const n=yi.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ve(e,t,n,r){const i=e.length;let o=0,a;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function Je(e,t){return e.length>0?(Ve(e,e.length,0,t),e):t}const Ei={}.hasOwnProperty;function Ta(e){const t={};let n=-1;for(;++n<e.length;)ec(t,e[n]);return t}function ec(e,t){let n;for(n in t){const i=(Ei.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Ei.call(i,a)||(i[a]=[]);const s=o[a];tc(i[a],Array.isArray(s)?s:s?[s]:[])}}}function tc(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ve(e,0,0,r)}function Ca(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&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 ot(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const je=Nt(/[A-Za-z]/),Fe=Nt(/[\dA-Za-z]/),nc=Nt(/[#-'*+\--9=?A-Z^-~]/);function Tn(e){return e!==null&&(e<32||e===127)}const Er=Nt(/\d/),rc=Nt(/[\dA-Fa-f]/),ic=Nt(/[!-/:-@[-`{-~]/);function Y(e){return e!==null&&e<-2}function ye(e){return e!==null&&(e<0||e===32)}function oe(e){return e===-2||e===-1||e===32}const Ln=Nt(new RegExp("\\p{P}|\\p{S}","u")),At=Nt(/\s/);function Nt(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ht(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&Fe(e.charCodeAt(n+1))&&Fe(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const s=e.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function de(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return oe(l)?(e.enter(n),s(l)):t(l)}function s(l){return oe(l)&&o++<i?(e.consume(l),s):(e.exit(n),t(l))}}const ac={tokenize:oc};function oc(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),de(e,t,"linePrefix")}function i(s){return e.enter("paragraph"),o(s)}function o(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Y(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),a)}}const sc={tokenize:lc},_i={tokenize:cc};function lc(e){const t=this,n=[];let r=0,i,o,a;return s;function s(S){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&T();const O=t.events.length;let L=O,w;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){w=t.events[L][1].end;break}E(r);let j=O;for(;j<t.events.length;)t.events[j][1].end={...w},j++;return Ve(t.events,L+1,0,t.events.slice(O)),t.events.length=j,c(S)}return s(S)}function c(S){if(r===n.length){if(!i)return f(S);if(i.currentConstruct&&i.currentConstruct.concrete)return h(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_i,u,d)(S)}function u(S){return i&&T(),E(r),f(S)}function d(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,h(S)}function f(S){return t.containerState={},e.attempt(_i,p,h)(S)}function p(S){return r++,n.push([t.currentConstruct,t.containerState]),f(S)}function h(S){if(S===null){i&&T(),E(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),y(S)}function y(S){if(S===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(S);return}return Y(S)?(e.consume(S),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(S),y)}function _(S,O){const L=t.sliceStream(S);if(O&&L.push(null),S.previous=o,o&&(o.next=S),o=S,i.defineSkip(S.start),i.write(L),t.parser.lazy[S.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<a&&(!i.events[w][1].end||i.events[w][1].end.offset>a))return;const j=t.events.length;let K=j,G,N;for(;K--;)if(t.events[K][0]==="exit"&&t.events[K][1].type==="chunkFlow"){if(G){N=t.events[K][1].end;break}G=!0}for(E(r),w=j;w<t.events.length;)t.events[w][1].end={...N},w++;Ve(t.events,K+1,0,t.events.slice(j)),t.events.length=w}}function E(S){let O=n.length;for(;O-- >S;){const L=n[O];t.containerState=L[1],L[0].exit.call(t,e)}n.length=S}function T(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cc(e,t,n){return de(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $t(e){if(e===null||ye(e)||At(e))return 1;if(Ln(e))return 2}function Pn(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const _r={name:"attention",resolveAll:uc,tokenize:dc};function uc(e,t){let n=-1,r,i,o,a,s,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};ki(d,-l),ki(f,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Je(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Je(c,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",o,t]]),c=Je(c,Pn(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Je(c,[["exit",o,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Je(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Ve(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function dc(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=$t(r);let o;return a;function a(l){return o=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===o)return e.consume(l),s;const c=e.exit("attentionSequence"),u=$t(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?d:d&&(i||!f)),c._close=!!(o===42?f:f&&(u||!d)),t(l)}}function ki(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pc={name:"autolink",tokenize:fc};function fc(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return je(p)?(e.consume(p),a):p===64?n(p):c(p)}function a(p){return p===43||p===45||p===46||Fe(p)?(r=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Fe(p))&&r++<32?(e.consume(p),s):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Tn(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):nc(p)?(e.consume(p),c):n(p)}function u(p){return Fe(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||Fe(p))&&r++<63){const h=p===45?f:d;return e.consume(p),h}return n(p)}}const on={partial:!0,tokenize:gc};function gc(e,t,n){return r;function r(o){return oe(o)?de(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Y(o)?t(o):n(o)}}const Aa={continuation:{tokenize:hc},exit:bc,name:"blockQuote",tokenize:mc};function mc(e,t,n){const r=this;return i;function i(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),o}return n(a)}function o(a){return oe(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function hc(e,t,n){const r=this;return i;function i(a){return oe(a)?de(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(Aa,t,n)(a)}}function bc(e){e.exit("blockQuote")}const Ia={name:"characterEscape",tokenize:xc};function xc(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return ic(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const Oa={name:"characterReference",tokenize:yc};function yc(e,t,n){const r=this;let i=0,o,a;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,a=Fe,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=rc,u):(e.enter("characterReferenceValue"),o=7,a=Er,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return a===Fe&&!Br(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&i++<o?(e.consume(d),u):n(d)}}const wi={partial:!0,tokenize:_c},Ni={concrete:!0,name:"codeFenced",tokenize:Ec};function Ec(e,t,n){const r=this,i={partial:!0,tokenize:L};let o=0,a=0,s;return l;function l(w){return c(w)}function c(w){const j=r.events[r.events.length-1];return o=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(w)}function u(w){return w===s?(a++,e.consume(w),u):a<3?n(w):(e.exit("codeFencedFenceSequence"),oe(w)?de(e,d,"whitespace")(w):d(w))}function d(w){return w===null||Y(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(wi,y,O)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(w))}function f(w){return w===null||Y(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(w)):oe(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),de(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),f)}function p(w){return w===null||Y(w)?d(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||Y(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(w)):w===96&&w===s?n(w):(e.consume(w),h)}function y(w){return e.attempt(i,O,_)(w)}function _(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),E}function E(w){return o>0&&oe(w)?de(e,T,"linePrefix",o+1)(w):T(w)}function T(w){return w===null||Y(w)?e.check(wi,y,O)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||Y(w)?(e.exit("codeFlowValue"),T(w)):(e.consume(w),S)}function O(w){return e.exit("codeFenced"),t(w)}function L(w,j,K){let G=0;return N;function N(I){return w.enter("lineEnding"),w.consume(I),w.exit("lineEnding"),B}function B(I){return w.enter("codeFencedFence"),oe(I)?de(w,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return I===s?(w.enter("codeFencedFenceSequence"),te(I)):K(I)}function te(I){return I===s?(G++,w.consume(I),te):G>=a?(w.exit("codeFencedFenceSequence"),oe(I)?de(w,P,"whitespace")(I):P(I)):K(I)}function P(I){return I===null||Y(I)?(w.exit("codeFencedFence"),j(I)):K(I)}}}function _c(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Zn={name:"codeIndented",tokenize:wc},kc={partial:!0,tokenize:Nc};function wc(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),de(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Y(c)?e.attempt(kc,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||Y(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function Nc(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Y(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):de(e,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):Y(a)?i(a):n(a)}}const Sc={name:"codeText",previous:Tc,resolve:vc,tokenize:Cc};function vc(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<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Tc(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Cc(e,t,n){let r=0,i,o;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),s(d)}function s(d){return d===96?(e.consume(d),r++,s):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(o=e.enter("codeTextSequence"),i=0,u(d)):Y(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Y(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(o.type="codeTextData",c(d))}}class Ac{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yt(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Yt(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Yt(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Yt(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Yt(this.left,n.reverse())}}}function Yt(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ra(e){const t={};let n=-1,r,i,o,a,s,l,c;const u=new Ac(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Ic(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(a=u.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ve(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Ic(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let u,d,f=-1,p=n,h=0,y=0;const _=[y];for(;p;){for(;e.get(++i)[1]!==p;);o.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(u),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]==="exit"&&s[f-1][0]==="enter"&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(y=f+1,_.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),f=_.length;f--;){const E=s.slice(_[f],_[f+1]),T=o.pop();l.push([T,T+E.length-1]),e.splice(T,2,E)}for(l.reverse(),f=-1;++f<l.length;)c[h+l[f][0]]=h+l[f][1],h+=l[f][1]-l[f][0]-1;return c}const Oc={resolve:Mc,tokenize:Dc},Rc={partial:!0,tokenize:Lc};function Mc(e){return Ra(e),e}function Dc(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(s)}function i(s){return s===null?o(s):Y(s)?e.check(Rc,a,o)(s):(e.consume(s),i)}function o(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Lc(e,t,n){const r=this;return i;function i(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),de(e,o,"linePrefix")}function o(a){if(a===null||Y(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Ma(e,t,n,r,i,o,a,s,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(E){return E===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(E),e.exit(o),f):E===null||E===32||E===41||Tn(E)?n(E):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),y(E))}function f(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(s),f(E)):E===null||E===60||Y(E)?n(E):(e.consume(E),E===92?h:p)}function h(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function y(E){return!u&&(E===null||E===41||ye(E))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(E)):u<c&&E===40?(e.consume(E),u++,y):E===41?(e.consume(E),u--,y):E===null||E===32||E===40||Tn(E)?n(E):(e.consume(E),E===92?_:y)}function _(E){return E===40||E===41||E===92?(e.consume(E),y):y(E)}}function Da(e,t,n,r,i,o){const a=this;let s=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Y(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Y(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!oe(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function La(e,t,n,r,i,o){let a;return s;function s(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),a=f===40?41:f,l):n(f)}function l(f){return f===a?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),c(f))}function c(f){return f===a?(e.exit(o),l(a)):f===null?n(f):Y(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),de(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===a||f===null||Y(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===a||f===92?(e.consume(f),u):u(f)}}function Jt(e,t){let n;return r;function r(i){return Y(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):oe(i)?de(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Pc={name:"definition",tokenize:Fc},Bc={partial:!0,tokenize:zc};function Fc(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),a(p)}function a(p){return Da.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return i=ot(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ye(p)?Jt(e,c)(p):c(p)}function c(p){return Ma(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Bc,d,d)(p)}function d(p){return oe(p)?de(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Y(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function zc(e,t,n){return r;function r(s){return ye(s)?Jt(e,i)(s):n(s)}function i(s){return La(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return oe(s)?de(e,a,"whitespace")(s):a(s)}function a(s){return s===null||Y(s)?t(s):n(s)}}const Uc={name:"hardBreakEscape",tokenize:$c};function $c(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Y(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const jc={name:"headingAtx",resolve:Hc,tokenize:Kc};function Hc(e,t){let n=e.length-2,r=3,i,o;return 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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ve(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function Kc(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),a(u)}function a(u){return u===35&&r++<6?(e.consume(u),a):u===null||ye(u)?(e.exit("atxHeadingSequence"),s(u)):n(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Y(u)?(e.exit("atxHeading"),t(u)):oe(u)?de(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||ye(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}const Gc=["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"],Si=["pre","script","style","textarea"],qc={concrete:!0,name:"htmlFlow",resolveTo:Yc,tokenize:Zc},Wc={partial:!0,tokenize:Qc},Vc={partial:!0,tokenize:Xc};function Yc(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 Zc(e,t,n){const r=this;let i,o,a,s,l;return c;function c(x){return u(x)}function u(x){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(x),d}function d(x){return x===33?(e.consume(x),f):x===47?(e.consume(x),o=!0,y):x===63?(e.consume(x),i=3,r.interrupt?t:b):je(x)?(e.consume(x),a=String.fromCharCode(x),_):n(x)}function f(x){return x===45?(e.consume(x),i=2,p):x===91?(e.consume(x),i=5,s=0,h):je(x)?(e.consume(x),i=4,r.interrupt?t:b):n(x)}function p(x){return x===45?(e.consume(x),r.interrupt?t:b):n(x)}function h(x){const ve="CDATA[";return x===ve.charCodeAt(s++)?(e.consume(x),s===ve.length?r.interrupt?t:U:h):n(x)}function y(x){return je(x)?(e.consume(x),a=String.fromCharCode(x),_):n(x)}function _(x){if(x===null||x===47||x===62||ye(x)){const ve=x===47,Oe=a.toLowerCase();return!ve&&!o&&Si.includes(Oe)?(i=1,r.interrupt?t(x):U(x)):Gc.includes(a.toLowerCase())?(i=6,ve?(e.consume(x),E):r.interrupt?t(x):U(x)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(x):o?T(x):S(x))}return x===45||Fe(x)?(e.consume(x),a+=String.fromCharCode(x),_):n(x)}function E(x){return x===62?(e.consume(x),r.interrupt?t:U):n(x)}function T(x){return oe(x)?(e.consume(x),T):N(x)}function S(x){return x===47?(e.consume(x),N):x===58||x===95||je(x)?(e.consume(x),O):oe(x)?(e.consume(x),S):N(x)}function O(x){return x===45||x===46||x===58||x===95||Fe(x)?(e.consume(x),O):L(x)}function L(x){return x===61?(e.consume(x),w):oe(x)?(e.consume(x),L):S(x)}function w(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),l=x,j):oe(x)?(e.consume(x),w):K(x)}function j(x){return x===l?(e.consume(x),l=null,G):x===null||Y(x)?n(x):(e.consume(x),j)}function K(x){return x===null||x===34||x===39||x===47||x===60||x===61||x===62||x===96||ye(x)?L(x):(e.consume(x),K)}function G(x){return x===47||x===62||oe(x)?S(x):n(x)}function N(x){return x===62?(e.consume(x),B):n(x)}function B(x){return x===null||Y(x)?U(x):oe(x)?(e.consume(x),B):n(x)}function U(x){return x===45&&i===2?(e.consume(x),J):x===60&&i===1?(e.consume(x),se):x===62&&i===4?(e.consume(x),fe):x===63&&i===3?(e.consume(x),b):x===93&&i===5?(e.consume(x),me):Y(x)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Wc,ue,te)(x)):x===null||Y(x)?(e.exit("htmlFlowData"),te(x)):(e.consume(x),U)}function te(x){return e.check(Vc,P,ue)(x)}function P(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),I}function I(x){return x===null||Y(x)?te(x):(e.enter("htmlFlowData"),U(x))}function J(x){return x===45?(e.consume(x),b):U(x)}function se(x){return x===47?(e.consume(x),a="",ee):U(x)}function ee(x){if(x===62){const ve=a.toLowerCase();return Si.includes(ve)?(e.consume(x),fe):U(x)}return je(x)&&a.length<8?(e.consume(x),a+=String.fromCharCode(x),ee):U(x)}function me(x){return x===93?(e.consume(x),b):U(x)}function b(x){return x===62?(e.consume(x),fe):x===45&&i===2?(e.consume(x),b):U(x)}function fe(x){return x===null||Y(x)?(e.exit("htmlFlowData"),ue(x)):(e.consume(x),fe)}function ue(x){return e.exit("htmlFlow"),t(x)}}function Xc(e,t,n){const r=this;return i;function i(a){return Y(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Qc(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(on,t,n)}}const Jc={name:"htmlText",tokenize:eu};function eu(e,t,n){const r=this;let i,o,a;return s;function s(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),c):b===47?(e.consume(b),L):b===63?(e.consume(b),S):je(b)?(e.consume(b),K):n(b)}function c(b){return b===45?(e.consume(b),u):b===91?(e.consume(b),o=0,h):je(b)?(e.consume(b),T):n(b)}function u(b){return b===45?(e.consume(b),p):n(b)}function d(b){return b===null?n(b):b===45?(e.consume(b),f):Y(b)?(a=d,se(b)):(e.consume(b),d)}function f(b){return b===45?(e.consume(b),p):d(b)}function p(b){return b===62?J(b):b===45?f(b):d(b)}function h(b){const fe="CDATA[";return b===fe.charCodeAt(o++)?(e.consume(b),o===fe.length?y:h):n(b)}function y(b){return b===null?n(b):b===93?(e.consume(b),_):Y(b)?(a=y,se(b)):(e.consume(b),y)}function _(b){return b===93?(e.consume(b),E):y(b)}function E(b){return b===62?J(b):b===93?(e.consume(b),E):y(b)}function T(b){return b===null||b===62?J(b):Y(b)?(a=T,se(b)):(e.consume(b),T)}function S(b){return b===null?n(b):b===63?(e.consume(b),O):Y(b)?(a=S,se(b)):(e.consume(b),S)}function O(b){return b===62?J(b):S(b)}function L(b){return je(b)?(e.consume(b),w):n(b)}function w(b){return b===45||Fe(b)?(e.consume(b),w):j(b)}function j(b){return Y(b)?(a=j,se(b)):oe(b)?(e.consume(b),j):J(b)}function K(b){return b===45||Fe(b)?(e.consume(b),K):b===47||b===62||ye(b)?G(b):n(b)}function G(b){return b===47?(e.consume(b),J):b===58||b===95||je(b)?(e.consume(b),N):Y(b)?(a=G,se(b)):oe(b)?(e.consume(b),G):J(b)}function N(b){return b===45||b===46||b===58||b===95||Fe(b)?(e.consume(b),N):B(b)}function B(b){return b===61?(e.consume(b),U):Y(b)?(a=B,se(b)):oe(b)?(e.consume(b),B):G(b)}function U(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),i=b,te):Y(b)?(a=U,se(b)):oe(b)?(e.consume(b),U):(e.consume(b),P)}function te(b){return b===i?(e.consume(b),i=void 0,I):b===null?n(b):Y(b)?(a=te,se(b)):(e.consume(b),te)}function P(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||ye(b)?G(b):(e.consume(b),P)}function I(b){return b===47||b===62||ye(b)?G(b):n(b)}function J(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function se(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ee}function ee(b){return oe(b)?de(e,me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):me(b)}function me(b){return e.enter("htmlTextData"),a(b)}}const Fr={name:"labelEnd",resolveAll:iu,resolveTo:au,tokenize:ou},tu={tokenize:su},nu={tokenize:lu},ru={tokenize:cu};function iu(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ve(e,0,e.length,n),e}function au(e,t){let n=e.length,r=0,i,o,a,s;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=Je(s,e.slice(o+1,o+r+3)),s=Je(s,[["enter",u,t]]),s=Je(s,Pn(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),s=Je(s,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),s=Je(s,e.slice(a+1)),s=Je(s,[["exit",l,t]]),Ve(e,o,e.length,s),e}function ou(e,t,n){const r=this;let i=r.events.length,o,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return s;function s(f){return o?o._inactive?d(f):(a=r.parser.defined.includes(ot(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(tu,u,a?u:d)(f):f===91?e.attempt(nu,u,a?c:d)(f):a?u(f):d(f)}function c(f){return e.attempt(ru,u,d)(f)}function u(f){return t(f)}function d(f){return o._balanced=!0,n(f)}}function su(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return ye(d)?Jt(e,o)(d):o(d)}function o(d){return d===41?u(d):Ma(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return ye(d)?Jt(e,l)(d):u(d)}function s(d){return n(d)}function l(d){return d===34||d===39||d===40?La(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ye(d)?Jt(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function lu(e,t,n){const r=this;return i;function i(s){return Da.call(r,e,o,a,"reference","referenceMarker","referenceString")(s)}function o(s){return r.parser.defined.includes(ot(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function cu(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const uu={name:"labelStartImage",resolveAll:Fr.resolveAll,tokenize:du};function du(e,t,n){const r=this;return i;function i(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),o}function o(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const pu={name:"labelStartLink",resolveAll:Fr.resolveAll,tokenize:fu};function fu(e,t,n){const r=this;return i;function i(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Xn={name:"lineEnding",tokenize:gu};function gu(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),de(e,t,"linePrefix")}}const vn={name:"thematicBreak",tokenize:mu};function mu(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),a(c)}function a(c){return i=c,s(c)}function s(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Y(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),oe(c)?de(e,s,"whitespace")(c):s(c))}}const Ke={continuation:{tokenize:yu},exit:_u,name:"list",tokenize:xu},hu={partial:!0,tokenize:ku},bu={partial:!0,tokenize:Eu};function xu(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(p){const h=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Er(p)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(vn,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Er(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(on,r.interrupt?n:u,e.attempt(hu,f,d))}function u(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return oe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function yu(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(on,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,de(e,t,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!oe(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bu,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,de(e,e.attempt(Ke,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Eu(e,t,n){const r=this;return de(e,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(o):n(o)}}function _u(e){e.exit(this.containerState.type)}function ku(e,t,n){const r=this;return de(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!oe(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const vi={name:"setextUnderline",resolveTo:wu,tokenize:Nu};function wu(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function Nu(e,t,n){const r=this;let i;return o;function o(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===i?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),oe(c)?de(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Y(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Su={tokenize:vu};function vu(e){const t=this,n=e.attempt(on,r,e.attempt(this.parser.constructs.flowInitial,i,de(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Oc,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Tu={resolveAll:Ba()},Cu=Pa("string"),Au=Pa("text");function Pa(e){return{resolveAll:Ba(e==="text"?Iu:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,a,s);return a;function a(u){return c(u)?o(u):s(u)}function s(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Ba(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function Iu(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,a=-1,s=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const Ou={42:Ke,43:Ke,45:Ke,48:Ke,49:Ke,50:Ke,51:Ke,52:Ke,53:Ke,54:Ke,55:Ke,56:Ke,57:Ke,62:Aa},Ru={91:Pc},Mu={[-2]:Zn,[-1]:Zn,32:Zn},Du={35:jc,42:vn,45:[vi,vn],60:qc,61:vi,95:vn,96:Ni,126:Ni},Lu={38:Oa,92:Ia},Pu={[-5]:Xn,[-4]:Xn,[-3]:Xn,33:uu,38:Oa,42:_r,60:[pc,Jc],91:pu,92:[Uc,Ia],93:Fr,95:_r,96:Sc},Bu={null:[_r,Tu]},Fu={null:[42,95]},zu={null:[]},Uu=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Fu,contentInitial:Ru,disable:zu,document:Ou,flow:Du,flowInitial:Mu,insideSpan:Bu,string:Lu,text:Pu},Symbol.toStringTag,{value:"Module"}));function $u(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],s=[];const l={attempt:j(L),check:j(w),consume:T,enter:S,exit:O,interrupt:j(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:h,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(B){return a=Je(a,B),_(),a[a.length-1]!==null?[]:(K(t,0),c.events=Pn(o,c.events,c),c.events)}function f(B,U){return Hu(p(B),U)}function p(B){return ju(a,B)}function h(){const{_bufferIndex:B,_index:U,line:te,column:P,offset:I}=r;return{_bufferIndex:B,_index:U,line:te,column:P,offset:I}}function y(B){i[B.line]=B.column,N()}function _(){let B;for(;r._index<a.length;){const U=a[r._index];if(typeof U=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<U.length;)E(U.charCodeAt(r._bufferIndex));else E(U)}}function E(B){u=u(B)}function T(B){Y(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,N()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=B}function S(B,U){const te=U||{};return te.type=B,te.start=h(),c.events.push(["enter",te,c]),s.push(te),te}function O(B){const U=s.pop();return U.end=h(),c.events.push(["exit",U,c]),U}function L(B,U){K(B,U.from)}function w(B,U){U.restore()}function j(B,U){return te;function te(P,I,J){let se,ee,me,b;return Array.isArray(P)?ue(P):"tokenize"in P?ue([P]):fe(P);function fe(ke){return Ye;function Ye(we){const Ie=we!==null&&ke[we],Te=we!==null&&ke.null,et=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(Te)?Te:Te?[Te]:[]];return ue(et)(we)}}function ue(ke){return se=ke,ee=0,ke.length===0?J:x(ke[ee])}function x(ke){return Ye;function Ye(we){return b=G(),me=ke,ke.partial||(c.currentConstruct=ke),ke.name&&c.parser.constructs.disable.null.includes(ke.name)?Oe():ke.tokenize.call(U?Object.assign(Object.create(c),U):c,l,ve,Oe)(we)}}function ve(ke){return B(me,b),I}function Oe(ke){return b.restore(),++ee<se.length?x(se[ee]):J}}}function K(B,U){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&Ve(c.events,U,c.events.length-U,B.resolve(c.events.slice(U),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function G(){const B=h(),U=c.previous,te=c.currentConstruct,P=c.events.length,I=Array.from(s);return{from:P,restore:J};function J(){r=B,c.previous=U,c.currentConstruct=te,c.events.length=P,s=I,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ju(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let a;if(n===i)a=[e[n].slice(r,o)];else{if(a=e.slice(n,i),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(e[i].slice(0,o))}return a}function Hu(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
3
3
  `;break}case-3:{a=`\r
4
4
  `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,r.push(a)}return r.join("")}function Ku(e){const r={constructs:Ta([Uu,...(e||{}).extensions||[]]),content:i(ac),defined:[],document:i(sc),flow:i(Su),lazy:{},string:i(Cu),text:i(Au)};return r;function i(o){return a;function a(s){return $u(r,o,s)}}}function Gu(e){for(;!Ra(e););return e}const Ti=/[\0\t\n\r]/g;function qu(){let e=1,t="",n=!0,r;return i;function i(o,a,s){const l=[];let c,u,d,f,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),d=0,t="",n&&(o.charCodeAt(0)===65279&&d++,n=void 0);d<o.length;){if(Ti.lastIndex=d,c=Ti.exec(o),f=c&&c.index!==void 0?c.index:o.length,p=o.charCodeAt(f),!c){t=o.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(o.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Wu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Vu(e){return e.replace(Wu,Yu)}function Yu(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Ca(n.slice(o?2:1),o?16:10)}return Br(n)||e}const Fa={}.hasOwnProperty;function Zu(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),Xu(n)(Gu(Ku(n).document().write(qu()(e,t,!0))))}function Xu(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(yt),autolinkProtocol:G,autolinkEmail:G,atxHeading:o(Ze),blockQuote:o(Te),characterEscape:G,characterReference:G,codeFenced:o(et),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(et,a),codeText:o(tt,a),codeTextData:G,data:G,codeFlowValue:G,definition:o(Rt),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(xt),hardBreakEscape:o(le),hardBreakTrailing:o(le),htmlFlow:o(nt,a),htmlFlowData:G,htmlText:o(nt,a),htmlTextData:G,image:o(rt),label:a,link:o(yt),listItem:o(Kt),listItemValue:f,listOrdered:o(St,d),listUnordered:o(St),paragraph:o(Mt),reference:x,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ze),strong:o(st),thematicBreak:o(Dt)},exit:{atxHeading:l(),atxHeadingSequence:L,autolink:l(),autolinkEmail:Ie,autolinkProtocol:we,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:Oe,characterReferenceMarkerNumeric:Oe,characterReferenceValue:ke,characterReference:Ye,codeFenced:l(_),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:N,codeIndented:l(E),codeText:l(I),codeTextData:N,data:N,definition:l(),definitionDestinationString:O,definitionLabelString:T,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(U),hardBreakTrailing:l(U),htmlFlow:l(te),htmlFlowData:N,htmlText:l(P),htmlTextData:N,image:l(se),label:me,labelText:ee,lineEnding:B,link:l(J),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ve,resourceDestinationString:b,resourceTitleString:fe,resource:ue,setextHeading:l(K),setextHeadingLineSequence:j,setextHeadingText:w,strong:l(),thematicBreak:l()}};za(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(v){let D={type:"root",children:[]};const Q={stack:[D],tokenStack:[],config:t,enter:s,exit:c,buffer:a,resume:u,data:n},ie=[];let pe=-1;for(;++pe<v.length;)if(v[pe][1].type==="listOrdered"||v[pe][1].type==="listUnordered")if(v[pe][0]==="enter")ie.push(pe);else{const Le=ie.pop();pe=i(v,Le,pe)}for(pe=-1;++pe<v.length;){const Le=t[v[pe][0]];Fa.call(Le,v[pe][1].type)&&Le[v[pe][1].type].call(Object.assign({sliceSerialize:v[pe][2].sliceSerialize},Q),v[pe][1])}if(Q.tokenStack.length>0){const Le=Q.tokenStack[Q.tokenStack.length-1];(Le[1]||Ci).call(Q,void 0,Le[0])}for(D.position={start:wt(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:wt(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<t.transforms.length;)D=t.transforms[pe](D)||D;return D}function i(v,D,Q){let ie=D-1,pe=-1,Le=!1,it,He,Qe,lt;for(;++ie<=Q;){const Re=v[ie];switch(Re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Re[0]==="enter"?pe++:pe--,lt=void 0;break}case"lineEndingBlank":{Re[0]==="enter"&&(it&&!lt&&!pe&&!Qe&&(Qe=ie),lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lt=void 0}if(!pe&&Re[0]==="enter"&&Re[1].type==="listItemPrefix"||pe===-1&&Re[0]==="exit"&&(Re[1].type==="listUnordered"||Re[1].type==="listOrdered")){if(it){let ct=ie;for(He=void 0;ct--;){const Ue=v[ct];if(Ue[1].type==="lineEnding"||Ue[1].type==="lineEndingBlank"){if(Ue[0]==="exit")continue;He&&(v[He][1].type="lineEndingBlank",Le=!0),Ue[1].type="lineEnding",He=ct}else if(!(Ue[1].type==="linePrefix"||Ue[1].type==="blockQuotePrefix"||Ue[1].type==="blockQuotePrefixWhitespace"||Ue[1].type==="blockQuoteMarker"||Ue[1].type==="listItemIndent"))break}Qe&&(!He||Qe<He)&&(it._spread=!0),it.end=Object.assign({},He?v[He][1].start:Re[1].end),v.splice(He||ie,0,["exit",it,Re[2]]),ie++,Q++}if(Re[1].type==="listItemPrefix"){const ct={type:"listItem",_spread:!1,start:Object.assign({},Re[1].start),end:void 0};it=ct,v.splice(ie,0,["enter",ct,Re[2]]),ie++,Q++,Qe=void 0,lt=!0}}}return v[D][1]._spread=Le,Q}function o(v,D){return Q;function Q(ie){s.call(this,v(ie),ie),D&&D.call(this,ie)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(v,D,Q){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([D,Q||void 0]),v.position={start:wt(D.start),end:void 0}}function l(v){return D;function D(Q){v&&v.call(this,Q),c.call(this,Q)}}function c(v,D){const Q=this.stack.pop(),ie=this.tokenStack.pop();if(ie)ie[0].type!==v.type&&(D?D.call(this,v,ie[0]):(ie[1]||Ci).call(this,v,ie[0]));else throw new Error("Cannot close `"+v.type+"` ("+Qt({start:v.start,end:v.end})+"): it’s not open");Q.position.end=wt(v.end)}function u(){return Pr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(v){if(this.data.expectingFirstListItemValue){const D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function p(){const v=this.resume(),D=this.stack[this.stack.length-1];D.lang=v}function h(){const v=this.resume(),D=this.stack[this.stack.length-1];D.meta=v}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v.replace(/(\r?\n|\r)$/g,"")}function T(v){const D=this.resume(),Q=this.stack[this.stack.length-1];Q.label=D,Q.identifier=ot(this.sliceSerialize(v)).toLowerCase()}function S(){const v=this.resume(),D=this.stack[this.stack.length-1];D.title=v}function O(){const v=this.resume(),D=this.stack[this.stack.length-1];D.url=v}function L(v){const D=this.stack[this.stack.length-1];if(!D.depth){const Q=this.sliceSerialize(v).length;D.depth=Q}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function j(v){const D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function G(v){const Q=this.stack[this.stack.length-1].children;let ie=Q[Q.length-1];(!ie||ie.type!=="text")&&(ie=Xe(),ie.position={start:wt(v.start),end:void 0},Q.push(ie)),this.stack.push(ie)}function N(v){const D=this.stack.pop();D.value+=this.sliceSerialize(v),D.position.end=wt(v.end)}function B(v){const D=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=D.children[D.children.length-1];Q.position.end=wt(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(D.type)&&(G.call(this,v),N.call(this,v))}function U(){this.data.atHardBreak=!0}function te(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function P(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function I(){const v=this.resume(),D=this.stack[this.stack.length-1];D.value=v}function J(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=D,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function se(){const v=this.stack[this.stack.length-1];if(this.data.inReference){const D=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=D,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function ee(v){const D=this.sliceSerialize(v),Q=this.stack[this.stack.length-2];Q.label=Vu(D),Q.identifier=ot(D).toLowerCase()}function me(){const v=this.stack[this.stack.length-1],D=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const ie=v.children;Q.children=ie}else Q.alt=D}function b(){const v=this.resume(),D=this.stack[this.stack.length-1];D.url=v}function fe(){const v=this.resume(),D=this.stack[this.stack.length-1];D.title=v}function ue(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function ve(v){const D=this.resume(),Q=this.stack[this.stack.length-1];Q.label=D,Q.identifier=ot(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function Oe(v){this.data.characterReferenceType=v.type}function ke(v){const D=this.sliceSerialize(v),Q=this.data.characterReferenceType;let ie;Q?(ie=Ca(D,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ie=Br(D);const pe=this.stack[this.stack.length-1];pe.value+=ie}function Ye(v){const D=this.stack.pop();D.position.end=wt(v.end)}function we(v){N.call(this,v);const D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(v)}function Ie(v){N.call(this,v);const D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(v)}function Te(){return{type:"blockquote",children:[]}}function et(){return{type:"code",lang:null,meta:null,value:""}}function tt(){return{type:"inlineCode",value:""}}function Rt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xt(){return{type:"emphasis",children:[]}}function Ze(){return{type:"heading",depth:0,children:[]}}function le(){return{type:"break"}}function nt(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function yt(){return{type:"link",title:null,url:"",children:[]}}function St(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Kt(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Mt(){return{type:"paragraph",children:[]}}function st(){return{type:"strong",children:[]}}function Xe(){return{type:"text",value:""}}function Dt(){return{type:"thematicBreak"}}}function wt(e){return{line:e.line,column:e.column,offset:e.offset}}function za(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?za(e,r):Qu(e,r)}}function Qu(e,t){let n;for(n in t)if(Fa.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ci(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qt({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qt({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qt({start:t.start,end:t.end})+") is still open")}function Ju(e){const t=this;t.parser=n;function n(r){return Zu(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ed(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function td(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -35,7 +35,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Ae=M,Ee=V),ce===void 0
35
35
  `,1;if(Gn>1e5&&Gn>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return _e+=ae,ae.length}const dt=_t(M);if(!dt)throw Xe(W.replace("{}",M)),new Error('Unknown language: "'+M+'"');const rs=He(dt);let Kn="",re=Ee||rs;const ni={},Me=new $.__emitter($);ns();let _e="",gn=0,vt=0,Gn=0,qn=!1;try{if(dt.__emitTokens)dt.__emitTokens(V,Me);else{for(re.matcher.considerAll();;){Gn++,qn?qn=!1:re.matcher.considerAll(),re.matcher.lastIndex=vt;const z=re.matcher.exec(V);if(!z)break;const q=V.substring(vt,z.index),ae=ti(q,z);vt=z.index+ae}ti(V.substring(vt))}return Me.finalize(),Kn=Me.toHTML(),{language:M,value:Kn,relevance:gn,illegal:!1,_emitter:Me,_top:re}}catch(z){if(z.message&&z.message.includes("Illegal"))return{language:M,value:Ue(V),illegal:!0,relevance:0,_illegalBy:{message:z.message,index:vt,context:V.slice(vt-100,vt+100),mode:z.mode,resultSoFar:Kn},_emitter:Me};if(ge)return{language:M,value:Ue(V),illegal:!1,relevance:0,errorRaised:z,_emitter:Me,_top:re};throw z}}function $n(M){const V={value:Ue(M),illegal:!1,relevance:0,_top:H,_emitter:new $.__emitter($)};return V._emitter.addText(M),V}function jn(M,V){V=V||$.languages||Object.keys(k);const ce=$n(M),Ee=V.filter(_t).filter(Xr).map(qe=>qt(qe,M,!1));Ee.unshift(ce);const Ae=Ee.sort((qe,ut)=>{if(qe.relevance!==ut.relevance)return ut.relevance-qe.relevance;if(qe.language&&ut.language){if(_t(qe.language).supersetOf===ut.language)return 1;if(_t(ut.language).supersetOf===qe.language)return-1}return 0}),[at,kt]=Ae,pn=at;return pn.secondBest=kt,pn}function jo(M,V,ce){const Ee=V&&C[V]||ce;M.classList.add("hljs"),M.classList.add(`language-${Ee}`)}function Hn(M){let V=null;const ce=Ce(M);if(Z(ce))return;if(dn("before:highlightElement",{el:M,language:ce}),M.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",M);return}if(M.children.length>0&&($.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(M)),$.throwUnescapedHTML))throw new ct("One of your code blocks includes unescaped HTML.",M.innerHTML);V=M;const Ee=V.textContent,Ae=ce?Ne(Ee,{language:ce,ignoreIllegals:!0}):jn(Ee);M.innerHTML=Ae.value,M.dataset.highlighted="yes",jo(M,ce,Ae.language),M.result={language:Ae.language,re:Ae.relevance,relevance:Ae.relevance},Ae.secondBest&&(M.secondBest={language:Ae.secondBest.language,relevance:Ae.secondBest.relevance}),dn("after:highlightElement",{el:M,result:Ae,text:Ee})}function Ho(M){$=Gt($,M)}const Ko=()=>{un(),v("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Go(){un(),v("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Yr=!1;function un(){function M(){un()}if(document.readyState==="loading"){Yr||window.addEventListener("DOMContentLoaded",M,!1),Yr=!0;return}document.querySelectorAll($.cssSelector).forEach(Hn)}function qo(M,V){let ce=null;try{ce=V(m)}catch(Ee){if(Xe("Language definition for '{}' could not be registered.".replace("{}",M)),ge)Xe(Ee);else throw Ee;ce=H}ce.name||(ce.name=M),k[M]=ce,ce.rawDefinition=V.bind(null,m),ce.aliases&&Zr(ce.aliases,{languageName:M})}function Wo(M){delete k[M];for(const V of Object.keys(C))C[V]===M&&delete C[V]}function Vo(){return Object.keys(k)}function _t(M){return M=(M||"").toLowerCase(),k[M]||k[C[M]]}function Zr(M,{languageName:V}){typeof M=="string"&&(M=[M]),M.forEach(ce=>{C[ce.toLowerCase()]=V})}function Xr(M){const V=_t(M);return V&&!V.disableAutodetect}function Yo(M){M["before:highlightBlock"]&&!M["before:highlightElement"]&&(M["before:highlightElement"]=V=>{M["before:highlightBlock"](Object.assign({block:V.el},V))}),M["after:highlightBlock"]&&!M["after:highlightElement"]&&(M["after:highlightElement"]=V=>{M["after:highlightBlock"](Object.assign({block:V.el},V))})}function Zo(M){Yo(M),F.push(M)}function Xo(M){const V=F.indexOf(M);V!==-1&&F.splice(V,1)}function dn(M,V){const ce=M;F.forEach(function(Ee){Ee[ce]&&Ee[ce](V)})}function Qo(M){return v("10.7.0","highlightBlock will be removed entirely in v12.0"),v("10.7.0","Please use highlightElement now."),Hn(M)}Object.assign(m,{highlight:Ne,highlightAuto:jn,highlightAll:un,highlightElement:Hn,highlightBlock:Qo,configure:Ho,initHighlighting:Ko,initHighlightingOnLoad:Go,registerLanguage:qo,unregisterLanguage:Wo,listLanguages:Vo,getLanguage:_t,registerAliases:Zr,autoDetection:Xr,inherit:Gt,addPlugin:Zo,removePlugin:Xo}),m.debugMode=function(){ge=!1},m.safeMode=function(){ge=!0},m.versionString=Re,m.regex={concat:y,lookahead:f,either:E,optional:h,anyNumberOfTimes:p};for(const M in Te)typeof Te[M]=="object"&&e(Te[M]);return Object.assign(m,Te),m},A=Et({});return A.newInstance=()=>Et({}),pr=A,A.HighlightJS=A,A.default=A,pr}var mh=gh();const hh=Cr(mh),la={},bh="hljs-";function xh(e){const t=hh.newInstance();return e&&o(e),{highlight:n,highlightAuto:r,listLanguages:i,register:o,registerAlias:a,registered:s};function n(l,c,u){const d=u||la,f=typeof d.prefix=="string"?d.prefix:bh;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:yh,classPrefix:f});const p=t.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const h=p._emitter.root,y=h.data;return y.language=p.language,y.relevance=p.relevance,h}function r(l,c){const d=(c||la).subset||i();let f=-1,p=0,h;for(;++f<d.length;){const y=d[f];if(!t.getLanguage(y))continue;const _=n(y,l,c);_.data&&_.data.relevance!==void 0&&_.data.relevance>p&&(p=_.data.relevance,h=_)}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return t.listLanguages()}function o(l,c){if(typeof l=="string")t.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&t.registerLanguage(u,l[u])}}function a(l,c){if(typeof l=="string")t.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];t.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function s(l){return!!t.getLanguage(l)}}class yh{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(a,s){return s?a+"_".repeat(s):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],o={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(o),this.stack.push(o)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Eh={};function _h(e){const t=e||Eh,n=t.aliases,r=t.detect||!1,i=t.languages||fh,o=t.plainText,a=t.prefix,s=t.subset;let l="hljs";const c=xh(i);if(n&&c.registerAlias(n),a){const u=a.indexOf("-");l=u===-1?a:a.slice(0,u)}return function(u,d){zn(u,"element",function(f,p,h){if(f.tagName!=="code"||!h||h.type!=="element"||h.tagName!=="pre")return;const y=kh(f);if(y===!1||!y&&!r||y&&o&&o.includes(y))return;Array.isArray(f.properties.className)||(f.properties.className=[]),f.properties.className.includes(l)||f.properties.className.unshift(l);const _=Ug(f,{whitespace:"pre"});let E;try{E=y?c.highlight(y,_,{prefix:a}):c.highlightAuto(_,{prefix:a,subset:s})}catch(T){const S=T;if(y&&/Unknown language/.test(S.message)){d.message("Cannot highlight as `"+y+"`, it’s not registered",{ancestors:[h,f],cause:S,place:f.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw S}!y&&E.data&&E.data.language&&f.properties.className.push("language-"+E.data.language),E.children.length>0&&(f.children=E.children)})}}function kh(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){const i=String(t[n]);if(i==="no-highlight"||i==="nohighlight")return!1;!r&&i.slice(0,5)==="lang-"&&(r=i.slice(5)),!r&&i.slice(0,9)==="language-"&&(r=i.slice(9))}return r}function zo({reasoning:e,thinkMs:t,streaming:n,showThinking:r=!0}){const[i,o]=X.useState(!1),a=X.useRef(null);X.useEffect(()=>{i&&n&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[e,i,n]);const s=t?`Thought for ${(t/1e3).toFixed(1)}s`:n?"Thinking…":"Thinking";return r?g.jsxs("div",{className:"mb-3 rounded-lg border border-border bg-panel-2",children:[g.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex w-full items-center gap-1.5 px-3 py-2 text-[12px] font-medium text-muted hover:text-ink",children:[g.jsx(rn,{size:13,className:i?"rotate-180 transition-transform":"transition-transform"}),s,n&&!i&&g.jsx("span",{className:"tllm-pulse ml-0.5",children:"·"})]}),i&&g.jsx("pre",{ref:a,className:"max-h-48 overflow-auto px-3 pb-3 font-mono text-[12px] leading-relaxed text-muted whitespace-pre-wrap",children:e})]}):g.jsx("div",{className:"mb-3 text-[12px] font-medium text-faint px-0 py-0.5",children:s})}function wh({stats:e}){const t=[];if(e.tps&&t.push(`${e.tps.toFixed(1)} tok/s`),e.promptTps&&t.push(`${e.promptTps.toFixed(0)} tok/s prefill`),e.ttftMs!=null&&e.ttftMs>0&&t.push(`${(e.ttftMs/1e3).toFixed(2)}s TTFT`),e.promptTokens!=null&&e.genTokens!=null&&t.push(`${e.promptTokens}+${e.genTokens} tokens`),e.cachedTokens!=null&&e.cachedTokens>0){const r=e.promptTokens?Math.round(e.cachedTokens/e.promptTokens*100):0;t.push(`${e.cachedTokens} cached${r?` (${r}%)`:""}`)}if(e.totalMs&&t.push(`${(e.totalMs/1e3).toFixed(1)}s total`),!t.length)return null;const n=[e.model?`Model: ${e.model}`:"",e.promptMs?`Prefill: ${e.promptMs.toFixed(0)}ms`:"",e.genMs?`Gen: ${e.genMs.toFixed(0)}ms`:"",e.ctxUsed!=null?`Context: ${e.ctxUsed} / ${e.ctxMax}`:"",e.aborted?"Aborted":""].filter(Boolean).join(`
36
36
  `);return g.jsxs("div",{className:"mt-2 text-[11px] text-faint",title:n,children:[t.join(" · "),e.aborted&&g.jsx("span",{className:"ml-2",style:{color:"var(--warn)"},children:"· aborted"})]})}const Mn=X.memo(function({children:t}){return g.jsx(yp,{remarkPlugins:[Mg],rehypePlugins:[_h],components:{a:({children:n,href:r})=>g.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline underline-offset-2",children:n}),code:({className:n,children:r,...i})=>{if(!(!!n?.includes("language-")||typeof r=="string"&&r.includes(`
37
37
  `)))return g.jsx("code",{className:"rounded bg-panel-2 px-1 py-0.5 font-mono text-[0.88em]",...i,children:r});const s=n?.replace("language-","")??"";return g.jsxs("div",{className:"relative my-2 overflow-hidden rounded-lg border border-border",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-panel-2 px-3 py-1 font-mono text-[11px] text-muted",children:[g.jsx("span",{children:s}),g.jsx(gr,{text:String(r),size:12})]}),g.jsx("div",{className:"overflow-x-auto overscroll-x-contain",onScroll:l=>l.stopPropagation(),children:g.jsx("code",{className:`${n??""} block p-3 font-mono text-[13px] leading-relaxed whitespace-pre`,...i,children:r})})]})},pre:({children:n})=>g.jsx(g.Fragment,{children:n}),table:({children:n})=>g.jsx("div",{className:"overflow-x-auto my-2",children:g.jsx("table",{className:"w-full border-collapse text-[13px]",children:n})}),th:({children:n})=>g.jsx("th",{className:"border border-border bg-panel-2 px-3 py-1.5 text-left font-semibold text-[13px]",children:n}),td:({children:n})=>g.jsx("td",{className:"border border-border px-3 py-1.5 text-[13px]",children:n})},children:t})});function Nh(e){return e.startsWith("mcp__")?e.replace(/^mcp__[^_]+(?:_[^_]+)*__/,""):e.replace(/_/g," ")}function Sh({call:e}){const[t,n]=X.useState(!1),r=!!e.result?.length;return g.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-panel-2",children:[g.jsxs("button",{type:"button",onClick:()=>r&&n(i=>!i),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left",style:{cursor:r?"pointer":"default"},children:[e.status==="pending"&&g.jsx(da,{size:12,className:"shrink-0 animate-spin",style:{color:"var(--accent)"}}),e.status==="done"&&g.jsx(Ts,{size:12,className:"shrink-0",style:{color:"#4ade80"}}),e.status==="error"&&g.jsx(Fs,{size:12,className:"shrink-0",style:{color:"var(--err)"}}),g.jsx("span",{className:"font-mono text-[12px] font-medium text-ink",children:Nh(e.name)}),g.jsx("span",{className:"text-[11px] text-faint",children:e.status==="pending"?"running…":e.status==="error"?"error":"done"}),r&&g.jsx(rn,{size:11,className:`ml-auto shrink-0 text-faint transition-transform ${t?"rotate-180":""}`})]}),t&&e.result&&g.jsx("pre",{className:"max-h-48 overflow-auto border-t border-border px-3 pb-3 pt-2 font-mono text-[11px] leading-relaxed text-muted whitespace-pre-wrap",children:e.result.length>2e3?`${e.result.slice(0,2e3)}
38
- …(truncated)`:e.result})]})}function Uo({calls:e}){return e.length?g.jsx("div",{className:"mb-3 space-y-1",children:e.map(t=>g.jsx(Sh,{call:t},t.id))}):null}function vh({confidence:e}){const t=Math.round(e*100),n=e>=.8;return g.jsxs("span",{title:"Model's self-assessed confidence. A local LLM never reaches 1.0 — that's expected.",className:"inline-flex items-center rounded px-1.5 py-0.5 text-[11px] font-medium",style:{background:n?"color-mix(in srgb, var(--accent) 15%, transparent)":"color-mix(in srgb, var(--warn) 15%, transparent)",color:n?"var(--accent)":"var(--warn)",border:`1px solid ${n?"color-mix(in srgb, var(--accent) 30%, transparent)":"color-mix(in srgb, var(--warn) 30%, transparent)"}`},children:["Confidence ",t,"%"]})}function Th({source:e,idx:t}){const[n,r]=X.useState(!1),i=e.relevanceScore>=.7?"var(--accent)":e.relevanceScore>=.5?"var(--warn)":"var(--faint)";return g.jsxs("div",{className:"rounded border border-border bg-panel-2 overflow-hidden",children:[g.jsxs("button",{type:"button",onClick:()=>r(o=>!o),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left text-[12px]",children:[g.jsxs("span",{className:"shrink-0 font-mono text-faint",children:[t+1,"."]}),g.jsxs("span",{className:"min-w-0 flex-1",children:[g.jsx("span",{className:"font-medium text-ink truncate block",children:e.title||e.domain}),g.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-faint hover:text-accent truncate block",onClick:o=>o.stopPropagation(),children:e.domain})]}),g.jsxs("span",{className:"shrink-0 rounded px-1 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, currentColor 12%, transparent)",color:i},children:[Math.round(e.relevanceScore*100),"%"]}),n?g.jsx(rn,{size:11,className:"shrink-0 text-faint mt-0.5"}):g.jsx(Ar,{size:11,className:"shrink-0 text-faint mt-0.5"})]}),n&&g.jsx("p",{className:"border-t border-border px-3 pb-2 pt-1.5 text-[11px] leading-relaxed text-muted",children:e.passage||"(no passage)"})]})}function Ch({meta:e}){const[t,n]=X.useState(!1),r=e.sources??[];return r.length===0?null:g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{type:"button",onClick:()=>n(i=>!i),className:"flex items-center gap-1 text-[12px] text-muted hover:text-ink",children:[t?g.jsx(rn,{size:12}):g.jsx(Ar,{size:12}),g.jsxs("span",{children:["Sources [",r.length,"]"]})]}),t&&g.jsx("div",{className:"mt-1.5 space-y-1",children:r.map((i,o)=>g.jsx(Th,{source:i,idx:o},i.url))})]})}function Ah({content:e,verdicts:t}){if(!t.length)return g.jsx(Mn,{children:e});const n=new Map;for(const o of t)n.set(o.sentence.trim(),o);const r=[];let i=e;for(const[o,a]of n){const s=i.indexOf(o);s!==-1&&(s>0&&r.push({text:i.slice(0,s)}),r.push({text:o,verdict:a.verdict==="uncited"?void 0:a.verdict}),i=i.slice(s+o.length))}return i&&r.push({text:i}),g.jsx(g.Fragment,{children:r.map((o,a)=>g.jsxs("span",{className:"relative",children:[o.verdict==="verified"&&g.jsx("span",{title:"Claim found in cited source",className:"inline-block text-[9px] font-bold ml-0.5 mr-0.5 align-super",style:{color:"var(--ok)"},children:"✓"}),o.verdict==="unverified"&&g.jsx("span",{title:"Could not verify this claim in the cited source — check manually",className:"inline-block text-[9px] font-bold ml-0.5 mr-0.5 align-super",style:{color:"var(--warn)"},children:"?"}),g.jsx(Mn,{children:o.text})]},a))})}function Ih({content:e,reasoning:t,progress:n,liveGenTps:r,genTokens:i,toolCalls:o=[]}){const a=!!n&&n.phase==="prompt";return g.jsxs("div",{className:"flex gap-3",children:[g.jsx($o,{}),g.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[t&&g.jsx(zo,{reasoning:t,streaming:!0}),g.jsx(Uo,{calls:o}),g.jsx("div",{className:"prose-tllm text-[15px] leading-[1.7] text-ink",children:e?g.jsx(Mn,{children:e}):g.jsx("span",{className:"text-muted",children:a?"Processing prompt…":t?"Generating…":o.length?"Working…":"Thinking…"})}),a&&g.jsxs("div",{className:"mt-2 space-y-1",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[g.jsx("span",{children:"Processing prompt"}),g.jsxs("span",{className:"font-medium",style:{color:"var(--ink)"},children:[n.pct,"%"]}),n.tps>0&&g.jsxs("span",{children:["· ",n.tps.toFixed(0)," tok/s prefill"]})]}),g.jsx("div",{className:"h-[3px] w-full overflow-hidden rounded-full",style:{background:"var(--border)"},children:g.jsx("div",{className:"h-full rounded-full transition-all duration-200",style:{width:`${n.pct}%`,background:"var(--accent)"}})})]}),!a&&(e||t)&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-faint",children:[g.jsx("span",{className:"tllm-pulse",children:"·"}),i>0&&g.jsxs("span",{className:"font-medium",style:{color:"var(--ink)"},children:[i," tok"]}),r>0?g.jsxs("span",{children:["· ",r.toFixed(1)," tok/s"]}):i===0&&g.jsx("span",{children:"…"})]})]})]})}function Oh({message:e,isLast:t,onEdit:n,onDelete:r,onRegenerate:i,editingId:o,onEditSave:a,onEditCancel:s,showThinking:l=!0}){const[c,u]=X.useState(e.content),d=o===e.id;if(e.role==="user")return g.jsx("div",{className:"group flex justify-end gap-2",children:g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[d?g.jsxs("div",{className:"w-full max-w-[75%]",children:[g.jsx("textarea",{autoFocus:!0,className:"w-full resize-none rounded-[var(--radius-lg)] border border-accent bg-panel px-4 py-2.5 text-[15px] leading-[1.6] text-ink outline-none",rows:3,value:c,onChange:_=>u(_.target.value),onKeyDown:_=>{(_.ctrlKey||_.metaKey)&&_.key==="Enter"&&(_.preventDefault(),a(c)),_.key==="Escape"&&s()}}),g.jsxs("div",{className:"mt-1.5 flex gap-1.5 justify-end",children:[g.jsx(Be,{size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),g.jsx(Be,{size:"sm",onClick:()=>a(c),children:"Save & Resend"})]})]}):g.jsxs("div",{className:"flex max-w-[75%] flex-col items-end",children:[g.jsx("div",{className:"whitespace-pre-wrap rounded-[var(--radius-lg)] bg-accent px-4 py-2.5 text-[15px] leading-[1.6] text-on-accent",children:e.content}),e.attachments?.filter(_=>_.startsWith("data:image")).map((_,E)=>g.jsx("img",{src:_,className:"mt-2 max-h-48 max-w-xs rounded-lg object-contain",alt:"attached image"},E)),e.textAttachments?.length>0&&g.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1 justify-end",children:e.textAttachments.map((_,E)=>g.jsxs("span",{className:"flex items-center gap-1 rounded border border-border bg-panel-2 px-2 py-0.5 text-[12px] text-muted",children:[g.jsx(Zs,{size:11,className:"shrink-0"}),_]},E))})]}),!d&&g.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx(gr,{text:e.content,className:"rounded p-1 hover:bg-panel-2"}),n&&g.jsx(Sn,{icon:g.jsx(pa,{size:12}),label:"Edit",onClick:()=>{u(e.content),n(e)}}),r&&g.jsx(Sn,{icon:g.jsx(mr,{size:12}),label:"Delete",onClick:()=>r(e),destructive:!0})]})]})});const f=e.stats.aborted&&!e.content,p=(e.toolCalls??[]).map(_=>({id:_.id,name:_.name,status:_.error?"error":"done",result:_.error??_.result})),h=e.researchMeta,y=h?.refereeVerdicts??[];return g.jsxs("div",{className:"group flex gap-3",children:[g.jsx($o,{}),g.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[e.reasoning&&g.jsx(zo,{reasoning:e.reasoning,thinkMs:e.stats.thinkMs,showThinking:l}),g.jsx(Uo,{calls:p}),f?g.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[14px]",style:{borderColor:"var(--err)",color:"var(--err)",background:"color-mix(in srgb, var(--err) 8%, transparent)"},children:["Generation failed or was stopped.",t&&i&&g.jsx("button",{type:"button",className:"ml-3 underline",onClick:i,children:"Regenerate"})]}):g.jsx("div",{className:"prose-tllm text-[15px] leading-[1.7] text-ink",children:y.length>0?g.jsx(Ah,{content:e.content,verdicts:y}):g.jsx(Mn,{children:e.content})}),h?.confidence!==void 0&&g.jsx("div",{className:"mt-1.5",children:g.jsx(vh,{confidence:h.confidence})}),h&&g.jsx(Ch,{meta:h}),g.jsx(wh,{stats:e.stats}),g.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx(gr,{text:e.content,className:"rounded p-1 hover:bg-panel-2"}),t&&i&&g.jsx(Sn,{icon:g.jsx(vs,{size:12}),label:"Regenerate",onClick:i}),r&&g.jsx(Sn,{icon:g.jsx(mr,{size:12}),label:"Delete",onClick:()=>r(e),destructive:!0})]})]})]})}function $o(){return g.jsx("div",{className:"mt-1 grid h-5 w-5 shrink-0 place-items-center rounded bg-panel-2 text-[9px] font-bold text-muted",children:"T"})}function Sn({icon:e,label:t,onClick:n,destructive:r}){return g.jsx("button",{type:"button",title:t,onClick:n,className:"rounded p-1 transition-colors hover:bg-panel-2",style:{color:r?"var(--err)":"var(--faint)"},children:e})}function ca(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Rh({ctxUsed:e,ctxMax:t}){if(t<=0)return null;const n=t>0?e/t:0,r=Math.min(1,n),i=Math.round(r*100),o=n>.9?"var(--err)":n>.75?"var(--warn)":"var(--accent)",a=n>.9?{color:"var(--err)"}:n>.75?{color:"var(--warn)"}:{},s=n>.9?"Context nearly full — older messages may be truncated":`Context: ${e.toLocaleString()} / ${t.toLocaleString()} tokens`;return g.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",title:s,children:[g.jsx("div",{className:"h-[3px] w-20 overflow-hidden rounded-full shrink-0",style:{background:"var(--border)"},children:g.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${(r*100).toFixed(1)}%`,background:o}})}),g.jsx("span",{className:"text-[11px] text-faint whitespace-nowrap tabular-nums shrink-0",style:a,children:`${ca(e)} / ${ca(t)} · ${i}%`})]})}function Mh(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function Dh({activeId:e,onSelect:t,onNew:n,onImport:r,collapsed:i,onToggle:o}){const[a,s]=X.useState(""),[l,c]=X.useState(""),u=X.useRef(null),d=Dn(),p=ls(l||void 0).data?.conversations??[];X.useEffect(()=>{const y=setTimeout(()=>c(a),200);return()=>clearTimeout(y)},[a]),X.useEffect(()=>{const y=_=>{(_.ctrlKey||_.metaKey)&&_.key==="k"&&(_.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]);const h=(y,_)=>{y.stopPropagation(),d.remove.mutate(_.id,{onSuccess:()=>{De.success("Conversation deleted")},onError:()=>{De.error("Could not delete conversation.")}})};return i?g.jsxs("div",{className:"flex h-full flex-col items-center gap-1 border-r border-border bg-panel-2 py-3",children:[o&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:o,title:"Expand sidebar",className:"h-7 w-7",children:g.jsx(Ar,{size:15})}),g.jsx(Be,{size:"icon",variant:"ghost",onClick:n,title:"New chat (Ctrl+N)",className:"h-7 w-7",children:g.jsx(si,{size:15})}),r&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:r,title:"Import chat (.turbollm-chat.json or OpenAI JSON)",className:"h-7 w-7",children:g.jsx(fr,{size:15})})]}):g.jsxs("div",{className:"flex h-full flex-col border-r border-border bg-panel-2",children:[g.jsxs("div",{className:"flex items-center gap-2 px-3 py-3",children:[o&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:o,title:"Collapse sidebar",className:"h-7 w-7 shrink-0",children:g.jsx(Vs,{size:15})}),g.jsxs("div",{className:"relative flex-1",children:[g.jsx(zs,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-faint"}),g.jsx(ms,{ref:u,value:a,onChange:y=>s(y.target.value),placeholder:"Search…",className:"h-7 pl-7 text-[12px]"})]}),g.jsx(Be,{size:"icon",variant:"ghost",onClick:n,title:"New chat (Ctrl+N)",className:"h-7 w-7 shrink-0",children:g.jsx(si,{size:15})}),r&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:r,title:"Import chat (.turbollm-chat.json or OpenAI JSON)",className:"h-7 w-7 shrink-0",children:g.jsx(fr,{size:15})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-1 pb-2",children:[p.length===0&&g.jsx("p",{className:"px-3 py-4 text-[12px] text-faint",children:a?"No results.":"No conversations yet."}),p.map(y=>g.jsx(Lh,{conv:y,active:y.id===e,onSelect:t,onDelete:h},y.id))]})]})}function Lh({conv:e,active:t,onSelect:n,onDelete:r}){const[i,o]=X.useState(!1),[a,s]=X.useState(e.title),l=Dn(),c=()=>{o(!1);const u=a.trim();if(!u||u===e.title){s(e.title);return}l.update.mutate({id:e.id,title:u},{onError:()=>{s(e.title),De.error("Could not rename conversation.")}})};return g.jsxs("div",{onClick:()=>!i&&n(e.id),className:"group relative flex cursor-pointer flex-col gap-0.5 rounded-md px-3 py-2 transition-colors",style:{background:t?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},children:[i?g.jsx("input",{autoFocus:!0,className:"w-full bg-transparent text-[13px] font-medium text-ink outline-none",value:a,onChange:u=>s(u.target.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&c(),u.key==="Escape"&&(s(e.title),o(!1))},onClick:u=>u.stopPropagation()}):g.jsx("span",{className:"truncate text-[13px] font-medium text-ink",style:{color:t?"var(--accent)":void 0},onDoubleClick:u=>{u.stopPropagation(),o(!0)},children:e.title}),g.jsx("span",{className:"text-[11px] text-faint",children:Mh(e.updatedAt)}),!i&&g.jsxs("div",{className:"absolute right-1.5 top-1/2 flex -translate-y-1/2 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),s(e.title),o(!0)},className:"rounded p-1 text-faint transition-colors hover:text-ink",title:"Rename conversation",children:g.jsx(pa,{size:13})}),g.jsx("button",{type:"button",onClick:u=>r(u,e),className:"rounded p-1 text-faint transition-colors hover:text-err",title:"Delete conversation",children:g.jsx(mr,{size:13})})]})]})}function Ph({models:e,loadedKey:t,loadedName:n,pending:r,ejecting:i,onLoad:o,onEject:a,onSettings:s,align:l="start"}){const c=e.filter(d=>!d.incomplete&&!d.parseError),u=i?"Ejecting…":n||(t?"Loaded model":"Load a model");return g.jsxs(Cs,{children:[g.jsxs(As,{className:"flex h-8 max-w-[260px] items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 text-[13px] text-ink transition-colors hover:border-[color:var(--accent)] disabled:opacity-60",disabled:r,children:[r||i?g.jsx(da,{size:14,className:"animate-spin text-muted"}):g.jsx(hs,{size:14,className:t?"text-accent":"text-muted"}),g.jsx("span",{className:"truncate",children:u}),g.jsx(rn,{size:14,className:"shrink-0 text-muted"})]}),g.jsxs(Is,{align:l,className:"max-h-[60vh] w-[280px] overflow-y-auto",children:[g.jsx("div",{className:"px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide text-faint",children:c.length?"Load a model":"No models found"}),c.map(d=>{const f=d.key===t;return g.jsxs("div",{role:"menuitem",tabIndex:-1,className:"flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-[13px] outline-none hover:bg-panel-2 focus:bg-panel-2",onClick:p=>{if(p.altKey&&s){s(d.key);return}f||o(d.key)},children:[g.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:f&&g.jsx(js,{size:14,className:"text-accent"})}),g.jsx("span",{className:"min-w-0 flex-1 truncate",children:d.name}),g.jsx("span",{className:"shrink-0 text-[11px] uppercase text-faint",children:d.format==="mlx"?"MLX":d.quant})]},d.key)}),s&&g.jsx("div",{className:"px-2 py-1 text-[11px] text-faint",children:"Alt+click to configure"}),t&&g.jsxs(g.Fragment,{children:[g.jsx(Os,{}),g.jsxs(Rs,{onSelect:a,style:{color:"var(--err)"},children:[g.jsx(Ms,{size:14})," Eject model"]})]})]})]})}const Bh=[{key:"temperature",label:"Temperature",min:0,max:2,step:.01,def:.8},{key:"top_p",label:"Top P",min:0,max:1,step:.01,def:.95},{key:"top_k",label:"Top K",min:0,max:200,step:1,def:40},{key:"min_p",label:"Min P",min:0,max:1,step:.01,def:.05}];function Fh({conv:e}){const t=Dn(),[n,r]=X.useState(!1),[i,o]=X.useState(""),[a,s]=X.useState({});X.useEffect(()=>{n&&e&&(o(e.systemPrompt??""),s(e.sampling??{}))},[n,e]);const l=Object.keys(a).length>0,c=e?.expertMode??!1,u=(p,h)=>s(y=>({...y,[p]:h})),d=()=>s({}),f=()=>{if(!e)return;const p=c?{id:e.id,sampling:a}:{id:e.id,systemPrompt:i,sampling:a};t.update.mutate(p,{onSuccess:()=>{De.success("Thread settings saved"),r(!1)},onError:h=>De.error(h instanceof Bt?h.message:"Could not save settings.")})};return g.jsxs(Ds,{open:n,onOpenChange:r,children:[g.jsx(Ls,{asChild:!0,children:g.jsx(Be,{size:"icon",variant:"ghost",className:"h-8 w-8",title:"Thread settings — system prompt & sampling overrides",disabled:!e,children:g.jsx(bs,{size:15})})}),g.jsxs(Ps,{className:"max-w-md",children:[g.jsx("div",{className:"mb-4",children:g.jsx("span",{className:"text-[15px] font-semibold text-ink",children:"Thread settings"})}),g.jsxs("div",{className:"flex flex-col gap-5",children:[g.jsxs("div",{children:[g.jsx("label",{className:"mb-1.5 block text-[11px] font-medium uppercase tracking-wide text-faint",children:"System prompt"}),c?g.jsx("p",{className:"rounded-lg border border-border bg-panel-2 px-3 py-2 text-[13px] text-muted",children:"System prompt is managed by TurboLLM for the Expert assistant."}):g.jsx("textarea",{rows:4,value:i,onChange:p=>o(p.target.value),placeholder:"Leave blank to use the model's built-in default",className:"w-full resize-none rounded-lg border border-border bg-bg px-3 py-2 text-[14px] leading-[1.6] text-ink outline-none placeholder:text-faint focus:border-[color:var(--accent)]"})]}),g.jsxs("div",{children:[g.jsxs("div",{className:"mb-2.5 flex items-center justify-between",children:[g.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:"Sampling overrides"}),l&&g.jsx("button",{type:"button",onClick:d,className:"text-[12px] text-muted underline-offset-2 hover:text-ink hover:underline",children:"Reset to model defaults"})]}),g.jsx("div",{className:"flex flex-col gap-3.5",children:Bh.map(p=>{const h=p.key in a,y=h?a[p.key]??p.def:p.def;return g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:"w-24 shrink-0 text-[13px]",style:{color:h?"var(--ink)":"var(--muted)"},children:p.label}),g.jsx("input",{type:"range",min:p.min,max:p.max,step:p.step,value:y,onChange:_=>u(p.key,parseFloat(_.target.value)),className:"flex-1",style:{accentColor:"var(--accent)"}}),g.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[13px] tabular-nums text-ink",children:p.step<1?y.toFixed(2):String(Math.round(y))})]},p.key)})}),!l&&g.jsx("p",{className:"mt-2.5 text-[12px] text-faint",children:"Using model defaults · move any slider to override for this thread"})]})]}),g.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[g.jsx(Bs,{asChild:!0,children:g.jsx(Be,{variant:"ghost",size:"sm",children:"Cancel"})}),g.jsx(Be,{size:"sm",onClick:f,disabled:t.update.isPending,children:t.update.isPending?"Saving…":"Save"})]})]})]})}function Jh(){const{data:e}=xs(),t=e?.model,n=e?.engine.state,{convId:r}=os(),[i]=ss(),o=i.get("readonly")==="1",[a,s]=X.useState(r??null),[l,c]=X.useState(null),[u,d]=X.useState(""),[f,p]=X.useState(null),[h,y]=X.useState(null),[_,E]=X.useState(!1),[T,S]=X.useState(!0),[O,L]=X.useState([]),[w,j]=X.useState(!1),[K,G]=X.useState(null),N=X.useRef(null),B=X.useRef(null),[U,te]=X.useState(null),[P,I]=X.useState(null),J=A=>{if(A){const k=localStorage.getItem(`tllm.thinkingEnabled.${A}`);if(k!==null)return k!=="false"}return localStorage.getItem("tllm.thinkingEnabled.default")!=="false"},[se,ee]=X.useState(()=>J(null)),me=A=>{a&&localStorage.setItem(`tllm.thinkingEnabled.${a}`,String(A)),ee(A)},[b,fe]=X.useState(()=>ri()),ue=X.useRef(null),x=X.useRef([]),ve=X.useRef(null),Oe=X.useRef(null),ke=X.useRef(null),Ye=X.useRef(null),we=X.useRef(!1),Ie=ys(),Te=Dn(),et=Es(),tt=_s(),xt=cs(a).data,Ze=xt?.messages??[],le=ai(A=>A.pendingConversationId),nt=ai(A=>A.setPendingConversationId);X.useEffect(()=>{le&&(pe(le),nt(null))},[le]);const rt=(et.data?.models??[]).filter(A=>A.compatibleWithActiveEngine),yt=tt.load.isPending||tt.eject.isPending||n==="starting"||n==="stopping",St=A=>{tt.load.mutate({key:A},{onError:m=>De.error(m instanceof Bt?m.message:"Could not load model.")})},Kt=()=>{l&&(ue.current?.abort(),c(null)),tt.eject.mutate(void 0,{onError:A=>De.error(A instanceof Bt?A.message:"Could not eject model.")})},Mt=()=>{const A=Oe.current;A&&(A.style.height="auto",A.style.height=`${Math.min(A.scrollHeight,160)}px`)},st=X.useCallback((A=!1)=>{const m=ve.current;m&&(A||!we.current)&&(m.scrollTo({top:m.scrollHeight,behavior:"smooth"}),E(!1))},[]);X.useEffect(()=>{const A=ve.current;if(!A)return;const m=()=>{const k=A.scrollHeight-A.scrollTop-A.clientHeight<80;we.current=!k,E(!k&&!!l)};return A.addEventListener("scroll",m),()=>A.removeEventListener("scroll",m)},[l]),X.useEffect(()=>{l&&st()},[l,st]),X.useEffect(()=>{const A=m=>{(m.ctrlKey||m.metaKey)&&m.key==="n"&&(m.preventDefault(),ie()),m.key==="Escape"&&l&&Le()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)}),X.useEffect(()=>{ee(J(a))},[a]),X.useEffect(()=>{if(!w)return;const A=m=>{N.current&&!N.current.contains(m.target)&&j(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[w]);const Xe=async(A,m,k)=>{j(!1);try{await navigator.clipboard.writeText(A),De.success(m)}catch{G({text:A,title:k})}},Dt=async()=>{if(a)try{const{url:A}=await ks(a);await Xe(A,"Link copied","Share link")}catch{De.error("Could not get share URL.")}},v=async()=>{if(a)try{const A=await ws(a);await Xe(A,"Debug info copied","Debug snapshot")}catch{De.error("Could not get debug info.")}},D=()=>{a&&(j(!1),Ns(a))},Q=async A=>{const m=A.target.files?.[0];if(A.target.value="",!m)return;te(null),I(null);let k;try{const C=await m.text();k=JSON.parse(C)}catch{te("Invalid file — could not parse JSON.");return}if(!Array.isArray(k)){const C=k?.model;C&&((et.data?.models??[]).some(W=>W.key===C)||I(C))}try{const{id:C}=await Ss(k);Ie.invalidateQueries({queryKey:["conversations"]}),pe(C)}catch(C){const F=C instanceof Bt?C.message:"Import failed. Check the file is a valid .turbollm-chat.json or OpenAI-format JSON.";te(F)}},ie=()=>{s(null),d(""),c(null),fe(ri()),Oe.current?.focus()},pe=A=>{l&&(ue.current?.abort(),c(null)),s(A),p(null),fe(us(A)),we.current=!1,setTimeout(()=>st(!0),50)},Le=async()=>{ue.current?.abort(),a&&await Te.stop.mutateAsync(a).catch(()=>{})},it=async A=>{const m=Array.from(A.target.files??[]),k=await Promise.all(m.map(async C=>{const F=await new Promise(ge=>{const W=new FileReader;W.onload=()=>ge(W.result),C.type.startsWith("image/")?W.readAsDataURL(C):W.readAsText(C)});return{file:C,dataUrl:F}}));L(C=>[...C,...k]),A.target.value=""},He=()=>{const A=Date.now();return x.current.push(A),x.current=x.current.filter(m=>m>A-2e3),Math.round(x.current.length/2*10)/10},Qe=async(A,m)=>{try{for await(const k of m)if(k.event==="meta")x.current=[],c({assistantId:k.data.assistantMessageId,content:"",reasoning:"",progress:null,liveGenTps:0,genTokens:0,toolCalls:[]}),Ie.invalidateQueries({queryKey:["conversation",A]});else if(k.event==="progress")c(C=>C&&{...C,progress:{phase:k.data.phase,pct:k.data.pct,tps:k.data.tps}});else if(k.event==="reasoning"){const C=He();c(F=>F&&{...F,reasoning:F.reasoning+k.data.delta,progress:null,liveGenTps:C,genTokens:F.genTokens+1})}else if(k.event==="delta"){const C=He();c(F=>F&&{...F,content:F.content+k.data.delta,progress:null,liveGenTps:C,genTokens:F.genTokens+1})}else if(k.event==="tool_call"){const C=k.data;c(F=>{if(!F)return F;const ge=F.toolCalls.findIndex(W=>W.id===C.id);if(ge>=0){const W=[...F.toolCalls];return W[ge]={...W[ge],status:C.status,result:C.result},{...F,toolCalls:W}}return{...F,toolCalls:[...F.toolCalls,{id:C.id,name:C.name,args:C.args,status:C.status,result:C.result}]}})}else k.event==="done"?(c(null),Ie.invalidateQueries({queryKey:["conversation",A]}),Ie.invalidateQueries({queryKey:["conversations"]}),setTimeout(()=>st(!0),80)):k.event==="error"&&(c(null),Ie.invalidateQueries({queryKey:["conversation",A]}),De.error(k.data.message));c(null),Ie.invalidateQueries({queryKey:["conversation",A]})}catch(k){c(null),k?.name!=="AbortError"&&De.error(k instanceof Bt?k.message:"Request failed."),Ie.invalidateQueries({queryKey:["conversation",A]})}},lt=async A=>{const m=u.trim();if(!m&&O.length===0||l)return;if(n!=="running"||!t){De.error("Load a model first.");return}const k=O.filter(W=>W.dataUrl.startsWith("data:image/")),C=O.filter(W=>!W.dataUrl.startsWith("data:image/")),F=k.map(W=>W.dataUrl),ge=C.map(W=>`[Attached: ${W.file.name}]
38
+ …(truncated)`:e.result})]})}function Uo({calls:e}){return e.length?g.jsx("div",{className:"mb-3 space-y-1",children:e.map(t=>g.jsx(Sh,{call:t},t.id))}):null}function vh({confidence:e}){const t=Math.round(e*100),n=e>=.8;return g.jsxs("span",{title:"Model's self-assessed confidence. A local LLM never reaches 1.0 — that's expected.",className:"inline-flex items-center rounded px-1.5 py-0.5 text-[11px] font-medium",style:{background:n?"color-mix(in srgb, var(--accent) 15%, transparent)":"color-mix(in srgb, var(--warn) 15%, transparent)",color:n?"var(--accent)":"var(--warn)",border:`1px solid ${n?"color-mix(in srgb, var(--accent) 30%, transparent)":"color-mix(in srgb, var(--warn) 30%, transparent)"}`},children:["Confidence ",t,"%"]})}function Th({source:e,idx:t}){const[n,r]=X.useState(!1),i=e.relevanceScore>=.7?"var(--accent)":e.relevanceScore>=.5?"var(--warn)":"var(--faint)";return g.jsxs("div",{className:"rounded border border-border bg-panel-2 overflow-hidden",children:[g.jsxs("button",{type:"button",onClick:()=>r(o=>!o),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left text-[12px]",children:[g.jsxs("span",{className:"shrink-0 font-mono text-faint",children:[t+1,"."]}),g.jsxs("span",{className:"min-w-0 flex-1",children:[g.jsx("span",{className:"font-medium text-ink truncate block",children:e.title||e.domain}),g.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-faint hover:text-accent truncate block",onClick:o=>o.stopPropagation(),children:e.domain})]}),g.jsxs("span",{className:"shrink-0 rounded px-1 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, currentColor 12%, transparent)",color:i},children:[Math.round(e.relevanceScore*100),"%"]}),n?g.jsx(rn,{size:11,className:"shrink-0 text-faint mt-0.5"}):g.jsx(Ar,{size:11,className:"shrink-0 text-faint mt-0.5"})]}),n&&g.jsx("p",{className:"border-t border-border px-3 pb-2 pt-1.5 text-[11px] leading-relaxed text-muted",children:e.passage||"(no passage)"})]})}function Ch({meta:e}){const[t,n]=X.useState(!1),r=e.sources??[];return r.length===0?null:g.jsxs("div",{className:"mt-2",children:[g.jsxs("button",{type:"button",onClick:()=>n(i=>!i),className:"flex items-center gap-1 text-[12px] text-muted hover:text-ink",children:[t?g.jsx(rn,{size:12}):g.jsx(Ar,{size:12}),g.jsxs("span",{children:["Sources [",r.length,"]"]})]}),t&&g.jsx("div",{className:"mt-1.5 space-y-1",children:r.map((i,o)=>g.jsx(Th,{source:i,idx:o},i.url))})]})}function Ah({content:e,verdicts:t}){if(!t.length)return g.jsx(Mn,{children:e});const n=new Map;for(const o of t)n.set(o.sentence.trim(),o);const r=[];let i=e;for(const[o,a]of n){const s=i.indexOf(o);s!==-1&&(s>0&&r.push({text:i.slice(0,s)}),r.push({text:o,verdict:a.verdict==="uncited"?void 0:a.verdict}),i=i.slice(s+o.length))}return i&&r.push({text:i}),g.jsx(g.Fragment,{children:r.map((o,a)=>g.jsxs("span",{className:"relative",children:[o.verdict==="verified"&&g.jsx("span",{title:"Claim found in cited source",className:"inline-block text-[9px] font-bold ml-0.5 mr-0.5 align-super",style:{color:"var(--ok)"},children:"✓"}),o.verdict==="unverified"&&g.jsx("span",{title:"Could not verify this claim in the cited source — check manually",className:"inline-block text-[9px] font-bold ml-0.5 mr-0.5 align-super",style:{color:"var(--warn)"},children:"?"}),g.jsx(Mn,{children:o.text})]},a))})}function Ih({content:e,reasoning:t,progress:n,liveGenTps:r,genTokens:i,toolCalls:o=[]}){const a=!!n&&n.phase==="prompt";return g.jsxs("div",{className:"flex gap-3",children:[g.jsx($o,{}),g.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[t&&g.jsx(zo,{reasoning:t,streaming:!0}),g.jsx(Uo,{calls:o}),g.jsx("div",{className:"prose-tllm text-[15px] leading-[1.7] text-ink",children:e?g.jsx(Mn,{children:e}):g.jsx("span",{className:"text-muted",children:a?"Processing prompt…":t?"Generating…":o.length?"Working…":"Thinking…"})}),a&&g.jsxs("div",{className:"mt-2 space-y-1",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[g.jsx("span",{children:"Processing prompt"}),g.jsxs("span",{className:"font-medium",style:{color:"var(--ink)"},children:[n.pct,"%"]}),n.tps>0&&g.jsxs("span",{children:["· ",n.tps.toFixed(0)," tok/s prefill"]})]}),g.jsx("div",{className:"h-[3px] w-full overflow-hidden rounded-full",style:{background:"var(--border)"},children:g.jsx("div",{className:"h-full rounded-full transition-all duration-200",style:{width:`${n.pct}%`,background:"var(--accent)"}})})]}),!a&&(e||t)&&g.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-faint",children:[g.jsx("span",{className:"tllm-pulse",children:"·"}),i>0&&g.jsxs("span",{className:"font-medium",style:{color:"var(--ink)"},children:[i," tok"]}),r>0?g.jsxs("span",{children:["· ",r.toFixed(1)," tok/s"]}):i===0&&g.jsx("span",{children:"…"})]})]})]})}function Oh({message:e,isLast:t,onEdit:n,onDelete:r,onRegenerate:i,editingId:o,onEditSave:a,onEditCancel:s,showThinking:l=!0}){const[c,u]=X.useState(e.content),d=o===e.id;if(e.role==="user")return g.jsx("div",{className:"group flex justify-end gap-2",children:g.jsxs("div",{className:"flex flex-col items-end gap-1",children:[d?g.jsxs("div",{className:"w-full max-w-[75%]",children:[g.jsx("textarea",{autoFocus:!0,className:"w-full resize-none rounded-[var(--radius-lg)] border border-accent bg-panel px-4 py-2.5 text-[15px] leading-[1.6] text-ink outline-none",rows:3,value:c,onChange:_=>u(_.target.value),onKeyDown:_=>{(_.ctrlKey||_.metaKey)&&_.key==="Enter"&&(_.preventDefault(),a(c)),_.key==="Escape"&&s()}}),g.jsxs("div",{className:"mt-1.5 flex gap-1.5 justify-end",children:[g.jsx(Be,{size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),g.jsx(Be,{size:"sm",onClick:()=>a(c),children:"Save & Resend"})]})]}):g.jsxs("div",{className:"flex max-w-[75%] flex-col items-end",children:[g.jsx("div",{className:"whitespace-pre-wrap rounded-[var(--radius-lg)] bg-accent px-4 py-2.5 text-[15px] leading-[1.6] text-on-accent",children:e.content}),e.attachments?.filter(_=>_.startsWith("data:image")).map((_,E)=>g.jsx("img",{src:_,className:"mt-2 max-h-48 max-w-xs rounded-lg object-contain",alt:"attached image"},E)),e.textAttachments?.length>0&&g.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1 justify-end",children:e.textAttachments.map((_,E)=>g.jsxs("span",{className:"flex items-center gap-1 rounded border border-border bg-panel-2 px-2 py-0.5 text-[12px] text-muted",children:[g.jsx(Zs,{size:11,className:"shrink-0"}),_]},E))})]}),!d&&g.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx(gr,{text:e.content,className:"rounded p-1 hover:bg-panel-2"}),n&&g.jsx(Sn,{icon:g.jsx(pa,{size:12}),label:"Edit",onClick:()=>{u(e.content),n(e)}}),r&&g.jsx(Sn,{icon:g.jsx(mr,{size:12}),label:"Delete",onClick:()=>r(e),destructive:!0})]})]})});const f=e.stats.aborted&&!e.content,p=(e.toolCalls??[]).map(_=>({id:_.id,name:_.name,status:_.error?"error":"done",result:_.error??_.result})),h=e.researchMeta,y=h?.refereeVerdicts??[];return g.jsxs("div",{className:"group flex gap-3",children:[g.jsx($o,{}),g.jsxs("div",{className:"min-w-0 flex-1 pt-0.5",children:[e.reasoning&&g.jsx(zo,{reasoning:e.reasoning,thinkMs:e.stats.thinkMs,showThinking:l}),g.jsx(Uo,{calls:p}),f?g.jsxs("div",{className:"rounded-lg border px-4 py-3 text-[14px]",style:{borderColor:"var(--err)",color:"var(--err)",background:"color-mix(in srgb, var(--err) 8%, transparent)"},children:["Generation failed or was stopped.",t&&i&&g.jsx("button",{type:"button",className:"ml-3 underline",onClick:i,children:"Regenerate"})]}):g.jsx("div",{className:"prose-tllm text-[15px] leading-[1.7] text-ink",children:y.length>0?g.jsx(Ah,{content:e.content,verdicts:y}):g.jsx(Mn,{children:e.content})}),h?.confidence!==void 0&&g.jsx("div",{className:"mt-1.5",children:g.jsx(vh,{confidence:h.confidence})}),h&&g.jsx(Ch,{meta:h}),g.jsx(wh,{stats:e.stats}),g.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx(gr,{text:e.content,className:"rounded p-1 hover:bg-panel-2"}),t&&i&&g.jsx(Sn,{icon:g.jsx(vs,{size:12}),label:"Regenerate",onClick:i}),r&&g.jsx(Sn,{icon:g.jsx(mr,{size:12}),label:"Delete",onClick:()=>r(e),destructive:!0})]})]})]})}function $o(){return g.jsx("div",{className:"mt-1 grid h-5 w-5 shrink-0 place-items-center rounded bg-panel-2 text-[9px] font-bold text-muted",children:"T"})}function Sn({icon:e,label:t,onClick:n,destructive:r}){return g.jsx("button",{type:"button",title:t,onClick:n,className:"rounded p-1 transition-colors hover:bg-panel-2",style:{color:r?"var(--err)":"var(--faint)"},children:e})}function ca(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Rh({ctxUsed:e,ctxMax:t}){if(t<=0)return null;const n=t>0?e/t:0,r=Math.min(1,n),i=Math.round(r*100),o=n>.9?"var(--err)":n>.75?"var(--warn)":"var(--accent)",a=n>.9?{color:"var(--err)"}:n>.75?{color:"var(--warn)"}:{},s=n>.9?"Context nearly full — older messages may be truncated":`Context: ${e.toLocaleString()} / ${t.toLocaleString()} tokens`;return g.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",title:s,children:[g.jsx("div",{className:"h-[3px] w-20 overflow-hidden rounded-full shrink-0",style:{background:"var(--border)"},children:g.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${(r*100).toFixed(1)}%`,background:o}})}),g.jsx("span",{className:"text-[11px] text-faint whitespace-nowrap tabular-nums shrink-0",style:a,children:`${ca(e)} / ${ca(t)} · ${i}%`})]})}function Mh(e){const t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function Dh({activeId:e,onSelect:t,onNew:n,onImport:r,collapsed:i,onToggle:o}){const[a,s]=X.useState(""),[l,c]=X.useState(""),u=X.useRef(null),d=Dn(),p=ls(l||void 0).data?.conversations??[];X.useEffect(()=>{const y=setTimeout(()=>c(a),200);return()=>clearTimeout(y)},[a]),X.useEffect(()=>{const y=_=>{(_.ctrlKey||_.metaKey)&&_.key==="k"&&(_.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]);const h=(y,_)=>{y.stopPropagation(),d.remove.mutate(_.id,{onSuccess:()=>{De.success("Conversation deleted")},onError:()=>{De.error("Could not delete conversation.")}})};return i?g.jsxs("div",{className:"flex h-full flex-col items-center gap-1 border-r border-border bg-panel-2 py-3",children:[o&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:o,title:"Expand sidebar",className:"h-7 w-7",children:g.jsx(Ar,{size:15})}),g.jsx(Be,{size:"icon",variant:"ghost",onClick:n,title:"New chat (Ctrl+N)",className:"h-7 w-7",children:g.jsx(si,{size:15})}),r&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:r,title:"Import chat (.turbollm-chat.json or OpenAI JSON)",className:"h-7 w-7",children:g.jsx(fr,{size:15})})]}):g.jsxs("div",{className:"flex h-full flex-col border-r border-border bg-panel-2",children:[g.jsxs("div",{className:"flex items-center gap-2 px-3 py-3",children:[o&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:o,title:"Collapse sidebar",className:"h-7 w-7 shrink-0",children:g.jsx(Vs,{size:15})}),g.jsxs("div",{className:"relative flex-1",children:[g.jsx(zs,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-faint"}),g.jsx(ms,{ref:u,value:a,onChange:y=>s(y.target.value),placeholder:"Search…",className:"h-7 pl-7 text-[12px]"})]}),g.jsx(Be,{size:"icon",variant:"ghost",onClick:n,title:"New chat (Ctrl+N)",className:"h-7 w-7 shrink-0",children:g.jsx(si,{size:15})}),r&&g.jsx(Be,{size:"icon",variant:"ghost",onClick:r,title:"Import chat (.turbollm-chat.json or OpenAI JSON)",className:"h-7 w-7 shrink-0",children:g.jsx(fr,{size:15})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-1 pb-2",children:[p.length===0&&g.jsx("p",{className:"px-3 py-4 text-[12px] text-faint",children:a?"No results.":"No conversations yet."}),p.map(y=>g.jsx(Lh,{conv:y,active:y.id===e,onSelect:t,onDelete:h},y.id))]})]})}function Lh({conv:e,active:t,onSelect:n,onDelete:r}){const[i,o]=X.useState(!1),[a,s]=X.useState(e.title),l=Dn(),c=()=>{o(!1);const u=a.trim();if(!u||u===e.title){s(e.title);return}l.update.mutate({id:e.id,title:u},{onError:()=>{s(e.title),De.error("Could not rename conversation.")}})};return g.jsxs("div",{onClick:()=>!i&&n(e.id),className:"group relative flex cursor-pointer flex-col gap-0.5 rounded-md px-3 py-2 transition-colors",style:{background:t?"color-mix(in srgb, var(--accent) 10%, transparent)":"transparent"},children:[i?g.jsx("input",{autoFocus:!0,className:"w-full bg-transparent text-[13px] font-medium text-ink outline-none",value:a,onChange:u=>s(u.target.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&c(),u.key==="Escape"&&(s(e.title),o(!1))},onClick:u=>u.stopPropagation()}):g.jsx("span",{className:"truncate text-[13px] font-medium text-ink",style:{color:t?"var(--accent)":void 0},onDoubleClick:u=>{u.stopPropagation(),o(!0)},children:e.title}),g.jsx("span",{className:"text-[11px] text-faint",children:Mh(e.updatedAt)}),!i&&g.jsxs("div",{className:"absolute right-1.5 top-1/2 flex -translate-y-1/2 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[g.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),s(e.title),o(!0)},className:"rounded p-1 text-faint transition-colors hover:text-ink",title:"Rename conversation",children:g.jsx(pa,{size:13})}),g.jsx("button",{type:"button",onClick:u=>r(u,e),className:"rounded p-1 text-faint transition-colors hover:text-err",title:"Delete conversation",children:g.jsx(mr,{size:13})})]})]})}function Ph({models:e,loadedKey:t,loadedName:n,pending:r,ejecting:i,onLoad:o,onEject:a,onSettings:s,align:l="start"}){const c=e.filter(d=>!d.incomplete&&!d.parseError),u=i?"Ejecting…":n||(t?"Loaded model":"Load a model");return g.jsxs(Cs,{children:[g.jsxs(As,{className:"flex h-8 max-w-[260px] items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 text-[13px] text-ink transition-colors hover:border-[color:var(--accent)] disabled:opacity-60",disabled:r,children:[r||i?g.jsx(da,{size:14,className:"animate-spin text-muted"}):g.jsx(hs,{size:14,className:t?"text-accent":"text-muted"}),g.jsx("span",{className:"truncate",children:u}),g.jsx(rn,{size:14,className:"shrink-0 text-muted"})]}),g.jsxs(Is,{align:l,className:"max-h-[60vh] w-[280px] overflow-y-auto",children:[g.jsx("div",{className:"px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide text-faint",children:c.length?"Load a model":"No models found"}),c.map(d=>{const f=d.key===t;return g.jsxs("div",{role:"menuitem",tabIndex:-1,className:"flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-[13px] outline-none hover:bg-panel-2 focus:bg-panel-2",onClick:p=>{if(p.altKey&&s){s(d.key);return}f||o(d.key)},children:[g.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:f&&g.jsx(js,{size:14,className:"text-accent"})}),g.jsx("span",{className:"min-w-0 flex-1 truncate",children:d.name}),g.jsx("span",{className:"shrink-0 text-[11px] uppercase text-faint",children:d.quant})]},d.key)}),s&&g.jsx("div",{className:"px-2 py-1 text-[11px] text-faint",children:"Alt+click to configure"}),t&&g.jsxs(g.Fragment,{children:[g.jsx(Os,{}),g.jsxs(Rs,{onSelect:a,style:{color:"var(--err)"},children:[g.jsx(Ms,{size:14})," Eject model"]})]})]})]})}const Bh=[{key:"temperature",label:"Temperature",min:0,max:2,step:.01,def:.8},{key:"top_p",label:"Top P",min:0,max:1,step:.01,def:.95},{key:"top_k",label:"Top K",min:0,max:200,step:1,def:40},{key:"min_p",label:"Min P",min:0,max:1,step:.01,def:.05}];function Fh({conv:e}){const t=Dn(),[n,r]=X.useState(!1),[i,o]=X.useState(""),[a,s]=X.useState({});X.useEffect(()=>{n&&e&&(o(e.systemPrompt??""),s(e.sampling??{}))},[n,e]);const l=Object.keys(a).length>0,c=e?.expertMode??!1,u=(p,h)=>s(y=>({...y,[p]:h})),d=()=>s({}),f=()=>{if(!e)return;const p=c?{id:e.id,sampling:a}:{id:e.id,systemPrompt:i,sampling:a};t.update.mutate(p,{onSuccess:()=>{De.success("Thread settings saved"),r(!1)},onError:h=>De.error(h instanceof Bt?h.message:"Could not save settings.")})};return g.jsxs(Ds,{open:n,onOpenChange:r,children:[g.jsx(Ls,{asChild:!0,children:g.jsx(Be,{size:"icon",variant:"ghost",className:"h-8 w-8",title:"Thread settings — system prompt & sampling overrides",disabled:!e,children:g.jsx(bs,{size:15})})}),g.jsxs(Ps,{className:"max-w-md",children:[g.jsx("div",{className:"mb-4",children:g.jsx("span",{className:"text-[15px] font-semibold text-ink",children:"Thread settings"})}),g.jsxs("div",{className:"flex flex-col gap-5",children:[g.jsxs("div",{children:[g.jsx("label",{className:"mb-1.5 block text-[11px] font-medium uppercase tracking-wide text-faint",children:"System prompt"}),c?g.jsx("p",{className:"rounded-lg border border-border bg-panel-2 px-3 py-2 text-[13px] text-muted",children:"System prompt is managed by TurboLLM for the Expert assistant."}):g.jsx("textarea",{rows:4,value:i,onChange:p=>o(p.target.value),placeholder:"Leave blank to use the model's built-in default",className:"w-full resize-none rounded-lg border border-border bg-bg px-3 py-2 text-[14px] leading-[1.6] text-ink outline-none placeholder:text-faint focus:border-[color:var(--accent)]"})]}),g.jsxs("div",{children:[g.jsxs("div",{className:"mb-2.5 flex items-center justify-between",children:[g.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-faint",children:"Sampling overrides"}),l&&g.jsx("button",{type:"button",onClick:d,className:"text-[12px] text-muted underline-offset-2 hover:text-ink hover:underline",children:"Reset to model defaults"})]}),g.jsx("div",{className:"flex flex-col gap-3.5",children:Bh.map(p=>{const h=p.key in a,y=h?a[p.key]??p.def:p.def;return g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("span",{className:"w-24 shrink-0 text-[13px]",style:{color:h?"var(--ink)":"var(--muted)"},children:p.label}),g.jsx("input",{type:"range",min:p.min,max:p.max,step:p.step,value:y,onChange:_=>u(p.key,parseFloat(_.target.value)),className:"flex-1",style:{accentColor:"var(--accent)"}}),g.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[13px] tabular-nums text-ink",children:p.step<1?y.toFixed(2):String(Math.round(y))})]},p.key)})}),!l&&g.jsx("p",{className:"mt-2.5 text-[12px] text-faint",children:"Using model defaults · move any slider to override for this thread"})]})]}),g.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[g.jsx(Bs,{asChild:!0,children:g.jsx(Be,{variant:"ghost",size:"sm",children:"Cancel"})}),g.jsx(Be,{size:"sm",onClick:f,disabled:t.update.isPending,children:t.update.isPending?"Saving…":"Save"})]})]})]})}function Jh(){const{data:e}=xs(),t=e?.model,n=e?.engine.state,{convId:r}=os(),[i]=ss(),o=i.get("readonly")==="1",[a,s]=X.useState(r??null),[l,c]=X.useState(null),[u,d]=X.useState(""),[f,p]=X.useState(null),[h,y]=X.useState(null),[_,E]=X.useState(!1),[T,S]=X.useState(!0),[O,L]=X.useState([]),[w,j]=X.useState(!1),[K,G]=X.useState(null),N=X.useRef(null),B=X.useRef(null),[U,te]=X.useState(null),[P,I]=X.useState(null),J=A=>{if(A){const k=localStorage.getItem(`tllm.thinkingEnabled.${A}`);if(k!==null)return k!=="false"}return localStorage.getItem("tllm.thinkingEnabled.default")!=="false"},[se,ee]=X.useState(()=>J(null)),me=A=>{a&&localStorage.setItem(`tllm.thinkingEnabled.${a}`,String(A)),ee(A)},[b,fe]=X.useState(()=>ri()),ue=X.useRef(null),x=X.useRef([]),ve=X.useRef(null),Oe=X.useRef(null),ke=X.useRef(null),Ye=X.useRef(null),we=X.useRef(!1),Ie=ys(),Te=Dn(),et=Es(),tt=_s(),xt=cs(a).data,Ze=xt?.messages??[],le=ai(A=>A.pendingConversationId),nt=ai(A=>A.setPendingConversationId);X.useEffect(()=>{le&&(pe(le),nt(null))},[le]);const rt=(et.data?.models??[]).filter(A=>A.compatibleWithActiveEngine),yt=tt.load.isPending||tt.eject.isPending||n==="starting"||n==="stopping",St=A=>{tt.load.mutate({key:A},{onError:m=>De.error(m instanceof Bt?m.message:"Could not load model.")})},Kt=()=>{l&&(ue.current?.abort(),c(null)),tt.eject.mutate(void 0,{onError:A=>De.error(A instanceof Bt?A.message:"Could not eject model.")})},Mt=()=>{const A=Oe.current;A&&(A.style.height="auto",A.style.height=`${Math.min(A.scrollHeight,160)}px`)},st=X.useCallback((A=!1)=>{const m=ve.current;m&&(A||!we.current)&&(m.scrollTo({top:m.scrollHeight,behavior:"smooth"}),E(!1))},[]);X.useEffect(()=>{const A=ve.current;if(!A)return;const m=()=>{const k=A.scrollHeight-A.scrollTop-A.clientHeight<80;we.current=!k,E(!k&&!!l)};return A.addEventListener("scroll",m),()=>A.removeEventListener("scroll",m)},[l]),X.useEffect(()=>{l&&st()},[l,st]),X.useEffect(()=>{const A=m=>{(m.ctrlKey||m.metaKey)&&m.key==="n"&&(m.preventDefault(),ie()),m.key==="Escape"&&l&&Le()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)}),X.useEffect(()=>{ee(J(a))},[a]),X.useEffect(()=>{if(!w)return;const A=m=>{N.current&&!N.current.contains(m.target)&&j(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[w]);const Xe=async(A,m,k)=>{j(!1);try{await navigator.clipboard.writeText(A),De.success(m)}catch{G({text:A,title:k})}},Dt=async()=>{if(a)try{const{url:A}=await ks(a);await Xe(A,"Link copied","Share link")}catch{De.error("Could not get share URL.")}},v=async()=>{if(a)try{const A=await ws(a);await Xe(A,"Debug info copied","Debug snapshot")}catch{De.error("Could not get debug info.")}},D=()=>{a&&(j(!1),Ns(a))},Q=async A=>{const m=A.target.files?.[0];if(A.target.value="",!m)return;te(null),I(null);let k;try{const C=await m.text();k=JSON.parse(C)}catch{te("Invalid file — could not parse JSON.");return}if(!Array.isArray(k)){const C=k?.model;C&&((et.data?.models??[]).some(W=>W.key===C)||I(C))}try{const{id:C}=await Ss(k);Ie.invalidateQueries({queryKey:["conversations"]}),pe(C)}catch(C){const F=C instanceof Bt?C.message:"Import failed. Check the file is a valid .turbollm-chat.json or OpenAI-format JSON.";te(F)}},ie=()=>{s(null),d(""),c(null),fe(ri()),Oe.current?.focus()},pe=A=>{l&&(ue.current?.abort(),c(null)),s(A),p(null),fe(us(A)),we.current=!1,setTimeout(()=>st(!0),50)},Le=async()=>{ue.current?.abort(),a&&await Te.stop.mutateAsync(a).catch(()=>{})},it=async A=>{const m=Array.from(A.target.files??[]),k=await Promise.all(m.map(async C=>{const F=await new Promise(ge=>{const W=new FileReader;W.onload=()=>ge(W.result),C.type.startsWith("image/")?W.readAsDataURL(C):W.readAsText(C)});return{file:C,dataUrl:F}}));L(C=>[...C,...k]),A.target.value=""},He=()=>{const A=Date.now();return x.current.push(A),x.current=x.current.filter(m=>m>A-2e3),Math.round(x.current.length/2*10)/10},Qe=async(A,m)=>{try{for await(const k of m)if(k.event==="meta")x.current=[],c({assistantId:k.data.assistantMessageId,content:"",reasoning:"",progress:null,liveGenTps:0,genTokens:0,toolCalls:[]}),Ie.invalidateQueries({queryKey:["conversation",A]});else if(k.event==="progress")c(C=>C&&{...C,progress:{phase:k.data.phase,pct:k.data.pct,tps:k.data.tps}});else if(k.event==="reasoning"){const C=He();c(F=>F&&{...F,reasoning:F.reasoning+k.data.delta,progress:null,liveGenTps:C,genTokens:F.genTokens+1})}else if(k.event==="delta"){const C=He();c(F=>F&&{...F,content:F.content+k.data.delta,progress:null,liveGenTps:C,genTokens:F.genTokens+1})}else if(k.event==="tool_call"){const C=k.data;c(F=>{if(!F)return F;const ge=F.toolCalls.findIndex(W=>W.id===C.id);if(ge>=0){const W=[...F.toolCalls];return W[ge]={...W[ge],status:C.status,result:C.result},{...F,toolCalls:W}}return{...F,toolCalls:[...F.toolCalls,{id:C.id,name:C.name,args:C.args,status:C.status,result:C.result}]}})}else k.event==="done"?(c(null),Ie.invalidateQueries({queryKey:["conversation",A]}),Ie.invalidateQueries({queryKey:["conversations"]}),setTimeout(()=>st(!0),80)):k.event==="error"&&(c(null),Ie.invalidateQueries({queryKey:["conversation",A]}),De.error(k.data.message));c(null),Ie.invalidateQueries({queryKey:["conversation",A]})}catch(k){c(null),k?.name!=="AbortError"&&De.error(k instanceof Bt?k.message:"Request failed."),Ie.invalidateQueries({queryKey:["conversation",A]})}},lt=async A=>{const m=u.trim();if(!m&&O.length===0||l)return;if(n!=="running"||!t){De.error("Load a model first.");return}const k=O.filter(W=>W.dataUrl.startsWith("data:image/")),C=O.filter(W=>!W.dataUrl.startsWith("data:image/")),F=k.map(W=>W.dataUrl),ge=C.map(W=>`[Attached: ${W.file.name}]
39
39
  ${W.dataUrl}`).join(`
40
40
 
41
41
  `);d(""),L([]),setTimeout(Mt,0),we.current=!1;try{let W=a;if(!W){const Z=ds(b,ps());W=(await Te.create.mutateAsync({modelKey:t.key,systemPrompt:Z||void 0,toolPolicy:b==="research"?"force_web_search":void 0})).id,fs(W,b),s(W)}const H=new AbortController;ue.current=H;const $=C.map(Z=>Z.file.name);await Qe(W,gs(W,m,H.signal,F,ge,$,!se))}catch(W){c(null),W?.name!=="AbortError"&&De.error(W instanceof Bt?W.message:"Request failed."),a&&Ie.invalidateQueries({queryKey:["conversation",a]})}},Re=(A,m)=>{a&&(p(null),Te.editMsg.mutate({convId:a,msgId:A,content:m},{onSuccess:()=>{if(we.current=!1,n==="running"&&t){const k=new AbortController;ue.current=k,Qe(a,ii(a,k.signal,!se))}},onError:()=>De.error("Could not edit message.")}))},ct=async()=>{if(!a||l)return;if(n!=="running"||!t){De.error("Load a model first.");return}await Te.regenerate.mutateAsync(a).catch(()=>{});const A=new AbortController;ue.current=A,Qe(a,ii(a,A.signal,!se))},Ue=A=>{a&&Te.deleteMsg.mutate({convId:a,msgId:A.id},{onError:()=>De.error("Could not delete message.")})},Gt=Ze.findLast(A=>A.role==="assistant")?.stats,cn=Gt?.ctxUsed??0,Un=t?.ctx||Gt?.ctxMax||0,Et=n==="running"&&!!t;return g.jsxs("div",{className:"flex h-full overflow-hidden",children:[g.jsx("div",{className:T?"w-56 shrink-0":"w-10 shrink-0",style:{transition:"width 0.15s"},children:g.jsx(Dh,{activeId:a,onSelect:pe,onNew:ie,onImport:o?void 0:()=>B.current?.click(),collapsed:!T,onToggle:()=>S(A=>!A)})}),g.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col",children:[o&&g.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-panel-2 px-4 py-1.5 text-[12px] text-muted",children:[g.jsx("span",{className:"font-medium text-ink",children:"Shared view"}),g.jsx("span",{className:"text-faint",children:"—"}),g.jsx("span",{children:"read only"})]}),g.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-border px-4",children:[g.jsx(Ph,{models:rt,loadedKey:t?.key??null,loadedName:t?.name??null,pending:yt,ejecting:tt.eject.isPending,onLoad:St,onEject:Kt,onSettings:A=>y(A)}),t&&g.jsx(Be,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>y(t.key),title:"Model settings — change on the fly",children:g.jsx(Us,{size:15})}),g.jsx(Fh,{conv:xt}),g.jsx(Be,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>me(!se),title:se?"Thinking on — model reasons before answering. Click to disable.":"Thinking off — model answers directly. Click to enable reasoning.",style:{color:se?"var(--accent)":"var(--faint)"},children:g.jsx(qs,{size:15})}),a&&(()=>{const A=ua.find(m=>m.id===b);return A?g.jsxs("span",{title:A.description,className:"inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] text-muted select-none",children:[g.jsx(sl,{size:11}),A.name]}):null})(),n==="starting"&&g.jsx("span",{className:"text-[12px] text-muted",children:"Loading model…"}),n==="stopping"&&g.jsx("span",{className:"text-[12px] text-muted",children:"Ejecting…"}),Et&&g.jsx(Rh,{ctxUsed:cn,ctxMax:Un}),a&&g.jsxs("div",{ref:N,className:"relative ml-auto",children:[g.jsx(Be,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>j(A=>!A),title:"Share or export this chat",children:g.jsx(rl,{size:15})}),w&&g.jsxs("div",{className:"absolute right-0 top-9 z-50 min-w-[180px] rounded-md border border-border bg-panel shadow-[var(--shadow-2)] py-1",children:[g.jsxs("button",{type:"button",onClick:()=>{Dt()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-ink hover:bg-panel-2",children:[g.jsx(oi,{size:13,className:"text-muted"}),"Copy link (LAN)"]}),g.jsxs("button",{type:"button",onClick:()=>{v()},className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-ink hover:bg-panel-2",children:[g.jsx(oi,{size:13,className:"text-muted"}),"Copy debug info"]}),g.jsx("div",{className:"my-1 border-t border-border"}),g.jsxs("button",{type:"button",onClick:D,className:"flex w-full items-center gap-2 px-3 py-2 text-[13px] text-ink hover:bg-panel-2",children:[g.jsx(fr,{size:13,className:"text-muted"}),"Export chat"]})]})]})]}),g.jsx("div",{ref:ve,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:g.jsxs("div",{className:"flex w-full flex-col gap-6 px-8 py-6",children:[g.jsx("input",{ref:B,type:"file",accept:".json,.turbollm-chat.json",hidden:!0,onChange:A=>{Q(A)}}),P&&g.jsxs("div",{className:"mb-2 flex items-start gap-2 rounded-md border border-[color:var(--warn,#ca8a04)] bg-[color-mix(in_srgb,var(--warn,#ca8a04)_8%,transparent)] px-3 py-2 text-[13px]",children:[g.jsxs("span",{className:"flex-1",children:[g.jsx("span",{className:"font-medium",children:"Model not found:"})," ",g.jsx("span",{className:"font-mono",children:P})," is not available on this machine. The chat was imported — select a different model to continue."]}),g.jsx("button",{type:"button",onClick:()=>I(null),className:"shrink-0 text-faint hover:text-ink",children:g.jsx(mn,{size:13})})]}),U&&g.jsxs("div",{className:"mb-2 flex items-start gap-2 rounded-md border border-[color:var(--err)] bg-[color-mix(in_srgb,var(--err)_8%,transparent)] px-3 py-2 text-[13px]",children:[g.jsx("span",{className:"flex-1 text-[color:var(--err)]",children:U}),g.jsx("button",{type:"button",onClick:()=>te(null),className:"shrink-0 text-faint hover:text-ink",children:g.jsx(mn,{size:13})})]}),Ze.length===0&&!l&&g.jsx("div",{className:"flex flex-col items-center gap-4 py-16",children:t?g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"text-[15px] font-medium text-ink",children:t.name}),g.jsx(zh,{selected:b,onChange:fe}),g.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:["Explain something to me","Help me write","Review this code"].map(A=>g.jsx("button",{type:"button",onClick:()=>{d(A),setTimeout(()=>Oe.current?.focus(),0)},className:"rounded-full border border-border px-4 py-1.5 text-[13px] text-muted hover:border-accent hover:text-ink transition-colors",children:A},A))})]}):g.jsx("p",{className:"text-[14px] text-muted",children:"Select a model above to begin"})}),Ze.map((A,m)=>g.jsx(Oh,{message:A,isLast:m===Ze.length-1&&!l,onEdit:o?void 0:k=>p(k.id),onDelete:o?void 0:Ue,onRegenerate:o?void 0:ct,editingId:f,onEditSave:k=>Re(A.id,k),onEditCancel:()=>p(null)},A.id)),l&&g.jsx(Ih,{content:l.content,reasoning:l.reasoning,progress:l.progress,liveGenTps:l.liveGenTps,genTokens:l.genTokens,toolCalls:l.toolCalls}),g.jsx("div",{ref:ke})]})}),_&&g.jsxs("button",{type:"button",onClick:()=>{we.current=!1,st(!0)},className:"absolute bottom-28 left-1/2 -translate-x-1/2 flex items-center gap-1.5 rounded-full border border-border bg-panel px-3 py-1.5 text-[12px] text-muted shadow-[var(--shadow-1)] hover:text-ink",children:[g.jsx(Ks,{size:13})," Jump to latest"]}),K&&g.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/40",onClick:()=>G(null),children:g.jsxs("div",{className:"mx-4 w-full max-w-lg rounded-lg border border-border bg-panel p-4 shadow-[var(--shadow-2)]",onClick:A=>A.stopPropagation(),children:[g.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[g.jsx("span",{className:"text-[13px] font-medium text-ink",children:K.title}),g.jsx("button",{type:"button",onClick:()=>G(null),className:"text-faint hover:text-ink",children:g.jsx(mn,{size:14})})]}),g.jsx("textarea",{readOnly:!0,autoFocus:!0,className:"h-48 w-full resize-none rounded border border-border bg-panel-2 p-2 text-[12px] font-mono text-ink outline-none",value:K.text,onFocus:A=>A.target.select()}),g.jsx("p",{className:"mt-1 text-[11px] text-faint",children:"Select all and copy (Ctrl+C / Cmd+C)"})]})}),o?null:g.jsx("div",{className:"px-8 pb-5",children:g.jsxs("div",{className:"w-full",children:[g.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-border bg-panel shadow-[var(--shadow-2)] focus-within:border-[color:var(--accent)]",children:[O.length>0&&g.jsx("div",{className:"flex flex-wrap gap-1.5 px-2 pt-2",children:O.map((A,m)=>g.jsxs("div",{className:"relative flex items-center gap-1 rounded border border-border bg-panel-2 px-2 py-1 text-[12px]",children:[A.file.type.startsWith("image/")?g.jsx("img",{src:A.dataUrl,className:"h-8 w-8 rounded object-cover",alt:""}):g.jsx("span",{className:"text-muted",children:A.file.name}),g.jsx("button",{type:"button",onClick:()=>L(k=>k.filter((C,F)=>F!==m)),className:"text-faint hover:text-err",children:g.jsx(mn,{size:11})})]},m))}),g.jsxs("div",{className:"flex items-end gap-2 p-2",children:[g.jsx("button",{type:"button",onClick:()=>Ye.current?.click(),disabled:!Et||!!l,className:"grid h-9 w-9 shrink-0 place-items-center rounded-md hover:bg-panel-2 disabled:opacity-40",title:"Attach image or document",children:g.jsx(Js,{size:15,className:"text-muted"})}),g.jsx("input",{ref:Ye,type:"file",multiple:!0,accept:"image/*,.pdf,.txt,.md,.csv",hidden:!0,onChange:it}),g.jsx("textarea",{ref:Oe,rows:1,className:"max-h-40 min-h-9 flex-1 resize-none bg-transparent px-2 py-1.5 text-[15px] text-ink outline-none placeholder:overflow-hidden placeholder:whitespace-nowrap placeholder:text-faint",placeholder:Et?`Message ${t.name}…`:"Load a model above to start chatting",value:u,disabled:!Et||!!l||!!f,onChange:A=>{d(A.target.value),Mt()},onKeyDown:A=>{if(A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),lt()),A.key==="ArrowUp"&&!u&&!l){const m=Ze.findLast(k=>k.role==="user");m&&p(m.id)}}}),l?g.jsx(Be,{size:"icon",variant:"outline",onClick:()=>{Le()},title:"Stop generation (Esc)",children:g.jsx(al,{size:15})}):g.jsx(Be,{size:"icon",onClick:()=>{lt()},disabled:!Et||!u.trim()&&O.length===0||!!f,"aria-label":"Send",children:g.jsx(tl,{size:15})})]})]}),g.jsx("p",{className:"mt-1.5 px-1 text-[11px] text-faint",children:t?`${t.name} · Enter to send · Shift+Enter for newline`:"Load a model above to start chatting"})]})})]}),g.jsx($s,{modelKey:h,onClose:()=>y(null)})]})}function zh({selected:e,onChange:t}){return g.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[g.jsx("p",{className:"text-[11px] uppercase tracking-wide text-faint",children:"Persona"}),g.jsx("select",{value:e,onChange:n=>t(n.target.value),className:"rounded-md border border-border bg-bg px-2 py-1.5 text-[13px] text-ink outline-none",children:ua.map(n=>g.jsxs("option",{value:n.id,children:[n.name," — ",n.description]},n.id))})]})}export{Jh as ChatScreen};