import{j as e,r as t}from"./vendor-react-Dp9pL_Wn.js";import{u as s}from"./vendor-intl-BDR1NhN_.js";import{BT as n,BY as i,cX as o,C3 as a,o$ as r,Is as l,bX as c}from"./c4b350ac1-KLFM4jkb.js";import{b9 as m,aD as d,aE as p,aF as u,aG as g}from"./c40b9b8f5-CcFpJKg-.js";import{I as f}from"./vendor-ant-cds-DvTmcYA1.js";const b=e.jsx(f,{name:"Scroll"}),h=e.jsx(f,{name:"Plugin"}),x=/(^|\s)(\/[\w:.-]+)/g;function y(e){return{type:"doc",content:e.split("\n").map(e=>{if(!e)return{type:"paragraph"};const t=[];let s,n=0;for(x.lastIndex=0;null!==(s=x.exec(e));){const i=s[1],o=s[2],a=e.slice(n,s.index)+i;a&&t.push({type:"text",text:a});const r=o.slice(1);t.push({type:"skillChip",attrs:{skillId:r,skillDisplayName:r,skillDescription:"",skillArgumentHint:""}}),n=s.index+s[0].length}const i=e.slice(n);return i&&t.push({type:"text",text:i}),{type:"paragraph",content:t}})}}function k({prompt:s}){const i=n(),o=s.split(x);return e.jsx(e.Fragment,{children:o.map((s,n)=>{if(n%3!=2)return e.jsx(t.Fragment,{children:s},n);const o=s.slice(1),a=i.get(o);return a?e.jsx(m,{id:o,info:a},n):e.jsx(t.Fragment,{children:s},n)})})}function j({clientRect:n,editor:m,range:f,onClose:x,query:y}){const k=s(),{items:j}=i(),{data:v}=o(),w=t.useRef(f);w.current=f;const C=t.useCallback(e=>"skill"!==e.type?e:{...e,onAction:()=>{const t=w.current;m.chain().focus().deleteRange(t).insertContent(a(e.skillId,e.label??e.skillId,e.skillDescription??"",e.argumentHint??"")).run(),x()}},[m,x]),A=t.useMemo(()=>j.map(C),[j,C]),F=t.useCallback((e,t,s,n)=>{const i=w.current;m.chain().focus().deleteRange(i).insertContent(a(e,t,s,n??"")).run(),x()},[m,x]),_=t.useMemo(()=>v.filter(e=>e.enabled&&e.skills.some(r)).map(e=>({type:"submenu",label:c(e),items:l(e,F),submenuClassName:"!max-h-[288px]"})),[v,F]),$=t.useMemo(()=>{const e=[];return _.length>0&&e.push({type:"submenu",icon:h,label:k.formatMessage({defaultMessage:"Plugins",id:"QJAllUAc2k"}),items:_}),A.length>0&&e.push({type:"submenu",icon:b,label:k.formatMessage({defaultMessage:"Skills",id:"EJSVsOA19u"}),items:A}),e},[k,_,A]),M=t.useMemo(()=>d($,y),[$,y]),E=M.length>0;return t.useEffect(()=>{const e=m.storage["slash-command-suggestion"];e&&(e.hasVisibleItems=E)},[m,E]),t.useEffect(()=>{m.view.dom.focus()},[m]),E?e.jsxs(e.Fragment,{children:[e.jsx(p,{editor:m,query:y}),e.jsx(u,{items:M,onClose:x,resetKey:y,children:e.jsx(g,{clientRect:n,maxHeightCap:384})})]}):null}
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/var v={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}};const w=Object.freeze(Object.defineProperty({__proto__:null,conf:v,language:{defaultToken:"",tokenPostfix:".kt",keywords:["as","as?","break","class","continue","do","else","false","for","fun","if","in","!in","interface","is","!is","null","object","package","return","super","this","throw","true","try","typealias","val","var","when","while","by","catch","constructor","delegate","dynamic","field","file","finally","get","import","init","param","property","receiver","set","setparam","where","actual","abstract","annotation","companion","const","crossinline","data","enum","expect","external","final","infix","inline","inner","internal","lateinit","noinline","open","operator","out","override","private","protected","public","reified","sealed","suspend","tailrec","vararg","field","it"],operators:["+","-","*","/","%","=","+=","-=","*=","/=","%=","++","--","&&","||","!","==","!=","===","!==",">","<","<=",">=","[","]","!!","?.","?:","::","..",":","?","->","@",";","$","_"],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,tokenizer:{root:[[/[A-Z][\w\$]*/,"type.identifier"],[/[a-zA-Z_$][\w$]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/@\s*[a-zA-Z_\$][\w\$]*/,"annotation"],[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,"number.float"],[/0[xX](@hexdigits)[Ll]?/,"number.hex"],[/0(@octaldigits)[Ll]?/,"number.octal"],[/0[bB](@binarydigits)[Ll]?/,"number.binary"],[/(@digits)[fFdD]/,"number.float"],[/(@digits)[lL]?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"""/,"string","@multistring"],[/"/,"string","@string"],[/'[^\\']'/,"string"],[/(')(@escapes)(')/,["string","string.escape","string"]],[/'/,"string.invalid"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@javadoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment","@comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],javadoc:[[/[^\/*]+/,"comment.doc"],[/\/\*/,"comment.doc","@push"],[/\/\*/,"comment.doc.invalid"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],string:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],multistring:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"""/,"string","@pop"],[/./,"string"]]}}},Symbol.toStringTag,{value:"Module"}));export{j as C,k as R,w as k,y as p};
