2026-03-23 17:45:01 +08:00
var m = ( d , u , l ) => new Promise ( ( s , t ) => { var i = n => { try { c ( l . next ( n ) ) } catch ( o ) { t ( o ) } } , r = n => { try { c ( l . throw ( n ) ) } catch ( o ) { t ( o ) } } , c = n => n . done ? s ( n . value ) : Promise . resolve ( n . value ) . then ( i , r ) ; c ( ( l = l . apply ( d , u ) ) . next ( ) ) } ) ; import { u as N } from "./index-DGBP3Vy2.js" ; import { R as k } from "./data-DFWPTHWq.js" ; import { a9 as _ } from "./bootstrap-DhvYQWXT.js" ; import { _ as C } from "./code-editor.vue_vue_type_script_setup_true_lang-CxSQ1b4b.js" ; import { m as D , b9 as f , aa as x , ab as y , b2 as b , bJ as T , ae as w , ac as J , u as g } from "../jse/index-index-rerQU-kO.js" ; import { u as S } from "./use-modal-BGJvg0Kx.js" ; import "./x-DMlD3woK.js" ; const V = { class : "h-[400px] w-full px-4" } , M = D ( { _ _name : "device-config-modal" , emits : [ "success" ] , setup ( d , { emit : u } ) { const l = u , s = f ( null ) , t = f ( "" ) , i = f ( ! 1 ) , r = x ( ( ) => { var p , v ; const a = s . value ; if ( ! a ) return "设备配置" ; const e = ( v = ( p = k . find ( O => O . value === a . relationType ) ) == null ? void 0 : p . label ) != null ? v : a . relationType ; return ` ${ a . nickname || a . deviceName || a . deviceKey || "设备" } - ${ e } 配置 ` } ) ; function c ( a ) { t . value = a } const [ n , o ] = S ( { onConfirm ( ) { return m ( this , null , function * ( ) { let a = { } ; try { t . value && ( a = JSON . parse ( t . value ) ) } catch ( h ) { _ . error ( "JSON 格式错误,请检查" ) ; return } const e = s . value ; if ( e != null && e . id ) { o . lock ( ) ; try { yield N ( { id : e . id , configData : a , enabled : e . enabled } ) , yield o . close ( ) , l ( "success" ) , _ . success ( "配置已保存" ) } finally { o . unlock ( ) } } } ) } , onOpenChange ( a ) { return m ( this , null , function * ( ) { if ( i . value = a , ! a ) { s . value = null , t . value = "" ; return } const e = o . getData ( ) ; s . value = e != null ? e : null , t . value = e != null && e . configData && Object . keys ( e . configData ) . length > 0 ? JSON . stringify ( e . configData , null , 2 ) : ` {
} ` })}});return(a,e)=>(b(),y(g(n),{title:r.value},{default:T(()=>[w("div",V,[i.value?(b(),y(g(C),{key:0,value:t.value,bordered:!0,"auto-format":!1,onChange:c},null,8,["value"])):J("",!0)])]),_:1},8,["title"]))}});export{M as default};