var qt=Object.defineProperty,Ut=Object.defineProperties;var Vt=Object.getOwnPropertyDescriptors;var st=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var at=(x,T,i)=>T in x?qt(x,T,{enumerable:!0,configurable:!0,writable:!0,value:i}):x[T]=i,lt=(x,T)=>{for(var i in T||(T={}))Gt.call(T,i)&&at(x,i,T[i]);if(st)for(var i of st(T))Kt.call(T,i)&&at(x,i,T[i]);return x},ft=(x,T)=>Ut(x,Vt(T));import{e as zt,r as W,b as Dt,h as Q,o as $t,u as ut,c as ct,a4 as jt,C as Jt,z as ht,y as Xt,H as Yt,Q as Qt,B as dt,K as Zt}from"./vue-vendor-DNhG1Cve.js";import{as as N,U as Mt,bo as te,dJ as ee,dW as ne,aO as ie,au as re}from"./index-X7Y8jykP.js";import{useRuleFormItem as oe}from"./useFormItem-b_EqFlJz.js";import{a as I,_ as se}from"./htmlmixed-DQsDbTFv.js";import"./vue-SgbjusIu.js";/* empty css */import"./emoji-mart-vue-fast-R0uJEDq-.js";var gt={exports:{}},pt;function Nt(){return pt||(pt=1,(function(x,T){(function(i){i(I())})(function(i){function L(f,c,r,l){if(r&&r.call){var d=r;r=null}else var d=p(f,r,"rangeFinder");typeof c=="number"&&(c=i.Pos(c,0));var o=p(f,r,"minFoldSize");function h(t){var n=d(f,c);if(!n||n.to.line-n.from.linef.firstLine();)c=i.Pos(c.line-1,0),g=h(!1);if(!(!g||g.cleared||l==="unfold")){var b=k(f,r,g);i.on(b,"mousedown",function(t){s.clear(),i.e_preventDefault(t)});var s=f.markText(g.from,g.to,{replacedWith:b,clearOnEnter:p(f,r,"clearOnEnter"),__isFold:!0});s.on("clear",function(t,n){i.signal(f,"unfold",f,t,n)}),i.signal(f,"fold",f,g.from,g.to)}}function k(f,c,r){var l=p(f,c,"widget");if(typeof l=="function"&&(l=l(r.from,r.to)),typeof l=="string"){var d=document.createTextNode(l);l=document.createElement("span"),l.appendChild(d),l.className="CodeMirror-foldmarker"}else l&&(l=l.cloneNode(!0));return l}i.newFoldFunction=function(f,c){return function(r,l){L(r,l,{rangeFinder:f,widget:c})}},i.defineExtension("foldCode",function(f,c,r){L(this,f,c,r)}),i.defineExtension("isFolded",function(f){for(var c=this.findMarksAt(f),r=0;rk.lastLine())return null;var h=k.getTokenAt(i.Pos(o,1));if(/\S/.test(h.string)||(h=k.getTokenAt(i.Pos(o,h.end+1))),h.type!="keyword"||h.string!="import")return null;for(var g=o,b=Math.min(k.lastLine(),o+10);g<=b;++g){var s=k.getLine(g),t=s.indexOf(";");if(t!=-1)return{startCh:h.end,end:i.Pos(g,t)}}}var f=A.line,c=p(f),r;if(!c||p(f-1)||(r=p(f-2))&&r.end.line==f-1)return null;for(var l=c.end;;){var d=p(l.line+1);if(d==null)break;l=d.end}return{from:k.clipPos(i.Pos(f,c.startCh+1)),to:l}}),i.registerHelper("fold","include",function(k,A){function p(d){if(dk.lastLine())return null;var o=k.getTokenAt(i.Pos(d,1));if(/\S/.test(o.string)||(o=k.getTokenAt(i.Pos(d,o.end+1))),o.type=="meta"&&o.string.slice(0,8)=="#include")return o.start+8}var f=A.line,c=p(f);if(c==null||p(f-1)!=null)return null;for(var r=f;;){var l=p(r+1);if(l==null)break;++r}return{from:i.Pos(f,c+1),to:k.clipPos(i.Pos(r))}})})})()),vt.exports}ae();var yt={exports:{}},kt;function le(){return kt||(kt=1,(function(x,T){(function(i){i(I())})(function(i){i.registerGlobalHelper("fold","comment",function(L){return L.blockCommentStart&&L.blockCommentEnd},function(L,k){var A=L.getModeAt(k),p=A.blockCommentStart,f=A.blockCommentEnd;if(!(!p||!f)){for(var c=k.line,r=L.getLine(c),l,d=k.ch,o=0;;){var h=d<=0?-1:r.lastIndexOf(p,d-1);if(h==-1){if(o==1)return;o=1,d=r.length;continue}if(o==1&&hp)f=c;else break}if(f)return{from:i.Pos(A.line,k.getLine(A.line).length),to:i.Pos(f,k.getLine(f).length)}}})})})()),xt.exports}fe();var At={exports:{}},Lt;function ue(){return Lt||(Lt=1,(function(x,T){(function(i){i(I(),Nt())})(function(i){i.defineOption("foldGutter",!1,function(s,t,n){n&&n!=i.Init&&(s.clearGutter(s.state.foldGutter.options.gutter),s.state.foldGutter=null,s.off("gutterClick",d),s.off("changes",h),s.off("viewportChange",g),s.off("fold",b),s.off("unfold",b),s.off("swapDoc",h),s.off("optionChange",o)),t&&(s.state.foldGutter=new k(A(t)),l(s),s.on("gutterClick",d),s.on("changes",h),s.on("viewportChange",g),s.on("fold",b),s.on("unfold",b),s.on("swapDoc",h),s.on("optionChange",o))});var L=i.Pos;function k(s){this.options=s,this.from=this.to=0}function A(s){return s===!0&&(s={}),s.gutter==null&&(s.gutter="CodeMirror-foldgutter"),s.indicatorOpen==null&&(s.indicatorOpen="CodeMirror-foldgutter-open"),s.indicatorFolded==null&&(s.indicatorFolded="CodeMirror-foldgutter-folded"),s}function p(s,t){for(var n=s.findMarks(L(t,0),L(t+1,0)),e=0;e=u){if(w&&y&&w.test(y.className))return;S=f(e.indicatorOpen)}}!S&&!y||s.setGutterMarker(H,e.gutter,S)})}function r(s){return new RegExp("(^|\\s)"+s+"(?:$|\\s)\\s*")}function l(s){var t=s.getViewport(),n=s.state.foldGutter;n&&(s.operation(function(){c(s,t.from,t.to)}),n.from=t.from,n.to=t.to)}function d(s,t,n){var e=s.state.foldGutter;if(e){var a=e.options;if(n==a.gutter){var u=p(s,t);u?u.clear():s.foldCode(L(t,0),a)}}}function o(s,t){t=="mode"&&h(s)}function h(s){var t=s.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){l(s)},n.foldOnChangeTimeSpan||600)}}function g(s){var t=s.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var e=s.getViewport();t.from==t.to||e.from-t.to>20||t.from-e.to>20?l(s):s.operation(function(){e.fromt.to&&(c(s,t.to,e.to),t.to=e.to)})},n.updateViewportTimeSpan||400)}}function b(s,t){var n=s.state.foldGutter;if(n){var e=t.line;e>=n.from&&e1)){if(this.somethingSelected()){if(!t.hint.supportsSelection)return;for(var e=0;ev.clientHeight+1:!1,_;setTimeout(function(){_=a.getScrollInfo()});var Wt=P.bottom-j;if(Wt>0){var J=P.bottom-P.top,X=P.top-(B.bottom-B.top)-2;j-P.topX&&(v.style.height=(J=X)+"px"),v.style.top=(K=B.top-J)-D+"px",M=!1):v.style.height=j-P.top-2+"px"}var U=P.right-q;if(nt&&(U+=a.display.nativeBarWidth),U>0&&(P.right-P.left>q&&(v.style.width=q-5+"px",U-=P.right-P.left-q),v.style.left=(G=Math.max(B.left-U-z,0))+"px"),nt)for(var V=v.firstChild;V;V=V.nextSibling)V.style.paddingRight=a.display.nativeBarWidth+"px";if(a.addKeyMap(this.keyMap=l(t,{moveFocus:function(C,E){e.changeActive(e.selectedHint+C,E)},setFocus:function(C){e.changeActive(C)},menuSize:function(){return e.screenAmount()},length:H.length,close:function(){t.close()},pick:function(){e.pick()},data:n})),t.options.closeOnUnfocus){var it;a.on("blur",this.onBlur=function(){it=setTimeout(function(){t.close()},100)}),a.on("focus",this.onFocus=function(){clearTimeout(it)})}a.on("scroll",this.onScroll=function(){var C=a.getScrollInfo(),E=a.getWrapperElement().getBoundingClientRect();_||(_=a.getScrollInfo());var ot=K+_.top-C.top,Y=ot-(m.pageYOffset||(u.documentElement||u.body).scrollTop);if(M||(Y+=v.offsetHeight),Y<=E.top||Y>=E.bottom)return t.close();v.style.top=ot+"px",v.style.left=G+_.left-C.left+"px"}),i.on(v,"dblclick",function(C){var E=d(v,C.target||C.srcElement);E&&E.hintId!=null&&(e.changeActive(E.hintId),e.pick())}),i.on(v,"click",function(C){var E=d(v,C.target||C.srcElement);E&&E.hintId!=null&&(e.changeActive(E.hintId),t.options.completeOnSingleClick&&e.pick())}),i.on(v,"mousedown",function(){setTimeout(function(){a.focus()},20)});var rt=this.getSelectedHintRange();return(rt.from!==0||rt.to!==0)&&this.scrollToActive(),i.signal(n,"select",H[this.selectedHint],v.childNodes[this.selectedHint]),!0}o.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm.getInputField();t.removeAttribute("aria-activedescendant"),t.removeAttribute("aria-owns");var n=this.completion.cm;this.completion.options.closeOnUnfocus&&(n.off("blur",this.onBlur),n.off("focus",this.onFocus)),n.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,n){if(t>=this.data.list.length?t=n?this.data.list.length-1:0:t<0&&(t=n?0:this.data.list.length-1),this.selectedHint!=t){var e=this.hints.childNodes[this.selectedHint];e&&(e.className=e.className.replace(" "+k,""),e.removeAttribute("aria-selected")),e=this.hints.childNodes[this.selectedHint=t],e.className+=" "+k,e.setAttribute("aria-selected","true"),this.completion.cm.getInputField().setAttribute("aria-activedescendant",e.id),this.scrollToActive(),i.signal(this.data,"select",this.data.list[this.selectedHint],e)}},scrollToActive:function(){var t=this.getSelectedHintRange(),n=this.hints.childNodes[t.from],e=this.hints.childNodes[t.to],a=this.hints.firstChild;n.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=e.offsetTop+e.offsetHeight-this.hints.clientHeight+a.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var t=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-t),to:Math.min(this.data.list.length-1,this.selectedHint+t)}}};function h(t,n){if(!t.somethingSelected())return n;for(var e=[],a=0;a0?v(F):S(y+1)})}S(0)};return u.async=!0,u.supportsSelection=!0,u}else return(a=t.getHelper(t.getCursor(),"hintWords"))?function(m){return i.hint.fromList(m,{words:a})}:i.hint.anyword?function(m,v){return i.hint.anyword(m,v)}:function(){}}i.registerHelper("hint","auto",{resolve:b}),i.registerHelper("hint","fromList",function(t,n){var e=t.getCursor(),a=t.getTokenAt(e),u,m=i.Pos(e.line,a.start),v=e;a.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};i.defineOption("hintOptions",null)})})()),Ht.exports}he();var Ft={exports:{}},Ot;function de(){return Ot||(Ot=1,(function(x,T){(function(i){i(I())})(function(i){var L=/[\w$]+/,k=500;i.registerHelper("hint","anyword",function(A,p){for(var f=p&&p.word||L,c=p&&p.range||k,r=A.getCursor(),l=A.getLine(r.line),d=r.ch,o=d;o&&f.test(l.charAt(o-1));)--o;for(var h=o!=d&&l.slice(o,d),g=p&&p.list||[],b={},s=new RegExp(f.source,"g"),t=-1;t<=1;t+=2)for(var n=r.line,e=Math.min(Math.max(n+t*c,A.firstLine()),A.lastLine())+t;n!=e;n+=t)for(var a=A.getLine(n),u;u=s.exec(a);)n==r.line&&u[0]===h||(!h||u[0].lastIndexOf(h,0)==0)&&!Object.prototype.hasOwnProperty.call(b,u[0])&&(b[u[0]]=!0,g.push(u[0]));return{list:g,from:i.Pos(r.line,o),to:i.Pos(r.line,d)}})})})()),Ft.exports}de();var Ct={exports:{}},Et;function ge(){return Et||(Et=1,(function(x,T){(function(i){i(I())})(function(i){var L=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),k=i.Pos,A={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(o){return o&&o.bracketRegex||/[(){}[\]]/}function f(o,h,g){var b=o.getLineHandle(h.line),s=h.ch-1,t=g&&g.afterCursor;t==null&&(t=/(^| )cm-fat-cursor($| )/.test(o.getWrapperElement().className));var n=p(g),e=!t&&s>=0&&n.test(b.text.charAt(s))&&A[b.text.charAt(s)]||n.test(b.text.charAt(s+1))&&A[b.text.charAt(++s)];if(!e)return null;var a=e.charAt(1)==">"?1:-1;if(g&&g.strict&&a>0!=(s==h.ch))return null;var u=o.getTokenTypeAt(k(h.line,s+1)),m=c(o,k(h.line,s+(a>0?1:0)),a,u,g);return m==null?null:{from:k(h.line,s),to:m&&m.pos,match:m&&m.ch==e.charAt(0),forward:a>0}}function c(o,h,g,b,s){for(var t=s&&s.maxScanLineLength||1e4,n=s&&s.maxScanLines||1e3,e=[],a=p(s),u=g>0?Math.min(h.line+n,o.lastLine()+1):Math.max(o.firstLine()-1,h.line-n),m=h.line;m!=u;m+=g){var v=o.getLine(m);if(v){var w=g>0?0:v.length-1,H=g>0?v.length:-1;if(!(v.length>t))for(m==h.line&&(w=h.ch-(g<0?1:0));w!=H;w+=g){var S=v.charAt(w);if(a.test(S)&&(b===void 0||(o.getTokenTypeAt(k(m,w+1))||"")==(b||""))){var y=A[S];if(y&&y.charAt(1)==">"==g>0)e.push(S);else if(e.length)e.pop();else return{pos:k(m,w),ch:S}}}}}return m-g==(g>0?o.lastLine():o.firstLine())?!1:null}function r(o,h,g){for(var b=o.state.matchBrackets.maxHighlightLineLength||1e3,s=g&&g.highlightNonMatching,t=[],n=o.listSelections(),e=0;e{const L=[...T];return{codeHintingRegistry:()=>{const p=[];L.forEach(c=>{c.superiors&&p.push(c.superiors)});const f=(c,r)=>{const l=c.getCursor(),d=c.getTokenAt(l),o=d.start,h=l.ch,g=d.string;let b=null;if(g.length){if(g==="."){const n=c.getLine(l.line);for(let e=0,a=p.length;en.toLowerCase().indexOf(e.toLowerCase());let t=L.filter(n=>b?n.superiors===b:n.superiors==null);if(g==="."?b==null&&(t=[]):t=t.filter(n=>{const{text:e}=n,a=s(e,g);return e.startsWith(".")?a===1:a===0}).sort((n,e)=>s(n.text,g)e.text.indexOf(".")===0?ft(lt({},e),{text:e.text.substring(1)}):e)),r({list:t,from:x.Pos(l.line,o),to:x.Pos(l.line,h)});const n=L[0];n!=null&&n.desc&&setTimeout(()=>{const e=document.querySelector(".CodeMirror-hints");if(e){const a=e.children;Array.from(a).forEach(u=>{const m=u.textContent,v=L.find(w=>w.displayText===m);v&&u.setAttribute("title",v.desc)})}},0)}}};f.async=!0,f.supportsSelection=!0,T.length&&x.registerHelper("hint",i,f)},codeHintingMount:p=>{T.length&&(p.setOption("mode",i),setTimeout(()=>{p.on("cursorActivity",function(){p==null||p.showHint({completeSingle:!1})})},1e3))}}},Z=zt({name:"JCodeEditor",inheritAttrs:!1,components:{},props:{value:N.string.def(""),height:N.string.def("auto"),disabled:N.bool.def(!1),fullScreen:N.bool.def(!1),zIndex:N.any.def(1500),theme:N.string.def("idea"),language:N.string.def(""),keywords:N.array.def([])},emits:["change","update:value"],setup(x,{emit:T}){var S;const{getDarkMode:i}=Mt(),L=W(null),{prefixCls:k}=te("code-editer"),A=window.CodeMirror||se,p=W(),[f]=oe(x,"value","change",p),c=W();let r=null;const l=ie();W(x.height);const d=Dt({tabSize:2,theme:i.value==ee.DARK?"monokai":x.theme,smartIndent:!0,lineNumbers:!0,line:!0,foldGutter:!0,lineWrapping:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter","CodeMirror-lint-markers"],styleActiveLine:!0,mode:x.language,readOnly:x.disabled,matchBrackets:!0,extraKeys:{"Cmd-/":y=>H(y),"Ctrl-/":y=>H(y)}});let o=(S=x.value)!=null?S:"";const h=W(!1),g=ct(()=>h.value?"fullscreen-exit":"fullscreen"),b=ct(()=>{let y={class:[k,"full-screen-parent","auto-height",{"full-screen":h.value}],style:{}};return h.value&&(y.style["z-index"]=x.zIndex),y}),{codeHintingMount:s,codeHintingRegistry:t}=ve(A,x.keywords,x.language);t(),Q(()=>x.value,()=>{o!=x.value&&n(x.value,!1)}),$t(()=>{u(),setTimeout(()=>{w()},150)});function n(y,F=!0){y&&ne(y)&&(y=JSON.stringify(JSON.parse(y),null,2)),r==null||r.setValue(y!=null?y:""),o=y,F&&a(o),setTimeout(()=>{w(),setTimeout(()=>{w()},600)},400)}function e(y){o=y.getValue()||"",x.value!=o&&a(o)}function a(y){T("change",y),T("update:value",y)}function u(){r=A.fromTextArea(c.value,d),r.on("change",e),n(o,!1),s(r)}function m(){h.value=!h.value}Q(()=>x.disabled,y=>{r&&r.setOption("readOnly",y)}),Q(()=>x.language,y=>{y&&r&&r.setOption("mode",y)});const v=Object.assign({},ut(x),ut(l));function w(){r&&r.refresh()}function H(y){var F=y.getSelection(),O=y.getCursor("start"),R=y.getCursor("end"),B=F.startsWith("//");B?y.replaceRange(F.replace(/\n\/\/\s/g,` `).replace(/^\/\/\s/,""),O,R):y.replaceRange("// "+F.replace(/\n(?=.)/g,` // `),O,R)}return{state:f,textarea:c,boxBindProps:b,getBindValue:v,setValue:n,isFullScreen:h,fullScreenIcon:g,onToggleFullScreen:m,refresh:w,containerRef:L}}}),Rt=()=>{jt(x=>({v6562177b:x.height}))},Bt=Z.setup;Z.setup=Bt?(x,T)=>(Rt(),Bt(x,T)):Rt;function me(x,T,i,L,k,A){const p=Zt("a-icon");return ht(),Jt("div",dt({ref:"containerRef"},x.boxBindProps),[x.fullScreen?(ht(),Xt(p,{key:0,class:"full-screen-icon",type:x.fullScreenIcon,onClick:x.onToggleFullScreen},null,8,["type","onClick"])):Yt("",!0),Qt("textarea",dt({ref:"textarea"},x.getBindValue),null,16)],16)}const He=re(Z,[["render",me]]);export{He as default};