import{j as i,L as Y,B as M,aK as te,u as O,e0 as it,bP as Dt,bS as Le,Q as F,aV as Ut,r as f,bL as je,fp as Pt,br as Ot,cf as Ht,s as D,fq as $,fm as xe,aU as _t,aG as ae,c2 as de,P as A,m as G,aD as Bt,W as zt,id as Vt,fJ as Ft,as as ye,Z as be,b2 as qt,ij as $t,cm as Wt,ik as Zt,aP as Kt,il as Gt,im as Qt,io as Yt,ip as Xt,iq as Jt,ir as en,is as tn,it as nn,hg as rn,w as qe,a_ as on,bT as sn,iu as an,g as cn,e as st,fF as at,fC as ln,c as dn,bE as un,b as $e,aX as mn,fD as We,q as fn}from"./index-dP1W1_bd.js";import{A as pn,a as z}from"./Anchor-B_lGyhCa.js";import{C as V}from"./CardBoundary-9qdE9Itc.js";import{M as hn}from"./ModelSchema-BceiIHh5.js";import{d as xn}from"./dumbPluralize-CcxDsNiu.js";import{b as gn,e as vn,d as ct,f as Cn}from"./index-DEBSKkGo.js";import{S as yn,P as bn}from"./SchematisedTags-Cv11B62T.js";import{B as wn,u as Ln}from"./ButtonWithRole-CF64B_Or.js";import{b as jn}from"./utils-DkzJkCAG.js";import{u as lt,g as En,E as Sn}from"./useDownload-C3yCvYJa.js";import{g as kn,b as Tn,a as Nn}from"./getDefaultFormValues-BDGdN25U.js";import{aj as dt,w as L,ak as Ze,al as An,am as Mn,an as Rn,ao as Ee,ap as ut,aq as In,ar as Dn,as as Un,at as Ke,au as Pn,av as On,aw as Hn,ax as _n,ay as Bn,az as ce,aA as mt,aB as zn,aC as Vn}from"./Project-CsYwwOpN.js";import{c as oe,t as Fn,u as qn,h as $n,y as Wn}from"./FileUploaderButton-frSujVRY.js";import{N as ft}from"./NoData-DLZ_8GEo.js";import{P as Zn}from"./Panel-M9AVvYdm.js";import"./index-Cvhu13Ah.js";import"./useKeyPress-OcDHupLZ.js";import"./transform-C0Urpblx.js";import"./string-CFFdVFMV.js";import"./zoom-CRTJnDeN.js";import"./bump-BOZP-SHu.js";import"./Deprecated-ClfPkp7s.js";import"./uniq-98MdbBvs.js";import"./uniqBy-6mvKp2Ip.js";import"./SchematisedTagsEdit-Caewn4Mk.js";import"./SchematisedTagsForm-DmZAUPYh.js";import"./useUpdateTdOrFvInfoService-Rjt2OAr8.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./length-BzpOfCdE.js";import"./useProject-CXVt1xnE.js";import"./alertManagerConfig.selectors-B_R5cvew.js";import"./__-BIxbRvwe.js";import"./complement-D_Q2yZKt.js";import"./index-MHdXqM53.js";import"./CardActionButton-BtCnEqTK.js";import"./utils-UGwNsahk.js";import"./zipObj-DEkcXp9d.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-mJT60wVA.js";import"./git-C8OLuEaG.js";import"./useCopyToClipboard-DTBM3H3Z.js";function Kn(e){if(e==null)throw new TypeError("Cannot destructure "+e)}function Gn(e,n){return dt.parse(e,n)}function Qn(e,n,r){typeof e=="string"&&(r=n,n=e,e=null);const t=dt.getFragmentParser(e,r);return t.tokenizer.write(n,!0),t.getFragment()}const Yn=e=>`import hopsworks

# connect with Hopsworks
project = hopsworks.login()

# get Hopsworks Model Registry
mr = project.get_model_registry()

# get model object
model = mr.get_model("${e.modelName}", version=${e.modelVersion})
`,Xn=e=>{if(!e.metrics)return"";const n=Object.keys(e.metrics);return`EVALUATION_METRIC="${n.shift()}"  ${n.length?`# or ${n.join(", ")}`:""}
SORT_METRICS_BY="max" # your sorting criteria

# get best model based on custom metrics
best_model = mr.get_best_model("${e.modelName}",
                               EVALUATION_METRIC,
                               SORT_METRICS_BY)
`},Jn=e=>`# get the model you want to download
model = mr.get_model("${e.modelName}", version=${e.modelVersion})

# download the model artifact
model.download()
`,er=e=>`from hsml.schema import Schema
from hsml.model_schema import ModelSchema

SAVED_MODEL_PATH = "path-to-the-new-model-files"

x_df = [] # your training data (Pandas, numpy, tensors,...)
y_df = [] # your labels

input_schema = Schema(x_df)
output_schema = Schema(y_df)

# create the model metadata for a python model (or tensorflow, sklearn, torch...)
model = mr.python.create_model("${e.modelName}", 
                               metrics={EVALUATION_METRIC: EVALUATION_METRIC_VALUE},
                               input_example=x_df,
                               model_schema=ModelSchema(input_schema=input_schema,
                                                        output_schema=output_schema))

# save model version in the Model Registry
model.save(SAVED_MODEL_PATH)
`,tr=({model:e})=>{const{isLoading:n,project:r}=lt();if(n||!r)return i.jsx(Y,{});const t={projectName:r==null?void 0:r.projectName,modelName:e.name,modelVersion:e.version,metrics:e.metrics},o=i.jsx(te,{copyButton:!0,title:"Download model",content:Jn(t),language:"python"});return i.jsxs(M,{alignItems:"flex-start",sx:{gap:"20px"},p:"20px",children:[i.jsxs(M,{flexDirection:"column",sx:{gap:"20px"},width:"50%",children:[i.jsx(te,{copyButton:!0,title:"Get model",content:Yn(t),language:"python"}),e.metrics&&Object.keys(e.metrics).length>0?i.jsx(te,{copyButton:!0,title:"Get best model based on custom metrics",content:Xn(t),language:"python"}):o]}),i.jsxs(M,{flexDirection:"column",sx:{gap:"20px"},width:"50%",children:[i.jsx(te,{copyButton:!0,title:"Train a new version of the model",content:er(t),language:"python"}),e.metrics&&o]})]})},nr=()=>{const{id:e,vId:n,mId:r}=O(),{data:t=[],isLoading:o}=gn({modelId:`${r}_${n}`,projectId:e});return i.jsx(yn,{isLoading:o,type:it.modelVersion,data:t})},Ge={overflow:"auto",padding:0},rr=({label:e,date:n,primary:r,...t})=>{const{DATE_TIME_FULL:o}=Dt.DATE_TIME;return i.jsxs(M,{flexDirection:"column",...t,children:[i.jsx(Le,{mb:"3px",gray:!0,children:e}),i.jsx(F,{primary:r,children:Ut(n,o)})]})},or=({data:e})=>{const{mId:n,vId:r}=O(),t=je(),{data:o,isLoading:s}=Pt(),{data:a,isLoading:c}=Ot(),{isServiceUser:d}=Ht(),l=f.useCallback(()=>{t(D.project.settings.fileBrowserWithPath,{"*":`Models/${n}/${r}/Files`})},[n,r,t]),m=f.useCallback(()=>{if(e!=null&&e.framework)switch(e==null?void 0:e.framework){case"TENSORFLOW":return $.TENSORFLOW;case"SKLEARN":return $.SKLEARN;default:return $.PYTHON}return $.PYTHON},[e==null?void 0:e.framework]),u=f.useCallback(()=>{if(e!=null&&e.framework){if(e.framework===$.TENSORFLOW)return $.TENSORFLOW;if(e.framework===xe.VLLM)return xe.VLLM}return xe.PYTHON},[e.framework]),h=f.useCallback(()=>{const{kafkaTopic:p,inferenceLogging:x,modelInput:b,predictions:C}=kn(c,d),v=Nn(s,d,o);t(D.deployments.create,void 0,{state:{modelFramework:m(),modelServer:u(),kserve:Tn(s,d,o),modelName:n,modelVersion:+r,kafkaTopicDTO:p,inferenceLogging:x,modelInput:b,predictions:C,requestedInstances:v}})},[t,m,u,n,r,s,d,o,c]);return i.jsxs(M,{children:[i.jsx(_t,{firstName:e.userFullName.split(" ")[0],lastName:e.userFullName.split(" ")[1]}),i.jsx(rr,{ml:"25px",label:"Version created on",date:e.created}),i.jsxs(M,{flexDirection:"column",ml:"30px",flex:"1",children:[i.jsx(Le,{mb:"3px",gray:!0,children:"Framework"}),i.jsx(F,{children:e!=null&&e.framework?e.framework:"No framework"})]}),i.jsxs(M,{children:[i.jsx(ae,{intent:"secondary",onClick:l,mr:"8px",children:"Browse model files ->"}),i.jsx(ae,{onClick:h,children:"Deploy this version ->"})]})]})},ir=f.memo(or),sr=({metrics:e})=>i.jsx(M,{flexWrap:"wrap",gap:"20px",children:e?Object.entries(e).map(([n,r])=>i.jsxs(M,{flexDirection:"column",children:[i.jsx(Le,{mb:"3px",gray:!0,children:n}),i.jsx(F,{color:"black",children:r})]},n)):i.jsx(de,{children:"No metrics found for this version"})}),ar=f.memo(sr);function cr(e,n){return L({},e,n)}var q=A.createContext({markdown:""});function pt(e,n){return e===void 0&&(e=[]),n===void 0&&(n={}),e.forEach(r=>{r.children&&Array.isArray(r.children)?n=L({},n,pt(r.children||[])):r.keyCommand&&r.shortcuts&&r.execute&&(n[r.shortcuts.toLocaleLowerCase()]=r)}),n}function ht(e,n,r,t,o){n===void 0&&(n=[]);var s=pt(n||[]),a=[];if(e.altKey&&a.push("alt"),e.shiftKey&&a.push("shift"),e.metaKey&&a.push("cmd"),e.ctrlKey&&a.push("ctrl"),a.length>0&&!/(control|alt|meta|shift)/.test(e.key.toLocaleLowerCase())&&a.push(e.key.toLocaleLowerCase()),/escape/.test(e.key.toLocaleLowerCase())&&a.push("escape"),!(a.length<1)){var c=!!s[a.join("+")],d=c?s[a.join("+")]:void 0;if(Object.keys(s).forEach(l=>{var m=l.split("+").every(u=>/ctrlcmd/.test(u)?a.includes("ctrl")||a.includes("cmd"):a.includes(u));m&&(d=s[l])}),d&&r){e.stopPropagation(),e.preventDefault(),r.executeCommand(d,t,o,a);return}}}function lr(e,n){return n||(n=e.slice(0)),e.raw=n,e}const dr={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},ur="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",mr=/-[a-z]/g,fr=/%c(?:([-+])(\d+))?/g,pr=/%x/g,hr={2:!0,1:!1,0:null},xr={};function gr(e,n){const r=n||xr,t=r.onerror,o=e instanceof Ze?e:new Ze(e),s=r.fragment?Qn:Gn,a=String(o),c=s(a,{sourceCodeLocationInfo:!0,onParseError:r.onerror?d:null,scriptingEnabled:!1});return An(c,{file:o,space:r.space,verbose:r.verbose});function d(l){const m=l.code,u=vr(m),h=r[u],p=h??!0,x=typeof p=="number"?p:p?1:0;if(x){const C=dr[u],v=new Mn(b(C.reason),{place:{start:{line:l.startLine,column:l.startCol,offset:l.startOffset},end:{line:l.endLine,column:l.endCol,offset:l.endOffset}},ruleId:m,source:"hast-util-from-html"});o.path&&(v.file=o.path,v.name=o.path+":"+v.name),v.fatal=hr[x],v.note=b(C.description),v.url=C.url===!1?void 0:ur+m,t(v)}function b(C){return C.replace(fr,v).replace(pr,y);function v(R,w,N){const U=(N?Number.parseInt(N,10):0)*(w==="-"?-1:1),P=a.charAt(l.startOffset+U);return yr(P)}function y(){return br(a.charCodeAt(l.startOffset))}}}}function vr(e){return e.replace(mr,Cr)}function Cr(e){return e.charAt(1).toUpperCase()}function yr(e){return e==="`"?"` ` `":e}function br(e){return"0x"+e.toString(16).toUpperCase()}function wr(e){const n=this,{emitParseErrors:r,...t}={...n.data("settings"),...e};n.parser=o;function o(s,a){return gr(s,{...t,onerror:r?function(c){a.path&&(c.name=a.path+":"+c.name,c.file=a.path),a.messages.push(c)}:void 0})}}const Lr=/["&'<>`]/g,jr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Er=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Sr=/[|\\{}()[\]^$+*?.]/g,Qe=new WeakMap;function kr(e,n){if(e=e.replace(n.subset?Tr(n.subset):Lr,t),n.subset||n.escapeOnly)return e;return e.replace(jr,r).replace(Er,t);function r(o,s,a){return n.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,a.charCodeAt(s+2),n)}function t(o,s,a){return n.format(o.charCodeAt(0),a.charCodeAt(s+1),n)}}function Tr(e){let n=Qe.get(e);return n||(n=Nr(e),Qe.set(e,n)),n}function Nr(e){const n=[];let r=-1;for(;++r<e.length;)n.push(e[r].replace(Sr,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}const Ar=/[\dA-Fa-f]/;function Mr(e,n,r){const t="&#x"+e.toString(16).toUpperCase();return r&&n&&!Ar.test(String.fromCharCode(n))?t:t+";"}const Rr=/\d/;function Ir(e,n,r){const t="&#"+String(e);return r&&n&&!Rr.test(String.fromCharCode(n))?t:t+";"}const ge={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Dr=["cent","copy","divide","gt","lt","not","para","times"],xt={}.hasOwnProperty,we={};let ne;for(ne in ge)xt.call(ge,ne)&&(we[ge[ne]]=ne);const Ur=/[^\dA-Za-z]/;function Pr(e,n,r,t){const o=String.fromCharCode(e);if(xt.call(we,o)){const s=we[o],a="&"+s;return r&&Rn.includes(s)&&!Dr.includes(s)&&(!t||n&&n!==61&&Ur.test(String.fromCharCode(n)))?a:a+";"}return""}function Or(e,n,r){let t=Mr(e,n,r.omitOptionalSemicolons),o;if((r.useNamedReferences||r.useShortestReferences)&&(o=Pr(e,n,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!o)&&r.useShortestReferences){const s=Ir(e,n,r.omitOptionalSemicolons);s.length<t.length&&(t=s)}return o&&(!r.useShortestReferences||o.length<t.length)?o:t}function W(e,n){return kr(e,Object.assign({format:Or},n))}const Hr=/^>|^->|<!--|-->|--!>|<!-$/g,_r=[">"],Br=["<",">"];function zr(e,n,r,t){return t.settings.bogusComments?"<?"+W(e.value,Object.assign({},t.settings.characterReferences,{subset:_r}))+">":"<!--"+e.value.replace(Hr,o)+"-->";function o(s){return W(s,Object.assign({},t.settings.characterReferences,{subset:Br}))}}function Vr(e,n,r,t){return"<!"+(t.settings.upperDoctype?"DOCTYPE":"doctype")+(t.settings.tightDoctype?"":" ")+"html>"}const E=vt(1),gt=vt(-1),Fr=[];function vt(e){return n;function n(r,t,o){const s=r?r.children:Fr;let a=(t||0)+e,c=s[a];if(!o)for(;c&&Ee(c);)a+=e,c=s[a];return c}}const qr={}.hasOwnProperty;function Ct(e){return n;function n(r,t,o){return qr.call(e,r.tagName)&&e[r.tagName](r,t,o)}}const Se=Ct({body:Wr,caption:ve,colgroup:ve,dd:Qr,dt:Gr,head:ve,html:$r,li:Kr,optgroup:Yr,option:Xr,p:Zr,rp:Ye,rt:Ye,tbody:eo,td:Xe,tfoot:to,th:Xe,thead:Jr,tr:no});function ve(e,n,r){const t=E(r,n,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Ee(t.value.charAt(0)))}function $r(e,n,r){const t=E(r,n);return!t||t.type!=="comment"}function Wr(e,n,r){const t=E(r,n);return!t||t.type!=="comment"}function Zr(e,n,r){const t=E(r,n);return t?t.type==="element"&&(t.tagName==="address"||t.tagName==="article"||t.tagName==="aside"||t.tagName==="blockquote"||t.tagName==="details"||t.tagName==="div"||t.tagName==="dl"||t.tagName==="fieldset"||t.tagName==="figcaption"||t.tagName==="figure"||t.tagName==="footer"||t.tagName==="form"||t.tagName==="h1"||t.tagName==="h2"||t.tagName==="h3"||t.tagName==="h4"||t.tagName==="h5"||t.tagName==="h6"||t.tagName==="header"||t.tagName==="hgroup"||t.tagName==="hr"||t.tagName==="main"||t.tagName==="menu"||t.tagName==="nav"||t.tagName==="ol"||t.tagName==="p"||t.tagName==="pre"||t.tagName==="section"||t.tagName==="table"||t.tagName==="ul"):!r||!(r.type==="element"&&(r.tagName==="a"||r.tagName==="audio"||r.tagName==="del"||r.tagName==="ins"||r.tagName==="map"||r.tagName==="noscript"||r.tagName==="video"))}function Kr(e,n,r){const t=E(r,n);return!t||t.type==="element"&&t.tagName==="li"}function Gr(e,n,r){const t=E(r,n);return!!(t&&t.type==="element"&&(t.tagName==="dt"||t.tagName==="dd"))}function Qr(e,n,r){const t=E(r,n);return!t||t.type==="element"&&(t.tagName==="dt"||t.tagName==="dd")}function Ye(e,n,r){const t=E(r,n);return!t||t.type==="element"&&(t.tagName==="rp"||t.tagName==="rt")}function Yr(e,n,r){const t=E(r,n);return!t||t.type==="element"&&t.tagName==="optgroup"}function Xr(e,n,r){const t=E(r,n);return!t||t.type==="element"&&(t.tagName==="option"||t.tagName==="optgroup")}function Jr(e,n,r){const t=E(r,n);return!!(t&&t.type==="element"&&(t.tagName==="tbody"||t.tagName==="tfoot"))}function eo(e,n,r){const t=E(r,n);return!t||t.type==="element"&&(t.tagName==="tbody"||t.tagName==="tfoot")}function to(e,n,r){return!E(r,n)}function no(e,n,r){const t=E(r,n);return!t||t.type==="element"&&t.tagName==="tr"}function Xe(e,n,r){const t=E(r,n);return!t||t.type==="element"&&(t.tagName==="td"||t.tagName==="th")}const ro=Ct({body:so,colgroup:ao,head:io,html:oo,tbody:co});function oo(e){const n=E(e,-1);return!n||n.type!=="comment"}function io(e){const n=new Set;for(const t of e.children)if(t.type==="element"&&(t.tagName==="base"||t.tagName==="title")){if(n.has(t.tagName))return!1;n.add(t.tagName)}const r=e.children[0];return!r||r.type==="element"}function so(e){const n=E(e,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Ee(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function ao(e,n,r){const t=gt(r,n),o=E(e,-1,!0);return r&&t&&t.type==="element"&&t.tagName==="colgroup"&&Se(t,r.children.indexOf(t),r)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function co(e,n,r){const t=gt(r,n),o=E(e,-1);return r&&t&&t.type==="element"&&(t.tagName==="thead"||t.tagName==="tbody")&&Se(t,r.children.indexOf(t),r)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const re={name:[[`	
\f\r &/=>`.split(""),`	
\f\r "&'/=>\``.split("")],[`\0	
\f\r "&'/<=>`.split(""),`\0	
\f\r "&'/<=>\``.split("")]],unquoted:[[`	
\f\r &>`.split(""),`\0	
\f\r "&'<=>\``.split("")],[`\0	
\f\r "&'<=>\``.split(""),`\0	
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function lo(e,n,r,t){const o=t.schema,s=o.space==="svg"?!1:t.settings.omitOptionalTags;let a=o.space==="svg"?t.settings.closeEmptyElements:t.settings.voids.includes(e.tagName.toLowerCase());const c=[];let d;o.space==="html"&&e.tagName==="svg"&&(t.schema=ut);const l=uo(t,e.properties),m=t.all(o.space==="html"&&e.tagName==="template"?e.content:e);return t.schema=o,m&&(a=!1),(l||!s||!ro(e,n,r))&&(c.push("<",e.tagName,l?" "+l:""),a&&(o.space==="svg"||t.settings.closeSelfClosing)&&(d=l.charAt(l.length-1),(!t.settings.tightSelfClosing||d==="/"||d&&d!=='"'&&d!=="'")&&c.push(" "),c.push("/")),c.push(">")),c.push(m),!a&&(!s||!Se(e,n,r))&&c.push("</"+e.tagName+">"),c.join("")}function uo(e,n){const r=[];let t=-1,o;if(n){for(o in n)if(n[o]!==null&&n[o]!==void 0){const s=mo(e,o,n[o]);s&&r.push(s)}}for(;++t<r.length;){const s=e.settings.tightAttributes?r[t].charAt(r[t].length-1):void 0;t!==r.length-1&&s!=='"'&&s!=="'"&&(r[t]+=" ")}return r.join("")}function mo(e,n,r){const t=In(e.schema,n),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,s=e.settings.allowDangerousCharacters?0:1;let a=e.quote,c;if(t.overloadedBoolean&&(r===t.attribute||r==="")?r=!0:(t.boolean||t.overloadedBoolean&&typeof r!="string")&&(r=!!r),r==null||r===!1||typeof r=="number"&&Number.isNaN(r))return"";const d=W(t.attribute,Object.assign({},e.settings.characterReferences,{subset:re.name[o][s]}));return r===!0||(r=Array.isArray(r)?(t.commaSeparated?Dn:Un)(r,{padLeft:!e.settings.tightCommaSeparatedLists}):String(r),e.settings.collapseEmptyAttributes&&!r)?d:(e.settings.preferUnquoted&&(c=W(r,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:re.unquoted[o][s]}))),c!==r&&(e.settings.quoteSmart&&Ke(r,a)>Ke(r,e.alternative)&&(a=e.alternative),c=a+W(r,Object.assign({},e.settings.characterReferences,{subset:(a==="'"?re.single:re.double)[o][s],attribute:!0}))+a),d+(c&&"="+c))}const fo=["<","&"];function yt(e,n,r,t){return r&&r.type==="element"&&(r.tagName==="script"||r.tagName==="style")?e.value:W(e.value,Object.assign({},t.settings.characterReferences,{subset:fo}))}function po(e,n,r,t){return t.settings.allowDangerousHtml?e.value:yt(e,n,r,t)}function ho(e,n,r,t){return t.all(e)}const xo=Pn("type",{invalid:go,unknown:vo,handlers:{comment:zr,doctype:Vr,element:lo,raw:po,root:ho,text:yt}});function go(e){throw new Error("Expected node, not `"+e+"`")}function vo(e){const n=e;throw new Error("Cannot compile unknown node `"+n.type+"`")}const Co={},yo={},bo=[];function wo(e,n){const r=n||Co,t=r.quote||'"',o=t==='"'?"'":'"';if(t!=='"'&&t!=="'")throw new Error("Invalid quote `"+t+"`, expected `'` or `\"`");return{one:Lo,all:jo,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||On,characterReferences:r.characterReferences||yo,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space==="svg"?ut:Hn,quote:t,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Lo(e,n,r){return xo(e,n,r,this)}function jo(e){const n=[],r=e&&e.children||bo;let t=-1;for(;++t<r.length;)n[t]=this.one(r[t],t,e);return n.join("")}function Eo(e){const n=this,r={...n.data("settings"),...e};n.compiler=t;function t(o){return wo(o,r)}}const So=_n().use(wr).use(Eo).freeze();var Je;function ko(e){return e.replace(/[<&"]/g,n=>({"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"})[n])}function To(e){var{prefixCls:n}=e,{markdown:r="",highlightEnable:t,dispatch:o}=f.useContext(q),s=A.createRef();if(f.useEffect(()=>{s.current&&o&&o({textareaPre:s.current})},[]),!r)return i.jsx("pre",{ref:s,className:n+"-text-pre wmde-markdown-color"});var a='<pre class="language-markdown '+n+'-text-pre wmde-markdown-color"><code class="language-markdown">'+ko(String.raw(Je||(Je=lr(["",""])),r))+`
</code></pre>`;if(t)try{a=So().data("settings",{fragment:!0}).use(Bn,{ignoreMissing:!0}).processSync(a).toString()}catch{}return A.createElement("div",{className:"wmde-markdown-color",dangerouslySetInnerHTML:{__html:a||""}})}var Ce;function et(e){if(e.nodeName!=="TEXTAREA")return!1;if(typeof Ce>"u"){var n=document.createElement("textarea");n.value="1",Ce=!!n.firstChild}return Ce}function Z(e,n){if(e.focus(),document.selection){var r=document.selection.createRange();r.text=n,r.collapse(!1),r.select();return}var t=!1;if(n!==""?t=document.execCommand&&document.execCommand("insertText",!1,n):t=document.execCommand&&document.execCommand("delete",!1),!t){var o=e.selectionStart,s=e.selectionEnd;if(typeof e.setRangeText=="function")e.setRangeText(n);else{var a=document.createRange(),c=document.createTextNode(n);if(et(e)){var d=e.firstChild;if(!d)e.appendChild(c);else{for(var l=0,m=null,u=null;d&&(m===null||u===null);){var h=d.nodeValue.length;o>=l&&o<=l+h&&a.setStart(m=d,o-l),s>=l&&s<=l+h&&a.setEnd(u=d,s-l),l+=h,d=d.nextSibling}o!==s&&a.deleteContents()}}if(et(e)&&a.commonAncestorContainer.nodeName==="#text")a.insertNode(c);else{var p=e.value;e.value=p.slice(0,o)+n+p.slice(s)}}e.setSelectionRange(o+n.length,o+n.length);var x=document.createEvent("UIEvent");x.initEvent("input",!0,!1),e.dispatchEvent(x)}}function T(e){var{text:n,selection:r,prefix:t,suffix:o=t}=e,s=r;if(n&&n.length&&r.start===r.end&&(s=No(n,r.start)),s.start>=t.length&&s.end<=n.length-o.length){var a=n.slice(s.start-t.length,s.end+o.length);if(a.startsWith(t)&&a.endsWith(o))return{start:s.start-t.length,end:s.end+o.length}}return s}function Q(e){var{text:n,selection:r}=e,t=n.slice(0,r.start).lastIndexOf(`
`)+1,o=n.slice(r.end).indexOf(`
`)+r.end;return o===r.end-1&&(o=n.length),{start:t,end:o}}function bt(e,n){if(e===void 0&&(e=""),n===0)return 0;for(var r=2,t=!0,o=n-1;o>=0&&r>=0;o--)switch(e.charCodeAt(o)){case 32:continue;case 10:r--,t=!1;break;default:return r}return t?0:r}function wt(e,n){if(e===void 0&&(e=""),n===e.length-1)return 0;for(var r=2,t=!0,o=n;o<e.length&&r>=0;o++)switch(e.charCodeAt(o)){case 32:continue;case 10:{r--,t=!1;break}default:return r}return t?0:r}function No(e,n){if(!e)throw Error("Argument 'text' should be truthy");for(var r=c=>c===" "||c.charCodeAt(0)===10,t=0,o=e.length,s=n;s-1>-1;s--)if(r(e[s-1])){t=s;break}for(var a=n;a<e.length;a++)if(r(e[a])){o=a;break}return{start:t,end:o}}function k(e){var{api:n,selectedText:r,selection:t,prefix:o,suffix:s=o}=e;r.length>=o.length+s.length&&r.startsWith(o)&&r.endsWith(s)?(n.replaceSelection(r.slice(o.length,s.length?-s.length:void 0)),n.setSelectionRange({start:t.start-o.length,end:t.end-o.length})):(n.replaceSelection(""+o+r+s),n.setSelectionRange({start:t.start+o.length,end:t.end+o.length}))}function ke(e,n){var r=e.split(/\n/),t=0,o=r.map((s,a)=>{if(typeof n=="string")return s.startsWith(n)?(t-=n.length,s.slice(n.length)):(t+=n.length,n+s);if(typeof n=="function"){if(s.startsWith(n(s,a)))return t-=n(s,a).length,s.slice(n(s,a).length);var c=n(s,a);return t+=c.length,n(s,a)+s}throw Error("insertion is expected to be either a string or a function")}).join(`
`);return{modifiedText:o,insertionLength:t}}var Ao={name:"bold",keyCommand:"bold",shortcuts:"ctrlcmd+b",prefix:"**",buttonProps:{"aria-label":"Add bold text (ctrl + b)",title:"Add bold text (ctrl + b)"},icon:i.jsx("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:i.jsx("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),t=n.setSelectionRange(r);k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix})}},Lt={name:"codeBlock",keyCommand:"codeBlock",shortcuts:"ctrlcmd+shift+j",prefix:"```",buttonProps:{"aria-label":"Insert Code Block (ctrl + shift + j)",title:"Insert Code Block (ctrl + shift +j)"},icon:i.jsx("svg",{width:"13",height:"13",role:"img",viewBox:"0 0 156 156",children:i.jsx("path",{fill:"currentColor",d:"M110.85 120.575 43.7 120.483333 43.7083334 110.091667 110.85 110.191667 110.841667 120.583333 110.85 120.575ZM85.1333334 87.1916666 43.625 86.7083332 43.7083334 76.3166666 85.2083334 76.7916666 85.1333334 87.1916666 85.1333334 87.1916666ZM110.841667 53.4166666 43.7 53.3166666 43.7083334 42.925 110.85 43.025 110.841667 53.4166666ZM36 138C27.2916666 138 20.75 136.216667 16.4 132.666667 12.1333334 129.2 10 124.308333 10 118L10 95.3333332C10 91.0666666 9.25 88.1333332 7.7333334 86.5333332 6.3166668 84.8416666 3.7333334 84 0 84L0 72C3.7333334 72 6.3083334 71.2 7.7333334 69.6 9.2416668 67.9083334 10 64.9333334 10 60.6666666L10 38C10 31.775 12.1333334 26.8833334 16.4 23.3333332 20.7583334 19.7749998 27.2916666 18 36 18L40.6666668 18 40.6666668 30 36 30C34.0212222 29.9719277 32.1263151 30.7979128 30.8 32.2666666 29.3605875 33.8216362 28.5938182 35.8823287 28.6666668 38L28.6666668 60.6666666C28.6666668 67.5083332 26.6666668 72.4 22.6666668 75.3333332 20.9317416 76.7274684 18.8640675 77.6464347 16.6666668 78 18.8916668 78.35 20.8916668 79.2416666 22.6666668 80.6666666 26.6666668 83.95 28.6666668 88.8416666 28.6666668 95.3333332L28.6666668 118C28.6666668 120.308333 29.3750002 122.216667 30.8 123.733333 32.2166666 125.241667 33.9583334 126 36 126L40.6666668 126 40.6666668 138 36 138 36 138ZM114.116667 126 118.783333 126C120.833333 126 122.566667 125.241667 123.983333 123.733333 125.422746 122.178364 126.189515 120.117671 126.116667 118L126.116667 95.3333332C126.116667 88.8333332 128.116667 83.9499998 132.116667 80.6666666 133.9 79.2416666 135.9 78.35 138.116667 78 135.919156 77.6468047 133.851391 76.7277979 132.116667 75.3333332 128.116667 72.3999998 126.116667 67.5 126.116667 60.6666666L126.116667 38C126.189515 35.8823287 125.422746 33.8216361 123.983333 32.2666666 122.657018 30.7979128 120.762111 29.9719277 118.783333 30L114.116667 30 114.116667 18 118.783333 18C127.5 18 133.983333 19.775 138.25 23.3333332 142.608333 26.8833332 144.783333 31.7749998 144.783333 38L144.783333 60.6666666C144.783333 64.9333332 145.5 67.9083332 146.916667 69.6 148.433333 71.2 151.05 72 154.783333 72L154.783333 84C151.05 84 148.433333 84.8333334 146.916667 86.5333332 145.5 88.1333332 144.783333 91.0666666 144.783333 95.3333332L144.783333 118C144.783333 124.308333 142.616667 129.2 138.25 132.666667 133.983333 136.216667 127.5 138 118.783333 138L114.116667 138 114.116667 126 114.116667 126Z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:"```\n",suffix:"\n```"}),t=n.setSelectionRange(r),o="\n```\n",s="\n```\n";t.selectedText.length>=o.length+s.length-2&&t.selectedText.startsWith(o)&&t.selectedText.endsWith(s)?(o="```\n",s="\n```"):((t.selection.start>=1&&e.text.slice(t.selection.start-1,t.selection.start)===`
`||t.selection.start===0)&&(o="```\n"),(t.selection.end<=e.text.length-1&&e.text.slice(t.selection.end,t.selection.end+1)===`
`||t.selection.end===e.text.length)&&(s="\n```"));var a=T({text:e.text,selection:e.selection,prefix:o,suffix:s}),c=n.setSelectionRange(a);k({api:n,selectedText:c.selectedText,selection:e.selection,prefix:o,suffix:s})}},Mo={name:"code",keyCommand:"code",shortcuts:"ctrlcmd+j",prefix:"`",buttonProps:{"aria-label":"Insert code (ctrl + j)",title:"Insert code (ctrl + j)"},icon:i.jsx("svg",{width:"14",height:"14",role:"img",viewBox:"0 0 640 512",children:i.jsx("path",{fill:"currentColor",d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"})}),execute:(e,n)=>{if(e.selectedText.indexOf(`
`)===-1){var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),t=n.setSelectionRange(r);k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix})}else Lt.execute(e,n)}},Ro={name:"comment",keyCommand:"comment",shortcuts:"ctrlcmd+/",prefix:"<!-- ",suffix:" -->",buttonProps:{"aria-label":"Insert comment (ctrl + /)",title:"Insert comment (ctrl + /)"},icon:i.jsx("svg",{height:"1em",width:"1em",viewBox:"0 0 25 25",children:i.jsxs("g",{fill:"none",fillRule:"evenodd",children:[i.jsx("polygon",{points:".769 .727 24.981 .727 24.981 24.727 .769 24.727"}),i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"M12.625,23.8787879 L8.125,19.6969697 L5.125,19.6969697 C2.63971863,19.6969697 0.625,17.8247059 0.625,15.5151515 L0.625,7.15151515 C0.625,4.84196074 2.63971863,2.96969697 5.125,2.96969697 L20.125,2.96969697 C22.6102814,2.96969697 24.625,4.84196074 24.625,7.15151515 L24.625,15.5151515 C24.625,17.8247059 22.6102814,19.6969697 20.125,19.6969697 L17.125,19.6969697 L12.625,23.8787879"}),i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"M10.625,8.54545455 L7.25,11.3333333 L10.625,14.1212121 M15.6875,8.54545455 L19.0625,11.3333333 L15.6875,14.1212121"})]})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}),t=n.setSelectionRange(r);k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix})}},ie={keyCommand:"divider"},Io={name:"fullscreen",keyCommand:"fullscreen",shortcuts:"ctrlcmd+0",value:"fullscreen",buttonProps:{"aria-label":"Toggle fullscreen (ctrl + 0)",title:"Toggle fullscreen (ctrl+ 0)"},icon:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:i.jsx("path",{fill:"currentColor",d:"M118 171.133334L118 342.200271C118 353.766938 126.675 365.333605 141.133333 365.333605L382.634614 365.333605C394.201281 365.333605 405.767948 356.658605 405.767948 342.200271L405.767948 171.133334C405.767948 159.566667 397.092948 148 382.634614 148L141.133333 148C126.674999 148 117.999999 156.675 118 171.133334zM465.353591 413.444444L370 413.444444 370 471.222222 474.0221 471.222222C500.027624 471.222222 520.254143 451 520.254143 425L520.254143 321 462.464089 321 462.464089 413.444444 465.353591 413.444444zM471.0221 43L367 43 367 100.777778 462.353591 100.777778 462.353591 196.111111 520.143647 196.111111 520.143647 89.2222219C517.254144 63.2222219 497.027624 43 471.0221 43zM57.7900547 100.777778L153.143646 100.777778 153.143646 43 46.2320439 43C20.2265191 43 0 63.2222219 0 89.2222219L0 193.222222 57.7900547 193.222222 57.7900547 100.777778zM57.7900547 321L0 321 0 425C0 451 20.2265191 471.222222 46.2320439 471.222223L150.254143 471.222223 150.254143 413.444445 57.7900547 413.444445 57.7900547 321z"})}),execute:(e,n,r,t,o)=>{n.textArea.focus(),o&&r&&t&&r({fullscreen:!t.fullscreen})}},Do=(e,n)=>{var r=L({children:e,icon:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:i.jsx("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})}),execute:()=>{}},n,{keyCommand:"group"});return Array.isArray(r.children)&&(r.children=r.children.map(t=>{var o=L({},(Kn(t),t));return o.parent=r,L({},o)})),r},Uo={name:"hr",keyCommand:"hr",shortcuts:"ctrlcmd+h",prefix:`

---
`,suffix:"",buttonProps:{"aria-label":"Insert HR (ctrl + h)",title:"Insert HR (ctrl + h)"},icon:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 175 175",children:i.jsx("path",{fill:"currentColor",d:"M0,129 L175,129 L175,154 L0,154 L0,129 Z M3,9 L28.2158203,9 L28.2158203,47.9824219 L55.7695313,47.9824219 L55.7695313,9 L81.0966797,9 L81.0966797,107.185547 L55.7695313,107.185547 L55.7695313,68.0214844 L28.2158203,68.0214844 L28.2158203,107.185547 L3,107.185547 L3,9 Z M93.1855469,100.603516 L93.1855469,19 L135.211914,19 C143.004922,19 148.960917,19.6679621 153.080078,21.0039063 C157.199239,22.3398504 160.520495,24.8168764 163.043945,28.4350586 C165.567395,32.0532407 166.829102,36.459935 166.829102,41.6552734 C166.829102,46.1826398 165.864267,50.0883625 163.93457,53.3725586 C162.004873,56.6567547 159.351579,59.3193257 155.974609,61.3603516 C153.822255,62.6591862 150.872089,63.7353473 147.124023,64.5888672 C150.129898,65.5908253 152.319329,66.5927684 153.692383,67.5947266 C154.620122,68.2626987 155.965323,69.6913953 157.728027,71.8808594 C159.490731,74.0703234 160.668942,75.7587831 161.262695,76.9462891 L173,100.603516 L144.953125,100.603516 L131.482422,75.6660156 C129.775382,72.4374839 128.253913,70.3408251 126.917969,69.3759766 C125.0996,68.1142515 123.040051,67.4833984 120.739258,67.4833984 L118.512695,67.4833984 L118.512695,100.603516 L93.1855469,100.603516 Z M118.512695,52.0644531 L129.144531,52.0644531 C130.294928,52.0644531 132.521468,51.6933631 135.824219,50.9511719 C137.494149,50.6171858 138.857905,49.7636787 139.915527,48.390625 C140.97315,47.0175713 141.501953,45.4404386 141.501953,43.6591797 C141.501953,41.0244009 140.667001,39.0019602 138.99707,37.5917969 C137.32714,36.1816336 134.191429,35.4765625 129.589844,35.4765625 L117.512695,35.4765625 L118.512695,52.0644531 Z",transform:"translate(0 9)"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}),t=n.setSelectionRange(r);t.selectedText.length>=e.command.prefix.length&&t.selectedText.startsWith(e.command.prefix)?k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}):(t=n.setSelectionRange({start:e.selection.start,end:e.selection.start}),k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}))}},Po={name:"image",keyCommand:"image",shortcuts:"ctrlcmd+k",prefix:"![image](",suffix:")",buttonProps:{"aria-label":"Add image (ctrl + k)",title:"Add image (ctrl + k)"},icon:i.jsx("svg",{width:"13",height:"13",viewBox:"0 0 20 20",children:i.jsx("path",{fill:"currentColor",d:"M15 9c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4-7H1c-.55 0-1 .45-1 1v14c0 .55.45 1 1 1h18c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 13l-6-5-2 2-4-5-4 8V4h16v11z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}),t=n.setSelectionRange(r);t.selectedText.includes("http")||t.selectedText.includes("www")?k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}):(r=T({text:e.text,selection:e.selection,prefix:"![",suffix:"]()"}),t=n.setSelectionRange(r),t.selectedText.length===0?k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:"![image",suffix:"](url)"}):k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:"![",suffix:"]()"}))}},Oo={name:"italic",keyCommand:"italic",shortcuts:"ctrlcmd+i",prefix:"*",buttonProps:{"aria-label":"Add italic text (ctrl + i)",title:"Add italic text (ctrl + i)"},icon:i.jsx("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 320 512",children:i.jsx("path",{fill:"currentColor",d:"M204.758 416h-33.849l62.092-320h40.725a16 16 0 0 0 15.704-12.937l6.242-32C297.599 41.184 290.034 32 279.968 32H120.235a16 16 0 0 0-15.704 12.937l-6.242 32C96.362 86.816 103.927 96 113.993 96h33.846l-62.09 320H46.278a16 16 0 0 0-15.704 12.935l-6.245 32C22.402 470.815 29.967 480 40.034 480h158.479a16 16 0 0 0 15.704-12.935l6.245-32c1.927-9.88-5.638-19.065-15.704-19.065z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),t=n.setSelectionRange(r);k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix})}},Ho={name:"link",keyCommand:"link",shortcuts:"ctrlcmd+l",prefix:"[",suffix:"](url)",buttonProps:{"aria-label":"Add a link (ctrl + l)",title:"Add a link (ctrl + l)"},icon:i.jsx("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:i.jsx("path",{fill:"currentColor",d:"M331.751196,182.121107 C392.438214,241.974735 391.605313,337.935283 332.11686,396.871226 C332.005129,396.991316 331.873084,397.121413 331.751196,397.241503 L263.493918,464.491645 C203.291404,523.80587 105.345257,523.797864 45.151885,464.491645 C-15.0506283,405.187427 -15.0506283,308.675467 45.151885,249.371249 L82.8416853,212.237562 C92.836501,202.39022 110.049118,208.9351 110.56511,222.851476 C111.223305,240.5867 114.451306,258.404985 120.407566,275.611815 C122.424812,281.438159 120.983487,287.882964 116.565047,292.23621 L103.272145,305.332975 C74.8052033,333.379887 73.9123737,379.047937 102.098973,407.369054 C130.563883,435.969378 177.350591,436.139505 206.033884,407.879434 L274.291163,340.6393 C302.9257,312.427264 302.805844,266.827265 274.291163,238.733318 C270.531934,235.036561 266.74528,232.16442 263.787465,230.157924 C259.544542,227.2873 256.928256,222.609848 256.731165,217.542518 C256.328935,206.967633 260.13184,196.070508 268.613213,187.714278 L289.998463,166.643567 C295.606326,161.118448 304.403592,160.439942 310.906317,164.911276 C318.353355,170.034591 325.328531,175.793397 331.751196,182.121107 Z M240.704978,55.4828366 L172.447607,122.733236 C172.325719,122.853326 172.193674,122.983423 172.081943,123.103513 C117.703294,179.334654 129.953294,261.569283 185.365841,328.828764 C191.044403,335.721376 198.762988,340.914712 206.209732,346.037661 C212.712465,350.509012 221.510759,349.829503 227.117615,344.305363 L248.502893,323.234572 C256.984277,314.87831 260.787188,303.981143 260.384957,293.406218 C260.187865,288.338869 257.571576,283.661398 253.328648,280.790763 C250.370829,278.78426 246.58417,275.912107 242.824936,272.215337 C214.310216,244.121282 206.209732,204.825874 229.906702,179.334654 L298.164073,112.094263 C326.847404,83.8340838 373.633159,84.0042113 402.099123,112.604645 C430.285761,140.92587 429.393946,186.594095 400.92595,214.641114 L387.63303,227.737929 C383.214584,232.091191 381.773257,238.536021 383.790506,244.362388 C389.746774,261.569283 392.974779,279.387637 393.632975,297.122928 C394.149984,311.039357 411.361608,317.584262 421.356437,307.736882 L459.046288,270.603053 C519.249898,211.29961 519.249898,114.787281 459.047304,55.4828366 C398.853851,-3.82360914 300.907572,-3.83161514 240.704978,55.4828366 Z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}),t=n.setSelectionRange(r);t.selectedText.includes("http")||t.selectedText.includes("www")?(r=T({text:e.text,selection:e.selection,prefix:"[](",suffix:")"}),t=n.setSelectionRange(r),k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:"[](",suffix:")"})):t.selectedText.length===0?k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:"[title",suffix:"](url)"}):k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix})}},Te=(e,n,r)=>{var t=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),o=n.setSelectionRange(t),s=bt(o.text,o.selection.start),a=Array(s+1).join(`
`),c=wt(o.text,o.selection.end),d=Array(c+1).join(`
`),{modifiedText:l,insertionLength:m}=ke(o.selectedText,r);if(m<0){var u=o.selection.start,h=o.selection.end;o.selection.start>0&&e.text.slice(o.selection.start-1,o.selection.start)===`
`&&(u-=1),o.selection.end<e.text.length-1&&e.text.slice(o.selection.end,o.selection.end+1)===`
`&&(h+=1),n.setSelectionRange({start:u,end:h}),n.replaceSelection(""+l),n.setSelectionRange({start:u,end:u+l.length})}else{n.replaceSelection(""+a+l+d);var p=o.selection.start+s,x=p+l.length;n.setSelectionRange({start:p,end:x})}},_o={name:"unordered-list",keyCommand:"list",shortcuts:"ctrl+shift+u",prefix:"- ",buttonProps:{"aria-label":"Add unordered list (ctrl + shift + u)",title:"Add unordered list (ctrl + shift + u)"},icon:i.jsx("svg",{"data-name":"unordered-list",width:"12",height:"12",viewBox:"0 0 512 512",children:i.jsx("path",{fill:"currentColor",d:"M96 96c0 26.51-21.49 48-48 48S0 122.51 0 96s21.49-48 48-48 48 21.49 48 48zM48 208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm0 160c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm96-236h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:(e,n)=>{Te(e,n,"- ")}},Bo={name:"ordered-list",keyCommand:"list",shortcuts:"ctrl+shift+o",prefix:"1. ",buttonProps:{"aria-label":"Add ordered list (ctrl + shift + o)",title:"Add ordered list (ctrl + shift + o)"},icon:i.jsx("svg",{"data-name":"ordered-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:i.jsx("path",{fill:"currentColor",d:"M3.263 139.527c0-7.477 3.917-11.572 11.573-11.572h15.131V88.078c0-5.163.534-10.503.534-10.503h-.356s-1.779 2.67-2.848 3.738c-4.451 4.273-10.504 4.451-15.666-1.068l-5.518-6.231c-5.342-5.341-4.984-11.216.534-16.379l21.72-19.938C32.815 33.602 36.732 32 42.785 32H54.89c7.656 0 11.749 3.916 11.749 11.572v84.384h15.488c7.655 0 11.572 4.094 11.572 11.572v8.901c0 7.477-3.917 11.572-11.572 11.572H14.836c-7.656 0-11.573-4.095-11.573-11.572v-8.902zM2.211 304.591c0-47.278 50.955-56.383 50.955-69.165 0-7.18-5.954-8.755-9.28-8.755-3.153 0-6.479 1.051-9.455 3.852-5.079 4.903-10.507 7.004-16.111 2.451l-8.579-6.829c-5.779-4.553-7.18-9.805-2.803-15.409C13.592 201.981 26.025 192 47.387 192c19.437 0 44.476 10.506 44.476 39.573 0 38.347-46.753 46.402-48.679 56.909h39.049c7.529 0 11.557 4.027 11.557 11.382v8.755c0 7.354-4.028 11.382-11.557 11.382h-67.94c-7.005 0-12.083-4.028-12.083-11.382v-4.028zM5.654 454.61l5.603-9.28c3.853-6.654 9.105-7.004 15.584-3.152 4.903 2.101 9.63 3.152 14.359 3.152 10.155 0 14.358-3.502 14.358-8.23 0-6.654-5.604-9.106-15.934-9.106h-4.728c-5.954 0-9.28-2.101-12.258-7.88l-1.05-1.926c-2.451-4.728-1.226-9.806 2.801-14.884l5.604-7.004c6.829-8.405 12.257-13.483 12.257-13.483v-.35s-4.203 1.051-12.608 1.051H16.685c-7.53 0-11.383-4.028-11.383-11.382v-8.755c0-7.53 3.853-11.382 11.383-11.382h58.484c7.529 0 11.382 4.027 11.382 11.382v3.327c0 5.778-1.401 9.806-5.079 14.183l-17.509 20.137c19.611 5.078 28.716 20.487 28.716 34.845 0 21.363-14.358 44.126-48.503 44.126-16.636 0-28.192-4.728-35.896-9.455-5.779-4.202-6.304-9.805-2.626-15.934zM144 132h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:(e,n)=>{Te(e,n,(r,t)=>t+1+". ")}},zo={name:"checked-list",keyCommand:"list",shortcuts:"ctrl+shift+c",prefix:"- [ ] ",buttonProps:{"aria-label":"Add checked list (ctrl + shift + c)",title:"Add checked list (ctrl + shift + c)"},icon:i.jsx("svg",{"data-name":"checked-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:i.jsx("path",{fill:"currentColor",d:"M208 132h288c8.8 0 16-7.2 16-16V76c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zM64 368c-26.5 0-48.6 21.5-48.6 48s22.1 48 48.6 48 48-21.5 48-48-21.5-48-48-48zm92.5-299l-72.2 72.2-15.6 15.6c-4.7 4.7-12.9 4.7-17.6 0L3.5 109.4c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.3c4.7-4.7 12.3-4.7 17 0l17 16.5c4.6 4.7 4.6 12.3-.1 17zm0 159.6l-72.2 72.2-15.7 15.7c-4.7 4.7-12.9 4.7-17.6 0L3.5 269c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.7c4.7-4.7 12.3-4.7 17 0l17 17c4.6 4.6 4.6 12.2-.1 16.9z"})}),execute:(e,n)=>{Te(e,n,(r,t)=>"- [ ] ")}},Vo={name:"preview",keyCommand:"preview",value:"preview",shortcuts:"ctrlcmd+9",buttonProps:{"aria-label":"Preview code (ctrl + 9)",title:"Preview code (ctrl + 9)"},icon:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[i.jsx("polygon",{fill:"currentColor",points:"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293"}),i.jsx("polygon",{fill:"currentColor",points:"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413"})]}),execute:(e,n,r,t,o)=>{n.textArea.focus(),o&&r&&t&&r({preview:"preview"})}},Fo={name:"edit",keyCommand:"preview",value:"edit",shortcuts:"ctrlcmd+7",buttonProps:{"aria-label":"Edit code (ctrl + 7)",title:"Edit code (ctrl + 7)"},icon:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[i.jsx("polygon",{fill:"currentColor",points:"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293"}),i.jsx("polygon",{fill:"currentColor",points:"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413"})]}),execute:(e,n,r,t,o)=>{n.textArea.focus(),o&&r&&t&&r({preview:"edit"})}},qo={name:"live",keyCommand:"preview",value:"live",shortcuts:"ctrlcmd+8",buttonProps:{"aria-label":"Live code (ctrl + 8)",title:"Live code (ctrl + 8)"},icon:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:[i.jsx("polygon",{fill:"currentColor",points:"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293"}),i.jsx("polygon",{fill:"currentColor",points:"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413"})]}),execute:(e,n,r,t,o)=>{n.textArea.focus(),o&&r&&t&&r({preview:"live"})}},$o={name:"quote",keyCommand:"quote",shortcuts:"ctrlcmd+q",prefix:"> ",buttonProps:{"aria-label":"Insert a quote (ctrl + q)",title:"Insert a quote (ctrl + q)"},icon:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:i.jsx("path",{fill:"currentColor",d:"M520,95.75 L520,225.75 C520,364.908906 457.127578,437.050625 325.040469,472.443125 C309.577578,476.586875 294.396016,464.889922 294.396016,448.881641 L294.396016,414.457031 C294.396016,404.242891 300.721328,395.025078 310.328125,391.554687 C377.356328,367.342187 414.375,349.711094 414.375,274.5 L341.25,274.5 C314.325781,274.5 292.5,252.674219 292.5,225.75 L292.5,95.75 C292.5,68.8257812 314.325781,47 341.25,47 L471.25,47 C498.174219,47 520,68.8257812 520,95.75 Z M178.75,47 L48.75,47 C21.8257813,47 0,68.8257812 0,95.75 L0,225.75 C0,252.674219 21.8257813,274.5 48.75,274.5 L121.875,274.5 C121.875,349.711094 84.8563281,367.342187 17.828125,391.554687 C8.22132813,395.025078 1.89601563,404.242891 1.89601563,414.457031 L1.89601563,448.881641 C1.89601563,464.889922 17.0775781,476.586875 32.5404687,472.443125 C164.627578,437.050625 227.5,364.908906 227.5,225.75 L227.5,95.75 C227.5,68.8257812 205.674219,47 178.75,47 Z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),t=n.setSelectionRange(r),o=bt(t.text,t.selection.start),s=Array(o+1).join(`
`),a=wt(t.text,t.selection.end),c=Array(a+1).join(`
`),d=ke(t.selectedText,e.command.prefix);n.replaceSelection(""+s+d.modifiedText+c);var l=t.selection.start+o,m=l+d.modifiedText.length;n.setSelectionRange({start:l,end:m})}},Wo={name:"strikethrough",keyCommand:"strikethrough",shortcuts:"ctrl+shift+x",buttonProps:{"aria-label":"Add strikethrough text (ctrl + shift + x)",title:"Add strikethrough text (ctrl + shift + x)"},prefix:"~~",icon:i.jsx("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:i.jsx("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix}),t=n.setSelectionRange(r);k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix})}},jt={name:"title1",keyCommand:"title1",shortcuts:"ctrlcmd+1",prefix:"# ",suffix:"",buttonProps:{"aria-label":"Insert title1 (ctrl + 1)",title:"Insert title1 (ctrl + 1)"},icon:i.jsx("div",{style:{fontSize:18,textAlign:"left"},children:"Title 1"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}};function K(e){var{state:n,api:r,prefix:t,suffix:o=t}=e,s=Q({text:n.text,selection:n.selection}),a=r.setSelectionRange(s);k({api:r,selectedText:a.selectedText,selection:n.selection,prefix:t,suffix:o})}L({},jt,{icon:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:i.jsx("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})})});var Zo={name:"title2",keyCommand:"title2",shortcuts:"ctrlcmd+2",prefix:"## ",suffix:"",buttonProps:{"aria-label":"Insert title2 (ctrl + 2)",title:"Insert title2 (ctrl + 2)"},icon:i.jsx("div",{style:{fontSize:16,textAlign:"left"},children:"Title 2"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}},Ko={name:"title3",keyCommand:"title3",shortcuts:"ctrlcmd+3",prefix:"### ",suffix:"",buttonProps:{"aria-label":"Insert title3 (ctrl + 3)",title:"Insert title3 (ctrl + 3)"},icon:i.jsx("div",{style:{fontSize:15,textAlign:"left"},children:"Title 3"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}},Go={name:"title4",keyCommand:"title4",shortcuts:"ctrlcmd+4",prefix:"#### ",suffix:"",buttonProps:{"aria-label":"Insert title4 (ctrl + 4)",title:"Insert title4 (ctrl + 4)"},icon:i.jsx("div",{style:{fontSize:14,textAlign:"left"},children:"Title 4"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}},Qo={name:"title5",keyCommand:"title5",shortcuts:"ctrlcmd+5",prefix:"##### ",suffix:"",buttonProps:{"aria-label":"Insert title5 (ctrl + 5)",title:"Insert title5 (ctrl + 5)"},icon:i.jsx("div",{style:{fontSize:12,textAlign:"left"},children:"Title 5"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}},Yo={name:"title6",keyCommand:"title6",shortcuts:"ctrlcmd+6",prefix:"###### ",suffix:"",buttonProps:{"aria-label":"Insert title6 (ctrl + 6)",title:"Insert title6 (ctrl + 6)"},icon:i.jsx("div",{style:{fontSize:12,textAlign:"left"},children:"Title 6"}),execute:(e,n)=>{K({state:e,api:n,prefix:e.command.prefix,suffix:e.command.suffix})}},Xo={name:"table",keyCommand:"table",prefix:`
| Header | Header |
|--------|--------|
| Cell | Cell |
| Cell | Cell |
| Cell | Cell |

`,suffix:"",buttonProps:{"aria-label":"Add table",title:"Add table"},icon:i.jsx("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 512 512",children:i.jsx("path",{fill:"currentColor",d:"M64 256V160H224v96H64zm0 64H224v96H64V320zm224 96V320H448v96H288zM448 256H288V160H448v96zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"})}),execute:(e,n)=>{var r=T({text:e.text,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}),t=n.setSelectionRange(r);t.selectedText.length>=e.command.prefix.length+e.command.suffix.length&&t.selectedText.startsWith(e.command.prefix)?k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}):(t=n.setSelectionRange({start:e.selection.start,end:e.selection.start}),k({api:n,selectedText:t.selectedText,selection:e.selection,prefix:e.command.prefix,suffix:e.command.suffix}))}},Jo={name:"help",keyCommand:"help",buttonProps:{"aria-label":"Open help",title:"Open help"},icon:i.jsx("svg",{viewBox:"0 0 16 16",width:"12px",height:"12px",children:i.jsx("path",{d:"M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm.9 13H7v-1.8h1.9V13Zm-.1-3.6v.5H7.1v-.6c.2-2.1 2-1.9 1.9-3.2.1-.7-.3-1.1-1-1.1-.8 0-1.2.7-1.2 1.6H5c0-1.7 1.2-3 2.9-3 2.3 0 3 1.4 3 2.3.1 2.3-1.9 2-2.1 3.5Z",fill:"currentColor"})}),execute:()=>{window.open("https://www.markdownguide.org/basic-syntax/","_blank","noreferrer")}},ei=()=>[Ao,Oo,Wo,Uo,Do([jt,Zo,Ko,Go,Qo,Yo],{name:"title",groupName:"title",buttonProps:{"aria-label":"Insert title",title:"Insert title"}}),ie,Ho,$o,Mo,Lt,Ro,Po,Xo,ie,_o,Bo,zo,ie,Jo],ti=()=>[Fo,qo,Vo,ie,Io];function le(e){var n;return{selection:{start:e.selectionStart,end:e.selectionEnd},text:e.value,selectedText:(n=e.value)==null?void 0:n.slice(e.selectionStart,e.selectionEnd)}}class Ne{constructor(n){this.textArea=void 0,this.textArea=n}replaceSelection(n){return Z(this.textArea,n),le(this.textArea)}setSelectionRange(n){return this.textArea.focus(),this.textArea.selectionStart=n.start,this.textArea.selectionEnd=n.end,le(this.textArea)}}class Ae{constructor(n){this.textArea=void 0,this.textApi=void 0,this.textArea=n,this.textApi=new Ne(n)}getState(){return this.textArea?le(this.textArea):!1}executeCommand(n,r,t,o){n.execute&&n.execute(L({command:n},le(this.textArea)),this.textApi,r,t,o)}}function se(e){e.stopPropagation(),e.preventDefault()}function tt(e,n){se(e);var r=e.target,t=new Ne(r),o={start:r.selectionStart,end:r.selectionEnd};if(o=Q({text:r.value,selection:o}),!(n<0&&o.start<=0||n>0&&o.end>=r.value.length)){var s=r.value.slice(o.start,o.end);if(n<0){var a=Q({text:r.value,selection:{start:o.start-1,end:o.start-1}}),c=r.value.slice(a.start,a.end);t.setSelectionRange({start:a.start,end:o.end}),Z(r,s+`
`+c),t.setSelectionRange({start:a.start,end:a.start+s.length})}else{var d=Q({text:r.value,selection:{start:o.end+1,end:o.end+1}}),l=r.value.slice(d.start,d.end);t.setSelectionRange({start:o.start,end:d.end}),Z(r,l+`
`+s),t.setSelectionRange({start:d.end-s.length,end:d.end})}}}function ni(e,n,r){n===void 0&&(n=2),r===void 0&&(r=!1);var t=e.target,o=t.value.substr(0,t.selectionStart),s=o.split(`
`),a=s[s.length-1],c=new Ne(t);if(!r&&e.code&&e.code.toLowerCase()==="tab"){se(e);var d=new Array(n+1).join("  ");if(t.selectionStart!==t.selectionEnd){var l=t.value.substring(0,t.selectionStart).split(`
`),m=t.value.substring(0,t.selectionEnd).split(`
`),u=[];m.forEach((P,X)=>{P!==l[X]&&u.push(P)});var h=u.join(`
`),p=t.value.substring(t.selectionStart,t.selectionEnd),x=t.value.substring(0,t.selectionStart).length;c.setSelectionRange({start:t.value.indexOf(h),end:t.selectionEnd});var b=ke(h,e.shiftKey?"":d),C=b.modifiedText;e.shiftKey&&(C=C.split(`
`).map(P=>P.replace(new RegExp("^"+d),"")).join(`
`)),c.replaceSelection(C);var v=e.shiftKey?-n:n,y=e.shiftKey?-u.length*n:u.length*n;c.setSelectionRange({start:x+v,end:x+p.length+y})}else return Z(t,d)}else if(e.keyCode===13&&e.code.toLowerCase()==="enter"&&(/^(-|\*)\s/.test(a)||/^\d+.\s/.test(a))&&!e.shiftKey){se(e);var R=`
- `;return a.startsWith("*")&&(R=`
* `),(a.startsWith("- [ ]")||a.startsWith("- [X]")||a.startsWith("- [x]"))&&(R=`
- [ ] `),/^\d+.\s/.test(a)&&(R=`
`+(parseInt(a)+1)+". "),Z(t,R)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){se(e);var w={start:t.selectionStart,end:t.selectionEnd},N=w;w=Q({text:t.value,selection:w});var U=t.value.slice(w.start,w.end);c.setSelectionRange({start:w.end,end:w.end}),Z(t,`
`+U),c.setSelectionRange({start:N.start,end:N.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?tt(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&tt(e,1)}var ri=["prefixCls","onChange"],oi=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","dispatch"];function ii(e){var{prefixCls:n,onChange:r}=e,t=ce(e,ri),o=f.useContext(q),{markdown:s,commands:a,fullscreen:c,preview:d,highlightEnable:l,extraCommands:m,tabSize:u,defaultTabEnable:h,dispatch:p}=o;ce(o,oi);var x=A.useRef(null),b=A.useRef(),C=A.useRef({fullscreen:c,preview:d});f.useEffect(()=>{C.current={fullscreen:c,preview:d,highlightEnable:l}},[c,d,l]),f.useEffect(()=>{if(x.current&&p){var y=new Ae(x.current);b.current=y,p({textarea:x.current,commandOrchestrator:y})}},[]);var v=y=>{ni(y,u,h),ht(y,[...a||[],...m||[]],b.current,p,C.current)};return f.useEffect(()=>(x.current&&x.current.addEventListener("keydown",v),()=>{x.current&&x.current.removeEventListener("keydown",v)}),[]),i.jsx("textarea",L({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},t,{ref:x,className:n+"-text-input "+(t.className?t.className:""),value:s,onChange:y=>{p&&p({markdown:y.target.value}),r&&r(y)}}))}var si=["prefixCls","className","onScroll","renderTextarea"];function ai(e){var n=e||{},{prefixCls:r,className:t,onScroll:o,renderTextarea:s}=n,a=ce(n,si),{markdown:c,scrollTop:d,commands:l,minHeight:m,highlightEnable:u,extraCommands:h,dispatch:p}=f.useContext(q),x=A.useRef(null),b=A.useRef(),C=A.createRef();f.useEffect(()=>{var y={};C.current&&(y.textareaWarp=C.current||void 0,C.current.scrollTop=d||0),p&&p(L({},y))},[]),f.useEffect(()=>{if(x.current&&p){var y=new Ae(x.current);b.current=y,p({textarea:x.current,commandOrchestrator:y})}},[]);var v=u?{}:{WebkitTextFillColor:"initial",overflow:"auto"};return i.jsx("div",{ref:C,className:r+"-area "+(t||""),onScroll:o,children:i.jsx("div",{className:r+"-text",style:{minHeight:m},children:s?A.cloneElement(s(L({},a,{value:c,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:r+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:p,onChange:a.onChange,shortcuts:ht,useContext:{commands:l,extraCommands:h,commandOrchestrator:b.current}}),{ref:x}):i.jsxs(f.Fragment,{children:[u&&i.jsx(To,{prefixCls:r}),i.jsx(ii,L({prefixCls:r},a,{style:v}))]})})})}function ci(e){var{prefixCls:n,groupName:r,commands:t,children:o}=e||{},{barPopup:s={}}=f.useContext(q);return f.useMemo(()=>i.jsx("div",{className:n+"-toolbar-child "+(r&&s[r]?"active":""),onClick:a=>a.stopPropagation(),children:Array.isArray(t)?i.jsx(Et,L({commands:t},e,{isChild:!0})):o}),[t,s,r,n])}function nt(e){var{prefixCls:n,overflow:r}=e,{fullscreen:t,preview:o,barPopup:s={},components:a,commandOrchestrator:c,dispatch:d}=f.useContext(q),l=f.useRef("");function m(u,h){if(d){var p={barPopup:L({},s)};u.keyCommand==="preview"&&(p.preview=u.value),u.keyCommand==="fullscreen"&&(p.fullscreen=!t),e.commands&&u.keyCommand==="group"?e.commands.forEach(x=>{h===x.groupName?p.barPopup[h]=!0:x.keyCommand&&(p.barPopup[x.groupName]=!1)}):(h||u.parent)&&Object.keys(p.barPopup||{}).forEach(x=>{p.barPopup[x]=!1}),Object.keys(p).length&&d(L({},p)),c&&c.executeCommand(u)}}return f.useEffect(()=>{document&&r&&(t?document.body.style.overflow="hidden":(l.current||(l.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=l.current))},[t,l,r]),i.jsx("ul",{children:(e.commands||[]).map((u,h)=>{if(u.keyCommand==="divider")return i.jsx("li",L({},u.liProps,{className:n+"-toolbar-divider"}),h);if(!u.keyCommand)return i.jsx(f.Fragment,{},h);var p=t&&u.keyCommand==="fullscreen"||u.keyCommand==="preview"&&o===u.value,x=u.children&&typeof u.children=="function"?u.children({getState:()=>c.getState(),textApi:c?c.textApi:void 0,close:()=>m({},u.groupName),execute:()=>m({execute:u.execute}),dispatch:d}):void 0,b=s&&o&&o==="preview"&&!/(preview|fullscreen)/.test(u.keyCommand),C=(a==null?void 0:a.toolbar)||u.render,v=C&&typeof C=="function"?C(u,!!b,m,h):null;return i.jsxs("li",L({},u.liProps,{className:p?"active":"",children:[v&&A.isValidElement(v)&&v,!v&&!u.buttonProps&&u.icon,!v&&u.buttonProps&&A.createElement("button",L({type:"button",key:h,disabled:b,"data-name":u.name},u.buttonProps,{onClick:y=>{y.stopPropagation(),m(u,u.groupName)}}),u.icon),u.children&&i.jsx(ci,{overflow:r,groupName:u.groupName,prefixCls:n,children:x,commands:Array.isArray(u.children)?u.children:void 0})]}),h)})})}function Et(e){e===void 0&&(e={});var{prefixCls:n,isChild:r,className:t}=e,{commands:o,extraCommands:s}=f.useContext(q);return i.jsxs("div",{className:n+"-toolbar "+t,children:[i.jsx(nt,L({},e,{commands:e.commands||o||[]})),!r&&i.jsx(nt,L({},e,{commands:s||[]}))]})}function rt(e){var{hideToolbar:n,toolbarBottom:r,placement:t,overflow:o,prefixCls:s}=e;if(n||t==="bottom"&&!r||t==="top"&&r)return null;var a=r?"bottom":"";return i.jsx(Et,{prefixCls:s,overflow:o,className:a})}var li=e=>{var{prefixCls:n,onChange:r}=e||{},t=f.useRef(null),o=f.useRef(),s=f.useRef(e.height);f.useEffect(()=>{s.current!==e.height&&(s.current=e.height)},[e.height]);function a(m){if(o.current){var u,h=m.clientY||((u=m.changedTouches[0])==null?void 0:u.clientY),p=o.current.height+h-o.current.dragY;p>=e.minHeight&&p<=e.maxHeight&&r&&r(o.current.height+(h-o.current.dragY))}}function c(){var m,u;o.current=void 0,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),(m=t.current)==null||m.removeEventListener("touchmove",a),(u=t.current)==null||u.removeEventListener("touchend",c)}function d(m){var u,h,p;m.preventDefault();var x=m.clientY||((u=m.changedTouches[0])==null?void 0:u.clientY);o.current={height:s.current,dragY:x},document.addEventListener("mousemove",a),document.addEventListener("mouseup",c),(h=t.current)==null||h.addEventListener("touchmove",a,{passive:!1}),(p=t.current)==null||p.addEventListener("touchend",c,{passive:!1})}f.useEffect(()=>{if(document){var m,u;(m=t.current)==null||m.addEventListener("touchstart",d,{passive:!1}),(u=t.current)==null||u.addEventListener("mousedown",d)}return()=>{if(document){var h;(h=t.current)==null||h.removeEventListener("touchstart",d),document.removeEventListener("mousemove",a)}}},[]);var l=f.useMemo(()=>i.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:i.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return i.jsx("div",{className:n+"-bar",ref:t,children:l})},di=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function ui(e){return e===void 0&&(e={}),Object.keys(e).forEach(n=>{e[n]=!1}),e}var mi=A.forwardRef((e,n)=>{var r=e||{},{prefixCls:t="w-md-editor",className:o,value:s,commands:a=ei(),commandsFilter:c,direction:d,extraCommands:l=ti(),height:m=200,enableScroll:u=!0,visibleDragbar:h=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:p=!0,preview:x="live",fullscreen:b=!1,overflow:C=!0,previewOptions:v={},textareaProps:y,maxHeight:R=1200,minHeight:w=100,autoFocus:N,tabSize:U=2,defaultTabEnable:P=!1,onChange:X,onStatistics:Me,onHeightChange:ue,hideToolbar:Re,toolbarBottom:Ie=!1,components:H,renderTextarea:Tt}=r,De=ce(r,di),Ue=a.map(j=>c?c(j,!1):j).filter(Boolean),Pe=l.map(j=>c?c(j,!0):j).filter(Boolean),[g,S]=f.useReducer(cr,{markdown:s,preview:x,components:H,height:m,minHeight:w,highlightEnable:p,tabSize:U,defaultTabEnable:P,scrollTop:0,scrollTopPreview:0,commands:Ue,extraCommands:Pe,fullscreen:b,barPopup:{}}),J=f.useRef(null),ee=f.useRef(null),Oe=f.useRef(u);f.useImperativeHandle(n,()=>L({},g,{container:J.current,dispatch:S})),f.useMemo(()=>Oe.current=u,[u]),f.useEffect(()=>{var j={};J.current&&(j.container=J.current||void 0),j.markdown=s||"",j.barPopup={},S&&S(L({},g,j))},[]);var Nt=[o,"wmde-markdown-var",d?t+"-"+d:null,t,g.preview?t+"-show-"+g.preview:null,g.fullscreen?t+"-fullscreen":null].filter(Boolean).join(" ").trim();f.useMemo(()=>s!==g.markdown&&S({markdown:s||""}),[s,g.markdown]),f.useMemo(()=>x!==g.preview&&S({preview:x}),[x]),f.useMemo(()=>U!==g.tabSize&&S({tabSize:U}),[U]),f.useMemo(()=>p!==g.highlightEnable&&S({highlightEnable:p}),[p]),f.useMemo(()=>N!==g.autoFocus&&S({autoFocus:N}),[N]),f.useMemo(()=>b!==g.fullscreen&&S({fullscreen:b}),[b]),f.useMemo(()=>m!==g.height&&S({height:m}),[m]),f.useMemo(()=>m!==g.height&&ue&&ue(g.height,m,g),[m,ue,g]),f.useMemo(()=>a!==g.commands&&S({commands:Ue}),[e.commands]),f.useMemo(()=>l!==g.extraCommands&&S({extraCommands:Pe}),[e.extraCommands]);var He=f.useRef(),_=f.useRef("preview"),_e=f.useRef(!1);f.useMemo(()=>{He.current=g.textareaWarp,g.textareaWarp&&(g.textareaWarp.addEventListener("mouseover",()=>{_.current="text"}),g.textareaWarp.addEventListener("mouseleave",()=>{_.current="preview"}))},[g.textareaWarp]);var Be=(j,pe)=>{if(Oe.current){var I=He.current,B=ee.current?ee.current:void 0;if(_e.current||(_.current=pe,_e.current=!0),I&&B){var Fe=(I.scrollHeight-I.offsetHeight)/(B.scrollHeight-B.offsetHeight);j.target===I&&_.current==="text"&&(B.scrollTop=I.scrollTop/Fe),j.target===B&&_.current==="preview"&&(I.scrollTop=B.scrollTop*Fe);var he=0;_.current==="text"?he=I.scrollTop||0:_.current==="preview"&&(he=B.scrollTop||0),S({scrollTop:he})}}},me=t+"-preview "+(v.className||""),ze=j=>Be(j,"preview"),Ve=f.useMemo(()=>i.jsx("div",{ref:ee,className:me,children:i.jsx(mt,L({},v,{onScroll:ze,source:g.markdown||""}))}),[me,v,g.markdown]),fe=(H==null?void 0:H.preview)&&(H==null?void 0:H.preview(g.markdown||"",g,S));fe&&A.isValidElement(fe)&&(Ve=i.jsx("div",{className:me,ref:ee,onScroll:ze,children:fe}));var At=L({},De.style,{height:g.height||"100%"}),Mt=()=>S({barPopup:L({},ui(g.barPopup))}),Rt=j=>S({height:j}),It=j=>{if(X&&X(j.target.value,j,g),y&&y.onChange&&y.onChange(j),g.textarea&&g.textarea instanceof HTMLTextAreaElement&&Me){var pe=new Ae(g.textarea),I=pe.getState()||{};Me(L({},I,{lineCount:j.target.value.split(`
`).length,length:j.target.value.length}))}};return i.jsx(q.Provider,{value:L({},g,{dispatch:S}),children:i.jsxs("div",L({ref:J,className:Nt},De,{onClick:Mt,style:At,children:[i.jsx(rt,{hideToolbar:Re,toolbarBottom:Ie,prefixCls:t,overflow:C,placement:"top"}),i.jsxs("div",{className:t+"-content",children:[/(edit|live)/.test(g.preview||"")&&i.jsx(ai,L({className:t+"-input",prefixCls:t,autoFocus:N},y,{onChange:It,renderTextarea:(H==null?void 0:H.textarea)||Tt,onScroll:j=>Be(j,"text")})),/(live|preview)/.test(g.preview||"")&&Ve]}),h&&!g.fullscreen&&i.jsx(li,{prefixCls:t,height:g.height,maxHeight:R,minHeight:w,onChange:Rt}),i.jsx(rt,{hideToolbar:Re,toolbarBottom:Ie,prefixCls:t,overflow:C,placement:"bottom"})]}))})}),St=mi;St.Markdown=mt;const fi=()=>{var u,h,p,x,b,C;const{id:e,mId:n,vId:r}=O(),{currentData:t,isLoading:o}=oe({id:+e,path:`Models/${n}/README.md`}),{currentData:s,isLoading:a}=oe({id:+e,path:`Models/${n}/${r}/README.md`}),{currentData:c,isLoading:d}=oe({id:+e,path:`Models/${n}/${r}/Files/README.md`}),l=c||s||t,m=d||a||o;return i.jsxs(G,{title:"Model card",actions:i.jsx(pi,{data:(u=l==null?void 0:l.preview)==null?void 0:u.content,dataForAllVersions:(h=s==null?void 0:s.preview)==null?void 0:h.content}),maxHeight:"400px",expandable:(p=l==null?void 0:l.preview)!=null&&p.content?((x=l==null?void 0:l.preview)==null?void 0:x.content.length)>400:!1,mb:(b=l==null?void 0:l.preview)!=null&&b.content&&((C=l==null?void 0:l.preview)==null?void 0:C.content.length)>400?"20px":"0px",children:[m&&i.jsx(Y,{}),l?i.jsx(zn,{content:l.preview.content||(s==null?void 0:s.preview.content)||"",...l}):i.jsx(ft,{mainText:"No README.md"})]})},pi=({data:e,dataForAllVersions:n})=>{const r=Bt(),{id:t,mId:o,vId:s}=O(),{project:a}=lt(),[c,d]=f.useState(void 0),l=!!c,m=f.useCallback(()=>d(void 0),[]),[u,h]=f.useState(""),[p,x]=f.useState(!1),[b]=Fn();f.useEffect(()=>{h(c==="all-versions"?n:e)},[e,n,c]);const C=f.useCallback(async()=>{const v=c==="all-versions"?`Models/${o}`:`Models/${o}/${s}/Files`,y=`${v}/README.md`;x(!0),(c==="all-versions"?n:e)!==void 0&&await b({id:+t,path:y});const w=new Blob([u??""],{type:""}),N=`/Projects/${a.projectName}/${v}`;await qn({file:w,uploadPath:N,options:{},projectId:t,name:"README.md"}),r($n.invalidateTags([{id:y,type:zt.ProjectTags.FileContent}])),x(!1),m()},[u,e,n,b,r,c,t,o,a,m,s]);return i.jsxs(i.Fragment,{children:[i.jsxs(Vt,{variant:"outline",spacing:"0.5",children:[i.jsx(ae,{onClick:()=>d("this-version"),children:e!==void 0?"Edit":"Create"}),i.jsx(Ft,{sx:{mt:"0px",height:"36px",span:{height:"100%"},":hover":{">button":{div:{bg:"primaryShade1"}}}},items:[{value:"Edit for all model versions",onClick:()=>d("all-versions")}],renderButton:({isOpen:v})=>i.jsx(ye,{icon:be.arrow_down,color:"white",height:"100%",alignItems:"center",sx:{bg:v?"primaryShade1":"primary"}})})]}),i.jsx(qt,{size:"7xl",hasCloseButton:!0,isOpen:l,onClose:m,title:"Create README.md",closeOnBackdropClick:!1,closeOnEsc:!1,footer:i.jsx(wn,{onClick:C,isLoading:p,children:"Save"}),children:i.jsx(St,{value:u,onChange:h,height:"calc(100vh - 200px)"})})]})},kt=({name:e,path:n,onClick:r,minHeight:t=200,sx:o,withoutText:s=!1,maxWidth:a=400})=>{const{id:c}=O(),{currentData:d,isLoading:l}=oe({id:+c,path:n}),m=En({fileName:e}),u=`data:image/${m};base64,${d==null?void 0:d.preview.content}`;return i.jsx($t,{onClick:r,sx:o,children:i.jsxs(Wt,{isLoaded:!l,minHeight:t,children:[m!=="svg"&&i.jsx(Zt,{src:u,m:"auto"}),m==="svg"&&i.jsx(Vn,{content:(d==null?void 0:d.preview.content)??"",sx:{svg:{maxWidth:a,maxHeight:a}}}),!s&&i.jsx(de,{m:"8px",children:e})]})})},hi=({content:e,isOpen:n,onClose:r})=>{const[t,o]=f.useState(e.find(({name:l})=>l===n)),s=e.findIndex(({name:l})=>l===(t==null?void 0:t.name)),a=f.useCallback(l=>()=>{let m=s+l;m<0&&(m=e.length-1),m>=e.length&&(m=0),o(e[m])},[e,s]),c=a(1),d=a(-1);return Kt({ArrowLeft:d,ArrowRight:c}),f.useEffect(()=>{o(e.find(({name:l})=>l===n))},[e,n]),i.jsxs(Gt,{isOpen:!!n,onClose:r,isCentered:!0,size:"8xl",children:[i.jsx(Qt,{}),i.jsxs(Yt,{height:"fit-content",children:[i.jsx(Xt,{mb:"10px",children:t==null?void 0:t.name}),i.jsx(Jt,{}),i.jsx(en,{p:"0",children:i.jsxs(tn,{gap:"10px",mb:"10px",justifyContent:"space-between",sx:{userSelect:"none"},children:[i.jsx(ye,{size:"xl",icon:be.arrow_left,sx:ot,color:"gray",onClick:d}),e.map(({name:l,path:m})=>{const u=e.findIndex(({name:p})=>p===l),h=()=>s===0?u===e.length-1?"left":"right":s===e.length-1?u===0?"right":"left":u>s?"right":"left";return i.jsx(nn,{in:l===(t==null?void 0:t.name),direction:h(),style:{position:l===(t==null?void 0:t.name)?"relative":"fixed",left:l===(t==null?void 0:t.name)?0:"-10000px",top:l===(t==null?void 0:t.name)?0:"-1000000px",opacity:l===(t==null?void 0:t.name)?1:0,transition:"opacity 1.8s ease"},children:i.jsx(kt,{name:l,path:m,withoutText:!0,sx:{opacity:(l===(t==null?void 0:t.name),1),transition:"all 1.5s ease"}})},l)}),i.jsx(ye,{size:"xl",icon:be.arrow_right,sx:ot,color:"gray",onClick:c})]})})]})]})},xi=f.memo(hi),ot={bg:"grayShade3",alignItems:"center",minWidth:"60px",justifyContent:"center",cursor:"pointer"},gi=5,vi=rn(2,8),Ci=()=>{const{id:e,mId:n,vId:r}=O(),[t,o]=f.useState(gi),[s,a]=f.useState(void 0),c=f.useCallback(()=>a(void 0),[]),{currentData:d,isLoading:l}=Wn({id:+e,path:`Models/${n}/${r}/Files/images`,skipError:!0},{refetchOnFocus:!0,selectFromResult:qe({currentData:qe({items:on(m=>Sn({fileName:m.attributes.name}))})})});return i.jsxs(G,{title:"Model evaluation images",actions:i.jsxs(M,{gap:"10px",alignItems:"center",children:[i.jsx(de,{children:"Max number of images"}),i.jsx(sn,{placeholder:"",options:vi.map(m=>({key:m,label:m.toString()})),value:t,onChange:m=>o(m.key),maxListHeight:"300px"})]}),contentProps:{sx:{bg:"grayShade3"}},children:[l&&i.jsx(Y,{}),i.jsx(an,{minChildWidth:`${1100/t}px`,spacing:"10px",children:cn((d==null?void 0:d.items)??[])?i.jsx(ft,{mainText:"No evaluation images"}):((d==null?void 0:d.items)??[]).map(m=>i.jsx(st,{sx:{border:"1px solid",borderColor:"grayShade2",borderRadius:"2px"},children:i.jsx(kt,{path:m.attributes.path,name:m.attributes.name,onClick:()=>{a(m.attributes.name)},sx:{cursor:"pointer"},maxWidth:1100/t})},m.attributes.id))}),i.jsx(xi,{isOpen:s,onClose:c,content:(d==null?void 0:d.items.map(m=>({name:m.attributes.name,path:m.attributes.path})))??[]})]})},yi=({children:e,...n})=>{const{id:r,mId:t,vId:o}=O(),s=je(),{currentData:{items:a}={items:[]}}=vn({projectId:r,modelName:t}),{currentData:c,isLoading:d}=ct({projectId:r,modelName:t,modelVersion:+o}),{isLoading:l,data:m}=at({projectId:r,model:t}),u=f.useMemo(()=>(a==null?void 0:a.map(p=>({id:Number(p.version),version:Number(p.version),deployments:((m==null?void 0:m.all)??[]).filter(x=>x.modelVersion===p.version).length})))??[],[m,a]),h=p=>{s(D.models.versionView,{vId:Number.parseInt(p,10),mId:(c==null?void 0:c.name)||""})};return d||l||!c?i.jsx(Y,{}):i.jsx(Zn,{type:it.modelVersion,data:c,title:c.name,version:c.version,versions:u,onVersionChange:h,idColor:"labels.blueShade1",...n,children:e})},ds=()=>{var y,R;const{id:e,mId:n,vId:r}=O(),t=je(),{handleDelete:o}=f.useContext(ln),[s,a]=dn(!1),{isObserver:c}=Ln(),{currentData:d,isLoading:l}=ct({projectId:e,modelName:n,modelVersion:+r}),{isLoading:m,data:u}=at({projectId:e,model:n}),h=f.useMemo(()=>((u==null?void 0:u.all)??[]).filter(w=>w.modelVersion===+r).sort(jn),[u==null?void 0:u.all,r]),p=(w,N)=>()=>{t(D.deployments.overview,{dId:N,mId:w})},x=()=>{t(D.models.overview,{mId:n})},[b,{isLoading:C}]=Cn(),v=async()=>{try{const w=`${n}_${r}`;await b({projectId:e,mlId:w}).unwrap(),o(fn(D.models.versionView,D.project.value,{id:e,mId:n,vId:r})),t(D.models.list)}catch(w){console.error(w)}};return l||m||!d?i.jsx(Y,{}):i.jsxs(i.Fragment,{children:[i.jsx(un,{title:`Delete ${n} v${r}`,secondaryText:"Once you delete a model, there is no going back. Please be certain.",isOpen:s,onClose:a,mainButtonProps:{children:"Delete",onClick:v,isLoading:C,"data-test":"delete-model"},secondaryButtonProps:{children:"Back",onClick:a}}),i.jsx(yi,{showDelete:!c,onClickDelete:a,children:i.jsx(ae,{intent:"secondary",onClick:x,ml:"10px",children:i.jsx($e,{bold:!0,children:"all versions ->"})})}),i.jsx(st,{mt:"10px",width:"100%",children:i.jsx(ir,{data:d})}),i.jsxs(M,{mt:"20px",width:"100%",flexWrap:"wrap",sx:{gap:"8px"},children:[i.jsx(F,{sx:{flex:"1 1 100%"},children:d.description?i.jsx(de,{my:"20px",children:(d==null?void 0:d.description)||"-"}):i.jsx($e,{my:"20px",gray:!0,children:"-"})}),i.jsx(F,{sx:{flex:"1 1 100%"},children:h.length>0?i.jsxs(F,{children:["This version is used in ",i.jsx(F,{primary:!0,display:"inline",children:h.length}),xn(" deployment",h.length)]}):"This version is not used in any deployments"}),i.jsx(M,{sx:{gap:"6px"},children:h.map(w=>i.jsx(mn,{height:"31px",isActive:w.status===We.RUNNING,indicator:"horizontal",mode:w.status===We.RUNNING?"highlight":"default",onClick:p(d.name,w.id),children:`${w.name} ->`},w.id))})]}),i.jsx(M,{flexDirection:"column",sx:{gap:"20px"},py:"20px",children:i.jsxs(pn,{children:[i.jsx(z,{name:"modelMetrics",children:i.jsx(V,{children:i.jsx(G,{title:"Model metrics",maxHeight:"400px",children:i.jsx(ar,{metrics:d.metrics})})})}),i.jsx(z,{name:"modelEvaluation",children:i.jsx(V,{children:i.jsx(Ci,{})})}),i.jsx(z,{name:"modelCard",children:i.jsx(V,{children:i.jsx(fi,{})})}),i.jsx(z,{name:"modelSchema",children:i.jsx(V,{children:i.jsx(G,{title:"Model schema",contentProps:Ge,children:i.jsx(hn,{schema:(R=(y=d.modelSchema)==null?void 0:y.preview)==null?void 0:R.content})})})}),i.jsx(z,{name:D.overviewAnchors.provenance,children:i.jsx(V,{title:"Provenance",children:i.jsx(bn,{projectId:+e,artifact:d})})}),i.jsx(z,{name:"modelTags",children:i.jsx(V,{children:i.jsx(nr,{})})}),i.jsx(z,{name:"codeSnippets",children:i.jsx(V,{children:i.jsx(G,{title:"Code snippets",contentProps:Ge,children:i.jsx(tr,{model:d})})})})]})})]})};export{ds as default};
