PageSourceSearch

https://statics.kimi.ai/kimi-web-seo/assets/kimi.editor-OfKJcZBB.js

js kimi.ai collected 2026-09-24 15:17:41 UTC 36,890 bytes, 3 lines download raw bytes

1/*! pre,oversea,71bf6a18,2026-09-24 09:50:50 */
2import{$r as computed,Ei as openBlock,Fi as useModel,Hi as withDirectives,Pr as watchPausable,Qn as useElementSize,Si as onMounted,Vi as withCtx,Xi as ref,Xr as Teleport,Zi as shallowRef,_i as nextTick,aa as normalizeStyle,an as _defineProperty,ei as createBaseVNode,er as useEventListener,fi as h,hi as mergeModels,ii as createSlots,ki as renderSlot,li as defineComponent,mr as useResizeObserver,n as vOnClickOutside,na as unref,ni as createCommentVNode,oa as toDisplayString,oi as createTextVNode,ra as normalizeClass,ri as createElementBlock,si as createVNode,ti as createBlock,yi as onBeforeUnmount,zi as watch}from"./framework-C0rYP0vN.js";import{At as useEnv}from"./kimi.utils-xGYnNOJo.js";import{$t as M,Gt as LexicalContentEditable_default,Jt as LexicalRichTextPlugin_default,Kt as LexicalHistoryPlugin_default,Qt as Ei,Ut as LexicalAutoFocusPlugin_default,Wt as LexicalComposer_default,Xt as Ai,Yt as useLexicalComposer,Zt as C,an as c,cn as gi,dn as ti,en as Mr,fn as xe,in as as,ln as i,nn as _,on as di,pn as z,qt as LexicalOnChangePlugin_default,rn as an,sn as fs,tn as Ts,un as ke}from"./vendor-BsFLkdmc.js";import{n as Theme}from"./theme_pb-1Ec_3TGP.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-gMEZ1Fsr.js";import{t as CSROnly_default}from"./CSROnly-Dfzkfnby.js";var REF_TYPE_FILE="file",REF_TYPE_IM_MENTION="im_mention",REF_TYPE_SKILL="skill",REF_TYPE_PLUGIN="plugin",REF_TYPE_EXTENSION="extension",REF_TYPE_AT_MEMBER="at_member";function wireEncode(refType,payload,delim){return`${refType}${delim}${payload}`}function getDelim(refType){return"im_mention"===refType?"":"file"===refType?"":"extension"===refType||"skill"===refType?"":""}var FILE_TAG_PATTERN=/\uE3A0([^\uE3A0-\uE3A8]+)[\uE3A1\uE3A4]([^\uE3A0-\uE3A8]+)\uE3A8/g,REF_TAG_PATTERN=/\uE3A0([^\uE3A0-\uE3A8]+)[\uE3A1\uE3A2\uE3A4]([^\uE3A0-\uE3A8]+)\uE3A8/g,MENTION_TEXT_PATTERN=/<@([^|<>]{1,50})\|([^<>]{1,50})>/g;function buildExtensionTag(sandboxPath,type){return wireEncode("extension","skill"===type?`skill://${sandboxPath}`:`plugin://${sandboxPath}`,"")}function buildSkillMetaEntry(skill){var _skill$id;return{matchedText:buildExtensionTag(skill.sandboxPath,"skill"),meta:{kind:"skill",skill:{id:null!==(_skill$id=skill.id)&&void 0!==_skill$id?_skill$id:"",name:skill.name,displayName:skill.displayName||skill.name,iconUrlLight:skill.iconUrlLight,iconUrlDark:skill.iconUrlDark}}}}function getSkillIconUrls(skill){var _skill$avatarUrl$vari,_skill$avatarUrl,_variants$find,_variants$find2;const variants=null!==(_skill$avatarUrl$vari=null===(_skill$avatarUrl=skill.avatarUrl)||void 0===_skill$avatarUrl?void 0:_skill$avatarUrl.variants)&&void 0!==_skill$avatarUrl$vari?_skill$avatarUrl$vari:[];return{iconUrlLight:(null===(_variants$find=variants.find(variant=>variant.theme===Theme.LIGHT))||void 0===_variants$find?void 0:_variants$find.assetUri)||void 0,iconUrlDark:(null===(_variants$find2=variants.find(variant=>variant.theme===Theme.DARK))||void 0===_variants$find2?void 0:_variants$find2.assetUri)||void 0}}function buildPluginMetaEntry(plugin){return{matchedText:buildExtensionTag(plugin.sandboxPath,"plugin"),meta:{kind:"plugin",plugin:{id:plugin.id,displayName:plugin.displayName,iconUrl:plugin.iconUrl,colorLight:plugin.colorLight,colorDark:plugin.colorDark}}}}var RefNode=class RefNode extends fs{static getType(){return"ref"}static clone(node){return new RefNode(node.__refType,node.__refPayload,node.__delim,node.__refMeta,node.__key)}constructor(refType,refPayload,delim,refMeta,key){super(key),_defineProperty(this,"__refType",void 0),_defineProperty(this,"__refPayload",void 0),_defineProperty(this,"__delim",void 0),_defineProperty(this,"__refMeta",void 0),this.__refType=refType,this.__refPayload=refPayload,this.__delim=delim,this.__refMeta=refMeta}createDOM(_config){const span=document.createElement("span");return span.setAttribute("id",this.getMountId()),span.setAttribute("class",`editor-mention-ref-node editor-mention-ref-node--${this.__refType}`),span}updateDOM(){return!1}exportDOM(){const element=document.createElement("span");return element.setAttribute("data-ref-type",this.__refType),element.setAttribute("data-ref-payload",this.__refPayload),element.textContent=this.getTextContent(),{element:element}}static importJSON(serializedNode){return $createRefNode(serializedNode.refType,serializedNode.refPayload,serializedNode.delim,serializedNode.refMeta)}exportJSON(){return{type:"ref",version:1,refType:this.__refType,refPayload:this.__refPayload,delim:this.__delim,refMeta:this.__refMeta}}getTextContent(){return"extension"===this.__refType?wireEncode("extension",this.__refPayload,this.__delim):"skill"===this.__refType?`/${this.__refPayload}`:"at_member"===this.__refType?`<@${this.__refPayload}>`:wireEncode(this.__refType,this.__refPayload,this.__delim)}isInline(){return!0}isKeyboardSelectable(){return!1}getRefType(){return this.__refType}getRefPayload(){return this.__refPayload}getRefMeta(){return this.getLatest().__refMeta}
2getMountId(){return`editor-ref-node-${this.getKey()}`}decorate(_editor,_config){return h("span",{style:"display: none;"})}};function $createRefNode(refType,refPayload,delim,refMeta){return an(new RefNode(refType,refPayload,delim,refMeta))}function $isRefNode(node){return node instanceof RefNode}function $collectRefMetaEntries(nodes){const entries=[];for(const node of nodes)if($isRefNode(node)&&"extension"===node.getRefType()){const meta=node.getRefMeta();meta&&entries.push({matchedText:node.getTextContent(),meta:meta})}return entries}function $parseTextWithRefTags(text,metaMap){const matches=[];for(const match of text.matchAll(REF_TAG_PATTERN)){var _match$index,_match$,_match$2;matches.push({index:null!==(_match$index=match.index)&&void 0!==_match$index?_match$index:0,length:match[0].length,refType:null!==(_match$=match[1])&&void 0!==_match$?_match$:"",payload:null!==(_match$2=match[2])&&void 0!==_match$2?_match$2:"",fullMatch:match[0]})}for(const match of text.matchAll(MENTION_TEXT_PATTERN)){var _match$index2,_match$3,_match$4;matches.push({index:null!==(_match$index2=match.index)&&void 0!==_match$index2?_match$index2:0,length:match[0].length,refType:"at_member",payload:`${null!==(_match$3=match[1])&&void 0!==_match$3?_match$3:""}|${null!==(_match$4=match[2])&&void 0!==_match$4?_match$4:""}`,fullMatch:match[0]})}matches.sort((a,b)=>a.index-b.index);const nodes=[];let lastIndex=0;for(const m of matches)m.index<lastIndex||(m.index>lastIndex&&nodes.push(ti(text.slice(lastIndex,m.index))),nodes.push($createRefNode(m.refType,m.payload,getDelim(m.refType),"extension"===m.refType?null==metaMap?void 0:metaMap.get(m.fullMatch):void 0)),lastIndex=m.index+m.length);return lastIndex<text.length&&nodes.push(ti(text.slice(lastIndex))),nodes}var llmUrlPattern=/<url id="([a-z0-9]+)?" type="url" status="([^<>'"]+)?" title="([^<>'"]+)?" wc="([^<>'"]+)?">([^<>'"]+?)<\/url>/g,commonSplit=new Set(' [.,,!;"?()[]{}()【】「」。;!“”‘’?]'.split("")),promptSplit=new Set("[.,,!;\"'?()[]{}()【】「」。;!“”‘’?]".split("")),mentionTrigger=new Set("@"),slashTrigger=new Set(["/","、"]);function getMatchAndRange(splitSet,{emptySplit:emptySplit,include:include}={emptySplit:!1,include:!1}){const selection=Ei();if(!di(selection))return{wordMatch:void 0,textNode:void 0,rangeStart:void 0,rangeEnd:void 0};const nodes=selection.getNodes().filter(node=>"text"===node.getType()),{anchor:anchor}=selection,{offset:offset}=anchor;if(nodes.length<1)return{wordMatch:void 0,textNode:void 0,rangeStart:void 0,rangeEnd:void 0};const textNode=nodes[nodes.length-1];let startPosition=0;const content=textNode.getTextContent();for(let i=0;i<offset;i++){const char=content[i];char&&commonSplit.has(char)&&(startPosition=i)}const textBeforeCursor=content.slice(startPosition,offset);let flag="",length=0;for(let len=textBeforeCursor.length;len--;){const char=textBeforeCursor[len];if(char&&splitSet.has(char)){flag=char,length=len;break}}if(""!==flag||emptySplit){include||""===flag||length++;const rangeStart=startPosition+length,rangeEnd=offset;return{wordMatch:textBeforeCursor.slice(length,offset),textNode:textNode,rangeStart:rangeStart,rangeEnd:rangeEnd}}return{wordMatch:void 0,textNode:void 0,rangeStart:void 0,rangeEnd:void 0}}function extractRefs(str){const refs=[...str.matchAll(FILE_TAG_PATTERN)].map(match=>{var _match$,_match$2,_match$index;return{refType:null!==(_match$=match[1])&&void 0!==_match$?_match$:"",payload:null!==(_match$2=match[2])&&void 0!==_match$2?_match$2:"",index:null!==(_match$index=match.index)&&void 0!==_match$index?_match$index:0,fullMatch:match[0]}});for(const match of str.matchAll(MENTION_TEXT_PATTERN)){var _match$3,_match$4,_match$index2;refs.push({refType:"at_member",payload:`${null!==(_match$3=match[1])&&void 0!==_match$3?_match$3:""}|${null!==(_match$4=match[2])&&void 0!==_match$4?_match$4:""}`,index:null!==(_match$index2=match.index)&&void 0!==_match$index2?_match$index2:0,fullMatch:match[0]})}return refs.sort((a,b)=>a.index-b.index),refs}function formatFileTagsForClipboard(text){return text.replace(FILE_TAG_PATTERN,(_match,refType,payload)=>function(refType,payload){if("file"===refType)return`@{${payload}}`;if("im_mention"===refType)return`@{${payload}}`;if("at_member"===refType){const sep=payload.indexOf("|");return`@{${sep>=0?payload.slice(sep+1):payload}}`}return"skill"===refType||"plugin"===refType||"extension"===refType?`/${payload}`:`@${payload}`}(refType,payload))}var Commands_default=defineComponent({__name:"Commands",emits:["confirm","keydown"],setup(__props,{emit:__emit}
2){function writeToClipboard(event,plain,metaJson){if(event&&"clipboardData"in event&&null!=event.clipboardData)return event.clipboardData.setData("text/plain",plain),metaJson&&event.clipboardData.setData("application/x-kimi-editor-meta",metaJson),void event.preventDefault();event&&event.preventDefault(),navigator.clipboard.writeText(plain).catch(()=>{})}const{isSafari:isSafari}=useEnv(),editor=useLexicalComposer(),emit=__emit;return onMounted(()=>{const copyUnSub=editor.registerCommand(M,event=>{let plain="",metaJson="",handled=!1;return editor.getEditorState().read(()=>{const selection=Ei();if(null===selection)return;const raw=selection.getTextContent();if(!raw)return;plain=formatFileTagsForClipboard(raw);const entries=$collectRefMetaEntries(selection.getNodes());entries.length&&(metaJson=JSON.stringify(entries)),handled=!0}),!!handled&&(writeToClipboard(event,plain,metaJson),!0)},3),cutUnSub=editor.registerCommand(z,event=>{let plain="",metaJson="",handled=!1;return editor.getEditorState().read(()=>{const selection=Ei();if(null===selection)return;if(!di(selection)&&!gi(selection))return;const raw=selection.getTextContent();if(!raw)return;plain=formatFileTagsForClipboard(raw);const entries=$collectRefMetaEntries(selection.getNodes());entries.length&&(metaJson=JSON.stringify(entries)),handled=!0}),!!handled&&(writeToClipboard(event,plain,metaJson),editor.update(()=>{const sel=Ei();if(di(sel))sel.removeText();else if(gi(sel))for(const node of sel.getNodes())node.remove()}),!0)},3),pasteUnSub=editor.registerCommand(c,event=>{var _event$clipboardData,_event$clipboardData2;"clipboardData"in event&&Ai($parseTextWithRefTags((null===(_event$clipboardData=event.clipboardData)||void 0===_event$clipboardData?void 0:_event$clipboardData.getData("text/plain"))||"",function(json){if(json)try{const entries=JSON.parse(json);if(!Array.isArray(entries)||0===entries.length)return;const valid=entries.filter(entry=>Boolean(null==entry?void 0:entry.matchedText)&&Boolean(null==entry?void 0:entry.meta));if(0===valid.length)return;return new Map(valid.map(entry=>[entry.matchedText,entry.meta]))}catch{return}}(null===(_event$clipboardData2=event.clipboardData)||void 0===_event$clipboardData2?void 0:_event$clipboardData2.getData("application/x-kimi-editor-meta"))));return event.preventDefault(),!0},1),keydownUnSub=editor.registerCommand(_,event=>(emit("keydown",event),event.defaultPrevented),1),enterUnSub=editor.registerCommand(C,(event,editor)=>{if(!event||editor.isComposing())return!1;const{shiftKey:shiftKey,metaKey:metaKey,altKey:altKey,ctrlKey:ctrlKey}=event,root=ke();if(shiftKey||altKey||ctrlKey)return!1;if(metaKey&&isSafari){const node=root.getLastChild();return node.append(Mr()),node.select(),!0}return!metaKey&&(emit("confirm"),event.preventDefault(),event.stopPropagation(),!0)},1);onBeforeUnmount(()=>{copyUnSub(),cutUnSub(),pasteUnSub(),keydownUnSub(),enterUnSub()})}),(_ctx,_cache)=>null}}),usePalemoonAdaptor=()=>{const{isPalemoon:isPalemoon}=useEnv();return{isPalemoon:isPalemoon,initAdaptPalemoon:isPalemoon?function(){if(isPalemoon){const root=ke();if(null===root.getFirstChild()){const paragraphNode=Ts();paragraphNode.append(ti("​")),root.append(paragraphNode)}}}:void 0,enterAdaptPalemoon:function(editor){isPalemoon&&editor.registerCommand(C,()=>(editor.update(()=>{const selection=Ei(),textNode=ti("​");selection&&selection.insertNodes([textNode])}),!1),1)},deleteCharAdaptPalemoon:function(editor){isPalemoon&&editor.registerCommand(i,()=>{const selection=Ei();if(!di(selection))return!1;const anchorNode=selection.anchor.getNode(),selectedText=selection.getTextContent();if(!selectedText&&"​"===(null==anchorNode?void 0:anchorNode.getTextContent())){const prevChild=anchorNode.getPreviousSibling();return null==prevChild||prevChild.remove(),!0}if(null==selectedText?void 0:selectedText.startsWith("​")){const focusNode=selection.focus.getNode(),isBefore=anchorNode.isBefore(focusNode);let firstPoint=null;firstPoint=focusNode===anchorNode?selection.anchor.offset<selection.focus.offset?selection.anchor:selection.focus:isBefore?selection.anchor:selection.focus,firstPoint.set(firstPoint.key,firstPoint.offset+1,firstPoint.type)}return!1},1)}}},InstancesUtils_default=defineComponent({__name:"InstancesUtils",props:{lastAction:{},lastActionModifiers:{}},emits:["update:lastAction"],setup(__props,{expose:__expose}){const model=useModel(__props,"lastAction"),editor=useLexicalComposer(),{isPalemoon:isPalemoon}=usePalemoonAdaptor();function appendNodesToEnd(nodes){const lastDescendant=ke().getLastDescendant();if(!lastDescendant)return;const type=lastDescendant.getType();if("text"===type||"linebreak"===type){let current=lastDescendant;
2for(const node of nodes)current.insertAfter(node),current=node}else lastDescendant.append(...nodes)}function insertAtTheEnd(text){const textNode=ti(text);appendNodesToEnd([textNode]),textNode.selectEnd()}function replaceAndInsert(textNode,rangeStart,rangeEnd,replaceString){const content=textNode.getTextContent(),beforeContent=content.slice(0,rangeStart),afterContent=content.slice(rangeEnd),beforeNode=ti(beforeContent),afterNode=ti(afterContent);if(textNode.insertBefore(beforeNode),textNode.insertAfter(afterNode),replaceString){const replaceNode=ti(replaceString);textNode.insertAfter(replaceNode)}textNode.remove(),afterNode.selectStart()}function selectAfterLastNode(nodes){const lastNode=nodes[nodes.length-1];if(lastNode)if($isRefNode(lastNode)){const trailingNode=ti("");lastNode.insertAfter(trailingNode),trailingNode.selectStart()}else lastNode.selectEnd()}function setContentWithRefTags(text,metaMap){editor.update(()=>{if(!text)return;const nodes=$parseTextWithRefTags(text,metaMap);0!==nodes.length?(appendNodesToEnd(nodes),selectAfterLastNode(nodes)):insertAtTheEnd(text)})}return __expose({focus:function(){var _editor$getRootElemen;null===(_editor$getRootElemen=editor.getRootElement())||void 0===_editor$getRootElemen||_editor$getRootElemen.focus({preventScroll:!0})},blur:function(){var _editor$getRootElemen2;null===(_editor$getRootElemen2=editor.getRootElement())||void 0===_editor$getRootElemen2||_editor$getRootElemen2.blur()},insertText:function(text){editor.update(()=>{const selection=Ei();di(selection)?selection.insertText(text):insertAtTheEnd(text)})},insertTextWithRefTags:function(text,metaMap){editor.update(()=>{model.value&&"insertPrompt"!==model.value&&(model.value="insertPrompt");const nodes=$parseTextWithRefTags(text,metaMap),selection=Ei();if(di(selection))return selection.insertNodes(nodes),void selectAfterLastNode(nodes);appendNodesToEnd(nodes),selectAfterLastNode(nodes)},{discrete:!0})},insertRefTag:function(refType,refPayload){editor.update(()=>{model.value&&"insertPrompt"!==model.value&&(model.value="insertPrompt");const{wordMatch:wordMatch,textNode:textNode,rangeStart:rangeStart,rangeEnd:rangeEnd}=getMatchAndRange(mentionTrigger,{include:!0});if(textNode&&wordMatch&&void 0!==rangeStart&&void 0!==rangeEnd)return void function(textNode,rangeStart,rangeEnd,refType,refPayload){const content=textNode.getTextContent(),beforeContent=content.slice(0,rangeStart),afterContent=content.slice(rangeEnd),beforeNode=ti(beforeContent),refTagNode=$createRefNode(refType,refPayload,getDelim(refType)),afterNode=ti(afterContent);textNode.insertBefore(beforeNode),textNode.insertAfter(afterNode),textNode.insertAfter(refTagNode),textNode.remove(),afterNode.selectStart()}(textNode,rangeStart,rangeEnd,refType,refPayload);const selection=Ei(),refTagNode=$createRefNode(refType,refPayload,getDelim(refType));di(selection)?(selection.insertNodes([refTagNode]),refTagNode.selectEnd()):(Ai([refTagNode]),refTagNode.selectEnd())})},setContentWithRefTags:setContentWithRefTags,setContentWithFileTags:setContentWithRefTags,insertFavoritePrompt:function(text){editor.update(()=>{model.value&&"insertPrompt"!==model.value&&(model.value="insertPrompt");const{wordMatch:wordMatch,textNode:textNode,rangeStart:rangeStart,rangeEnd:rangeEnd}=getMatchAndRange(promptSplit,{emptySplit:!0});void 0!==wordMatch&&""!==wordMatch&&void 0!==textNode&&void 0!==rangeStart&&void 0!==rangeEnd?replaceAndInsert(textNode,rangeStart,rangeEnd,text):insertAtTheEnd(text)})},clearMentionContent:function(){editor.update(()=>{const{wordMatch:wordMatch,textNode:textNode,rangeStart:rangeStart,rangeEnd:rangeEnd}=getMatchAndRange(mentionTrigger,{include:!0});textNode&&wordMatch&&void 0!==rangeStart&&void 0!==rangeEnd&&replaceAndInsert(textNode,rangeStart,rangeEnd)})},clearSlashContent:function(){editor.update(()=>{const{wordMatch:wordMatch,textNode:textNode,rangeStart:rangeStart,rangeEnd:rangeEnd}=getMatchAndRange(slashTrigger,{include:!0});textNode&&wordMatch&&void 0!==rangeStart&&void 0!==rangeEnd&&replaceAndInsert(textNode,rangeStart,rangeEnd)})},clear:function(){editor.update(()=>{const root=ke();root.clear();const paragraphNode=Ts();if(isPalemoon){const textNode=ti("​");paragraphNode.append(textNode)}root.append(paragraphNode)})},getContent:function(){return editor.getEditorState().read(()=>ke().getTextContent())},isCaretAtStart:function(){return editor.getEditorState().read(()=>{var _node$getParent;const selection=Ei();if(!di(selection)||!selection.isCollapsed())return!1;const firstChild=ke().getFirstChild();if(!firstChild)return!0;const anchor=selection.anchor;if(0!==anchor.offset)return!1;if("element"===anchor.type)return anchor.getNode().getKey()===firstChild.getKey();const node=anchor.getNode();return null===node.getPreviousSibling()&&(null===(_node$getParent=node.getParent())||void 0===_node$getParent?void 0:_node$getParent.getKey())===firstChild.getKey()})},getRefNodeMounts:function(){return editor.getEditorState().read(()=>{const mounts=[],queue=[...ke().getChildren()];for(;queue.length;){const node=queue.shift();node&&($isRefNode(node)&&mounts.push({refType:node.getRefType(),refPayload:node.getRefPayload(),matchedText:node.getTextContent(),nodeKey:node.getKey(),mountId:node.getMountId(),meta:node.getRefMeta()}
2),as(node)&&queue.push(...node.getChildren()))}return mounts})},removeRefNodeByKey:function(nodeKey){editor.update(()=>{const node=xe(nodeKey);$isRefNode(node)&&node.remove()})}}),(_ctx,_cache)=>null}}),PalemoonAdaptor_default=defineComponent({__name:"PalemoonAdaptor",setup(__props){const editor=useLexicalComposer(),{enterAdaptPalemoon:enterAdaptPalemoon,deleteCharAdaptPalemoon:deleteCharAdaptPalemoon}=usePalemoonAdaptor();return onMounted(()=>{enterAdaptPalemoon(editor),deleteCharAdaptPalemoon(editor)}),(_ctx,_cache)=>null}}),_hoisted_1={class:"chat-input"},_hoisted_2={class:"chat-input-prepend"},_hoisted_3={class:"chat-input-placeholder"},Editor_default=_plugin_vue_export_helper_default(defineComponent({__name:"Editor",props:mergeModels({autoFocus:{type:Boolean,default:!0},placeholder:{},sidebarShortcutScope:{type:Boolean}},{modelValue:{},modelModifiers:{},refMetas:{default:()=>[]},refMetasModifiers:{}}),emits:mergeModels(["action","confirm","keydown"],["update:modelValue","update:refMetas"]),setup(__props,{expose:__expose,emit:__emit}){const model=useModel(__props,"modelValue"),refMetas=useModel(__props,"refMetas"),emit=__emit,{initAdaptPalemoon:initAdaptPalemoon}=usePalemoonAdaptor(),config={namespace:"MyEditor",editorState:initAdaptPalemoon,nodes:[RefNode],theme:{},onError(error){console.error("Editor Error: ",error)}},editorUtils=shallowRef(),inlinePrependRef=shallowRef(),{width:inlinePrependWidth}=useElementSize(inlinePrependRef),refNodeMounts=shallowRef([]),refMetaMap=computed(()=>new Map(refMetas.value.map(entry=>[entry.matchedText,entry.meta]))),editorContainerStyle=computed(()=>({"--chat-input-inline-prepend-width":inlinePrependWidth.value?`${inlinePrependWidth.value}px`:"0px"}));function syncRefMetasFromNodes(content){var _editorUtils$value$ge,_editorUtils$value;const usedRefs=new Set([...content.matchAll(REF_TAG_PATTERN)].map(match=>match[0])),mounts=null!==(_editorUtils$value$ge=null===(_editorUtils$value=editorUtils.value)||void 0===_editorUtils$value?void 0:_editorUtils$value.getRefNodeMounts())&&void 0!==_editorUtils$value$ge?_editorUtils$value$ge:[],byText=new Map;for(const entry of refMetas.value)usedRefs.has(entry.matchedText)&&byText.set(entry.matchedText,entry.meta);for(const mount of mounts)mount.meta&&byText.set(mount.matchedText,mount.meta);refMetas.value=[...byText].map(([matchedText,meta])=>({matchedText:matchedText,meta:meta}))}function syncEditorState(){var _editorUtils$value2,_editorUtils$value$ge2,_editorUtils$value3;const content=null===(_editorUtils$value2=editorUtils.value)||void 0===_editorUtils$value2?void 0:_editorUtils$value2.getContent();model.value=content,refNodeMounts.value=null!==(_editorUtils$value$ge2=null===(_editorUtils$value3=editorUtils.value)||void 0===_editorUtils$value3?void 0:_editorUtils$value3.getRefNodeMounts())&&void 0!==_editorUtils$value$ge2?_editorUtils$value$ge2:[],syncRefMetasFromNodes(null!=content?content:"")}function resolveRefMeta(matchedText){return refMetaMap.value.get(matchedText)}function removeRefNodeByKey(nodeKey){var _editorUtils$value14;null===(_editorUtils$value14=editorUtils.value)||void 0===_editorUtils$value14||_editorUtils$value14.removeRefNodeByKey(nodeKey),syncEditorState()}watch(()=>model.value,newVal=>{var _editorUtils$value16;const oldVal=null===(_editorUtils$value16=editorUtils.value)||void 0===_editorUtils$value16?void 0:_editorUtils$value16.getContent();var _editorUtils$value17;if(oldVal&&oldVal.length>0&&""===newVal)null===(_editorUtils$value17=editorUtils.value)||void 0===_editorUtils$value17||_editorUtils$value17.clear(),syncRefMetasFromNodes("");else if(newVal&&newVal!==oldVal){var _editorUtils$value18,_editorUtils$value19;null===(_editorUtils$value18=editorUtils.value)||void 0===_editorUtils$value18||_editorUtils$value18.clear(),null===(_editorUtils$value19=editorUtils.value)||void 0===_editorUtils$value19||_editorUtils$value19.setContentWithRefTags(newVal,refMetaMap.value),syncRefMetasFromNodes(newVal)}});const{stop:stop}=watchPausable(()=>editorUtils.value,v=>{var _editorUtils$value$ge3,_editorUtils$value20;v&&(model.value&&v.setContentWithRefTags(model.value,refMetaMap.value),stop(),refNodeMounts.value=null!==(_editorUtils$value$ge3=null===(_editorUtils$value20=editorUtils.value)||void 0===_editorUtils$value20?void 0:_editorUtils$value20.getRefNodeMounts())&&void 0!==_editorUtils$value$ge3?_editorUtils$value$ge3:[])});__expose({focus:function(){var _editorUtils$value4;null===(_editorUtils$value4=editorUtils.value)||void 0===_editorUtils$value4||_editorUtils$value4.focus()},blur:function(){var _editorUtils$value5;null===(_editorUtils$value5=editorUtils.value)||void 0===_editorUtils$value5||_editorUtils$value5.blur()},insertText:function(value){var _editorUtils$value6;null===(_editorUtils$value6=editorUtils.value)||void 0===_editorUtils$value6||_editorUtils$value6.insertText(value),syncEditorState()},insertTextWithRefTagsAndMetas:function(text,metas=[]){var _editorUtils$value8;const metaMap=new Map(metas.map(entry=>[entry.matchedText,entry.meta]));null===(_editorUtils$value8=editorUtils.value)||void 0===_editorUtils$value8||_editorUtils$value8.insertTextWithRefTags(text,metaMap),syncEditorState()},insertRefTag:function(refType,refPayload){var _editorUtils$value9;null===(_editorUtils$value9=editorUtils.value)||void 0===_editorUtils$value9||_editorUtils$value9.insertRefTag(refType,refPayload),syncEditorState()},insertFavoritePrompt:function(value){var _editorUtils$value7;null===(_editorUtils$value7=editorUtils.value)||void 0===_editorUtils$value7||_editorUtils$value7.insertFavoritePrompt(value),syncEditorState()},clearMentionContent:function(){var _editorUtils$value10;null===(_editorUtils$value10=editorUtils.value)||void 0===_editorUtils$value10||_editorUtils$value10.clearMentionContent()},clearSlashContent:function(){var _editorUtils$value11;null===(_editorUtils$value11=editorUtils.value)||void 0===_editorUtils$value11||_editorUtils$value11.clearSlashContent()},replaceAll:function(content){var _editorUtils$value12,_editorUtils$value13;null===(_editorUtils$value12=editorUtils.value)||void 0===_editorUtils$value12||_editorUtils$value12.clear(),null===(_editorUtils$value13=editorUtils.value)||void 0===_editorUtils$value13||_editorUtils$value13.setContentWithRefTags(content,refMetaMap.value),syncEditorState()},getRefNodeMounts:()=>refNodeMounts.value,removeRefNodeByKey:removeRefNodeByKey,isCaretAtStart:function(){var _editorUtils$value$is,_editorUtils$value15;return null!==(_editorUtils$value$is=null===(_editorUtils$value15=editorUtils.value)||void 0===_editorUtils$value15?void 0:_editorUtils$value15.isCaretAtStart())&&void 0!==_editorUtils$value$is&&_editorUtils$value$is}});const lastAction=shallowRef("");function dispatchChangeEvent(editorState){editorState.read(()=>{var _editorUtils$value$ge4,_editorUtils$value21;const currentContent=ke().getTextContent();if(model.value=currentContent,refNodeMounts.value=null!==(_editorUtils$value$ge4=null===(_editorUtils$value21=editorUtils.value)||void 0===_editorUtils$value21?void 0:_editorUtils$value21.getRefNodeMounts())&&void 0!==_editorUtils$value$ge4?_editorUtils$value$ge4:[],syncRefMetasFromNodes(currentContent),""!==lastAction.value)return void(lastAction.value="");const{wordMatch:slashWordMatch,rangeStart:slashTriggerPos}=getMatchAndRange(slashTrigger,{include:!0});
2if(slashWordMatch&&void 0!==slashTriggerPos){const sel=Ei();if(di(sel)){const content=sel.anchor.getNode().getTextContent();if(0===slashTriggerPos||slashTriggerPos>0&&" "===content[slashTriggerPos-1])return void emit("action",{type:"slash",value:slashWordMatch.slice(1)})}}const{wordMatch:mentionWordMatch}=getMatchAndRange(mentionTrigger,{include:!0});mentionWordMatch?emit("action",{type:"mention",value:mentionWordMatch.slice(1)}):null==emit||emit("action",{type:"prompt",value:currentContent})})}return(_ctx,_cache)=>(openBlock(),createElementBlock("div",_hoisted_1,[createBaseVNode("div",_hoisted_2,[renderSlot(_ctx.$slots,"prepend",{},void 0,!0)]),_cache[12]||(_cache[12]=createTextVNode()),createBaseVNode("div",{class:"chat-input-editor-container",style:normalizeStyle(editorContainerStyle.value)},[createBaseVNode("div",{ref_key:"inlinePrependRef",ref:inlinePrependRef,class:normalizeClass(["chat-input-inline-prepend",{"is-empty":0===unref(inlinePrependWidth)}])},[renderSlot(_ctx.$slots,"inline-prepend",{},void 0,!0)],2),_cache[11]||(_cache[11]=createTextVNode()),createVNode(unref(LexicalComposer_default),{"initial-config":config},{default:withCtx(()=>[createVNode(unref(LexicalRichTextPlugin_default),null,createSlots({contentEditable:withCtx(()=>[createVNode(unref(LexicalContentEditable_default),{class:"chat-input-editor","data-sidebar-shortcut-scope":__props.sidebarShortcutScope?"":void 0},null,8,["data-sidebar-shortcut-scope"])]),_:2},[__props.placeholder?{name:"placeholder",fn:withCtx(()=>[createBaseVNode("div",_hoisted_3,toDisplayString(__props.placeholder),1)]),key:"0"}:void 0]),1024),_cache[8]||(_cache[8]=createTextVNode()),createVNode(unref(LexicalHistoryPlugin_default)),_cache[9]||(_cache[9]=createTextVNode()),__props.autoFocus?(openBlock(),createBlock(unref(LexicalAutoFocusPlugin_default),{key:0})):createCommentVNode("",!0),_cache[10]||(_cache[10]=createTextVNode()),createVNode(CSROnly_default,null,{default:withCtx(()=>[createVNode(unref(LexicalOnChangePlugin_default),{"ignore-selection-change":"",onChange:dispatchChangeEvent}),_cache[4]||(_cache[4]=createTextVNode()),createVNode(Commands_default,{onConfirm:_cache[0]||(_cache[0]=$event=>emit("confirm")),onKeydown:_cache[1]||(_cache[1]=$event=>emit("keydown",$event))}),_cache[5]||(_cache[5]=createTextVNode()),createVNode(PalemoonAdaptor_default),_cache[6]||(_cache[6]=createTextVNode()),createVNode(InstancesUtils_default,{ref_key:"editorUtils",ref:editorUtils,"last-action":lastAction.value,"onUpdate:lastAction":_cache[2]||(_cache[2]=$event=>lastAction.value=$event)},null,8,["last-action"]),_cache[7]||(_cache[7]=createTextVNode()),renderSlot(_ctx.$slots,"ref-nodes",{refNodeMounts:refNodeMounts.value,refMetaResolver:resolveRefMeta,removeRefNode:removeRefNodeByKey},void 0,!0)]),_:3})]),_:3})],4)]))}}),[["__scopeId","data-v-8c6a548d"]]);function useCalcPosition(menuRef,options){const menuLeft=ref(0),menuTop=ref(0);let rafId=null,stopListeners=null;const computePosition=()=>{var _options$anchorGap$va,_options$anchorGap;const el=menuRef.value;if(!el)return;const selection=window.getSelection();if(!selection||0===selection.rangeCount)return;const range=selection.getRangeAt(0),viewport=function(){var _vv$offsetLeft,_vv$offsetTop,_vv$width,_vv$height;const vv=window.visualViewport,left=null!==(_vv$offsetLeft=null==vv?void 0:vv.offsetLeft)&&void 0!==_vv$offsetLeft?_vv$offsetLeft:0,top=null!==(_vv$offsetTop=null==vv?void 0:vv.offsetTop)&&void 0!==_vv$offsetTop?_vv$offsetTop:0,width=null!==(_vv$width=null==vv?void 0:vv.width)&&void 0!==_vv$width?_vv$width:window.innerWidth,height=null!==(_vv$height=null==vv?void 0:vv.height)&&void 0!==_vv$height?_vv$height:window.innerHeight;return{left:left,top:top,width:width,height:height,right:left+width,bottom:top+height}}(),anchor=function(range,viewport){const cursorRect=range.getBoundingClientRect(),lineH=cursorRect.height||20,top=cursorRect.top+viewport.top,bottom=cursorRect.height>0?cursorRect.bottom+viewport.top:top+lineH;return{left:cursorRect.left+viewport.left,top:top,bottom:bottom}}(range,viewport),anchorTop=anchor.top,anchorBottom=anchor.bottom,menuH=el.getBoundingClientRect().height||el.offsetHeight||256,needBelow=menuH+12,needAbove=menuH+12,comfortableBelow=Math.max(100,needBelow),spaceBelow=viewport.bottom-anchorBottom,spaceAbove=anchorTop-viewport.top,gap=null!==(_options$anchorGap$va=null==options||null===(_o
2ptions$anchorGap=options.anchorGap)||void 0===_options$anchorGap?void 0:_options$anchorGap.value)&&void 0!==_options$anchorGap$va?_options$anchorGap$va:12;let nextTop;if(spaceBelow>=comfortableBelow)nextTop=anchorBottom+gap;else if(spaceAbove>=needAbove){var _options$anchorTo;nextTop=("caretBottom"===(null==options||null===(_options$anchorTo=options.anchorTo)||void 0===_options$anchorTo?void 0:_options$anchorTo.value)?anchorBottom+gap:anchorTop-gap)-menuH}else nextTop=viewport.bottom-8-menuH;const baseLeft=anchor.left;menuLeft.value=baseLeft+function(menuEl,baseLeft,viewport){const{width:width}=menuEl.getBoundingClientRect(),minLeft=viewport.left+24,maxRight=viewport.right-24;let nextLeft=baseLeft;const right=nextLeft+width;return nextLeft<minLeft&&(nextLeft=minLeft),right>maxRight&&(nextLeft-=right-maxRight),nextLeft<minLeft&&(nextLeft=minLeft),nextLeft-baseLeft}(el,baseLeft,viewport),menuTop.value=function(menuEl,baseTop,viewport){const{height:height}=menuEl.getBoundingClientRect(),padT=viewport.top+50,maxTop=viewport.bottom-8-height;return maxTop<padT?Math.max(viewport.top+8,maxTop):Math.min(Math.max(baseTop,padT),maxTop)}(el,nextTop,viewport)},scheduleCompute=()=>{null!==rafId&&cancelAnimationFrame(rafId),rafId=requestAnimationFrame(()=>{rafId=null,computePosition()})};return onMounted(()=>{menuLeft.value=0,menuTop.value=0,nextTick(()=>{scheduleCompute()});const stops=[useEventListener(window,"resize",scheduleCompute,{passive:!0}),useEventListener(window,"scroll",scheduleCompute,{passive:!0}),useEventListener(document,"selectionchange",()=>{const el=document.activeElement;el instanceof HTMLElement&&el.isContentEditable&&scheduleCompute()}),useEventListener(document,"focusin",scheduleCompute)],vv=window.visualViewport;vv&&(vv.addEventListener("resize",scheduleCompute,{passive:!0}),vv.addEventListener("scroll",scheduleCompute,{passive:!0}),stops.push(()=>{vv.removeEventListener("resize",scheduleCompute),vv.removeEventListener("scroll",scheduleCompute)})),stopListeners=()=>{stops.forEach(stop=>{stop()})}}),useResizeObserver(menuRef,()=>{scheduleCompute()}),onBeforeUnmount(()=>{null==stopListeners||stopListeners(),stopListeners=null,null!==rafId&&(cancelAnimationFrame(rafId),rafId=null)}),{menuLeft:menuLeft,menuTop:menuTop}}var EditorPanel_default=_plugin_vue_export_helper_default(defineComponent({__name:"EditorPanel",props:{anchorGap:{},anchorTo:{}},emits:["close"],setup(__props,{emit:__emit}){const emit=__emit,props=__props,panelRoot=ref(null),{menuLeft:menuLeft,menuTop:menuTop}=useCalcPosition(panelRoot,{anchorGap:computed(()=>props.anchorGap),anchorTo:computed(()=>props.anchorTo)}),menuStyle=computed(()=>({left:`${menuLeft.value}px`,top:`${menuTop.value}px`}));onMounted(()=>{useEventListener(document,"keydown",event=>{"Escape"===event.key&&(emit("close"),event.preventDefault(),event.stopPropagation())},!0)});const handleClickOutside=()=>{emit("close")};return(_ctx,_cache)=>(openBlock(),createBlock(Teleport,{to:"body"},[withDirectives((openBlock(),createElementBlock("div",{ref_key:"panelRoot",ref:panelRoot,class:"editor-caret-panel",style:normalizeStyle(menuStyle.value)},[renderSlot(_ctx.$slots,"default",{},void 0,!0)],4)),[[unref(vOnClickOutside),handleClickOutside]])]))}}),[["__scopeId","data-v-4ce0fd4a"]]),plugin_fallback_default="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAAAAOVBMVEUAAAAXgf8iiP8iiP8tjv8miv8chP8cd/8tjv8Ygv8tjv8pjP8sjv8kiv8rjf8ni/8qjf8uj/8ni/+0MxWQAAAAEXRSTlMATR5B8BAqB9k4v22QXJ9+r9x7jhQAAASfSURBVHja7dzbduMgDAVQIS7G99D//9hpOk0gmdg1NqmFRvu1T1rkCEwBEEIIIYQQQgghhBBCCHEGHHwwEwI3owlfZuAFw00PrPhwYywwgiEagREVogkYSQvzwAiGBKuW70Pg2RenEF2AkTFEBhixIaGBER+uKlhWIUKWIUQdUIWDCcEPFrbTIUF1VeVM+OIxI2SGfsjQ71lEdCEaXpauzq532rWg7ddWVVbPXfwJnMUnbaBEyFzfGRJtJYRdH1fm1aeLHSdDZu7e2Qam508XqwcfPpGZux/awL6QGbiG6obK3D3vm2sxJExIUJm79861PiwgM3ebfTsYQ9hAQZ7zQ6Z7HzYY4ER97g4G9hcTVlDZEcnawbDj4MMPyOyImI07GFYPXdiCyo7I+g5GulLaiMq24487GDhOWUVRWVWt7mBYtRwq8jPZ0g5GXCn9q4a2+LiDsT1U5Gdo0CEyNn5+HGS6GeFUNq1C6cGH4/ygCWzydKEocxkJFHU1FyzKT71yQIQOZfhpVlctUGDLhMpc5lHdNHA2XaSpm24YVcrCmbCfTKFQPXNwgrhSKhKqUb2g4QTx86NUqKIzQ1YoVFOv1iD8tqFEqGa1Iqfh05mxfPz9rYNfNh4K1bBa1KkNHwuGilbI/P6VUopeyIbCoSLT8MddK6WIbMhszkopw/mrKr8vVPWH7NVKqYqQ6fVQ9WoF6YZvzfZQ1RWyrlhTj0h8uvQbQlV9yF6tlKoNGfhbUb0GpxbV1/DRx41aVG8Evw4tfGvUG1k4kVbvg3AeXiFLWfVGDfw+/iFr1fs4yCMh+69DBuoJm4afhIxXYagSnEKWNHxehb1zVaUhTzUNP7uwWkKWWVg9IcvOWC0NP7+wSkLmIFsdqyqETLWErIFMlYRMQ74qGv7pp+DuIWP2SwRQN5ya/WPDZ9QT05Dxah2x4XNL2O3ThVlLvIeM3w/xHSHTJH6IAA3TugBapnWV/S22dOqChl0/LN4XWyL3WgoMWU+4rN1D1k+d+TCX76ocoXDdNVplGueL+fhrVtohxaqubGZR/iO6UC0qr+X3kzexqPMvmRaJ2Th8hioicff+SGUxVBGZu/cHKxv9c1E1vUaIWi25Dxa5u/ebNE69Nj9WRepFo0OD1seiyL1otBW26lmLaMIXii8abdektbXOwqeO8DsQWRqLn2zzdJi44pAt0IRfNDrGEH6645CJS8ii5ZCxeEgdCb9odIyn+6LRW69o0dqdyqG4hsxyHTHomM7QMIclZqp3SbW4qjJdT3zLY889SD/V2zMS3avLgsBA/3ADl8JNj0Ks/w6Va6j+22gnHC7flwVbYgcfikFmQ3bXUDurUozjOmSW7ZC1pE7wFWTJnhQ4qqV1OLEcS+zYZTkt3XMrJQ+HkDwMsROqlEZY1tiqFstOPdCvR61Bp69/rejX2mj1RDu06Tiha6vMYVJZSreftKZ1Sz+3ssouGWRUVt8Z6K2VMS0MwFV6+vRnqGt44mMXpzkO2FWDurbjwpthu1IU3ROom1jX/jtXO7RVF5WefHFfELFhUZIQQgghhBBCCCGEEEIIIYQQQgghRDl/AKAS9nVm3Hs5AAAAAElFTkSuQmCC";export{getDelim as _,llmUrlPattern as a,REF_TYPE_AT_MEMBER as c,REF_TYPE_IM_MENTION as d,REF_TYPE_PLUGIN as f,buildSkillMetaEntry as g,buildPluginMetaEntry as h,extractRefs as i,REF_TYPE_EXTENSION as l,buildExtensionTag as m,EditorPanel_default as n,MENTION_TEXT_PATTERN as o,REF_TYPE_SKILL as p,Editor_default as r,REF_TAG_PATTERN as s,plugin_fallback_default as t,REF_TYPE_FILE as u,getSkillIconUrls as v,wireEncode as y};
3//# sourceMappingURL=kimi.editor-OfKJcZBB.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.