/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index3.css');require('./index2.css');require('./index.css');const e=require("vue"),o=require("../../node_modules/@vueuse/core/dist/index.js"),r=require("../../node_modules/vue-codemirror/dist/vue-codemirror.esm.js"),t=require("../../node_modules/@codemirror/theme-one-dark/dist/index.js"),s=require("../../node_modules/@codemirror/lang-json/dist/index.js"),l=require("../../node_modules/@codemirror/lang-java/dist/index.js"),a=require("../../node_modules/@codemirror/lang-sql/dist/index.js"),n=require("../../node_modules/@codemirror/lang-javascript/dist/index.js"),i=require("../../node_modules/@codemirror/lang-yaml/dist/index.js"),d=require("../../node_modules/@codemirror/lang-xml/dist/index.js"),u=require("../../node_modules/@codemirror/lang-python/dist/index.js"),c=require("../../node_modules/@codemirror/lint/dist/index.js"),p=require("@gsc-basic/hooks"),m=require("../../hooks/useNamespace.js"),g=require("../../hooks/useLocale.js"),y=require("../../Button/index.js");/* empty css             *//* empty css             */;/* empty css            */const j=require("../../_virtual/_plugin-vue_export-helper.js"),v={class:"flex items-center justify-between py-1 text-xs dark:text-gray-200 dark:bg-gray-800"},x={class:"flex"},h={class:"pr-2"},f={class:"pr-2"},q={class:"pr-2"},_=Object.assign({name:"GscCodeEditor"},{__name:"index",props:{modelValue:{type:[String]},placeholder:{type:String},editorStyle:{type:[Array,String,Object],default:()=>({height:"180px"})},language:{type:String,default:"json",validator:e=>["json","java","sql","yaml","xml","python","javascript"].includes(e)},isDarkTheme:Boolean,disabled:Boolean,readonly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1}},emits:["change","update:modelValue"],setup(j){const _=j,{prefixCls:b}=m.useNamespace("code-editor"),{t:S}=g.useLocale(),V={json:()=>_.readonly?[s.json()]:[s.json(),c.linter(s.jsonParseLinter()),c.lintGutter()],java:()=>[l.java()],sql:()=>[a.sql()],yaml:()=>[i.yaml()],xml:()=>[d.xml()],python:()=>[u.python()],javascript:()=>[n.javascript({jsx:!0,typescript:!0})]},E=e.computed(()=>{const e=[...V[_.language]?.()??[]];return _.isDarkTheme&&e.push(t.oneDark),e}),k=e.computed(()=>{if(_.placeholder)return _.placeholder;const e=`gsc.codeEditor.placeholder.${_.language}`,o=S(e);return o===e?S("gsc.codeEditor.placeholder.default"):o}),[N,D]=p.useModelBinding(_,"modelValue","update:modelValue");try{"json"===_.language&&D(JSON.stringify(JSON.parse(e.unref(N)),null,2))}catch{}const B=e.computed(()=>{const o=e.unref(N);return!o||0===o.length}),{copy:C,copied:O,isSupported:T}=o.useClipboard({source:N,legacy:!0}),w=e.computed(()=>!T.value||B.value),z=e.computed(()=>S(O.value?"gsc.codeEditor.action.copied":"gsc.codeEditor.action.copy")),G=()=>{w.value||C()},L=e.reactive({lines:null,cursor:null,length:null}),M=e=>{const o=e.state.selection.ranges;L.cursor=o[0].anchor,L.length=e.state.doc.length,L.lines=e.state.doc.lines};return(o,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(b),j.isDarkTheme?"dark-bg":"light-bg"])},[e.createVNode(e.unref(r.Codemirror),{modelValue:e.unref(N),"onUpdate:modelValue":t[0]||(t[0]=o=>e.isRef(N)?N.value=o:null),placeholder:k.value,style:e.normalizeStyle(j.editorStyle),autofocus:j.autofocus,"indent-with-tab":!0,"tab-size":2,disabled:j.disabled,extensions:E.value,onUpdate:M},null,8,["modelValue","placeholder","style","autofocus","disabled","extensions"]),e.createElementVNode("div",v,[e.createVNode(e.unref(y.GscButton),{variant:"text",disabled:w.value,onClick:G},{default:e.withCtx(()=>[t[1]||(t[1]=e.createElementVNode("i",{class:"i-material-symbols:content-copy-outline"},null,-1)),e.createTextVNode(" "+e.toDisplayString(z.value),1)]),_:1},8,["disabled"]),e.createElementVNode("div",x,[e.createElementVNode("span",h,e.toDisplayString(e.unref(S)("gsc.codeEditor.info.length"))+": "+e.toDisplayString(L.length),1),e.createElementVNode("span",f,e.toDisplayString(e.unref(S)("gsc.codeEditor.info.lines"))+": "+e.toDisplayString(L.lines),1),e.createElementVNode("span",q,e.toDisplayString(e.unref(S)("gsc.codeEditor.info.cursor"))+": "+e.toDisplayString(L.cursor),1)])])],2))}}),b=j.default(_,[["__scopeId","data-v-ce63579c"]]);exports.default=b;