unione-form-vue 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,26 +1,26 @@
1
- (function(ee,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@hufe921/canvas-editor"),require("dayjs"),require("prismjs"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@hufe921/canvas-editor","dayjs","prismjs","@ant-design/icons-vue","uuid"],K):(ee=typeof globalThis<"u"?globalThis:ee||self,K(ee.index={},ee.UnioneBaseVue,ee.Vue,ee.antDesignVue,ee.lodashEs,ee.vueCodemirror,ee.langJavascript,ee.canvasEditor,ee.dayjs,ee.prism,ee.iconsVue,ee.uuid))})(this,function(ee,K,t,te,Aa,Zt,xa,he,Ca,Ol,it,va){"use strict";const Sa={isDebug:!0,axios:{form:"/portal",flow:"/flow"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},hn=t.ref(Sa);function Le(a){return a&&(hn.value=K.utils.obj.ext(a,hn.value)),hn.value}const Ba={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},Na={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},Va=t.ref([Ba,Na]);function Ra(a,e){return K.locales.loadLanguage(a,()=>new Promise((i,n)=>{const l=Va.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};i(s)}else{const s={...l[0],...o};i(s)}});else if(l.length==0){const o={...e,localeName:a};i(o)}else{const o={...l[0],...e};i(o)}else l.length>0?i(l[0]):n("local language not defined ,lang:"+a)}))}const fn={...K.locales};fn.loadLanguage=Ra;class Ea{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,i){this.$psn=t.ref(e),this.$pid=t.ref(""),this.$store=t.ref({}),this.$forms=t.ref({}),this.$params=t.ref({}),this.$refObj=t.ref({}),this.$refData=t.ref({}),this.$model=i}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const i in this.$store.value)this.$store.value[i].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,i){}setRefData(e,i,n){}use(e,i,n){let l=this.$store.value[e];return l||(l=new un(e,i,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),n&&(l.$form=n,this.$forms.value[e]=n),l}useForm(e,i,n){const l=this.use(e,"form",i);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{n&&n(o)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class un{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,i,n){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=i,this.$data=t.ref(i=="form"?{}:{body:[],total:0}),this.$dialog=K.useDialog(),this.$model=n||t.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}reset(e){this.$data.value=e||{},this.$form?.setValue(e||{})}$processParams(e,i){if(i)i.forEach(n=>{e[n.name]==null&&e[n.name]==null&&(this.$params[n.name]!=null&&this.$params[n.name]!=null?e[n.alias||n.name]=this.$params[n.name]:n.value!=null&&n.value!=null&&(e[n.alias||n.name]=n.value))});else if(this.$params)for(const n in this.$params)e[n]==null&&e[n]==null&&this.$params[n]!=null&&this.$params[n]!=null&&(e[n]=this.$params[n]);return e}request(e){return new Promise((i,n)=>{const l=te.message.loading("数据请求中..."),o=this.$store.controller+e.url;K.axios[this.$store.ctx||"form"]({method:"post",...e,url:o}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const i=this.$store.controller+(this.$store.findUrl||"/find");return!e&&this.$store.findParams&&(e={dsn:this.$dsn}),this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e&&(e.body=this.$processParams(e.body,this.$store.findParams)),new Promise((n,l)=>{const o=te.message.loading("数据加载中...");K.axios[this.$store.ctx||"form"]({url:i,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:i,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:i,params:e,err:s})}).finally(()=>{o()})})}save(e){const i=this.$store.controller+(this.$store.saveUrl||"/save");return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((n,l)=>{const o=te.message.loading("数据提交中...");K.axios[this.$store.ctx||"form"]({url:i,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||te.message.success(s.message),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:i,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:i,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((i,n)=>{const l=te.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";K.axios[this.$store.ctx||"form"]({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((i,n)=>{const l=te.message.loading("数据加载中..."),o=this.$store.controller+"/detail";K.axios[this.$store.ctx||"form"]({url:o,method:"post",headers:{"Content-Type":"application/json"},data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body),i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((i,n)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=te.message.loading("数据处理中..."),o=this.$store.controller+"/delete";K.axios[this.$store.ctx||"form"]({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Oa{$event;$onces;$delayEmit;constructor(){this.$event=t.ref({}),this.$onces=t.ref({}),this.$delayEmit=t.ref({})}$on(e,i){if(this.$event.value[e]=i,this.$delayEmit.value[e]){const n=this.$delayEmit.value[e];i(n)}}$emit(e,i){if(this.$onces.value[e]){const n=this.$onces.value[e];delete this.$onces.value[e],n(i)}this.$event.value[e]?this.$event.value[e](i):(this.$delayEmit.value[e]=i,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,i){this.$onces.value[e]=i}$off(e){delete this.$event.value[e]}}class dt{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const i=e.configs||{};this.model=t.ref("run"),this.type=t.ref(e.types||"setting"),this.define=t.ref(e),this.ebus=new Oa,this.$widgetList=t.ref([]),this.$widgetMap=t.ref({}),this.$dataManager=new Ea(i.dsnList?i.dsnList[0]:"",this.model),this.$axiosProccess=t.ref({}),this.$dialog=K.useDialog(),this.loadConfig(i)}sn(){return this.define.value.sn}load(e,i){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",i),i&&i.configs&&(this.define.value=i,this.type.value=this.define.value.types||"setting",this.loadConfig(i.configs));return}const n=sessionStorage.getItem("PAGE_DEFINE:"+e);if(n&&this.model.value=="run"){this.define.value=JSON.parse(n),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):i&&i.configs&&(this.define.value=i,this.loadConfig(i.configs))})}save(){return new Promise((e,i)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),i();return}this.$axiosProccess.value.save=!0;const n={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(n),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(te.message.success(o.message),this.define.value=o.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(o.body)):(this.$dialog.error({content:o.message}),i())}).catch(o=>{console.error("页面配置保存失败",o),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,i){if(i){const n={...i,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(n),n.configs?.widgets&&this.$processWidget(n.configs.widgets)),this.$widgetMap.value[e]=n}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(i=>{i.wid||(i.wid="w:"+Aa.uniqueId()),this.$widgetMap.value[i.wid]=i,i.configs?.widgets&&this.$processWidget(i.configs.widgets)})}dataManager(){return this.$dataManager}}const Ma={class:"widget-setting-dialog"},_a=t.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{expose:e,emit:i}){const n=i,l=t.ref(),o=t.ref(),s=t.ref(!1);function r(){o.value&&(s.value=!0),n("setting")}function c(){n("saving"),s.value=!1}function d(){return l.value?.clientHeight}function h(){return l.value?.clientWidth}return e({getHeight:d,getWidth:h}),(f,u)=>{const m=t.resolveComponent("SettingOutlined"),b=t.resolveComponent("a-tooltip"),A=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[t.createVNode(b,{title:a.settingTitle},{default:t.withCtx(()=>[a.model=="edit"&&(f.$slots["widget-setting"]||a.custome)?(t.openBlock(),t.createBlock(m,{key:0,class:"widget-setting",onClick:r})):t.createCommentVNode("",!0)]),_:1},8,["title"]),t.renderSlot(f.$slots,"default",{},void 0,!0),a.model=="edit"&&f.$slots["widget-setting"]?(t.openBlock(),t.createBlock(A,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":u[0]||(u[0]=C=>s.value=C),centered:"",width:"80%",onOk:c},{default:t.withCtx(()=>[t.createElementVNode("div",Ma,[t.renderSlot(f.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),ie=(a,e)=>{const i=a.__vccOpts||a;for(const[n,l]of e)i[n]=l;return i},ht=ie(_a,[["__scopeId","data-v-17b517f5"]]),Ta={key:0},Ia=["onClick"],wi=ie(t.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const i=a,n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{l.value.selectedRowKeys=g}}),o={mounted:g=>g.focus()},s=t.ref({});function r(){const g=Object.keys(s.value);if(g.length)for(let p in g){const N=A.value.form.action.params[p];N&&s.value[p]&&Object.keys(s.value[p]).forEach(M=>{N[M]=s.value[p][M]})}s.value={}}function c(g,p,N){r();const M={};M[N]=p[N]||"",N=="showIndex"&&(M[N]=p.show?.query?.index),s.value[g]=M}function d(g,p,N){if(!p||!N){s.value={};return}const M=s.value[g][N];p[N]=M,s.value={}}function h(){A.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=t.ref(""),m=t.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(g,p)=>u.value!=p&&i.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+i.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=t.ref([xa.javascript()]),A=t.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),C=t.ref();function w(g,p,N={}){g=JSON.parse(JSON.stringify(g)),g.event||(g.event={}),g.props||(g.props={}),g.action||(g.action={}),Object.keys(g.action).includes("maskClosable")||(g.action.maskClosable=!0),g.action.params||(g.action.params=[]),u.value=g.name,A.value.form=g,A.value.helps=N,A.value.visible=!0,C.value=p}const y=t.ref(null);function R(){y.value&&y.value.validate().then(()=>{A.value.visible=!1,C.value(A.value.form)})}return e({open:w,close}),(g,p)=>{const N=t.resolveComponent("a-input"),M=t.resolveComponent("a-form-item"),v=t.resolveComponent("a-select"),x=t.resolveComponent("a-input-number"),B=t.resolveComponent("a-checkbox"),V=t.resolveComponent("a-tab-pane"),k=t.resolveComponent("a-switch"),S=t.resolveComponent("a-button"),T=t.resolveComponent("a-divider"),O=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-tooltip"),$=t.resolveComponent("a-table"),I=t.resolveComponent("a-tabs"),j=t.resolveComponent("a-form"),P=t.resolveComponent("a-modal");return t.openBlock(),t.createBlock(P,{visible:A.value.visible,"onUpdate:visible":p[23]||(p[23]=E=>A.value.visible=E),title:A.value.title,centered:"",width:"50%",onOk:R},{default:t.withCtx(()=>[t.createVNode(j,{name:"basic",ref_key:"form",ref:y,rules:m.value,model:A.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:t.withCtx(()=>[t.createVNode(I,null,{default:t.withCtx(()=>[t.createVNode(V,{key:"base",tab:"基本设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"操作标题",required:"",name:"title"},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.title,"onUpdate:value":p[0]||(p[0]=E=>A.value.form.title=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"操作名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.name,"onUpdate:value":p[1]||(p[1]=E=>A.value.form.name=E),disabled:i.preset.includes(A.value.form.name)},null,8,["value","disabled"])]),_:1}),t.createVNode(M,{label:"操作图标"},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.icon,"onUpdate:value":p[2]||(p[2]=E=>A.value.form.icon=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.form.type,"onUpdate:value":p[3]||(p[3]=E=>A.value.form.type=E),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),t.createVNode(M,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(x,{value:A.value.form.index,"onUpdate:value":p[4]||(p[4]=E=>A.value.form.index=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮大小"},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.form.size,"onUpdate:value":p[5]||(p[5]=E=>A.value.form.size=E),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮特性"},{default:t.withCtx(()=>[t.createVNode(B,{checked:A.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=E=>A.value.form.props.block=E)},{default:t.withCtx(()=>p[24]||(p[24]=[t.createTextVNode("自适应 ")])),_:1},8,["checked"]),t.createVNode(B,{checked:A.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=E=>A.value.form.props.danger=E)},{default:t.withCtx(()=>p[25]||(p[25]=[t.createTextVNode("危险 ")])),_:1},8,["checked"]),t.createVNode(B,{checked:A.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=E=>A.value.form.props.ghost=E)},{default:t.withCtx(()=>p[26]||(p[26]=[t.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),t.createVNode(V,{key:"action",tab:"响应设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"响应方式",required:""},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.form.action.type,"onUpdate:value":p[9]||(p[9]=E=>A.value.form.action.type=E),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=E=>A.value.form.action.psn=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.action.component,"onUpdate:value":p[11]||(p[11]=E=>A.value.form.action.component=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(M,{label:"连接地址"},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.action.href,"onUpdate:value":p[12]||(p[12]=E=>A.value.form.action.href=E)},null,8,["value"])]),_:1}),["link","route"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:2,label:"连接方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.form.action.target,"onUpdate:value":p[13]||(p[13]=E=>A.value.form.action.target=E),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:3,label:"抽屉位置"},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.form.action.position,"onUpdate:value":p[14]||(p[14]=E=>A.value.form.action.position=E),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:4,label:"显示标题",required:""},{default:t.withCtx(()=>[t.createVNode(N,{value:A.value.form.action.title,"onUpdate:value":p[15]||(p[15]=E=>A.value.form.action.title=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:5,label:"蒙层关闭"},{default:t.withCtx(()=>[t.createVNode(k,{checked:A.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=E=>A.value.form.action.maskClosable=E),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:6,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(x,{value:A.value.form.action.width,"onUpdate:value":p[17]||(p[17]=E=>A.value.form.action.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["dialog"].includes(A.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:7,label:"显示高度"},{default:t.withCtx(()=>[t.createVNode(x,{value:A.value.form.action.height,"onUpdate:value":p[18]||(p[18]=E=>A.value.form.action.height=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(T,{orientation:"left"},{default:t.withCtx(()=>[p[29]||(p[29]=t.createTextVNode("参数列表 ")),t.createVNode(S,{size:"small",class:"param-btn",onClick:h},{default:t.withCtx(()=>p[27]||(p[27]=[t.createTextVNode("添加")])),_:1}),t.createVNode(S,{size:"small",class:"param-btn",danger:"",onClick:f},{default:t.withCtx(()=>p[28]||(p[28]=[t.createTextVNode("删除")])),_:1})]),_:1}),t.createVNode($,{columns:n.value,"data-source":A.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:E})=>[["name","title"].includes(E.key)?(t.openBlock(),t.createElementBlock("span",Ta,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(E.title),1)])):t.createCommentVNode("",!0),["value"].includes(E.key)?(t.openBlock(),t.createBlock(_,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:t.withCtx(()=>[t.createElementVNode("span",null,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(E.title),1)])]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:E,text:J,record:F,index:z})=>[["name","title","value"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!s.value[z]||!Object.keys(s.value[z]).includes(E.dataIndex))&&!J&&"empty"]),onClick:pe=>c(z,F,E.dataIndex)},[s.value[z]&&Object.keys(s.value[z]).includes(E.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(N,{key:0,value:s.value[z][E.dataIndex],"onUpdate:value":pe=>s.value[z][E.dataIndex]=pe,onBlur:pe=>d(z,F,E.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(J),1)],64))],10,Ia)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),t.createVNode(V,{key:"event",tab:"事件设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"点击事件",help:A.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=E=>A.value.form.event.clickScript=E),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"禁用逻辑",help:A.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=E=>A.value.form.event.disableScript=E),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"显示逻辑",help:A.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=E=>A.value.form.event.visibleScript=E),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"动态标题",help:A.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=E=>A.value.form.event.titleScript=E),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Fa=["src"],Da=["src"],$a=ie(t.defineComponent({__name:"btn",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const i=Le(),n=a,l=K.useSession();t.watch(()=>n.widget?.event,()=>{r()}),t.onMounted(()=>{r()});const o=t.ref({...n.editor?.widget(n.wid)||n.widget||{}}),s=t.ref({});function r(){o.value?.event&&(o.value.event.clickScript?s.value.click=new Function("ctx","btn","event",o.value.event.clickScript):o.value.event.click&&(s.value.click=o.value.event.click),o.value.event.disableScript?s.value.disable=new Function("ctx","btn",o.value.event.disableScript):o.value.event.disable&&(s.value.disable=o.value.event.disable),o.value.event.visibleScript?s.value.visible=new Function("ctx","btn",o.value.event.visibleScript):o.value.event.visible&&(s.value.visible=o.value.event.visible),o.value.event.titleScript?s.value.title=new Function("ctx","btn",o.value.event.titleScript):o.value.event.title&&(s.value.title=o.value.event.title)),typeof o.value.click=="function"&&(s.value.click=o.value.click),typeof o.value.title=="function"&&(s.value.title=o.value.title),typeof o.value.visible=="function"&&(s.value.visible=o.value.visible),typeof o.value.disabled=="function"&&(s.value.disable=o.value.disabled)}const c=t.computed(()=>s.value.title?s.value.title(m.value,o.value):o.value.title),d=t.computed(()=>s.value.visible?s.value.visible(m.value,o.value)!=!1:o.value.visible!=!1),h=t.computed(()=>n.disabled==!0?!0:s.value.disable?s.value.disable(m.value,o.value):o.value.disable==!0),f=t.ref(null);function u(){f.value?.open(o.value,p=>{console.log("btn props",p),Object.keys(p).forEach(N=>{o.value[N]=p[N]}),console.log("props btn",o.value)})}const m=t.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),b=t.ref({open:!1}),A=t.computed(()=>{if(o.value.action?.href){let p=o.value.action.href;const N=p.matchAll("{[a-zA-Z.]*}"),M=[];let v=null;for(;v=N.next();){if(v&&v.value&&v.value[0]){let x=v.value[0].substring(1,v.value[0].length-1);M.includes(x)||M.push(x)}if(v.done)break}if(M.length>0)for(let x=0;x<M.length;x++){let B=M[x],V=K.utils.obj.getValue(m.value,B);V?V instanceof Object?p=p.replaceAll("{"+B+"}",JSON.stringify(V)):Array.isArray(V)?p=p.replaceAll("{"+B+"}",V.join(",")):p=p.replaceAll("{"+B+"}",V):p=p.replaceAll("{"+B+"}","")}return p}return""}),C=t.computed(()=>{const p={};let N=o.value.action?.href||o.value.action?.link;if(N){const M=N.matchAll("{[a-zA-Z0-9.]*}"),v=[];let x=null;for(;x=M.next();){if(x&&x.value&&x.value[0]){let V=x.value[0].substring(1,x.value[0].length-1);v.includes(V)||v.push(V)}if(x.done)break}if(v.length>0)for(let V=0;V<v.length;V++){let k=v[V],S=K.utils.obj.getValue(m.value,k);S?S instanceof Object?N=N.replaceAll("{"+k+"}",JSON.stringify(S)):Array.isArray(S)?N=N.replaceAll("{"+k+"}",S.join(",")):N=N.replaceAll("{"+k+"}",S):N=N.replaceAll("{"+k+"}","")}const B=N.split("?")[1];B&&B.split("&").forEach(V=>{const k=V.split("=");k[0]&&k[1]&&(p[k[0]]=k[1])})}return o.value.action?.params&&o.value.action.params.filter(M=>M.value+"").forEach(M=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(M.value)){let x=K.utils.obj.getValue(m.value,M.value);p[M.name]=x}else p[M.name]=M.value}),p}),w=e,y=t.inject("router");function R(p){if(i.isDebug&&console.log("unione btn click",o.value,p),!(s.value.click&&s.value.click(m.value,o.value,p)==!1)){if(o.value.action?.type=="drawer"||o.value.action?.type=="dialog")b.value.open=!0;else if(o.value.action?.type=="route"&&(o.value.action?.href||o.value.action?.link)){if(o.value.action.link&&n.editor?.type.value=="code")return;y.push({path:o.value.action.href||o.value.action?.link,query:C.value})}w("click",{btn:o.value,event:p})}}function g(p){w("click",p)}return(p,N)=>{const M=t.resolveComponent("a-button"),v=t.resolveComponent("unione-btn"),x=t.resolveComponent("a-dropdown"),B=t.resolveComponent("a-drawer"),V=t.resolveComponent("a-modal");return d.value?(t.openBlock(),t.createBlock(ht,{key:0,class:t.normalizeClass(["unione-btn",o.value.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:u,custome:!0,"setting-title":"按钮设置"},{default:t.withCtx(()=>[!o.value.widget||o.value.widget=="button"?(t.openBlock(),t.createBlock(M,t.mergeProps({key:0,disabled:h.value,size:o.value.size||"small",type:a.type||a.widget.type,shape:o.value.shape,class:"unione-btn-"+o.value.name,loading:o.value.loading,target:o.value.action?.target,title:o.value.tooltip,onClick:R},o.value.props),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value)+" ",1)]),_:2},[o.value.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):t.createCommentVNode("",!0),o.value.widget=="dropdown"?(t.openBlock(),t.createBlock(x,{key:1,trigger:[o.value.trigger||"hover"],class:t.normalizeClass([o.value.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["dropdown-overlay",o.value.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.items,k=>(t.openBlock(),t.createBlock(v,{key:k.name,class:"item",widget:k,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:g},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(M,{size:o.value.size||"small"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):t.createCommentVNode("",!0),o.value.action?.type=="drawer"?(t.openBlock(),t.createBlock(B,{key:2,open:b.value.open,"onUpdate:open":N[0]||(N[0]=k=>b.value.open=k),title:o.value.action?.title,placement:o.value.action?.position,maskClosable:o.value.action?.maskClosable,width:o.value.action?.width,bodyStyle:{padding:0,overflow:!o.value.action.component||o.value.action.component=="iframe"?"hidden":"auto"}},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:A.value},null,8,Fa)):t.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):t.createCommentVNode("",!0),o.value.action?.type=="dialog"?(t.openBlock(),t.createBlock(V,{key:3,open:b.value.open,"onUpdate:open":N[1]||(N[1]=k=>b.value.open=k),title:o.value.action?.title,width:o.value.action?.width,maskClosable:o.value.action?.maskClosable,centered:"",footer:null},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:A.value,style:t.normalizeStyle({height:o.value.action?.height?o.value.action?.height+"px":""})},null,12,Da)):t.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):t.createCommentVNode("",!0),t.createVNode(wi,{ref_key:"btnSetting",ref:f,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-02b17517"]]),Pa={key:0,class:"unione-widget-empty-tip"},La=ie(t.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,i=t.ref(),n=t.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=t.resolveComponent("a-tab-pane"),r=t.resolveComponent("a-tabs");return t.openBlock(),t.createBlock(ht,{class:t.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:t.withCtx(()=>[n.value?(t.openBlock(),t.createBlock(r,{key:0,activeKey:i.value,"onUpdate:activeKey":o[0]||(o[0]=c=>i.value=c)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value.chidlren,(c,d)=>(t.openBlock(),t.createBlock(s,{key:d,class:"unione-layout-tab-pane"},{tab:t.withCtx(()=>[t.createElementVNode("span",null,[c.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.icon),{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(c.title),1)])]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.chidlren,(h,f)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(t.openBlock(),t.createElementBlock("div",Pa,t.toDisplayString(c.emptyTips),1)):t.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):t.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Ua={class:"title"},ja={class:"text"},za={key:0,class:"reactive"},qa={key:1,class:"opts"},Qa={class:"warp"},Ka=ie(t.defineComponent({__name:"section",props:t.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,i=t.computed(()=>e.editor?.widget(e.wid)||e.widget),n=t.computed(()=>i.value?.title||e.title),l=t.computed(()=>i.value?.icon||e.icon),o=t.computed(()=>i.value?.type||e.type),s=t.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,d)=>(t.openBlock(),t.createBlock(ht,{class:t.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[t.createElementVNode("div",Ua,[o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["type",o.value])},null,2)):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),{key:1,class:"icon"})):t.createCommentVNode("",!0),t.createElementVNode("span",ja,t.toDisplayString(n.value),1)]),a.reactive?(t.openBlock(),t.createElementBlock("div",za,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):t.createCommentVNode("",!0),a.location=="left"?(t.openBlock(),t.createElementBlock("div",qa,[t.renderSlot(c.$slots,"opts",{},void 0,!0)])):t.createCommentVNode("",!0)],2),t.withDirectives(t.createElementVNode("div",Qa,[t.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Wa={class:"unione-props-setting unione-form-setting"},Ya={class:"unione-form-btns"},Ha={key:0},Ga=["onClick"],Ja={class:"field-txt"},Xa=["onClick"],Za={key:1,class:"field-txt"},er=["onClick"],tr={key:0,class:"field-txt"},ir={key:3,class:"edit-field"},nr={key:0},lr=["onClick"],or=ie(t.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.settings||(v.configs.settings={}),v.configs.settings.btns||(v.configs.settings.btns=[]),v}),l=t.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{const v=n.value.configs.settings.btns,x=v.map(B=>B.name);if(!x.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};v.splice(B.index,0,B)}if(!x.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let V=B.index||1;v.splice(V,0,B)}if(!x.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};v.splice(B.index,0,B)}if(!x.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};v.splice(B.index,0,B)}return v}),s=t.ref(null);function r(v){s.value&&s.value.open(v,x=>{x.visible=!0,Object.keys(x).forEach(B=>{v[B]=x[B]}),n.value.configs.settings.btns.sort((B,V)=>{const k=B.index||1,S=V.index||1;return k-S}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const v=n.value.configs.settings.btns.length+1;let x={title:"新增",name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x.name="new_"+n.value.configs.settings.btns.length;const B=n.value.configs.settings.btns.filter(V=>V.name==x.name).length;B>0&&(x.name=x.name+B),n.value.configs.settings.btns.push(x),e.editor.widget(e.wid,n.value),s.value.open(x,V=>{Object.keys(V).forEach(k=>{x[k]=V[k]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(v){const x=()=>{if(["save","submit","reset","back"].includes(v.name))v.visible=!1,n.value.configs.settings.btns=[...n.value.configs.settings.btns];else{const B=[];n.value.configs.settings.btns.forEach(V=>{V.name!=v.name&&B.push(V)}),n.value.configs.settings.btns=B}};te.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{x()}})}const h=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:v=>{const x=h.value.widgets.filter(B=>B.value==v);return x[0]?x[0].label:v},toSetting:()=>{}}),f=t.ref({visible:!1,field:{},props:{},showInfo:v=>{let x="";return v.rules&&(x=v.rules.filter(B=>B.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const v=f.value.props,x={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(x.min=v.rangeMin,x.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(x.max=v.rangeMax,x.enable=!0);const B={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(B.pattern=v.regExpress,B.enable=!0),f.value.field.rules=[x,B],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(v){f.value.visible=!0,f.value.field=v;const x=v.rules||[],B={trigger:"change",whitespace:!0};x.forEach(V=>{V.name=="reg"&&(B.trigger=V.trigger,B.whitespace=V.whitespace,B.regExpress=V.pattern,B.regMessage=V.message),V.name=="range"&&(B.rangeMin=V.min,B.rangeMax=V.max,B.rangeMessage=V.message)}),f.value.props=B}const m=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(v,x){const B=y.value.filter(k=>k.name==v.name);B.forEach(k=>{x!="isSort"?k[x]=!0:k[x]=!k[x]});const V=B[0];if(!(!V||x=="isSort")){switch(m.value.prop=x,m.value.field=v,V.show||(V.show={}),x){case"isQuery":V.show.query||(V.show.query={}),m.value.show=V.show.query,m.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":V.show.form||(V.show.form={}),m.value.show=V.show.form,m.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":V.show.view||(V.show.view={}),m.value.show=V.show.view,m.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":V.show.list||(V.show.list={}),m.value.show=V.show.list,m.value.title=`列头设置/${v.title}(${v.name})`;break}m.value.visible=!0}}const A=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{A.value.convert.options||(A.value.convert.options=[]),A.value.convert.options.push({label:"",value:""})},toDelOption:(v,x)=>{A.value.convert.options.splice(v,1)},toSetting:()=>{A.value.visible=!1}});function C(v){A.value.visible=!0,A.value.field=v,A.value.convert=v.convert||{}}const w=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),y=t.computed(()=>w.value.fields?.length?w.value.fields:[]),R={mounted:v=>v.focus()},g=t.ref({});function p(v,x){const B={};x=="convertName"?B[x]=v.convert?.type:B[x]=v[x]||"",g.value={},g.value[v.name]=B}function N(v,x){{g.value={};return}}function M(v,x){y.value.filter(V=>V.name==v.name).forEach(V=>{V[x]=!V[x]})}return(v,x)=>{const B=t.resolveComponent("a-divider"),V=t.resolveComponent("CloseOutlined"),k=t.resolveComponent("a-button"),S=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-select"),O=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-checkbox"),$=t.resolveComponent("a-table"),I=t.resolveComponent("a-select-option"),j=t.resolveComponent("a-form-item"),P=t.resolveComponent("a-form"),E=t.resolveComponent("a-modal"),J=t.resolveComponent("a-checkbox-group"),F=t.resolveComponent("a-input-number"),z=t.resolveComponent("a-input"),pe=t.resolveComponent("a-col"),tt=t.resolveComponent("a-row");return t.openBlock(),t.createElementBlock("div",Wa,[t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[23]||(x[23]=[t.createTextVNode("按钮设置")])),_:1}),t.createElementVNode("div",Ya,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,L=>(t.openBlock(),t.createBlock(k,t.mergeProps({key:L.name,class:["btn",L.name,!L.visible&&"deleted"],type:L.visible?L.type:"default",size:L.size,ref_for:!0},L.props||{},{onClick:Oe=>r(L)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(L.title)+" ",1),L.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"btn-del",onClick:t.withModifiers(Oe=>d(L),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(k,{class:t.normalizeClass(["btn","btn-add"]),size:"small",onClick:x[0]||(x[0]=L=>c())},{default:t.withCtx(()=>[t.createVNode(S)]),_:1})]),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[24]||(x[24]=[t.createTextVNode("表单设置")])),_:1}),x[36]||(x[36]=t.createTextVNode(" 数据模型:")),t.createVNode(T,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":x[1]||(x[1]=L=>n.value.dataModel=L)},null,8,["options","value"]),t.createVNode($,{columns:i.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(t.openBlock(),t.createElementBlock("span",Ha,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(L.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:L,text:Oe,record:ne})=>[["rules"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!f.value.showInfo(ne)&&"empty"]),onClick:D=>u(ne)},[t.createElementVNode("span",Ja,t.toDisplayString(f.value.showInfo(ne)),1),f.value.showInfo(ne)?(t.openBlock(),t.createBlock(k,{key:0,type:"link"},{default:t.withCtx(()=>x[25]||(x[25]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Ga)):["widget"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!g.value[ne.name]||!Object.keys(g.value[ne.name]).includes(L.dataIndex))&&!Oe&&"empty"]),onClick:D=>p(ne,L.dataIndex)},[g.value[ne.name]&&Object.keys(g.value[ne.name]).includes(L.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:ne[L.dataIndex],"onUpdate:value":D=>ne[L.dataIndex]=D,options:h.value.widgets,onBlur:x[2]||(x[2]=D=>N())},null,8,["value","onUpdate:value","options"])),[[R]]):(t.openBlock(),t.createElementBlock("span",Za,t.toDisplayString(h.value.widgetName(Oe)),1))],10,Xa)):["convertName"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!g.value[ne.name]||!Object.keys(g.value[ne.name]).includes(L.dataIndex))&&!ne.convert?.type&&"empty"]),onClick:D=>p(ne,L.dataIndex)},[g.value[ne.name]&&Object.keys(g.value[ne.name]).includes(L.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:ne[L.dataIndex],"onUpdate:value":D=>ne[L.dataIndex]=D,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:x[3]||(x[3]=D=>N())},null,8,["value","onUpdate:value"])),[[R]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[ne.convert?.type?(t.openBlock(),t.createElementBlock("span",tr,t.toDisplayString(ne.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),ne.convert?.type?(t.openBlock(),t.createBlock(k,{key:1,type:"link",onClick:t.withModifiers(D=>C(ne),["stop"])},{default:t.withCtx(()=>x[26]||(x[26]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,er)):["isForm","isView"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",ir,[t.createVNode(_,{checked:ne[L.dataIndex],onClick:D=>M(ne,L.dataIndex)},null,8,["checked","onClick"]),t.createVNode(k,{type:"link",onClick:D=>b(ne,L.dataIndex)},{default:t.withCtx(()=>x[27]||(x[27]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(E,{visible:h.value.visible,"onUpdate:visible":x[5]||(x[5]=L=>h.value.visible=L),title:"控件设置",onOk:h.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[h.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(j,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(T,{value:h.value.props.mode,"onUpdate:value":x[4]||(x[4]=L=>h.value.props.mode=L),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(I,{value:"multiple"},{default:t.withCtx(()=>x[28]||(x[28]=[t.createTextVNode("多选")])),_:1}),t.createVNode(I,{value:"tags"},{default:t.withCtx(()=>x[29]||(x[29]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(E,{visible:f.value.visible,"onUpdate:visible":x[13]||(x[13]=L=>f.value.visible=L),title:"规则设置",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[30]||(x[30]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(j,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(J,{value:f.value.props.trigger,"onUpdate:value":x[6]||(x[6]=L=>f.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(j,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(_,{value:f.value.props.whitespace,"onUpdate:value":x[7]||(x[7]=L=>f.value.props.whitespace=L),checked:f.value.props.whitespace},{default:t.withCtx(()=>x[31]||(x[31]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[32]||(x[32]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(j,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(F,{value:f.value.props.rangeMin,"onUpdate:value":x[8]||(x[8]=L=>f.value.props.rangeMin=L)},null,8,["value"]),x[33]||(x[33]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(F,{value:f.value.props.rangeMax,"onUpdate:value":x[9]||(x[9]=L=>f.value.props.rangeMax=L)},null,8,["value"])]),_:1}),t.createVNode(j,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.rangeMessage,"onUpdate:value":x[10]||(x[10]=L=>f.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[34]||(x[34]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(j,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.regExpress,"onUpdate:value":x[11]||(x[11]=L=>f.value.props.regExpress=L)},null,8,["value"])]),_:1}),t.createVNode(j,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.regMessage,"onUpdate:value":x[12]||(x[12]=L=>f.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(E,{visible:m.value.visible,"onUpdate:visible":x[20]||(x[20]=L=>m.value.visible=L),title:m.value.title,onOk:m.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(j,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(F,{value:m.value.show.index,"onUpdate:value":x[14]||(x[14]=L=>m.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(j,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.width,"onUpdate:value":x[15]||(x[15]=L=>m.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.labelWidth,"onUpdate:value":x[16]||(x[16]=L=>m.value.show.labelWidth=L)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.valueWidth,"onUpdate:value":x[17]||(x[17]=L=>m.value.show.valueWidth=L)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(T,{value:m.value.show.fixed,"onUpdate:value":x[18]||(x[18]=L=>m.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(T,{value:m.value.show.align,"onUpdate:value":x[19]||(x[19]=L=>m.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(E,{visible:A.value.visible,"onUpdate:visible":x[22]||(x[22]=L=>A.value.visible=L),title:A.value.convert.type=="dict"?"字典设置":"选项设置",onOk:A.value.toSetting},{default:t.withCtx(()=>[A.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",nr,[t.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:A.value.toAddOption},{default:t.withCtx(()=>x[35]||(x[35]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode($,{columns:A.value.optionColumn,"data-source":A.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:L,record:Oe,index:ne})=>[L.dataIndex==="label"?(t.openBlock(),t.createBlock(z,{key:0,value:Oe.label,"onUpdate:value":D=>Oe.label=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),L.dataIndex==="value"?(t.openBlock(),t.createBlock(z,{key:1,value:Oe.value,"onUpdate:value":D=>Oe.value=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),L.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:D=>A.value.toDelOption(ne,Oe)},"删除",8,lr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),A.value.convert.type=="dict"?(t.openBlock(),t.createBlock(P,{key:1,model:A.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(tt,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(pe,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(j,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(z,{value:A.value.convert.dict,"onUpdate:value":x[21]||(x[21]=L=>A.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(wi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),sr={key:0,class:"form-left"},ar={class:"form-warp"},rr={key:1,class:"form-right"},cr=ie(t.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const i=a,n=t.ref(!1),l=t.ref(),o=t.ref({}),s=t.ref(null);t.onMounted(()=>{if(c.value.dsn){const p=r.value.dataManager();c.value.primary&&p.psn(c.value.dsn),s.value.setDisabled=g,s.value.getValue=A,s.value.setValue=C,s.value.reset=w,l.value=p.useForm(c.value.dsn,s.value,N=>{o.value=N.body||{}})}i.editor||r.value.loadConfig({widgets:d.value}),i.form?.model&&r.value.setModel(i.form.model),y()});const r=t.computed(()=>i.editor||new dt),c=t.computed(()=>i.widget||i.form||{}),d=t.computed(()=>{let p=c.value.widgets||[];return!p.length&&i.form?.fields&&(p=i.form.fields),p.forEach(N=>{N.widget||(N.widget="unione-form-item"),N.control||(N.control="a-input")}),p}),h=t.computed(()=>d.value.filter(p=>p.float=="left")),f=t.computed(()=>d.value.filter(p=>!p.float)),u=t.computed(()=>d.value.filter(p=>p.float=="right")),m=t.inject("pageSetting",{}),b=t.computed(()=>c.value.setting||m?.form||{});t.provide("formSetting",b.value);function A(){return o.value}function C(p){o.value=p,y()}function w(){o.value={},y()}function y(){const p=N=>{N.widget=="unione-form-item"&&N.name&&(N.value!=null&&N.value!=null&&N.value!=""||N.value==0)&&(o.value[N.name]==null||o.value[N.name]==null||o.value[N.name]=="")&&(o.value[N.name]=N.value),N.widgets?.forEach(M=>{p(M)})};d.value.forEach(N=>{p(N)})}function R(){return s.value.validate()}function g(p=!0){n.value=p}return e({validate:R,getValue:A,setValue:C,reset:w,setDisabled:g}),(p,N)=>{const M=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ht,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},t.createSlots({default:t.withCtx(()=>[t.createVNode(M,{ref_key:"formObj",ref:s,model:o.value,class:t.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(b.value.showColumn||3)])},{default:t.withCtx(()=>[h.value?.length?(t.openBlock(),t.createElementBlock("div",sr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0),t.createElementVNode("div",ar,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),u.value?.length?(t.openBlock(),t.createElementBlock("div",rr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:2},[a.editor&&c.value.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(or,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-12b27d37"]]);function Ml(a,e=!1){const i=Le();if(!a)return Promise.reject("字典名称不能为空");const n=localStorage.getItem("UNIONE-DICT-"+a);return n&&e==!1?Promise.resolve(JSON.parse(n)):(i.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{K.axios.admin({url:"/api/base/dict/load/"+a}).then(s=>{if(s.success){const r=s.body.filter(c=>c.dictName!=c.dictKey);r.forEach(c=>{c.value=c.dictKey,c.label=c.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):o("字典加载失败,dict:"+a+",字典项列表为空")}else i.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function _l(a,e){const i=Le();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Ml(a),l=n.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(i.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",n),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function dr(a,e){const i=await _l(a,e);return Promise.resolve(i.dictValue)}const Tl={load:Ml,getLabel:dr,getOption:_l};class Qe{types;convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.types=e.types,this.convertObj=e,this.options=e.options||[],this.config=Le()}load(e,i=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(n=>n.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((n,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Tl.load(this.convertObj.dictName,i).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),n(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((n,l)=>{const o={body:this.convertObj.params||{}};this.convertObj.pidField&&(o.pid=-1);const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?n(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(d=>d.value==e).length?n(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,K.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(d=>{if(d.success){const h={};this.options.forEach(f=>{h[e]=!0}),d.body.forEach(f=>{h[f.value]||this.options.push(f)}),n(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?Tl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const i=this.convertObj.options.filter(n=>n.value==e);return i.length?Promise.resolve(i[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const i=this.options.filter(n=>n.value==e);if(i.length)return Promise.resolve(i[0].label)}return new Promise((i,n)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return i(o[0].label);n()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((n,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],n(s.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,s),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+s.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){if(this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option")return Promise.resolve(this.options.filter(n=>n.label.indexOf(e)>=0));const i={...this.convertObj.params||{}};return new Promise(n=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:l,data:{body:{...i,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),n(o.body)):n([])})})}$processOptions(e){return this.convertObj.types=="local"&&!this.convertObj.process&&e.forEach(i=>{this.convertObj.idField&&(i.id=i[this.convertObj.idField]),this.convertObj.pidField&&(i.pid=i[this.convertObj.pidField]),i.value=i[this.convertObj.valueField||"id"],i.label=i[this.convertObj.labelField||"title"]}),this.convertObj.process?this.convertObj.process(e):e}}function At(a,e=350){let i=null;return n=>{clearTimeout(i),i=setTimeout(()=>{a(n)},e)}}const hr=["innerHTML"],fr={key:2,class:"text-view"},ur=ie(t.defineComponent({__name:"formItem",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.computed(()=>o.value.showFormat?o.value.showFormat.call(this,i.value,{label:C.value,form:e.formValue}):C.value||i.value),l=t.inject("formSetting");t.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(i.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?i.value=s.value.value.split(","):i.value=[s.value.value])))});const o=t.ref({}),s=t.computed(()=>{const w=e.editor?.widget(e.wid)||e.widget||{};return w.event&&Object.keys(w.event).forEach(y=>{const R=w.event[y];R&&(o.value[y]=null,typeof R=="function"?o.value[y]=R:R.enable&&R.scriptText&&(o.value[y]=new Function("value","ctx",R.scriptText)))}),w}),r=t.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=t.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=At(()=>{if(o.value.change)return o.value.change(e.formValue[s.value.name],e.formValue)||s.value.change;s.value.change&&s.value.change(e.formValue[s.value.name],e.formValue)}),h=t.ref({}),f=t.computed(()=>{const w=[],y=s.value.rule||{};let R=s.value.props?.required||s.value.required;if(o.value.required&&(R=o.value.required(e.formValue[s.value.name],e.formValue)),R&&w.push({required:!0,whitespace:y?.whitespace||!1,trigger:y?.trigger||l.ruleTrigger||"change",validator:(g,p)=>(y?.whitespace&&p&&typeof p=="string"&&(p=p.trim()),p!=null&&p!=null&&(p+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),y.advance&&h.value[y.advance]){const g=h.value[y.advance];w.push({pattern:g.pattern,message:g.message||"表单验证不通过!",trigger:y.trigger||l.ruleTrigger||"change"})}return y.regExpress&&w.push({pattern:y.regExpress,message:y.regMessage||"表单验证不通过!",trigger:y.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&w.push({validator:(g,p)=>p&&(p+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(p+"").length+"]"):Promise.resolve(),trigger:y?.trigger||l.ruleTrigger||"change"}),w}),u=t.computed(()=>{const w=s.value.props||{};if(s.value.control=="a-input-number"){const y=s.value.rule||{};y.rangeMin!=null&&y.rangeMin!=null&&(w.min=y.rangeMin),y.rangeMax!=null&&y.rangeMax!=null&&(w.max=y.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(w.format=s.value.view.dataFormat,w.valueFormat=s.value.view.dataFormat),s.value.required&&(w.required=s.value.required),w}),m=t.computed(()=>{const w=s.value.css||{},y=["form-item-"+s.value.name];return w.cssName&&y.push(w.cssName),l.platform=="app"?w.cssName?typeof w.cssName=="string"&&w.cssName.indexOf("all-line")<0&&y.push("all-line"):y.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!w.cssName||typeof w.cssName=="string"&&w.cssName.indexOf("all-line")<0)&&y.push("all-line"):s.value.view.width==2&&y.push("2in-line")),y}),b=t.computed(()=>{const w=l.showColumn||3;let y=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&w>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(y/w)}:s.value.view?.width>=3&&w>1?{span:Math.round(y/w)}:{span:y}}),A=t.computed(()=>{const w=l.showColumn||3;let y=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&w>1&&m.value.includes("all-line")?{}:{span:y}}),C=t.ref();return t.watch(i,()=>{i.value&&e.editor?.model.value=="view"&&s.value.convert&&new Qe(s.value.convert).convert(i.value.toString()).then(w=>{C.value=w})}),(w,y)=>{const R=t.resolveComponent("a-form-item");return t.openBlock(),t.createBlock(ht,{class:t.normalizeClass(["unione-form-item",m.value]),style:t.normalizeStyle(s.value.css?.cssText)},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(R,{key:0,label:c.value,name:s.value.name,labelCol:b.value,wrapperCol:A.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:t.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value.control||"a-input"),t.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:t.unref(d),value:i.value,"onUpdate:value":y[0]||(y[0]=g=>i.value=g),formValue:a.formValue},u.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:n.value},null,8,hr)):(t.openBlock(),t.createElementBlock("div",fr,t.toDisplayString(n.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):t.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),pr=ie(t.defineComponent({__name:"selectBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object},mode:{type:String,default:"combobox"},valueType:{type:String,default:"string"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Le();const e=a,i=t.ref(),n=t.useModel(a,"value"),l=t.ref([]),o=t.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=t.computed(()=>{const b=u.value.convert||e.convert||{};if(b.refValue){const A={};return b.refValue.split(",").forEach(w=>{const y=w.split("=");y.length==1?A[y[0]]=K.utils.obj.getValue(e.formValue,y[0]):A[y[0]]=K.utils.obj.getValue(e.formValue,y[1])}),A}return{}}),r=t.computed(()=>(u.value.convert||e.convert||{}).search||!1),c=At(b=>{const A=u.value.convert||e.convert||{};A.params={...h.value,...s.value},m.value.search(b).then(C=>{l.value=C})},500);function d(b,A){f.value.select&&f.value.select(b,{option:A,formValue:e.formValue})}const h=t.ref();t.onMounted(()=>{const b=u.value.convert||e.convert||{};h.value=b.params||{},b.params={...h.value,...s.value},e.mode=="multiple"&&typeof n.value=="string"&&(i.value=n.value.split(",")),m.value.load(n.value).then(A=>{l.value=A})});const f=t.ref({}),u=t.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(A=>{const C=b.event[A];C&&(f.value[A]=null,typeof C=="function"?f.value[A]=C:C.enable&&C.scriptText&&(f.value[A]=new Function("value","ctx",C.scriptText)))}),b}),m=t.computed(()=>{const b=u.value.convert||e.convert||{};return new Qe(b)});return t.watch(n,At(()=>{n.value&&(e.mode=="multiple"&&typeof n.value=="string"&&(i.value=n.value.split(",")),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(n.value).then(b=>{l.value=b}))},200)),t.watch(()=>u.value.convert||e.convert||{},At(()=>{m.value.load().then(b=>{l.value=b})})),t.watch(()=>s.value,At(()=>{if(console.log(u.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const b=u.value.convert||e.convert||{};b.params={...h.value,...s.value},m.value.load(n.value,!0).then(A=>{l.value=A})}},200),{deep:!0}),t.watch(i,()=>{Array.isArray(i.value)&&e.valueType=="string"?n.value=i.value.join(","):n.value=i.value}),(b,A)=>{const C=t.resolveComponent("a-select");return t.openBlock(),t.createBlock(C,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:i.value,"onUpdate:value":A[0]||(A[0]=w=>i.value=w),onSearch:t.unref(c),onSelect:d},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-f4706b5f"]]),mr=ie(t.defineComponent({__name:"switchBox",props:t.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.ref({});t.onMounted(()=>{s.value?.load(i.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(n.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?n.value.checkedValue=!0:n.value.checkedValue=1):(n.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?n.value.unCheckedValue=!1:n.value.unCheckedValue=0)})})});const l=t.ref({}),o=t.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(c=>{const d=r.event[c];d&&(l.value[c]=null,typeof d=="function"?l.value[c]=d:d.enable&&d.scriptText&&(l.value[c]=new Function("value","ctx",d.scriptText)))}),r}),s=t.computed(()=>{const r=o.value.convert||e.convert;return r?new Qe(r):null});return(r,c)=>{const d=t.resolveComponent("a-switch");return t.openBlock(),t.createBlock(d,t.mergeProps({class:"unione-form-switch"},n.value,{checked:i.value,"onUpdate:checked":c[0]||(c[0]=h=>i.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),gr=ie(t.defineComponent({__name:"radioBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.ref([]),l=t.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=t.computed(()=>{const h=c.value.convert||e.convert||{};if(h.refValue){const f={};return h.refValue.split(",").forEach(m=>{const b=m.split("=");b.length==1?f[b[0]]=K.utils.obj.getValue(e.formValue,b[0]):f[b[0]]=K.utils.obj.getValue(e.formValue,b[1])}),console.log(c.value.name+" ref field:"+h.refValue+",ref value",f),f}return{}}),s=t.ref();t.onMounted(()=>{const h=c.value.convert||e.convert||{};s.value=h.params||{},h.params={...s.value,...o.value},d.value.load(i.value||c.value.value).then(f=>{n.value=f})});const r=t.ref({}),c=t.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];u&&(r.value[f]=null,typeof u=="function"?r.value[f]=u:u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText)))}),h}),d=t.computed(()=>{const h=c.value.convert||e.convert||{};return new Qe(h)});return t.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const h=c.value.convert||e.convert||{};h.params={...s.value,...o.value},d.value.load(void 0,!0).then(f=>{n.value=f})}},{deep:!0}),(h,f)=>{const u=t.resolveComponent("a-radio-group");return t.openBlock(),t.createBlock(u,{class:"unione-form-radio",options:l.value,value:i.value,"onUpdate:value":f[0]||(f[0]=m=>i.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),kr=ie(t.defineComponent({__name:"checkBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},returnType:{type:String,default:"string"},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const i=a,n=t.useModel(a,"value"),l=t.ref(),o=t.ref([]),s=t.computed(()=>o.value?.length?o.value:i.options?.length?i.options:[]),r=t.computed(()=>{const b=h.value.convert||i.convert||{};if(b.refValue){const A={};return b.refValue.split(",").forEach(w=>{const y=w.split("=");y.length==1?A[y[0]]=K.utils.obj.getValue(i.formValue,y[0]):A[y[0]]=K.utils.obj.getValue(i.formValue,y[1])}),console.log(h.value.name+" ref field:"+b.refValue+",ref value",A),A}return{}}),c=t.ref();t.onMounted(()=>{const b=n.value||h.value.value;i.returnType==="string"?l.value=b.split(","):l.value=b;const A=h.value.convert||i.convert||{};c.value=A.params||{},A.params={...c.value,...r.value},m.value.load().then(C=>{o.value=C})});const d=t.ref({}),h=t.computed(()=>{const b=i.editor?.widget(i.wid)||i.widget||{};return b.event&&Object.keys(b.event).forEach(A=>{const C=b.event[A];d.value[A]=null,C.enable&&C.scriptText&&(d.value[A]=new Function("value","ctx",C.scriptText))}),b}),f=e;function u(b){i.returnType==="string"?n.value=b.join(","):n.value=b,console.log("checkbox changed",n.value),f("change",n.value)}const m=t.computed(()=>{const b=h.value.convert||i.convert||{};return new Qe(b)});return t.watch(()=>n.value,()=>{l.value=Array.isArray(n.value)?n.value:[],n.value&&!Array.isArray(n.value)&&(l.value=n.value.split(","))}),t.watch(()=>r.value,()=>{if(console.log(h.value.name+" ref value changed",r.value),r.value){l.value=[],i.returnType==="string"?n.value="":n.value=[];const b=h.value.convert||i.convert||{};b.params={...c.value,...r.value},m.value.load(void 0,!0).then(A=>{o.value=A})}},{deep:!0}),(b,A)=>{const C=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createBlock(C,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":A[0]||(A[0]=w=>l.value=w),onChange:u},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),br=ie(t.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=t.ref(),i=t.useModel(a,"value");return t.watch(()=>e.value,()=>{e.value?i.value=K.utils.sm2Encrypt(e.value):i.value=""}),(n,l)=>{const o=t.resolveComponent("a-input-password");return t.openBlock(),t.createBlock(o,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=s=>e.value=s)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]);function pn(a){const e=a.toLowerCase().split("_"),i=[];i.push(e[0]);for(let n=1;n<e.length;n++){const l=e[n];l&&(i.push(l.charAt(0).toUpperCase()),l.length>1&&i.push(l.substring(1)))}return i.join("")}const Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Fl(a=10){const e=Date.now().toString(),i=new Uint32Array(a);crypto.getRandomValues(i);let n="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+i[l])%Il.length;n+=Il[o]}return n}const yr={toHump:pn,randomStr:Fl},wr=ie(t.defineComponent({__name:"randomInput",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},len:{type:Number,default:10}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value");function n(){i.value=Fl(e.len)}return(l,o)=>{const s=t.resolveComponent("SyncOutlined"),r=t.resolveComponent("a-input");return t.openBlock(),t.createBlock(r,{class:"unione-form-random-input",value:i.value,"onUpdate:value":o[0]||(o[0]=c=>i.value=c)},{suffix:t.withCtx(()=>[t.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:n})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),Ar=ie(t.defineComponent({__name:"uploadBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},btnLabel:{type:String,default:"上传文件"},valueType:{type:String,default:"array"},autoUpload:{type:Boolean,default:!1},beforeUpload:{type:Function,required:!1},disabled:{type:Boolean,default:!1}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const i=a,n=e,l=t.useModel(a,"value"),o=t.ref([]),s=t.computed(()=>!i.disabled||i.editor?.model.value!="view");t.watch(l,()=>{o.value=[],l.value&&(Array.isArray(l.value)?o.value=l.value:o.value=JSON.parse(l.value))});function r(d){return i.beforeUpload?i.beforeUpload(d):i.autoUpload}function c({fileList:d}){i.valueType=="array"?(l.value=d,n("change",d)):(l.value=JSON.stringify(d),n("change",JSON.stringify(d)))}return(d,h)=>{const f=t.resolveComponent("upload-outlined"),u=t.resolveComponent("a-button"),m=t.resolveComponent("a-upload");return t.openBlock(),t.createBlock(m,{class:"unione-form-upload-box","file-list":o.value,"onUpdate:fileList":h[0]||(h[0]=b=>o.value=b),disabled:!s.value,beforeUpload:r,onChange:c},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createBlock(u,{key:0},{default:t.withCtx(()=>[t.createVNode(f),t.createTextVNode(" "+t.toDisplayString(a.btnLabel),1)]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["file-list","disabled"])}}}),[["__scopeId","data-v-a6190474"]]),xr={class:"unione-props-setting unione-query-setting"},Cr={class:"unione-query-opts"},vr={key:0},Sr=["onClick"],Br={key:1},Nr={key:1,class:"edit-field"},Vr=["onClick"],Rr=ie(t.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:R})=>R+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),n=t.computed(()=>{const R=e.editor.widget(e.wid)||{};return R.configs||(R.configs={}),R.configs.btns||(R.configs.btns=[]),R}),l=t.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),o=t.computed(()=>{const R=[],g=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(p=>{R.push(p),g.push(p.name)}),g.includes("query")||R.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||R.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||R.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),R.sort((p,N)=>{const M=p.index||1,v=N.index||1;return M-v}),R}),s=t.ref(null);function r(R){s.value&&s.value.open(R,g=>{g.visible=!0,Object.keys(g).forEach(p=>{R[p]=g[p]}),n.value.configs.btns.sort((p,N)=>{const M=p.index||1,v=N.index||1;return M-v}),n.value.configs.btns=[...n.value.configs.btns]})}function c(){const R=n.value.configs.btns.length+1;let g={title:"新增",name:"new_"+R,size:"default",index:R,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.btns.push(g),e.editor.widget(e.wid,n.value),s.value.open(g,p=>{Object.keys(p).forEach(N=>{g[N]=p[N]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(R){const g=()=>{if(["query","reset","advanced"].includes(R.name))R.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const p=[];n.value.configs.btns.forEach(N=>{N.name!=R.name&&p.push(N)}),n.value.configs.btns=p}};te.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const h=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),f=t.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:R=>R.focus()},m=t.ref({});function b(){const R=Object.keys(m.value);if(R.length)for(let g in R){const p=f.value.filter(N=>N.name==g);if(p&&p[0]){let N=m.value[g];Object.keys(N).forEach(M=>{if(M=="showIndex"){const v=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...v,index:N[M]}}else p[0][M]=N[M]})}}m.value={}}function A(R,g){b();const p={};p[g]=R[g]||"",g=="showIndex"&&(p[g]=R.show?.query?.index),m.value[R.name]=p}function C(R,g){if(!R||!g){m.value={};return}const p=m.value[R.name][g];if(g=="showIndex"){const N=R.show?.query||{};R.show||(R.show={}),R.show.query={...N,index:p}}else R[g]=p;m.value={}}function w(R,g){f.value.filter(N=>N.name==R.name).forEach(N=>{N[g]=!N[g]})}const y=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:R=>{const g=y.value.options.filter(p=>p.value==R);return g[0]?g[0].label:R}});return(R,g)=>{const p=t.resolveComponent("a-divider"),N=t.resolveComponent("CloseOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("PlusOutlined"),x=t.resolveComponent("a-select"),B=t.resolveComponent("ToolOutlined"),V=t.resolveComponent("a-checkbox"),k=t.resolveComponent("a-input-number"),S=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",xr,[t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>g[3]||(g[3]=[t.createTextVNode("查询按钮")])),_:1}),t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,T=>(t.openBlock(),t.createBlock(M,t.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"default",ref_for:!0},T.props||{},{onClick:O=>r(T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(N,{key:0,class:"btn-del",onClick:t.withModifiers(O=>d(T),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(M,{class:t.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=T=>c()),size:"small"},{default:t.withCtx(()=>[t.createVNode(v)]),_:1})]),t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>g[4]||(g[4]=[t.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=t.createTextVNode(" 数据模型:")),t.createVNode(x,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":g[1]||(g[1]=T=>n.value.dataModel=T)},null,8,["options","value"]),t.createVNode(S,{columns:i.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:T})=>[["showIndex","queryType"].includes(T.key)?(t.openBlock(),t.createElementBlock("span",vr,[t.createVNode(B),t.createTextVNode(" "+t.toDisplayString(T.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:T,text:O,record:_})=>[["queryType"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!m.value[_.name]||!Object.keys(m.value[_.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>A(_,T.dataIndex)},[m.value[_.name]&&Object.keys(m.value[_.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(x,{key:0,value:_[T.dataIndex],"onUpdate:value":$=>_[T.dataIndex]=$,allowClear:!0,options:y.value.options,onBlur:g[2]||(g[2]=$=>C())},null,8,["value","onUpdate:value","options"])),[[u]]):(t.openBlock(),t.createElementBlock("span",Br,t.toDisplayString(y.value.showLabel(O)),1))],10,Sr)):["isQuery"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",Nr,[t.createVNode(V,{checked:_[T.dataIndex],onClick:$=>w(_,T.dataIndex)},null,8,["checked","onClick"])])):T.dataIndex=="showIndex"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!m.value[_.name]||!Object.keys(m.value[_.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>A(_,T.dataIndex)},[m.value[_.name]&&Object.keys(m.value[_.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(k,{key:0,value:m.value[_.name][T.dataIndex],"onUpdate:value":$=>m.value[_.name][T.dataIndex]=$,onBlur:$=>C(_,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_.show?.query?.index||" "),1)],64))],10,Vr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(wi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),Er={class:"query-btn"},Or={class:"btn-advanced-overlay"},Dl=ie(t.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const i=a,n=t.computed(()=>{const C=i.editor?.widget(i.wid)||i.widget||{};return C.btns||(C.btns=[]),C}),l=t.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=t.computed(()=>{let C=[];return n.value.fields?.length&&(C=n.value.fields),C.length==0&&i.fields?.length&&(C=i.fields),C.sort((w,y)=>{const R=w.show?.query?.index||1,g=y.show?.query?.index||1;return R-g}),C.forEach(w=>{!w.widget&&!w.control&&w.convert&&(w.widget="unione-select-box"),w.widget=w.widget||w.control||"a-input",w.defaultValue!=null&&w.defaultValue!="undefined"&&typeof w.defaultValue<"u"&&(h.value[w.name]=w.defaultValue,w.value=w.defaultValue)}),C}),s=t.computed(()=>n.value.labelWidth||7),r=t.computed(()=>{const C=n.value.btns.filter(w=>w.name=="advanced")[0]||{};return C.event?.clickScript&&(C.event.click=new Function("ctx","btn","event",C.event.clickScript)),C.event?.disableScript&&(C.event.disable=new Function("ctx","btn",C.event.disableScript)),C.event?.visibleScript&&(C.event.visible=new Function("ctx","btn",C.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...C}}),c=["query","reset","advanced"],d=t.computed(()=>{const C=n.value.btns.filter(y=>y.name!="advanced"),w=[];return C.forEach(y=>{y.size||(y.size="default"),w.push(y.name)}),w.includes("query")||C.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),w.includes("reset")||C.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),C.sort((y,R)=>{const g=y.index||1,p=R.index||1;return g-p}),C}),h=t.ref({}),f=t.computed(()=>{const C={};return n.value.params?Object.keys(n.value.params).forEach(w=>{C[w]=n.value.params[w]}):i.params&&Object.keys(i.params).forEach(w=>{C[w]=i.params[w]}),C});t.onMounted(()=>{i.editor?.ebus.$on("query-form-params",C=>{n.value.params=C}),b()});const u=e;function m({btn:C,event:w}){console.log("unione query form btn click",C,w),C.name=="query"&&b(),C.name=="reset"&&A(),u("btnClick",{btn:C,event:w})}function b(){const C=[];o.value.forEach(y=>{y.visible&&C.push(y.name)});const w={params:{...f.value},keywords:""};Object.keys(h.value).forEach(y=>{C.includes(y)&&(w.params[y]=h.value[y])}),l.value.visible&&h.value[l.value.name]&&(w.keywords=h.value[l.value.name]),u("query",w),i.editor?.ebus.$emit("table-list-search",w)}function A(){h.value={},o.value.forEach(w=>{w.visible=!1});const C={params:{...f.value},keywords:""};u("reset",C),i.editor?.ebus.$emit("table-list-reset",C)}return(C,w)=>{const y=t.resolveComponent("a-input"),R=t.resolveComponent("a-form-item"),g=t.resolveComponent("unione-btn"),p=t.resolveComponent("a-checkbox"),N=t.resolveComponent("DownOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("a-dropdown"),x=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ht,{class:"unione-query-form",model:i.editor?.model.value,"setting-title":"查询设置"},t.createSlots({default:t.withCtx(()=>[t.createVNode(x,{model:h.value,layout:"horizontal","label-col":{span:s.value}},{default:t.withCtx(()=>[l.value.visible?(t.openBlock(),t.createBlock(R,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:t.normalizeStyle({width:s.value})},{default:t.withCtx(()=>[t.createVNode(y,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":w[0]||(w[0]=B=>h.value[l.value.name]=B),allowClear:"",onKeyup:t.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,B=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:B.name},[B.visible?(t.openBlock(),t.createBlock(R,{key:0,label:B.title,class:t.normalizeClass(["query-field",B.name]),style:t.normalizeStyle({width:s.value}),name:B.name},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),t.mergeProps({placeholder:B.placeholder,value:h.value[B.name],"onUpdate:value":V=>h.value[B.name]=V,ref_for:!0},B.props||{},{allowClear:"",widget:B}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):t.createCommentVNode("",!0)],64))),128)),t.createElementVNode("div",Er,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,B=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:B.name},[B.visible!=!1?(t.openBlock(),t.createBlock(g,{key:0,widget:B,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(t.openBlock(),t.createBlock(v,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:t.withCtx(()=>[t.createElementVNode("div",Or,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,B=>(t.openBlock(),t.createBlock(p,{key:B.name,class:"item",checked:B.visible,onClick:V=>B.visible=!B.visible},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:t.withCtx(()=>[t.createVNode(M,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.value.title)+" ",1),t.createVNode(N)]),_:1})]),_:1},8,["trigger"])):t.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[i.editor&&i.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(Rr,{editor:i.editor,wid:i.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),Mr={class:"unione-props-setting unione-table-setting"},_r={class:"unione-table-tools"},Tr={key:1,class:"unione-table-opts"},Ir={key:0},Fr=["onClick"],Dr={key:1,class:"edit-field"},$r=["onClick"],Pr={key:1},Lr=ie(t.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(v,x){let B=v.filter(V=>V.value==x);return B&&B[0]&&B[0].label||x}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(v,x){let B=v.filter(V=>V.value==x);return B&&B[0]&&B[0].label||x}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=t.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.leftBtns||(v.configs.leftBtns=[]),v.configs.rightBtns||(v.configs.rightBtns=[]),v.configs.operation||(v.configs.operation={}),v.configs.operation.btns||(v.configs.operation.btns=[]),v.configs.operation.more||(v.configs.operation.more={}),v}),l=t.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{if(!n.value)return[];const v=[],x=n.value.configs.leftBtns;if(x.forEach(B=>{v.push(B.name)}),!v.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};x.splice(0,0,B)}if(!v.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};x.splice(1,0,B)}return x}),s=t.computed(()=>{if(!n.value)return[];const v=[],x=n.value.configs.rightBtns;if(x.forEach(B=>{v.push(B.name)}),!v.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};x.splice(0,0,B)}if(!v.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};x.splice(1,0,B)}if(!v.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};x.splice(2,0,B)}if(!v.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};x.splice(3,0,B)}return x});function r(v,x){v=="left"?h.value.open(x,B=>{B.visible=!0,Object.keys(B).forEach(V=>{x[V]=B[V]}),n.value.configs.leftBtns.sort((V,k)=>{const S=V.index||1,T=k.index||1;return S-T}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):h.value.open(x,B=>{B.visible=!0,Object.keys(B).forEach(V=>{x[V]=B[V]}),n.value.configs.rightBtns.sort((V,k)=>{const S=V.index||1,T=k.index||1;return S-T}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(v){const x=v=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let B={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};v=="left"?n.value.configs.leftBtns.push(B):n.value.configs.rightBtns.push(B),e.editor.widget(e.wid,n.value),r(v,B)}function d(v,x){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(x.name))x.visible=!1,v=="left"?n.value.configs.leftBtns=[...n.value.configs.leftBtns]:n.value.configs.rightBtns=[...n.value.configs.rightBtns];else if(v=="left"){const V=[];n.value.configs.leftBtns.forEach(k=>{k.name!=x.name&&V.push(k)}),n.value.configs.leftBtns=V}else{const V=[];n.value.configs.rightBtns.forEach(k=>{k.name!=x.name&&V.push(k)}),n.value.configs.rightBtns=V}};te.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const h=t.ref(null);function f(v){h.value.open(v,x=>{x.visible=!0,Object.keys(x).forEach(B=>{v[B]=x[B]}),n.value.configs.operation.btns.sort((B,V)=>{const k=B.index||1,S=V.index||1;return k-S}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function u(){const v=n.value.configs.operation.btns.length+1;let x={title:"新增"+v,name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.operation.btns.push(x),e.editor.widget(e.wid,n.value),h.value.open(x,B=>{Object.keys(B).forEach(V=>{x[V]=B[V]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(v){const x=()=>{if(["delete","view","edit"].includes(v.name))v.visible=!1,n.value.configs.operation.btns=[...n.value.configs.operation.btns];else{const B=[];n.value.configs.operation.btns.forEach(V=>{V.name!=v.name&&B.push(V)}),n.value.configs.operation.btns=B}};te.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{x()}})}const b=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),A=t.computed(()=>b.value.fields?.length?(b.value.fields.forEach(v=>{v.show||(v.show={}),v.show.list||(v.show.list={})}),b.value.fields):[]),C={mounted:v=>v.focus()},w=t.ref({});function y(){const v=Object.keys(w.value);if(v.length)for(let x in v){const B=A.value.filter(V=>V.name==x);if(B&&B[0]){let V=w.value[x];Object.keys(V).forEach(k=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),k=="showIndex"?B[0].show.list.index=V[k]:k=="showWidth"?B[0].show.list.width=V[k]:k=="fixed"?B[0].show.list.fixed=V[k]:k=="align"?B[0].show.list.align=V[k]:B[0][k]=V[k]})}}w.value={}}function R(v,x){y();const B={};x=="showIndex"?B[x]=v.show?.list?.index:x=="showWidth"?B[x]=v.show?.list?.width:x=="fixed"?B[x]=v.show?.list?.fixed:x=="align"?B[x]=v.show?.list?.align:B[x]=v[x]||"",w.value[v.name]=B}function g(v,x){if(!v||!x){w.value={};return}const B=w.value[v.name][x];v.show||(v.show={}),v.show.list||(v.show.list={}),x=="showIndex"?v.show.list.index=B:x=="showWidth"?v.show.list.width=B:x=="fixed"?v.show.list.fixed=B:x=="align"?v.show.list.align=B:v[x]=B,w.value={}}function p(v,x){return x=="showIndex"?v.show?.list?.index:x=="showWidth"?v.show?.list?.width:x=="fixed"?v.show?.list?.fixed:x=="align"?v.show?.list?.align:v[x]}function N(v,x){A.value.filter(V=>V.name==v.name).forEach(V=>{V[x]=!V[x]})}const M=t.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:v=>{const x=M.value.options.filter(B=>B.value==v);return x[0]?x[0].label:v}});return(v,x)=>{const B=t.resolveComponent("a-divider"),V=t.resolveComponent("CloseOutlined"),k=t.resolveComponent("a-button"),S=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-input"),O=t.resolveComponent("a-form-item"),_=t.resolveComponent("a-col"),$=t.resolveComponent("a-input-number"),I=t.resolveComponent("a-checkbox"),j=t.resolveComponent("a-row"),P=t.resolveComponent("a-select"),E=t.resolveComponent("ToolOutlined"),J=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Mr,[t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[8]||(x[8]=[t.createTextVNode("工具设置")])),_:1}),t.createElementVNode("div",_r,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,F=>(t.openBlock(),t.createBlock(k,t.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:z=>r("left",F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"bool-del",onClick:t.withModifiers(z=>d("left",F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(k,{class:t.normalizeClass(["btn","tool-add"]),size:"small",onClick:x[0]||(x[0]=F=>c("left"))},{default:t.withCtx(()=>[t.createVNode(S)]),_:1}),t.createVNode(k,{class:t.normalizeClass(["btn","tool-add","right"]),onClick:x[1]||(x[1]=F=>c("right")),size:"small"},{default:t.withCtx(()=>[t.createVNode(S)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,F=>(t.openBlock(),t.createBlock(k,t.mergeProps({key:F.name,class:["btn","right",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:z=>r("right",F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"bool-del",onClick:t.withModifiers(z=>d("right",F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[9]||(x[9]=[t.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createBlock(j,{key:0},{default:t.withCtx(()=>[t.createVNode(_,{span:7},{default:t.withCtx(()=>[t.createVNode(O,{label:"操作标题"},{default:t.withCtx(()=>[t.createVNode(T,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:5},{default:t.withCtx(()=>[t.createVNode(O,{label:"显示宽度",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":x[2]||(x[2]=F=>n.value.configs.operation.width=F)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:6},{default:t.withCtx(()=>[t.createVNode(O,{label:"显示按钮数量",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":x[3]||(x[3]=F=>n.value.configs.operation.count=F)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:5},{default:t.withCtx(()=>[t.createVNode(O,{label:"是否显示"},{default:t.withCtx(()=>[t.createVNode(I,{checked:n.value.configs.operation.visible,"onUpdate:checked":x[4]||(x[4]=F=>n.value.configs.operation.visible=F)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[10]||(x[10]=[t.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createElementBlock("div",Tr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value.configs.operation.btns,F=>(t.openBlock(),t.createBlock(k,t.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size||"small",ref_for:!0},F.props||{},{onClick:z=>f(F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"btn-del",onClick:t.withModifiers(z=>m(F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(k,{class:t.normalizeClass(["btn","btn-add"]),onClick:x[5]||(x[5]=F=>u()),size:"small"},{default:t.withCtx(()=>[t.createVNode(S)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(B,{orientation:"left"},{default:t.withCtx(()=>x[11]||(x[11]=[t.createTextVNode("表头设置")])),_:1}),x[12]||(x[12]=t.createTextVNode(" 数据模型:")),t.createVNode(P,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":x[6]||(x[6]=F=>n.value.dataModel=F)},null,8,["options","value"]),t.createVNode(J,{columns:i.value,"data-source":A.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:F})=>[["showIndex","showWidth","align","fixed"].includes(F.key)?(t.openBlock(),t.createElementBlock("span",Ir,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(F.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:F,record:z})=>[["showIndex","showWidth"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!w.value[z.name]||!Object.keys(w.value[z.name]).includes(F.dataIndex))&&!p(z,F.dataIndex)&&"empty"]),onClick:pe=>R(z,F.dataIndex)},[w.value[z.name]&&Object.keys(w.value[z.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock($,{key:0,value:w.value[z.name][F.dataIndex],"onUpdate:value":pe=>w.value[z.name][F.dataIndex]=pe,onBlur:pe=>g(z,F.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[C]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p(z,F.dataIndex)),1)],64))],10,Fr)):["isList","isQuery","isSort"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",Dr,[t.createVNode(I,{checked:z[F.dataIndex],onClick:pe=>N(z,F.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!w.value[z.name]||!Object.keys(w.value[z.name]).includes(F.dataIndex))&&!p(z,F.dataIndex)&&"empty"]),onClick:pe=>R(z,F.dataIndex)},[w.value[z.name]&&Object.keys(w.value[z.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(P,{key:0,value:z.show.list[F.dataIndex],"onUpdate:value":pe=>z.show.list[F.dataIndex]=pe,allowClear:!0,options:F.options,onBlur:x[7]||(x[7]=pe=>g())},null,8,["value","onUpdate:value","options"])),[[C]]):(t.openBlock(),t.createElementBlock("span",Pr,t.toDisplayString(F.showLabel(F.options,p(z,F.dataIndex))),1))],10,$r)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(wi,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Ur={class:"unione-table-tools"},jr={class:"unione-table-data"},zr={key:0,class:"unione-table-opts"},$l=ie(t.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:i}){const n=Le(),l=a,o=t.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=t.computed(()=>o.value.props||{}),r=t.computed(()=>o.value.rowKey||l.rowKey||"id"),c=t.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),d=t.computed(()=>{const S=l.dataList||[];return!S.length&&c.value?c.value.data().body||[]:S}),h=t.computed(()=>{if(o.value.operation==!1||!Array.isArray(o.value.operation?.btns))return{visible:!1};const S=K.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),T=[];let O=(o.value.operation?.btns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_));if(O.forEach(_=>{T.push(_.name)}),T.includes("edit")||O.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),T.includes("view")||O.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),T.includes("delete")||O.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const _=O.filter(I=>I.name=="edit")[0];if(_.visible&&(_.action||(_.action={}),_.action.type||(_.action.type="route"),!_.action.href)){const I=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",j=l.editor.model.value;_.action.link=n.editPageUrl+"?psn="+I+"&model="+j+"&id={row."+l.rowKey+"}"}const $=O.filter(I=>I.name=="view")[0];if($.visible&&($.action||($.action={}),$.action.type||($.action.type="route"),!$.action.href)){const I=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";$.action.link=n.viewPageUrl+"?psn="+I+"&model=view&id={row."+l.rowKey+"}"}}return O=O.filter(_=>_.visible!=!1).sort((_,$)=>{const I=_.index||1,j=$.index||1;return I-j}),S.count&&(O.length>S.count+1?(S.btns=O.slice(0,S.count),S.more.items=O.slice(S.count,O.length),S.more.visible=!0):(S.btns=O,S.more.visible=!1)),S}),f=t.computed(()=>{let S=[];o.value.columns?.length&&(S=[...o.value.columns]);const T=[];S.forEach((_,$)=>{_.dataIndex=_.name,_.convert&&(_.dataIndex=_.name+"Label",_.convertObj=new Qe(_.convert),_.customCell=(I,j,P)=>{const E=K.utils.obj.getValue(I,P.name);_.convertObj&&(I[P.dataIndex]==null||I[P.dataIndex]==null)&&E!=null&&E!=null&&(E+"").length>0&&(I[P.dataIndex]=E,_.convertObj.convert(E).then(J=>{J&&K.utils.obj.setValue(I,P.dataIndex,J)}))}),_.sort?.enable&&(_.sorter=!0,_.sort.multiple&&(_.sorter={},_.sorter.multiple=_.sort.multiple),_.sort.defoult&&(_.defaultSortOrder=_.sort.asc?"ascend":"descend")),_.customRender=({record:I,column:j})=>K.utils.obj.getValue(I,j.dataIndex)||"--",_.fkey?.enable&&(_.fkey.labelName&&(_.dataIndex=pn(_.fkey.labelName)),_.fkey.labelTitle&&(_.title=_.fkey.labelTitle),_.customRender=({record:I,column:j})=>I&&I[j.name+"FEntry"]&&I[j.name+"FEntry"][j.dataIndex]||"--",_.fkey.fields?.forEach((I,j)=>{if(!I.name)return;const P=pn(I.name),E={fkName:_.name,title:I.title,name:P,dataIndex:I.name,width:I.width,index:I.index||$+j+1,customRender:({record:J,column:F})=>{if(J&&J[F.fkName+"FEntry"]){const z=J[F.fkName+"FEntry"][F.name];if(z)return I.convertObj&&I.convertObj.convert(z)||z}return"--"}};I.convert&&(I.convertObj=new Qe(I.convert)),T.push(E)}))}),T.forEach(_=>{S.splice(_.index,0,_)});const O=K.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return O&&O.visible!=!1&&(O.customRender=_=>R.value?(R.value.current-1)*R.value.pageSize+_.index+1:_.index,S=[O,...S]),h.value&&h.value.visible!=!1&&S.push({fixed:"right",align:"center",...h.value,name:"operation"}),S}),u=t.computed(()=>{if(o.value.leftBtns===!1||!Array.isArray(o.value.leftBtns))return[];const S=[],T=[];if((o.value.leftBtns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_)).forEach(_=>{_.visible!=!1&&S.push(_),T.push(_.name),_.name=="delBatch"&&!g.value&&(_.visible=!1)}),!T.includes("add")){const _={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};S.splice(0,0,_)}if(!T.includes("delBatch")&&g.value){const _={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};S.splice(1,0,_)}if(l.editor&&l.editor.type.value!="code"){const _=S.filter($=>$.name=="add")[0];if(_.visible&&(_.action||(_.action={}),_.action.type||(_.action.type="route"),!_.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",I=l.editor.model.value;_.action.link=n.addPageUrl+"?psn="+$+"&model="+I}}return S});function m({btn:S,event:T}){if(n.isDebug&&console.log("unione table left btn click",S,T),S.name=="delBatch"){if(!p.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(p.value.selectedRowKeys).then(()=>{V(),B(!0)});return}te.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("leftBtnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}M(S.name,{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("leftBtnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const b=t.computed(()=>{if(o.value.rightBtns===!1||!Array.isArray(o.value.rightBtns))return[];const S=[],T=[];if((o.value.rightBtns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_)).forEach(_=>{_.visible!=!1&&S.push(_),T.push(_.name)}),!T.includes("impData")){const _={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};S.splice(1,0,_)}if(!T.includes("expData")){const _={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};S.splice(2,0,_)}if(!T.includes("downTmpl")){const _={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};S.splice(3,0,_)}return S});function A({btn:S,event:T}){n.isDebug&&console.log("unione table right btn click",S,T),M(S.name,{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("rightBtnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const C=t.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),w=t.ref({}),y=t.ref(null),R=t.computed(()=>K.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:S=>"共"+S+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),g=t.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),p=t.ref({selectedRowKeys:[],selectedRowList:[],onChange:(S,T)=>{p.value.selectedRowKeys=S,p.value.selectedRowList=T},getCheckboxProps:S=>({disabled:S.checkable})}),N=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=i;function v({btn:S,event:T},O){if(n.isDebug&&console.log("unione table opt btn click",S,T),S.name=="delete"){if(c.value){c.value.deleteByIds([O[r.value]]).then(()=>{V(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(_=>_!=O[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(_=>_[r.value]!=O[r.value])});return}te.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(S.name,{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("optBtnClick",{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("btnClick",{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}M(S.name,{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("optBtnClick",{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),M("btnClick",{btn:S,event:T,row:O,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}function x(S,T,O,_){console.log("tableChanged",S,T,O,_),y.value={page:S.current,pageSize:S.pageSize},O&&(Array.isArray(O)?(y.value.sorts=[],O.forEach($=>{y.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):O.column&&(y.value.sorts=[{name:O.column.name,asc:O.order=="ascend"}])),V(),M("change",{pagination:S,filters:T,sorter:O,event:_})}function B(S=!1){S?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):te.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function V(){if(c.value){const S={page:R.value.current,pageSize:R.value.pageSize,keywords:w.value.keywords,body:w.value.params||{}};y.value?.page&&(S.page=y.value.page),y.value?.pageSize&&(S.pageSize=y.value.pageSize),y.value?.sorts&&(S.sorts=y.value.sorts),console.log("dataStorage find params",S),c.value.find(S)}}t.onMounted(()=>{f.value?.forEach(S=>{S.sort?.enable&&S.sort.defoult&&(y.value||(y.value={},y.value.sorts||(y.value.sorts=[]),y.value.sorts.push({name:S.name,asc:S.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",S=>{console.log("table-list-search",S),w.value=S||{},V()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),w.value={},V(),B(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),V()})});function k(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:k,clearSelected:B}),(S,T)=>{const O=t.resolveComponent("unione-btn"),_=t.resolveComponent("DownOutlined"),$=t.resolveComponent("a-button"),I=t.resolveComponent("a-dropdown"),j=t.resolveComponent("a-table");return t.openBlock(),t.createBlock(ht,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",Ur,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,P=>(t.openBlock(),t.createBlock(O,{key:P.name,class:"btn",widget:P,editor:a.editor,onClick:m,preset:N,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(t.openBlock(),t.createElementBlock("span",{key:0,class:"selected-info",onClick:T[0]||(T[0]=P=>B())},"当前选中记录("+t.toDisplayString(p.value.selectedRowKeys.length)+")",1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,P=>(t.openBlock(),t.createBlock(O,{key:P.name,class:"btn right",widget:P,editor:a.editor,onClick:A,preset:N,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),t.createElementVNode("div",jr,[f.value&&f.value.length?(t.openBlock(),t.createBlock(j,t.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":d.value,"row-selection":g.value?p.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:R.value,onChange:x},C.value),{bodyCell:t.withCtx(({column:P,record:E})=>[P.name==="operation"?(t.openBlock(),t.createElementBlock("div",zr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.btns,J=>(t.openBlock(),t.createBlock(O,{key:J.name,class:"opt",widget:J,editor:a.editor,onClick:F=>v(F,E),preset:N,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(t.openBlock(),t.createBlock(I,{key:0,trigger:[h.value.more.trigger||"hover"],class:t.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.more.items,J=>(t.openBlock(),t.createBlock(O,{key:J.name,class:"item",widget:J,editor:a.editor,onClick:F=>v(F,E),type:"text",preset:N,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode($,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h.value.more.title)+" ",1),t.createVNode(_)]),_:1})]),_:2},1032,["trigger","class"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):t.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(Lr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-ea916a8b"]]);class Ue{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:i,onClose:n,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(he.EDITOR_COMPONENT,he.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(he.EDITOR_COMPONENT,he.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const d=document.createElement("div");d.classList.add("dialog-title");const h=document.createElement("span");h.append(document.createTextNode(e));const f=document.createElement("i");f.onclick=()=>{n&&n(),this._dispose()},d.append(h),d.append(f),c.append(d);const u=document.createElement("div");u.classList.add("dialog-option");for(let C=0;C<i.length;C++){const w=i[C],y=document.createElement("div");if(y.classList.add("dialog-option__item"),w.label){const g=document.createElement("span");g.append(document.createTextNode(w.label)),y.append(g),w.required&&g.classList.add("dialog-option__item--require")}let R;w.type==="select"?(R=document.createElement("select"),w.options?.forEach(g=>{const p=document.createElement("option");p.value=g.value,p.label=g.label,R.append(p)})):w.type==="textarea"?R=document.createElement("textarea"):(R=document.createElement("input"),R.type=w.type),w.width&&(R.style.width=`${w.width}px`),w.height&&(R.style.height=`${w.height}px`),R.name=w.name,R.value=w.value||"",R instanceof HTMLSelectElement||(R.placeholder=w.placeholder||""),y.append(R),u.append(y),this.inputList.push(R)}c.append(u);const m=document.createElement("div");m.classList.add("dialog-menu");const b=document.createElement("button");b.classList.add("dialog-menu__cancel"),b.append(document.createTextNode("取消")),b.type="button",b.onclick=()=>{l&&l(),this._dispose()},m.append(b);const A=document.createElement("button");A.append(document.createTextNode("确定")),A.type="submit",A.onclick=()=>{if(o){const C=this.inputList.map(w=>({name:w.name,value:w.value}));o(C)}this._dispose()},m.append(A),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function qr(a){switch(a){case"comment":case"prolog":case"doctype":case"cdata":return{color:"#008000",italic:!0};case"namespace":return{opacity:.7};case"string":return{color:"#A31515"};case"punctuation":case"operator":return{color:"#393A34"};case"url":case"symbol":case"number":case"boolean":case"variable":case"constant":case"inserted":return{color:"#36acaa"};case"atrule":case"keyword":case"attr-value":return{color:"#0000ff"};case"function":return{color:"#b9a40a"};case"deleted":case"tag":return{color:"#9a050f"};case"selector":return{color:"#00009f"};case"important":return{color:"#e90",bold:!0};case"italic":return{italic:!0};case"class-name":case"property":return{color:"#2B91AF"};case"attr-name":case"regex":case"entity":return{color:"#ff0000"};default:return null}}function Qr(a){const e=[];function i(n){for(let l=0;l<n.length;l++){const o=n[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))i(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...qr(s)})}}}return i(a),e}const Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAnFBMVEUAAAAAAAAAgIBVVVVAQFU3SVs8S1o9R1w+Rlg6SlpASFg+RlU6SVc7RVg8Rlg+Rlg/R1g9SFY+SFg+SFc8SFc+Rlg8SFY8RlY+R1g+R1Y+Rlg8Rlc+SFg9R1c9SFc9R1c+R1c9R1Y9R1c8R1c9R1g9R1g9R1c9R1c8R1c9R1c9SFc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///96K4o3AAAAMnRSTlMAAQIDDA4RGR0fICEjNDc6PUdOUlVXWWJrc3R7gI2Sm6GxvMLDyc3R09vd3+309fr8/RCh/swAAAABYktHRDM31XxeAAAAZElEQVQY02NgIA4Iq+joqooh+KJ6Etw8UvricAElWRApowkXUFRAM0LQQI4DmW8EByjKmNlYUfUxSupzQZmsWvxgER0RmKQa2BZ2QwGYAJ+uPC+nkLoyE1w/l4K2noY0C3H+BAAncAfEJkWhEAAAAABJRU5ErkJggg==",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",xc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",Cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAz1BMVEUAAAAAAAAAgIBAQFU7Tk43SVs8RFU6SlpASFg+RlU8RFo6SVdAR1U6RVU+SVg8RlU7RVg+RlY9SFg8R1c9R1c9R1Y8Rlg+SFc+R1g9R1c9Rlc8SFg9SFc9R1Y8R1g+Rlc+SFg9R1c9R1Y8Rlg+R1c8Rlc+SFc9R1g9R1c8Rlc+R1g9SFc8R1c9R1g9Rlc9R1Y+SFc9R1c9R1Y9SFc8R1Y9R1c9R1c+SFc9R1g9R1c9R1c9R1Y9R1c8R1c9R1Y9R1c9R1c9R1c9R1c9R1f////kTFPbAAAAQ3RSTlMAAQIMDQ4eHyAhIiMkMDEzNF9gYWRlZmdrbG1udXZ3eICBgoOEmJmam5ydpKWmp7Gys7S5uru8y8zN5ebn6Onq9/3+2KlzWgAAAAFiS0dERPm0mMEAAAD9SURBVBgZhcFte4FgGIDhK1aUDbMxM8VMsXdmtlj01P3//9N60nHQJ+fJWfVBsFwGgxpl7bXINgz/RNYtjirTdDe0yTjuPp0YFCofElQpVGfyZnAwFZcTrjySa6cBJfOkifazq1Jixt9k6jIk5/R6NjkvtYAHsdFulIjqoDXkHgi2aI6SjLLRIh/4+kW7k1wXLVwAyxCtJ7lbtM0nEGzRHCUZZaNFPjAQB62jRNQ12qX0gZq45Oxut05ulFpk1vsLSsx4hdZKZ5Q8J1fknsTjhCdjDirvMjcpmC/yalAwJknsNcg0RnEyNjhqrkSicBOJrJqUWX1/sfD7Fuf8A/JKIgzf/RoEAAAAAElFTkSuQmCC",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",Sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",Bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",Nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",Vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",Pl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",Rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Ul="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",Ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",Oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",Mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",_c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",Tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",Fc=["title"],Dc=["title"],$c={class:"options"},Pc=["title"],Lc={class:"options"},Uc={class:"options"},jc=["title"],zc=["title"],qc=["title"],Qc=["title"],Kc=["title"],Wc={class:"options"},Yc={class:"options"},Hc={class:"options"},Gc={class:"options"},Jc={class:"options"},Xc={class:"menu-item__search__collapse__search"},Zc={class:"arrow-left"},ed={class:"arrow-right"},td=ie(t.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const i=a,n=t.ref(),l=t.computed(()=>{let V=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return i.items&&(i.items.length>1?V=i.items:i.items[0]=="simple"&&(V=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),V});function o(){return n.value?.clientHeight}function s(){return n.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(V,k){console.log("exec cmd "+V+",params:",k),V!="Separator"&&Array.isArray(k)?i.editor?.command["execute"+V](k[0],k[1]):i.editor?.command["execute"+V](k)}function d(V,k){const S=k.target.getBoundingClientRect(),T=n.value.querySelector("."+V+" .options");T.classList.toggle("visible"),T.style.top=S.height+S.top+"px"}let h=!0,f;function u(){h?(h=!1,f=window.setTimeout(()=>{h=!0,i.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(f)}function m(){h=!0,window.clearTimeout(f),i.editor?.command.executePainter({isDblclick:!0})}function b(){new Ue({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:V=>{const k=V.find(S=>S.name==="value")?.value;k&&i.editor?.command.executeInsertElementList([{type:he.ElementType.LATEX,value:k}])}})}function A(V){i.editor?.command.executeInsertElementList([{type:V,checkbox:{value:!1},value:""}])}function C(V,k){const S=k.target.getBoundingClientRect(),T=n.value.querySelector("."+V+" .options");T.classList.toggle("visible"),T.style.top=S.height+S.top+"px";const O=Ca();T.firstChild.childNodes.forEach(_=>{const $=_.attributes.getNamedItem("label-format").value;_.innerText=O.format($),_.onclick=()=>{i.editor?.command.executeInsertElementList([{type:he.ElementType.DATE,dateFormat:_.attributes.getNamedItem("data-format").value,valueList:[{value:_.innerText.trim()}]}])}})}function w(){new Ue({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:V=>{const k=V.find(j=>j.name==="type")?.value;if(!k)return;const S=V.find(j=>j.name==="width")?.value,T=V.find(j=>j.name==="height")?.value;if(!T)return;const O=V.find(j=>j.name==="src")?.value,_=V.find(j=>j.name==="srcdoc")?.value,$={type:k};if($.type===he.BlockType.IFRAME){if(!O&&!_)return;$.iframeBlock={src:O,srcdoc:_}}else if($.type===he.BlockType.VIDEO){if(!O)return;$.videoBlock={src:O}}const I={type:he.ElementType.BLOCK,value:"",height:Number(T),block:$};S&&(I.width=Number(S)),i.editor?.command.executeInsertElementList([I])}})}function y(V){const k=V.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__table__collapse");S.style.display="block",S.style.top=k.height+k.top+"px",S.style.left=k.left-270/2+"px";const T=n.value.querySelector(".menu-item__table__collapse .table-close"),O=n.value.querySelector(".menu-item__table__collapse .table-select"),_=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(P=>{$.push(P.childNodes)});let I=0,j=0;_.onmousemove=P=>{const{offsetX:z,offsetY:pe}=P;$.forEach(tt=>{tt.forEach(L=>{L.classList.remove("active")})}),I=Math.ceil(z/22)||1,j=Math.ceil(pe/26)||1,$.forEach((tt,L)=>{tt.forEach((Oe,ne)=>{ne<I&&L<j&&Oe.classList.add("active")})}),O.innerText=`${j}×${I}`},_.onclick=()=>{S.style.display="none",i.editor?.command.executeInsertTable(j,I)},T.onclick=P=>{P.stopPropagation(),S.style.display="none"}}function R(){const V=n.value.querySelector(".menu-item__image .image");V.click(),V.onchange=function(){const k=V.files[0],S=new FileReader;S.readAsDataURL(k),S.onload=function(){const T=new Image,O=S.result;T.src=O,T.onload=function(){i.editor?.command.executeImage({value:O,width:T.width,height:T.height}),V.value=""}}}}function g(){new Ue({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:i.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:V=>{const k=V.find(T=>T.name==="name")?.value;if(!k)return;const S=V.find(T=>T.name==="url")?.value;S&&i.editor?.command.executeHyperlink({type:he.ElementType.HYPERLINK,value:"",url:S,valueList:he.splitText(k).map(T=>({value:T,size:16}))})}})}function p(V){V==="add"?new Ue({title:"水印",data:[{type:"text",label:"内容",name:"data",required:!0,placeholder:"请输入内容"},{type:"color",label:"颜色",name:"color",required:!0,value:"#AEB5C0"},{type:"number",label:"字体大小",name:"size",required:!0,value:"120"},{type:"number",label:"透明度",name:"opacity",required:!0,value:"0.3"},{type:"select",label:"重复",name:"repeat",value:"0",required:!1,options:[{label:"不重复",value:"0"},{label:"重复",value:"1"}]},{type:"number",label:"水平间隔",name:"horizontalGap",required:!1,value:"10"},{type:"number",label:"垂直间隔",name:"verticalGap",required:!1,value:"10"}],onConfirm:k=>{if(~k.findIndex(_=>!_.value))return;const T=k.reduce((_,$)=>(_[$.name]=$.value,_),{}),O=T.repeat==="1";i.editor?.command.executeAddWatermark({data:T.data,color:T.color,size:Number(T.size),opacity:Number(T.opacity),repeat:O,gap:O&&T.horizontalGap&&T.verticalGap?[Number(T.horizontalGap),Number(T.verticalGap)]:void 0})}}):i.editor?.command.executeDeleteWatermark()}function N(){new Ue({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:V=>{const k=V.find(_=>_.name==="codeblock")?.value;if(!k)return;const S=Ol.tokenize(k,Ol.languages.javascript),T=Qr(S),O=[];for(let _=0;_<T.length;_++){const $=T[_],I=he.splitText($.content);for(let j=0;j<I.length;j++){const E={value:I[j]};$.color&&(E.color=$.color),$.bold&&(E.bold=!0),$.italic&&(E.italic=!0),O.push(E)}}O.unshift({value:`
2
- `}),i.editor?.command.executeInsertElementList(O)}})}function M(V){const k=V.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__search__collapse");S.style.display="block",S.style.top=k.height+k.top+"px",S.style.left=k.left-260/2+"px";const T=n.value.querySelector(".menu-item__search__collapse__search input"),O=n.value.querySelector(".menu-item__search__collapse__replace input"),_=S.querySelector(".search-result");T.focus();const $=()=>{const I=i.editor?.command.getSearchNavigateInfo();if(I){const{index:j,count:P}=I;_.innerText=`${j}/${P}`}else _.innerText=""};S.querySelector("span").onclick=()=>{S.style.display="none",T.value="",O.value="",i.editor?.command.executeSearch(null),$()},T.oninput=()=>{i.editor?.command.executeSearch(T.value||null),$()},T.onkeydown=I=>{I.key==="Enter"&&(i.editor?.command.executeSearch(T.value||null),$())},S.querySelector("button").onclick=()=>{const I=T.value,j=O.value;I&&j&&I!==j&&i.editor?.command.executeReplace(j)},S.querySelector(".arrow-left").onclick=()=>{i.editor?.command.executeSearchNavigatePre(),$()},S.querySelector(".arrow-right").onclick=()=>{i.editor?.command.executeSearchNavigateNext(),$()}}function v(){const V=n.value.querySelector(".menu-item__color .input-color");V.oninput=function(){i.editor?.command.executeColor(V.value)},V.click()}function x(){const V=n.value.querySelector(".menu-item__highlight .input-highlight");V.oninput=function(){i.editor?.command.executeHighlight(V.value)},V.click()}function B(V){switch(V){case he.ControlType.TEXT:new Ue({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:k=>{const S=k.find(O=>O.name==="placeholder")?.value;if(!S)return;const T=k.find(O=>O.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,value:T?[{value:T}]:null,placeholder:S}})}});break;case he.ControlType.SELECT:new Ue({title:"列举控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
1
+ (function(ee,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@hufe921/canvas-editor"),require("dayjs"),require("prismjs"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@hufe921/canvas-editor","dayjs","prismjs","@ant-design/icons-vue","uuid"],K):(ee=typeof globalThis<"u"?globalThis:ee||self,K(ee.index={},ee.UnioneBaseVue,ee.Vue,ee.antDesignVue,ee.lodashEs,ee.vueCodemirror,ee.langJavascript,ee.canvasEditor,ee.dayjs,ee.prism,ee.iconsVue,ee.uuid))})(this,function(ee,K,t,te,Aa,Zt,xa,he,Ca,Ol,it,va){"use strict";const Sa={isDebug:!0,axios:{form:"/portal",flow:"/flow"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},hn=t.ref(Sa);function Le(a){return a&&(hn.value=K.utils.obj.ext(a,hn.value)),hn.value}const Ba={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},Na={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},Va=t.ref([Ba,Na]);function Ra(a,e){return K.locales.loadLanguage(a,()=>new Promise((i,n)=>{const l=Va.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};i(s)}else{const s={...l[0],...o};i(s)}});else if(l.length==0){const o={...e,localeName:a};i(o)}else{const o={...l[0],...e};i(o)}else l.length>0?i(l[0]):n("local language not defined ,lang:"+a)}))}const fn={...K.locales};fn.loadLanguage=Ra;class Ea{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,i){this.$psn=t.ref(e),this.$pid=t.ref(""),this.$store=t.ref({}),this.$forms=t.ref({}),this.$params=t.ref({}),this.$refObj=t.ref({}),this.$refData=t.ref({}),this.$model=i}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const i in this.$store.value)this.$store.value[i].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,i){}setRefData(e,i,n){}use(e,i,n){let l=this.$store.value[e];return l||(l=new un(e,i,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),n&&(l.$form=n,this.$forms.value[e]=n),l}useForm(e,i,n){const l=this.use(e,"form",i);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{n&&n(o)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class un{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,i,n){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=i,this.$data=t.ref(i=="form"?{}:{body:[],total:0}),this.$dialog=K.useDialog(),this.$model=n||t.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}reset(e){this.$data.value=e||{},this.$form?.setValue(e||{})}$processParams(e,i){if(i)i.forEach(n=>{e[n.name]==null&&e[n.name]==null&&(this.$params[n.name]!=null&&this.$params[n.name]!=null?e[n.alias||n.name]=this.$params[n.name]:n.value!=null&&n.value!=null&&(e[n.alias||n.name]=n.value))});else if(this.$params)for(const n in this.$params)e[n]==null&&e[n]==null&&this.$params[n]!=null&&this.$params[n]!=null&&(e[n]=this.$params[n]);return e}request(e){return new Promise((i,n)=>{const l=te.message.loading("数据请求中..."),o=this.$store.controller+e.url;K.axios[this.$store.ctx||"form"]({method:"post",...e,url:o}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const i=this.$store.controller+(this.$store.findUrl||"/find");return!e&&this.$store.findParams&&(e={dsn:this.$dsn}),this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e&&(e.body=this.$processParams(e.body,this.$store.findParams)),new Promise((n,l)=>{const o=te.message.loading("数据加载中...");K.axios[this.$store.ctx||"form"]({url:i,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:i,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:i,params:e,err:s})}).finally(()=>{o()})})}save(e){const i=this.$store.controller+(this.$store.saveUrl||"/save");return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((n,l)=>{const o=te.message.loading("数据提交中...");K.axios[this.$store.ctx||"form"]({url:i,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||te.message.success(s.message),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:i,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:i,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((i,n)=>{const l=te.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";K.axios[this.$store.ctx||"form"]({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((i,n)=>{const l=te.message.loading("数据加载中..."),o=this.$store.controller+"/detail";K.axios[this.$store.ctx||"form"]({url:o,method:"post",headers:{"Content-Type":"application/json"},data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body),i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((i,n)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=te.message.loading("数据处理中..."),o=this.$store.controller+"/delete";K.axios[this.$store.ctx||"form"]({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?i(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Oa{$event;$onces;$delayEmit;constructor(){this.$event=t.ref({}),this.$onces=t.ref({}),this.$delayEmit=t.ref({})}$on(e,i){if(this.$event.value[e]=i,this.$delayEmit.value[e]){const n=this.$delayEmit.value[e];i(n)}}$emit(e,i){if(this.$onces.value[e]){const n=this.$onces.value[e];delete this.$onces.value[e],n(i)}this.$event.value[e]?this.$event.value[e](i):(this.$delayEmit.value[e]=i,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,i){this.$onces.value[e]=i}$off(e){delete this.$event.value[e]}}class ht{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const i=e.configs||{};this.model=t.ref("run"),this.type=t.ref(e.types||"setting"),this.define=t.ref(e),this.ebus=new Oa,this.$widgetList=t.ref([]),this.$widgetMap=t.ref({}),this.$dataManager=new Ea(i.dsnList?i.dsnList[0]:"",this.model),this.$axiosProccess=t.ref({}),this.$dialog=K.useDialog(),this.loadConfig(i)}sn(){return this.define.value.sn}load(e,i){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",i),i&&i.configs&&(this.define.value=i,this.type.value=this.define.value.types||"setting",this.loadConfig(i.configs));return}const n=sessionStorage.getItem("PAGE_DEFINE:"+e);if(n&&this.model.value=="run"){this.define.value=JSON.parse(n),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):i&&i.configs&&(this.define.value=i,this.loadConfig(i.configs))})}save(){return new Promise((e,i)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),i();return}this.$axiosProccess.value.save=!0;const n={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(n),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(te.message.success(o.message),this.define.value=o.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(o.body)):(this.$dialog.error({content:o.message}),i())}).catch(o=>{console.error("页面配置保存失败",o),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,i){if(i){const n={...i,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(n),n.configs?.widgets&&this.$processWidget(n.configs.widgets)),this.$widgetMap.value[e]=n}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(i=>{i.wid||(i.wid="w:"+Aa.uniqueId()),this.$widgetMap.value[i.wid]=i,i.configs?.widgets&&this.$processWidget(i.configs.widgets)})}dataManager(){return this.$dataManager}}const Ma={class:"widget-setting-dialog"},_a=t.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{expose:e,emit:i}){const n=i,l=t.ref(),o=t.ref(),s=t.ref(!1);function r(){o.value&&(s.value=!0),n("setting")}function c(){n("saving"),s.value=!1}function d(){return l.value?.clientHeight}function h(){return l.value?.clientWidth}return e({getHeight:d,getWidth:h}),(f,p)=>{const m=t.resolveComponent("SettingOutlined"),b=t.resolveComponent("a-tooltip"),w=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[t.createVNode(b,{title:a.settingTitle},{default:t.withCtx(()=>[a.model=="edit"&&(f.$slots["widget-setting"]||a.custome)?(t.openBlock(),t.createBlock(m,{key:0,class:"widget-setting",onClick:r})):t.createCommentVNode("",!0)]),_:1},8,["title"]),t.renderSlot(f.$slots,"default",{},void 0,!0),a.model=="edit"&&f.$slots["widget-setting"]?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":p[0]||(p[0]=C=>s.value=C),centered:"",width:"80%",onOk:c},{default:t.withCtx(()=>[t.createElementVNode("div",Ma,[t.renderSlot(f.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),ie=(a,e)=>{const i=a.__vccOpts||a;for(const[n,l]of e)i[n]=l;return i},ft=ie(_a,[["__scopeId","data-v-17b517f5"]]),Ta={key:0},Ia=["onClick"],wi=ie(t.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const i=a,n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=t.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let u in k){const S=w.value.form.action.params[u];S&&s.value[u]&&Object.keys(s.value[u]).forEach(M=>{S[M]=s.value[u][M]})}s.value={}}function c(k,u,S){r();const M={};M[S]=u[S]||"",S=="showIndex"&&(M[S]=u.show?.query?.index),s.value[k]=M}function d(k,u,S){if(!u||!S){s.value={};return}const M=s.value[k][S];u[S]=M,s.value={}}function h(){w.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const p=t.ref(""),m=t.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,u)=>p.value!=u&&i.preset.includes(u)?Promise.reject("预设按钮名称,请使用其他名称,["+i.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=t.ref([xa.javascript()]),w=t.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),C=t.ref();function y(k,u,S={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),p.value=k.name,w.value.form=k,w.value.helps=S,w.value.visible=!0,C.value=u}const A=t.ref(null);function V(){A.value&&A.value.validate().then(()=>{w.value.visible=!1,C.value(w.value.form)})}return e({open:y,close}),(k,u)=>{const S=t.resolveComponent("a-input"),M=t.resolveComponent("a-form-item"),v=t.resolveComponent("a-select"),x=t.resolveComponent("a-input-number"),N=t.resolveComponent("a-checkbox"),R=t.resolveComponent("a-tab-pane"),g=t.resolveComponent("a-switch"),B=t.resolveComponent("a-button"),T=t.resolveComponent("a-divider"),O=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-tooltip"),$=t.resolveComponent("a-table"),I=t.resolveComponent("a-tabs"),j=t.resolveComponent("a-form"),P=t.resolveComponent("a-modal");return t.openBlock(),t.createBlock(P,{visible:w.value.visible,"onUpdate:visible":u[23]||(u[23]=E=>w.value.visible=E),title:w.value.title,centered:"",width:"50%",onOk:V},{default:t.withCtx(()=>[t.createVNode(j,{name:"basic",ref_key:"form",ref:A,rules:m.value,model:w.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:t.withCtx(()=>[t.createVNode(I,null,{default:t.withCtx(()=>[t.createVNode(R,{key:"base",tab:"基本设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"操作标题",required:"",name:"title"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.title,"onUpdate:value":u[0]||(u[0]=E=>w.value.form.title=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"操作名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.name,"onUpdate:value":u[1]||(u[1]=E=>w.value.form.name=E),disabled:i.preset.includes(w.value.form.name)},null,8,["value","disabled"])]),_:1}),t.createVNode(M,{label:"操作图标"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.icon,"onUpdate:value":u[2]||(u[2]=E=>w.value.form.icon=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:w.value.form.type,"onUpdate:value":u[3]||(u[3]=E=>w.value.form.type=E),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),t.createVNode(M,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.index,"onUpdate:value":u[4]||(u[4]=E=>w.value.form.index=E)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮大小"},{default:t.withCtx(()=>[t.createVNode(v,{value:w.value.form.size,"onUpdate:value":u[5]||(u[5]=E=>w.value.form.size=E),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮特性"},{default:t.withCtx(()=>[t.createVNode(N,{checked:w.value.form.props.block,"onUpdate:checked":u[6]||(u[6]=E=>w.value.form.props.block=E)},{default:t.withCtx(()=>u[24]||(u[24]=[t.createTextVNode("自适应 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.danger,"onUpdate:checked":u[7]||(u[7]=E=>w.value.form.props.danger=E)},{default:t.withCtx(()=>u[25]||(u[25]=[t.createTextVNode("危险 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.ghost,"onUpdate:checked":u[8]||(u[8]=E=>w.value.form.props.ghost=E)},{default:t.withCtx(()=>u[26]||(u[26]=[t.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),t.createVNode(R,{key:"action",tab:"响应设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"响应方式",required:""},{default:t.withCtx(()=>[t.createVNode(v,{value:w.value.form.action.type,"onUpdate:value":u[9]||(u[9]=E=>w.value.form.action.type=E),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.psn,"onUpdate:value":u[10]||(u[10]=E=>w.value.form.action.psn=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.component,"onUpdate:value":u[11]||(u[11]=E=>w.value.form.action.component=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(M,{label:"连接地址"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.href,"onUpdate:value":u[12]||(u[12]=E=>w.value.form.action.href=E)},null,8,["value"])]),_:1}),["link","route"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:2,label:"连接方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:w.value.form.action.target,"onUpdate:value":u[13]||(u[13]=E=>w.value.form.action.target=E),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:3,label:"抽屉位置"},{default:t.withCtx(()=>[t.createVNode(v,{value:w.value.form.action.position,"onUpdate:value":u[14]||(u[14]=E=>w.value.form.action.position=E),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:4,label:"显示标题",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.title,"onUpdate:value":u[15]||(u[15]=E=>w.value.form.action.title=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:5,label:"蒙层关闭"},{default:t.withCtx(()=>[t.createVNode(g,{checked:w.value.form.action.maskClosable,"onUpdate:checked":u[16]||(u[16]=E=>w.value.form.action.maskClosable=E),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:6,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.width,"onUpdate:value":u[17]||(u[17]=E=>w.value.form.action.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:7,label:"显示高度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.height,"onUpdate:value":u[18]||(u[18]=E=>w.value.form.action.height=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(T,{orientation:"left"},{default:t.withCtx(()=>[u[29]||(u[29]=t.createTextVNode("参数列表 ")),t.createVNode(B,{size:"small",class:"param-btn",onClick:h},{default:t.withCtx(()=>u[27]||(u[27]=[t.createTextVNode("添加")])),_:1}),t.createVNode(B,{size:"small",class:"param-btn",danger:"",onClick:f},{default:t.withCtx(()=>u[28]||(u[28]=[t.createTextVNode("删除")])),_:1})]),_:1}),t.createVNode($,{columns:n.value,"data-source":w.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:E})=>[["name","title"].includes(E.key)?(t.openBlock(),t.createElementBlock("span",Ta,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(E.title),1)])):t.createCommentVNode("",!0),["value"].includes(E.key)?(t.openBlock(),t.createBlock(_,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:t.withCtx(()=>[t.createElementVNode("span",null,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(E.title),1)])]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:E,text:J,record:F,index:z})=>[["name","title","value"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!s.value[z]||!Object.keys(s.value[z]).includes(E.dataIndex))&&!J&&"empty"]),onClick:pe=>c(z,F,E.dataIndex)},[s.value[z]&&Object.keys(s.value[z]).includes(E.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(S,{key:0,value:s.value[z][E.dataIndex],"onUpdate:value":pe=>s.value[z][E.dataIndex]=pe,onBlur:pe=>d(z,F,E.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(J),1)],64))],10,Ia)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),t.createVNode(R,{key:"event",tab:"事件设置"},{default:t.withCtx(()=>[t.createVNode(M,{label:"点击事件",help:w.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.clickScript,"onUpdate:modelValue":u[19]||(u[19]=E=>w.value.form.event.clickScript=E),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"禁用逻辑",help:w.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.disableScript,"onUpdate:modelValue":u[20]||(u[20]=E=>w.value.form.event.disableScript=E),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"显示逻辑",help:w.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.visibleScript,"onUpdate:modelValue":u[21]||(u[21]=E=>w.value.form.event.visibleScript=E),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"动态标题",help:w.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.titleScript,"onUpdate:modelValue":u[22]||(u[22]=E=>w.value.form.event.titleScript=E),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Fa=["src"],Da=["src"],$a=ie(t.defineComponent({__name:"btn",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const i=Le(),n=a,l=K.useSession();t.watch(()=>n.widget?.event,()=>{r()}),t.onMounted(()=>{r()});const o=t.ref({...n.editor?.widget(n.wid)||n.widget||{}}),s=t.ref({});function r(){o.value?.event&&(o.value.event.clickScript?s.value.click=new Function("ctx","btn","event",o.value.event.clickScript):o.value.event.click&&(s.value.click=o.value.event.click),o.value.event.disableScript?s.value.disable=new Function("ctx","btn",o.value.event.disableScript):o.value.event.disable&&(s.value.disable=o.value.event.disable),o.value.event.visibleScript?s.value.visible=new Function("ctx","btn",o.value.event.visibleScript):o.value.event.visible&&(s.value.visible=o.value.event.visible),o.value.event.titleScript?s.value.title=new Function("ctx","btn",o.value.event.titleScript):o.value.event.title&&(s.value.title=o.value.event.title)),typeof o.value.click=="function"&&(s.value.click=o.value.click),typeof o.value.title=="function"&&(s.value.title=o.value.title),typeof o.value.visible=="function"&&(s.value.visible=o.value.visible),typeof o.value.disabled=="function"&&(s.value.disable=o.value.disabled)}const c=t.computed(()=>s.value.title?s.value.title(m.value,o.value):o.value.title),d=t.computed(()=>s.value.visible?s.value.visible(m.value,o.value)!=!1:o.value.visible!=!1),h=t.computed(()=>n.disabled==!0?!0:s.value.disable?s.value.disable(m.value,o.value):o.value.disable==!0),f=t.ref(null);function p(){f.value?.open(o.value,u=>{console.log("btn props",u),Object.keys(u).forEach(S=>{o.value[S]=u[S]}),console.log("props btn",o.value)})}const m=t.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),b=t.ref({open:!1}),w=t.computed(()=>{if(o.value.action?.href){let u=o.value.action.href;const S=u.matchAll("{[a-zA-Z.]*}"),M=[];let v=null;for(;v=S.next();){if(v&&v.value&&v.value[0]){let x=v.value[0].substring(1,v.value[0].length-1);M.includes(x)||M.push(x)}if(v.done)break}if(M.length>0)for(let x=0;x<M.length;x++){let N=M[x],R=K.utils.obj.getValue(m.value,N);R?R instanceof Object?u=u.replaceAll("{"+N+"}",JSON.stringify(R)):Array.isArray(R)?u=u.replaceAll("{"+N+"}",R.join(",")):u=u.replaceAll("{"+N+"}",R):u=u.replaceAll("{"+N+"}","")}return u}return""}),C=t.computed(()=>{const u={};let S=o.value.action?.href||o.value.action?.link;if(S){const M=S.matchAll("{[a-zA-Z0-9.]*}"),v=[];let x=null;for(;x=M.next();){if(x&&x.value&&x.value[0]){let R=x.value[0].substring(1,x.value[0].length-1);v.includes(R)||v.push(R)}if(x.done)break}if(v.length>0)for(let R=0;R<v.length;R++){let g=v[R],B=K.utils.obj.getValue(m.value,g);B?B instanceof Object?S=S.replaceAll("{"+g+"}",JSON.stringify(B)):Array.isArray(B)?S=S.replaceAll("{"+g+"}",B.join(",")):S=S.replaceAll("{"+g+"}",B):S=S.replaceAll("{"+g+"}","")}const N=S.split("?")[1];N&&N.split("&").forEach(R=>{const g=R.split("=");g[0]&&g[1]&&(u[g[0]]=g[1])})}return o.value.action?.params&&o.value.action.params.filter(M=>M.value+"").forEach(M=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(M.value)){let x=K.utils.obj.getValue(m.value,M.value);u[M.name]=x}else u[M.name]=M.value}),u}),y=e,A=t.inject("router");function V(u){if(i.isDebug&&console.log("unione btn click",o.value,u),!(s.value.click&&s.value.click(m.value,o.value,u)==!1)){if(o.value.action?.type=="drawer"||o.value.action?.type=="dialog")b.value.open=!0;else if(o.value.action?.type=="route"&&(o.value.action?.href||o.value.action?.link)){if(o.value.action.link&&n.editor?.type.value=="code")return;A.push({path:o.value.action.href||o.value.action?.link,query:C.value})}y("click",{btn:o.value,event:u,ctx:m.value})}}function k(u){y("click",u)}return(u,S)=>{const M=t.resolveComponent("a-button"),v=t.resolveComponent("unione-btn"),x=t.resolveComponent("a-dropdown"),N=t.resolveComponent("a-drawer"),R=t.resolveComponent("a-modal");return d.value?(t.openBlock(),t.createBlock(ft,{key:0,class:t.normalizeClass(["unione-btn",o.value.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:p,custome:!0,"setting-title":"按钮设置"},{default:t.withCtx(()=>[!o.value.widget||o.value.widget=="button"?(t.openBlock(),t.createBlock(M,t.mergeProps({key:0,disabled:h.value,size:o.value.size||"small",type:a.type||a.widget.type,shape:o.value.shape,class:"unione-btn-"+o.value.name,loading:o.value.loading,target:o.value.action?.target,title:o.value.tooltip,onClick:V},o.value.props),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value)+" ",1)]),_:2},[o.value.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):t.createCommentVNode("",!0),o.value.widget=="dropdown"?(t.openBlock(),t.createBlock(x,{key:1,trigger:[o.value.trigger||"hover"],class:t.normalizeClass([o.value.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["dropdown-overlay",o.value.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.items,g=>(t.openBlock(),t.createBlock(v,{key:g.name,class:"item",widget:g,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:S[0]||(S[0]=B=>k(B))},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(M,{size:o.value.size||"small"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):t.createCommentVNode("",!0),o.value.action?.type=="drawer"?(t.openBlock(),t.createBlock(N,{key:2,open:b.value.open,"onUpdate:open":S[1]||(S[1]=g=>b.value.open=g),title:o.value.action?.title,placement:o.value.action?.position,maskClosable:o.value.action?.maskClosable,width:o.value.action?.width,bodyStyle:{padding:0,overflow:!o.value.action.component||o.value.action.component=="iframe"?"hidden":"auto"}},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value},null,8,Fa)):t.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):t.createCommentVNode("",!0),o.value.action?.type=="dialog"?(t.openBlock(),t.createBlock(R,{key:3,open:b.value.open,"onUpdate:open":S[2]||(S[2]=g=>b.value.open=g),title:o.value.action?.title,width:o.value.action?.width,maskClosable:o.value.action?.maskClosable,centered:"",footer:null},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value,style:t.normalizeStyle({height:o.value.action?.height?o.value.action?.height+"px":""})},null,12,Da)):t.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):t.createCommentVNode("",!0),t.createVNode(wi,{ref_key:"btnSetting",ref:f,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8f0eca98"]]),Pa={key:0,class:"unione-widget-empty-tip"},La=ie(t.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,i=t.ref(),n=t.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=t.resolveComponent("a-tab-pane"),r=t.resolveComponent("a-tabs");return t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:t.withCtx(()=>[n.value?(t.openBlock(),t.createBlock(r,{key:0,activeKey:i.value,"onUpdate:activeKey":o[0]||(o[0]=c=>i.value=c)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value.chidlren,(c,d)=>(t.openBlock(),t.createBlock(s,{key:d,class:"unione-layout-tab-pane"},{tab:t.withCtx(()=>[t.createElementVNode("span",null,[c.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.icon),{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(c.title),1)])]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.chidlren,(h,f)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(t.openBlock(),t.createElementBlock("div",Pa,t.toDisplayString(c.emptyTips),1)):t.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):t.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Ua={class:"title"},ja={class:"text"},za={key:0,class:"reactive"},qa={key:1,class:"opts"},Qa={class:"warp"},Ka=ie(t.defineComponent({__name:"section",props:t.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,i=t.computed(()=>e.editor?.widget(e.wid)||e.widget),n=t.computed(()=>i.value?.title||e.title),l=t.computed(()=>i.value?.icon||e.icon),o=t.computed(()=>i.value?.type||e.type),s=t.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,d)=>(t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[t.createElementVNode("div",Ua,[o.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["type",o.value])},null,2)):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),{key:1,class:"icon"})):t.createCommentVNode("",!0),t.createElementVNode("span",ja,t.toDisplayString(n.value),1)]),a.reactive?(t.openBlock(),t.createElementBlock("div",za,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):t.createCommentVNode("",!0),a.location=="left"?(t.openBlock(),t.createElementBlock("div",qa,[t.renderSlot(c.$slots,"opts",{},void 0,!0)])):t.createCommentVNode("",!0)],2),t.withDirectives(t.createElementVNode("div",Qa,[t.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Wa={class:"unione-props-setting unione-form-setting"},Ya={class:"unione-form-btns"},Ha={key:0},Ga=["onClick"],Ja={class:"field-txt"},Xa=["onClick"],Za={key:1,class:"field-txt"},er=["onClick"],tr={key:0,class:"field-txt"},ir={key:3,class:"edit-field"},nr={key:0},lr=["onClick"],or=ie(t.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.settings||(v.configs.settings={}),v.configs.settings.btns||(v.configs.settings.btns=[]),v}),l=t.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{const v=n.value.configs.settings.btns,x=v.map(N=>N.name);if(!x.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};v.splice(N.index,0,N)}if(!x.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let R=N.index||1;v.splice(R,0,N)}if(!x.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};v.splice(N.index,0,N)}if(!x.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};v.splice(N.index,0,N)}return v}),s=t.ref(null);function r(v){s.value&&s.value.open(v,x=>{x.visible=!0,Object.keys(x).forEach(N=>{v[N]=x[N]}),n.value.configs.settings.btns.sort((N,R)=>{const g=N.index||1,B=R.index||1;return g-B}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const v=n.value.configs.settings.btns.length+1;let x={title:"新增",name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x.name="new_"+n.value.configs.settings.btns.length;const N=n.value.configs.settings.btns.filter(R=>R.name==x.name).length;N>0&&(x.name=x.name+N),n.value.configs.settings.btns.push(x),e.editor.widget(e.wid,n.value),s.value.open(x,R=>{Object.keys(R).forEach(g=>{x[g]=R[g]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(v){const x=()=>{if(["save","submit","reset","back"].includes(v.name))v.visible=!1,n.value.configs.settings.btns=[...n.value.configs.settings.btns];else{const N=[];n.value.configs.settings.btns.forEach(R=>{R.name!=v.name&&N.push(R)}),n.value.configs.settings.btns=N}};te.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{x()}})}const h=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:v=>{const x=h.value.widgets.filter(N=>N.value==v);return x[0]?x[0].label:v},toSetting:()=>{}}),f=t.ref({visible:!1,field:{},props:{},showInfo:v=>{let x="";return v.rules&&(x=v.rules.filter(N=>N.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const v=f.value.props,x={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(x.min=v.rangeMin,x.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(x.max=v.rangeMax,x.enable=!0);const N={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(N.pattern=v.regExpress,N.enable=!0),f.value.field.rules=[x,N],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function p(v){f.value.visible=!0,f.value.field=v;const x=v.rules||[],N={trigger:"change",whitespace:!0};x.forEach(R=>{R.name=="reg"&&(N.trigger=R.trigger,N.whitespace=R.whitespace,N.regExpress=R.pattern,N.regMessage=R.message),R.name=="range"&&(N.rangeMin=R.min,N.rangeMax=R.max,N.rangeMessage=R.message)}),f.value.props=N}const m=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(v,x){const N=A.value.filter(g=>g.name==v.name);N.forEach(g=>{x!="isSort"?g[x]=!0:g[x]=!g[x]});const R=N[0];if(!(!R||x=="isSort")){switch(m.value.prop=x,m.value.field=v,R.show||(R.show={}),x){case"isQuery":R.show.query||(R.show.query={}),m.value.show=R.show.query,m.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":R.show.form||(R.show.form={}),m.value.show=R.show.form,m.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":R.show.view||(R.show.view={}),m.value.show=R.show.view,m.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":R.show.list||(R.show.list={}),m.value.show=R.show.list,m.value.title=`列头设置/${v.title}(${v.name})`;break}m.value.visible=!0}}const w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(v,x)=>{w.value.convert.options.splice(v,1)},toSetting:()=>{w.value.visible=!1}});function C(v){w.value.visible=!0,w.value.field=v,w.value.convert=v.convert||{}}const y=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),A=t.computed(()=>y.value.fields?.length?y.value.fields:[]),V={mounted:v=>v.focus()},k=t.ref({});function u(v,x){const N={};x=="convertName"?N[x]=v.convert?.type:N[x]=v[x]||"",k.value={},k.value[v.name]=N}function S(v,x){{k.value={};return}}function M(v,x){A.value.filter(R=>R.name==v.name).forEach(R=>{R[x]=!R[x]})}return(v,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),g=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-select"),O=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-checkbox"),$=t.resolveComponent("a-table"),I=t.resolveComponent("a-select-option"),j=t.resolveComponent("a-form-item"),P=t.resolveComponent("a-form"),E=t.resolveComponent("a-modal"),J=t.resolveComponent("a-checkbox-group"),F=t.resolveComponent("a-input-number"),z=t.resolveComponent("a-input"),pe=t.resolveComponent("a-col"),tt=t.resolveComponent("a-row");return t.openBlock(),t.createElementBlock("div",Wa,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[23]||(x[23]=[t.createTextVNode("按钮设置")])),_:1}),t.createElementVNode("div",Ya,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,L=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:L.name,class:["btn",L.name,!L.visible&&"deleted"],type:L.visible?L.type:"default",size:L.size,ref_for:!0},L.props||{},{onClick:Me=>r(L)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(L.title)+" ",1),L.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(Me=>d(L),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(g,{class:t.normalizeClass(["btn","btn-add"]),size:"small",onClick:x[0]||(x[0]=L=>c())},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[24]||(x[24]=[t.createTextVNode("表单设置")])),_:1}),x[36]||(x[36]=t.createTextVNode(" 数据模型:")),t.createVNode(T,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":x[1]||(x[1]=L=>n.value.dataModel=L)},null,8,["options","value"]),t.createVNode($,{columns:i.value,"data-source":A.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(t.openBlock(),t.createElementBlock("span",Ha,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(L.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:L,text:Me,record:ne})=>[["rules"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!f.value.showInfo(ne)&&"empty"]),onClick:D=>p(ne)},[t.createElementVNode("span",Ja,t.toDisplayString(f.value.showInfo(ne)),1),f.value.showInfo(ne)?(t.openBlock(),t.createBlock(g,{key:0,type:"link"},{default:t.withCtx(()=>x[25]||(x[25]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Ga)):["widget"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!k.value[ne.name]||!Object.keys(k.value[ne.name]).includes(L.dataIndex))&&!Me&&"empty"]),onClick:D=>u(ne,L.dataIndex)},[k.value[ne.name]&&Object.keys(k.value[ne.name]).includes(L.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:ne[L.dataIndex],"onUpdate:value":D=>ne[L.dataIndex]=D,options:h.value.widgets,onBlur:x[2]||(x[2]=D=>S())},null,8,["value","onUpdate:value","options"])),[[V]]):(t.openBlock(),t.createElementBlock("span",Za,t.toDisplayString(h.value.widgetName(Me)),1))],10,Xa)):["convertName"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!k.value[ne.name]||!Object.keys(k.value[ne.name]).includes(L.dataIndex))&&!ne.convert?.type&&"empty"]),onClick:D=>u(ne,L.dataIndex)},[k.value[ne.name]&&Object.keys(k.value[ne.name]).includes(L.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:ne[L.dataIndex],"onUpdate:value":D=>ne[L.dataIndex]=D,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:x[3]||(x[3]=D=>S())},null,8,["value","onUpdate:value"])),[[V]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[ne.convert?.type?(t.openBlock(),t.createElementBlock("span",tr,t.toDisplayString(ne.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),ne.convert?.type?(t.openBlock(),t.createBlock(g,{key:1,type:"link",onClick:t.withModifiers(D=>C(ne),["stop"])},{default:t.withCtx(()=>x[26]||(x[26]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,er)):["isForm","isView"].includes(L.dataIndex)?(t.openBlock(),t.createElementBlock("div",ir,[t.createVNode(_,{checked:ne[L.dataIndex],onClick:D=>M(ne,L.dataIndex)},null,8,["checked","onClick"]),t.createVNode(g,{type:"link",onClick:D=>b(ne,L.dataIndex)},{default:t.withCtx(()=>x[27]||(x[27]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(E,{visible:h.value.visible,"onUpdate:visible":x[5]||(x[5]=L=>h.value.visible=L),title:"控件设置",onOk:h.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[h.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(j,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(T,{value:h.value.props.mode,"onUpdate:value":x[4]||(x[4]=L=>h.value.props.mode=L),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(I,{value:"multiple"},{default:t.withCtx(()=>x[28]||(x[28]=[t.createTextVNode("多选")])),_:1}),t.createVNode(I,{value:"tags"},{default:t.withCtx(()=>x[29]||(x[29]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(E,{visible:f.value.visible,"onUpdate:visible":x[13]||(x[13]=L=>f.value.visible=L),title:"规则设置",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[30]||(x[30]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(j,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(J,{value:f.value.props.trigger,"onUpdate:value":x[6]||(x[6]=L=>f.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(j,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(_,{value:f.value.props.whitespace,"onUpdate:value":x[7]||(x[7]=L=>f.value.props.whitespace=L),checked:f.value.props.whitespace},{default:t.withCtx(()=>x[31]||(x[31]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[32]||(x[32]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(j,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(F,{value:f.value.props.rangeMin,"onUpdate:value":x[8]||(x[8]=L=>f.value.props.rangeMin=L)},null,8,["value"]),x[33]||(x[33]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(F,{value:f.value.props.rangeMax,"onUpdate:value":x[9]||(x[9]=L=>f.value.props.rangeMax=L)},null,8,["value"])]),_:1}),t.createVNode(j,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.rangeMessage,"onUpdate:value":x[10]||(x[10]=L=>f.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[34]||(x[34]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(j,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.regExpress,"onUpdate:value":x[11]||(x[11]=L=>f.value.props.regExpress=L)},null,8,["value"])]),_:1}),t.createVNode(j,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(z,{value:f.value.props.regMessage,"onUpdate:value":x[12]||(x[12]=L=>f.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(E,{visible:m.value.visible,"onUpdate:visible":x[20]||(x[20]=L=>m.value.visible=L),title:m.value.title,onOk:m.value.toSetting},{default:t.withCtx(()=>[t.createVNode(P,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(j,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(F,{value:m.value.show.index,"onUpdate:value":x[14]||(x[14]=L=>m.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(j,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.width,"onUpdate:value":x[15]||(x[15]=L=>m.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.labelWidth,"onUpdate:value":x[16]||(x[16]=L=>m.value.show.labelWidth=L)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(z,{value:m.value.show.valueWidth,"onUpdate:value":x[17]||(x[17]=L=>m.value.show.valueWidth=L)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(T,{value:m.value.show.fixed,"onUpdate:value":x[18]||(x[18]=L=>m.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(j,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(T,{value:m.value.show.align,"onUpdate:value":x[19]||(x[19]=L=>m.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(E,{visible:w.value.visible,"onUpdate:visible":x[22]||(x[22]=L=>w.value.visible=L),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",nr,[t.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>x[35]||(x[35]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode($,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:L,record:Me,index:ne})=>[L.dataIndex==="label"?(t.openBlock(),t.createBlock(z,{key:0,value:Me.label,"onUpdate:value":D=>Me.label=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),L.dataIndex==="value"?(t.openBlock(),t.createBlock(z,{key:1,value:Me.value,"onUpdate:value":D=>Me.value=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),L.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:D=>w.value.toDelOption(ne,Me)},"删除",8,lr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(P,{key:1,model:w.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(tt,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(pe,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(j,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(z,{value:w.value.convert.dict,"onUpdate:value":x[21]||(x[21]=L=>w.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(wi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),sr={key:0,class:"form-left"},ar={class:"form-warp"},rr={key:1,class:"form-right"},cr=ie(t.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const i=a,n=t.ref(!1),l=t.ref(),o=t.ref({}),s=t.ref(null);t.onMounted(()=>{if(c.value.dsn){const u=r.value.dataManager();c.value.primary&&u.psn(c.value.dsn),s.value.setDisabled=k,s.value.getValue=w,s.value.setValue=C,s.value.reset=y,l.value=u.useForm(c.value.dsn,s.value,S=>{o.value=S.body||{}})}i.editor||r.value.loadConfig({widgets:d.value}),i.form?.model&&r.value.setModel(i.form.model),A()});const r=t.computed(()=>i.editor||new ht),c=t.computed(()=>i.widget||i.form||{}),d=t.computed(()=>{let u=c.value.widgets||[];return!u.length&&i.form?.fields&&(u=i.form.fields),u.forEach(S=>{S.widget||(S.widget="unione-form-item"),S.control||(S.control="a-input")}),u}),h=t.computed(()=>d.value.filter(u=>u.float=="left")),f=t.computed(()=>d.value.filter(u=>!u.float)),p=t.computed(()=>d.value.filter(u=>u.float=="right")),m=t.inject("pageSetting",{}),b=t.computed(()=>c.value.setting||m?.form||{});t.provide("formSetting",b.value);function w(){return o.value}function C(u){o.value=u,A()}function y(){o.value={},A()}function A(){const u=S=>{S.widget=="unione-form-item"&&S.name&&(S.value!=null&&S.value!=null&&S.value!=""||S.value==0)&&(o.value[S.name]==null||o.value[S.name]==null||o.value[S.name]=="")&&(o.value[S.name]=S.value),S.widgets?.forEach(M=>{u(M)})};d.value.forEach(S=>{u(S)})}function V(){return new Promise((u,S)=>{s.value.validate().then(M=>{u(o.value)}).catch(M=>{S(M)})})}function k(u=!0){n.value=u}return e({validate:V,getValue:w,setValue:C,reset:y,setDisabled:k}),(u,S)=>{const M=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ft,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},t.createSlots({default:t.withCtx(()=>[t.createVNode(M,{ref_key:"formObj",ref:s,model:o.value,class:t.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(b.value.showColumn||3)])},{default:t.withCtx(()=>[h.value?.length?(t.openBlock(),t.createElementBlock("div",sr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0),t.createElementVNode("div",ar,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),p.value?.length?(t.openBlock(),t.createElementBlock("div",rr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,v=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(v.widget),{key:v.name,widget:v,editor:r.value,value:o.value[v.name],"onUpdate:value":x=>o.value[v.name]=x,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:2},[a.editor&&c.value.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(or,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a31125db"]]);function Ml(a,e=!1){const i=Le();if(!a)return Promise.reject("字典名称不能为空");const n=localStorage.getItem("UNIONE-DICT-"+a);return n&&e==!1?Promise.resolve(JSON.parse(n)):(i.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{K.axios.admin({url:"/api/base/dict/load/"+a}).then(s=>{if(s.success){const r=s.body.filter(c=>c.dictName!=c.dictKey);r.forEach(c=>{c.value=c.dictKey,c.label=c.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):o("字典加载失败,dict:"+a+",字典项列表为空")}else i.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function _l(a,e){const i=Le();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Ml(a),l=n.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(i.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",n),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function dr(a,e){const i=await _l(a,e);return Promise.resolve(i.dictValue)}const Tl={load:Ml,getLabel:dr,getOption:_l};class Qe{types;convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.types=e.types,this.convertObj=e,this.options=e.options||[],this.config=Le()}load(e,i=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(n=>n.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((n,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Tl.load(this.convertObj.dictName,i).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),n(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((n,l)=>{const o={body:this.convertObj.params||{}};this.convertObj.pidField&&(o.pid=-1);const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?n(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(d=>d.value==e).length?n(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,K.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(d=>{if(d.success){const h={};this.options.forEach(f=>{h[e]=!0}),d.body.forEach(f=>{h[f.value]||this.options.push(f)}),n(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?Tl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const i=this.convertObj.options.filter(n=>n.value==e);return i.length?Promise.resolve(i[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const i=this.options.filter(n=>n.value==e);if(i.length)return Promise.resolve(i[0].label)}return new Promise((i,n)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return i(o[0].label);n()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((n,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],n(s.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,s),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+s.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){if(this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option")return Promise.resolve(this.options.filter(n=>n.label.indexOf(e)>=0));const i={...this.convertObj.params||{}};return new Promise(n=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios[this.convertObj.ctx||"admin"]({url:l,data:{body:{...i,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),n(o.body)):n([])})})}$processOptions(e){return this.convertObj.types=="local"&&!this.convertObj.process&&e.forEach(i=>{this.convertObj.idField&&(i.id=i[this.convertObj.idField]),this.convertObj.pidField&&(i.pid=i[this.convertObj.pidField]),i.value=i[this.convertObj.valueField||"id"],i.label=i[this.convertObj.labelField||"title"]}),this.convertObj.process?this.convertObj.process(e):e}}function At(a,e=350){let i=null;return n=>{clearTimeout(i),i=setTimeout(()=>{a(n)},e)}}const hr=["innerHTML"],fr={key:2,class:"text-view"},ur=ie(t.defineComponent({__name:"formItem",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.computed(()=>o.value.showFormat?o.value.showFormat.call(this,i.value,{label:C.value,form:e.formValue}):C.value||i.value),l=t.inject("formSetting");t.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(i.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?i.value=s.value.value.split(","):i.value=[s.value.value])))});const o=t.ref({}),s=t.computed(()=>{const y=e.editor?.widget(e.wid)||e.widget||{};return y.event&&Object.keys(y.event).forEach(A=>{const V=y.event[A];V&&(o.value[A]=null,typeof V=="function"?o.value[A]=V:V.enable&&V.scriptText&&(o.value[A]=new Function("value","ctx",V.scriptText)))}),y}),r=t.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=t.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=At(()=>{if(o.value.change)return o.value.change(e.formValue[s.value.name],e.formValue)||s.value.change;s.value.change&&s.value.change(e.formValue[s.value.name],e.formValue)}),h=t.ref({}),f=t.computed(()=>{const y=[],A=s.value.rule||{};let V=s.value.props?.required||s.value.required;if(o.value.required&&(V=o.value.required(e.formValue[s.value.name],e.formValue)),V&&y.push({required:!0,whitespace:A?.whitespace||!1,trigger:A?.trigger||l.ruleTrigger||"change",validator:(k,u)=>(A?.whitespace&&u&&typeof u=="string"&&(u=u.trim()),u!=null&&u!=null&&(u+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),A.advance&&h.value[A.advance]){const k=h.value[A.advance];y.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"})}return A.regExpress&&y.push({pattern:A.regExpress,message:A.regMessage||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&y.push({validator:(k,u)=>u&&(u+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(u+"").length+"]"):Promise.resolve(),trigger:A?.trigger||l.ruleTrigger||"change"}),y}),p=t.computed(()=>{const y=s.value.props||{};if(s.value.control=="a-input-number"){const A=s.value.rule||{};A.rangeMin!=null&&A.rangeMin!=null&&(y.min=A.rangeMin),A.rangeMax!=null&&A.rangeMax!=null&&(y.max=A.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(y.format=s.value.view.dataFormat,y.valueFormat=s.value.view.dataFormat),s.value.required&&(y.required=s.value.required),y}),m=t.computed(()=>{const y=s.value.css||{},A=["form-item-"+s.value.name];return y.cssName&&A.push(y.cssName),l.platform=="app"?y.cssName?typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0&&A.push("all-line"):A.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!y.cssName||typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0)&&A.push("all-line"):s.value.view.width==2&&A.push("2in-line")),A}),b=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&y>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(A/y)}:s.value.view?.width>=3&&y>1?{span:Math.round(A/y)}:{span:A}}),w=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&y>1&&m.value.includes("all-line")?{}:{span:A}}),C=t.ref();return t.watch(i,()=>{i.value&&e.editor?.model.value=="view"&&s.value.convert&&new Qe(s.value.convert).convert(i.value.toString()).then(y=>{C.value=y})}),(y,A)=>{const V=t.resolveComponent("a-form-item");return t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-form-item",m.value]),style:t.normalizeStyle(s.value.css?.cssText)},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(V,{key:0,label:c.value,name:s.value.name,labelCol:b.value,wrapperCol:w.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:t.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value.control||"a-input"),t.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:t.unref(d),value:i.value,"onUpdate:value":A[0]||(A[0]=k=>i.value=k),formValue:a.formValue},p.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:n.value},null,8,hr)):(t.openBlock(),t.createElementBlock("div",fr,t.toDisplayString(n.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):t.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),pr=ie(t.defineComponent({__name:"selectBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object},mode:{type:String,default:"combobox"},valueType:{type:String,default:"string"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Le();const e=a,i=t.ref(),n=t.useModel(a,"value"),l=t.ref([]),o=t.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=t.computed(()=>{const b=p.value.convert||e.convert||{};if(b.refValue){const w={};return b.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=K.utils.obj.getValue(e.formValue,A[0]):w[A[0]]=K.utils.obj.getValue(e.formValue,A[1])}),w}return{}}),r=t.computed(()=>(p.value.convert||e.convert||{}).search||!1),c=At(b=>{const w=p.value.convert||e.convert||{};w.params={...h.value,...s.value},m.value.search(b).then(C=>{l.value=C})},500);function d(b,w){f.value.select&&f.value.select(b,{option:w,formValue:e.formValue})}const h=t.ref();t.onMounted(()=>{const b=p.value.convert||e.convert||{};h.value=b.params||{},b.params={...h.value,...s.value},e.mode=="multiple"&&typeof n.value=="string"&&(i.value=n.value.split(",")),m.value.load(n.value).then(w=>{l.value=w})});const f=t.ref({}),p=t.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(w=>{const C=b.event[w];C&&(f.value[w]=null,typeof C=="function"?f.value[w]=C:C.enable&&C.scriptText&&(f.value[w]=new Function("value","ctx",C.scriptText)))}),b}),m=t.computed(()=>{const b=p.value.convert||e.convert||{};return new Qe(b)});return t.watch(n,At(()=>{n.value&&(e.mode=="multiple"&&typeof n.value=="string"&&(i.value=n.value.split(",")),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(n.value).then(b=>{l.value=b}))},200)),t.watch(()=>p.value.convert||e.convert||{},At(()=>{m.value.load().then(b=>{l.value=b})})),t.watch(()=>s.value,At(()=>{if(console.log(p.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const b=p.value.convert||e.convert||{};b.params={...h.value,...s.value},m.value.load(n.value,!0).then(w=>{l.value=w})}},200),{deep:!0}),t.watch(i,()=>{Array.isArray(i.value)&&e.valueType=="string"?n.value=i.value.join(","):n.value=i.value}),(b,w)=>{const C=t.resolveComponent("a-select");return t.openBlock(),t.createBlock(C,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:i.value,"onUpdate:value":w[0]||(w[0]=y=>i.value=y),onSearch:t.unref(c),onSelect:d},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-f4706b5f"]]),mr=ie(t.defineComponent({__name:"switchBox",props:t.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.ref({});t.onMounted(()=>{s.value?.load(i.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(n.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?n.value.checkedValue=!0:n.value.checkedValue=1):(n.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?n.value.unCheckedValue=!1:n.value.unCheckedValue=0)})})});const l=t.ref({}),o=t.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(c=>{const d=r.event[c];d&&(l.value[c]=null,typeof d=="function"?l.value[c]=d:d.enable&&d.scriptText&&(l.value[c]=new Function("value","ctx",d.scriptText)))}),r}),s=t.computed(()=>{const r=o.value.convert||e.convert;return r?new Qe(r):null});return(r,c)=>{const d=t.resolveComponent("a-switch");return t.openBlock(),t.createBlock(d,t.mergeProps({class:"unione-form-switch"},n.value,{checked:i.value,"onUpdate:checked":c[0]||(c[0]=h=>i.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),gr=ie(t.defineComponent({__name:"radioBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value"),n=t.ref([]),l=t.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=t.computed(()=>{const h=c.value.convert||e.convert||{};if(h.refValue){const f={};return h.refValue.split(",").forEach(m=>{const b=m.split("=");b.length==1?f[b[0]]=K.utils.obj.getValue(e.formValue,b[0]):f[b[0]]=K.utils.obj.getValue(e.formValue,b[1])}),console.log(c.value.name+" ref field:"+h.refValue+",ref value",f),f}return{}}),s=t.ref();t.onMounted(()=>{const h=c.value.convert||e.convert||{};s.value=h.params||{},h.params={...s.value,...o.value},d.value.load(i.value||c.value.value).then(f=>{n.value=f})});const r=t.ref({}),c=t.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const p=h.event[f];p&&(r.value[f]=null,typeof p=="function"?r.value[f]=p:p.enable&&p.scriptText&&(r.value[f]=new Function("value","ctx",p.scriptText)))}),h}),d=t.computed(()=>{const h=c.value.convert||e.convert||{};return new Qe(h)});return t.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const h=c.value.convert||e.convert||{};h.params={...s.value,...o.value},d.value.load(void 0,!0).then(f=>{n.value=f})}},{deep:!0}),(h,f)=>{const p=t.resolveComponent("a-radio-group");return t.openBlock(),t.createBlock(p,{class:"unione-form-radio",options:l.value,value:i.value,"onUpdate:value":f[0]||(f[0]=m=>i.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),kr=ie(t.defineComponent({__name:"checkBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},returnType:{type:String,default:"string"},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const i=a,n=t.useModel(a,"value"),l=t.ref(),o=t.ref([]),s=t.computed(()=>o.value?.length?o.value:i.options?.length?i.options:[]),r=t.computed(()=>{const b=h.value.convert||i.convert||{};if(b.refValue){const w={};return b.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=K.utils.obj.getValue(i.formValue,A[0]):w[A[0]]=K.utils.obj.getValue(i.formValue,A[1])}),console.log(h.value.name+" ref field:"+b.refValue+",ref value",w),w}return{}}),c=t.ref();t.onMounted(()=>{const b=n.value||h.value.value;i.returnType==="string"?l.value=b.split(","):l.value=b;const w=h.value.convert||i.convert||{};c.value=w.params||{},w.params={...c.value,...r.value},m.value.load().then(C=>{o.value=C})});const d=t.ref({}),h=t.computed(()=>{const b=i.editor?.widget(i.wid)||i.widget||{};return b.event&&Object.keys(b.event).forEach(w=>{const C=b.event[w];d.value[w]=null,C.enable&&C.scriptText&&(d.value[w]=new Function("value","ctx",C.scriptText))}),b}),f=e;function p(b){i.returnType==="string"?n.value=b.join(","):n.value=b,console.log("checkbox changed",n.value),f("change",n.value)}const m=t.computed(()=>{const b=h.value.convert||i.convert||{};return new Qe(b)});return t.watch(()=>n.value,()=>{l.value=Array.isArray(n.value)?n.value:[],n.value&&!Array.isArray(n.value)&&(l.value=n.value.split(","))}),t.watch(()=>r.value,()=>{if(console.log(h.value.name+" ref value changed",r.value),r.value){l.value=[],i.returnType==="string"?n.value="":n.value=[];const b=h.value.convert||i.convert||{};b.params={...c.value,...r.value},m.value.load(void 0,!0).then(w=>{o.value=w})}},{deep:!0}),(b,w)=>{const C=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createBlock(C,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":w[0]||(w[0]=y=>l.value=y),onChange:p},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),br=ie(t.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=t.ref(),i=t.useModel(a,"value");return t.watch(()=>e.value,()=>{e.value?i.value=K.utils.sm2Encrypt(e.value):i.value=""}),(n,l)=>{const o=t.resolveComponent("a-input-password");return t.openBlock(),t.createBlock(o,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=s=>e.value=s)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]);function pn(a){const e=a.toLowerCase().split("_"),i=[];i.push(e[0]);for(let n=1;n<e.length;n++){const l=e[n];l&&(i.push(l.charAt(0).toUpperCase()),l.length>1&&i.push(l.substring(1)))}return i.join("")}const Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Fl(a=10){const e=Date.now().toString(),i=new Uint32Array(a);crypto.getRandomValues(i);let n="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+i[l])%Il.length;n+=Il[o]}return n}const yr={toHump:pn,randomStr:Fl},wr=ie(t.defineComponent({__name:"randomInput",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},len:{type:Number,default:10}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,i=t.useModel(a,"value");function n(){i.value=Fl(e.len)}return(l,o)=>{const s=t.resolveComponent("SyncOutlined"),r=t.resolveComponent("a-input");return t.openBlock(),t.createBlock(r,{class:"unione-form-random-input",value:i.value,"onUpdate:value":o[0]||(o[0]=c=>i.value=c)},{suffix:t.withCtx(()=>[t.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:n})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),Ar=ie(t.defineComponent({__name:"uploadBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},btnLabel:{type:String,default:"上传文件"},valueType:{type:String,default:"array"},autoUpload:{type:Boolean,default:!1},beforeUpload:{type:Function,required:!1},disabled:{type:Boolean,default:!1}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const i=a,n=e,l=t.useModel(a,"value"),o=t.ref([]),s=t.computed(()=>!i.disabled||i.editor?.model.value!="view");t.watch(l,()=>{o.value=[],l.value&&(Array.isArray(l.value)?o.value=l.value:o.value=JSON.parse(l.value))});function r(d){return i.beforeUpload?i.beforeUpload(d):i.autoUpload}function c({fileList:d}){i.valueType=="array"?(l.value=d,n("change",d)):(l.value=JSON.stringify(d),n("change",JSON.stringify(d)))}return(d,h)=>{const f=t.resolveComponent("upload-outlined"),p=t.resolveComponent("a-button"),m=t.resolveComponent("a-upload");return t.openBlock(),t.createBlock(m,{class:"unione-form-upload-box","file-list":o.value,"onUpdate:fileList":h[0]||(h[0]=b=>o.value=b),disabled:!s.value,beforeUpload:r,onChange:c},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createBlock(p,{key:0},{default:t.withCtx(()=>[t.createVNode(f),t.createTextVNode(" "+t.toDisplayString(a.btnLabel),1)]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["file-list","disabled"])}}}),[["__scopeId","data-v-a6190474"]]),xr={class:"unione-props-setting unione-query-setting"},Cr={class:"unione-query-opts"},vr={key:0},Sr=["onClick"],Br={key:1},Nr={key:1,class:"edit-field"},Vr=["onClick"],Rr=ie(t.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),n=t.computed(()=>{const V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),l=t.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=t.computed(()=>{const V=[],k=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(u=>{V.push(u),k.push(u.name)}),k.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((u,S)=>{const M=u.index||1,v=S.index||1;return M-v}),V}),s=t.ref(null);function r(V){s.value&&s.value.open(V,k=>{k.visible=!0,Object.keys(k).forEach(u=>{V[u]=k[u]}),n.value.configs.btns.sort((u,S)=>{const M=u.index||1,v=S.index||1;return M-v}),n.value.configs.btns=[...n.value.configs.btns]})}function c(){const V=n.value.configs.btns.length+1;let k={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.btns.push(k),e.editor.widget(e.wid,n.value),s.value.open(k,u=>{Object.keys(u).forEach(S=>{k[S]=u[S]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(V){const k=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const u=[];n.value.configs.btns.forEach(S=>{S.name!=V.name&&u.push(S)}),n.value.configs.btns=u}};te.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const h=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),f=t.computed(()=>h.value.fields?.length?h.value.fields:[]),p={mounted:V=>V.focus()},m=t.ref({});function b(){const V=Object.keys(m.value);if(V.length)for(let k in V){const u=f.value.filter(S=>S.name==k);if(u&&u[0]){let S=m.value[k];Object.keys(S).forEach(M=>{if(M=="showIndex"){const v=u[0].show?.query||{};u[0].show||(u[0].show={}),u[0].show.query={...v,index:S[M]}}else u[0][M]=S[M]})}}m.value={}}function w(V,k){b();const u={};u[k]=V[k]||"",k=="showIndex"&&(u[k]=V.show?.query?.index),m.value[V.name]=u}function C(V,k){if(!V||!k){m.value={};return}const u=m.value[V.name][k];if(k=="showIndex"){const S=V.show?.query||{};V.show||(V.show={}),V.show.query={...S,index:u}}else V[k]=u;m.value={}}function y(V,k){f.value.filter(S=>S.name==V.name).forEach(S=>{S[k]=!S[k]})}const A=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:V=>{const k=A.value.options.filter(u=>u.value==V);return k[0]?k[0].label:V}});return(V,k)=>{const u=t.resolveComponent("a-divider"),S=t.resolveComponent("CloseOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("PlusOutlined"),x=t.resolveComponent("a-select"),N=t.resolveComponent("ToolOutlined"),R=t.resolveComponent("a-checkbox"),g=t.resolveComponent("a-input-number"),B=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",xr,[t.createVNode(u,{orientation:"left"},{default:t.withCtx(()=>k[3]||(k[3]=[t.createTextVNode("查询按钮")])),_:1}),t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,T=>(t.openBlock(),t.createBlock(M,t.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"default",ref_for:!0},T.props||{},{onClick:O=>r(T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(S,{key:0,class:"btn-del",onClick:t.withModifiers(O=>d(T),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(M,{class:t.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=T=>c()),size:"small"},{default:t.withCtx(()=>[t.createVNode(v)]),_:1})]),t.createVNode(u,{orientation:"left"},{default:t.withCtx(()=>k[4]||(k[4]=[t.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=t.createTextVNode(" 数据模型:")),t.createVNode(x,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":k[1]||(k[1]=T=>n.value.dataModel=T)},null,8,["options","value"]),t.createVNode(B,{columns:i.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:T})=>[["showIndex","queryType"].includes(T.key)?(t.openBlock(),t.createElementBlock("span",vr,[t.createVNode(N),t.createTextVNode(" "+t.toDisplayString(T.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:T,text:O,record:_})=>[["queryType"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!m.value[_.name]||!Object.keys(m.value[_.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>w(_,T.dataIndex)},[m.value[_.name]&&Object.keys(m.value[_.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(x,{key:0,value:_[T.dataIndex],"onUpdate:value":$=>_[T.dataIndex]=$,allowClear:!0,options:A.value.options,onBlur:k[2]||(k[2]=$=>C())},null,8,["value","onUpdate:value","options"])),[[p]]):(t.openBlock(),t.createElementBlock("span",Br,t.toDisplayString(A.value.showLabel(O)),1))],10,Sr)):["isQuery"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",Nr,[t.createVNode(R,{checked:_[T.dataIndex],onClick:$=>y(_,T.dataIndex)},null,8,["checked","onClick"])])):T.dataIndex=="showIndex"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!m.value[_.name]||!Object.keys(m.value[_.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>w(_,T.dataIndex)},[m.value[_.name]&&Object.keys(m.value[_.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(g,{key:0,value:m.value[_.name][T.dataIndex],"onUpdate:value":$=>m.value[_.name][T.dataIndex]=$,onBlur:$=>C(_,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_.show?.query?.index||" "),1)],64))],10,Vr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(wi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),Er={class:"query-btn"},Or={class:"btn-advanced-overlay"},Dl=ie(t.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const i=a,n=t.computed(()=>{const C=i.editor?.widget(i.wid)||i.widget||{};return C.btns||(C.btns=[]),C}),l=t.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=t.computed(()=>{let C=[];return n.value.fields?.length&&(C=n.value.fields),C.length==0&&i.fields?.length&&(C=i.fields),C.sort((y,A)=>{const V=y.show?.query?.index||1,k=A.show?.query?.index||1;return V-k}),C.forEach(y=>{!y.widget&&!y.control&&y.convert&&(y.widget="unione-select-box"),y.widget=y.widget||y.control||"a-input",y.defaultValue!=null&&y.defaultValue!="undefined"&&typeof y.defaultValue<"u"&&(h.value[y.name]=y.defaultValue,y.value=y.defaultValue)}),C}),s=t.computed(()=>n.value.labelWidth||7),r=t.computed(()=>{const C=n.value.btns.filter(y=>y.name=="advanced")[0]||{};return C.event?.clickScript&&(C.event.click=new Function("ctx","btn","event",C.event.clickScript)),C.event?.disableScript&&(C.event.disable=new Function("ctx","btn",C.event.disableScript)),C.event?.visibleScript&&(C.event.visible=new Function("ctx","btn",C.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...C}}),c=["query","reset","advanced"],d=t.computed(()=>{const C=n.value.btns.filter(A=>A.name!="advanced"),y=[];return C.forEach(A=>{A.size||(A.size="default"),y.push(A.name)}),y.includes("query")||C.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),y.includes("reset")||C.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),C.sort((A,V)=>{const k=A.index||1,u=V.index||1;return k-u}),C}),h=t.ref({}),f=t.computed(()=>{const C={};return n.value.params?Object.keys(n.value.params).forEach(y=>{C[y]=n.value.params[y]}):i.params&&Object.keys(i.params).forEach(y=>{C[y]=i.params[y]}),C});t.onMounted(()=>{i.editor?.ebus.$on("query-form-params",C=>{n.value.params=C}),b()});const p=e;function m({btn:C,event:y}){console.log("unione query form btn click",C,y),C.name=="query"&&b(),C.name=="reset"&&w(),p("btnClick",{btn:C,event:y})}function b(){const C=[];o.value.forEach(A=>{A.visible&&C.push(A.name)});const y={params:{...f.value},keywords:""};Object.keys(h.value).forEach(A=>{C.includes(A)&&(y.params[A]=h.value[A])}),l.value.visible&&h.value[l.value.name]&&(y.keywords=h.value[l.value.name]),p("query",y),i.editor?.ebus.$emit("table-list-search",y)}function w(){h.value={},o.value.forEach(y=>{y.visible=!1});const C={params:{...f.value},keywords:""};p("reset",C),i.editor?.ebus.$emit("table-list-reset",C)}return(C,y)=>{const A=t.resolveComponent("a-input"),V=t.resolveComponent("a-form-item"),k=t.resolveComponent("unione-btn"),u=t.resolveComponent("a-checkbox"),S=t.resolveComponent("DownOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("a-dropdown"),x=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ft,{class:"unione-query-form",model:i.editor?.model.value,"setting-title":"查询设置"},t.createSlots({default:t.withCtx(()=>[t.createVNode(x,{model:h.value,layout:"horizontal","label-col":{span:s.value}},{default:t.withCtx(()=>[l.value.visible?(t.openBlock(),t.createBlock(V,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:t.normalizeStyle({width:s.value})},{default:t.withCtx(()=>[t.createVNode(A,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":y[0]||(y[0]=N=>h.value[l.value.name]=N),allowClear:"",onKeyup:t.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible?(t.openBlock(),t.createBlock(V,{key:0,label:N.title,class:t.normalizeClass(["query-field",N.name]),style:t.normalizeStyle({width:s.value}),name:N.name},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(N.widget),t.mergeProps({placeholder:N.placeholder,value:h.value[N.name],"onUpdate:value":R=>h.value[N.name]=R,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):t.createCommentVNode("",!0)],64))),128)),t.createElementVNode("div",Er,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible!=!1?(t.openBlock(),t.createBlock(k,{key:0,widget:N,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(t.openBlock(),t.createBlock(v,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:t.withCtx(()=>[t.createElementVNode("div",Or,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createBlock(u,{key:N.name,class:"item",checked:N.visible,onClick:R=>N.visible=!N.visible},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:t.withCtx(()=>[t.createVNode(M,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.value.title)+" ",1),t.createVNode(S)]),_:1})]),_:1},8,["trigger"])):t.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[i.editor&&i.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(Rr,{editor:i.editor,wid:i.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),Mr={class:"unione-props-setting unione-table-setting"},_r={class:"unione-table-tools"},Tr={key:1,class:"unione-table-opts"},Ir={key:0},Fr=["onClick"],Dr={key:1,class:"edit-field"},$r=["onClick"],Pr={key:1},Lr=ie(t.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(v,x){let N=v.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(v,x){let N=v.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=t.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.leftBtns||(v.configs.leftBtns=[]),v.configs.rightBtns||(v.configs.rightBtns=[]),v.configs.operation||(v.configs.operation={}),v.configs.operation.btns||(v.configs.operation.btns=[]),v.configs.operation.more||(v.configs.operation.more={}),v}),l=t.computed(()=>(e.editor.dataModels()||[]).map(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{if(!n.value)return[];const v=[],x=n.value.configs.leftBtns;if(x.forEach(N=>{v.push(N.name)}),!v.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};x.splice(0,0,N)}if(!v.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};x.splice(1,0,N)}return x}),s=t.computed(()=>{if(!n.value)return[];const v=[],x=n.value.configs.rightBtns;if(x.forEach(N=>{v.push(N.name)}),!v.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};x.splice(0,0,N)}if(!v.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};x.splice(1,0,N)}if(!v.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};x.splice(2,0,N)}if(!v.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};x.splice(3,0,N)}return x});function r(v,x){v=="left"?h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),n.value.configs.leftBtns.sort((R,g)=>{const B=R.index||1,T=g.index||1;return B-T}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),n.value.configs.rightBtns.sort((R,g)=>{const B=R.index||1,T=g.index||1;return B-T}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(v){const x=v=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let N={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};v=="left"?n.value.configs.leftBtns.push(N):n.value.configs.rightBtns.push(N),e.editor.widget(e.wid,n.value),r(v,N)}function d(v,x){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(x.name))x.visible=!1,v=="left"?n.value.configs.leftBtns=[...n.value.configs.leftBtns]:n.value.configs.rightBtns=[...n.value.configs.rightBtns];else if(v=="left"){const R=[];n.value.configs.leftBtns.forEach(g=>{g.name!=x.name&&R.push(g)}),n.value.configs.leftBtns=R}else{const R=[];n.value.configs.rightBtns.forEach(g=>{g.name!=x.name&&R.push(g)}),n.value.configs.rightBtns=R}};te.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const h=t.ref(null);function f(v){h.value.open(v,x=>{x.visible=!0,Object.keys(x).forEach(N=>{v[N]=x[N]}),n.value.configs.operation.btns.sort((N,R)=>{const g=N.index||1,B=R.index||1;return g-B}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function p(){const v=n.value.configs.operation.btns.length+1;let x={title:"新增"+v,name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.operation.btns.push(x),e.editor.widget(e.wid,n.value),h.value.open(x,N=>{Object.keys(N).forEach(R=>{x[R]=N[R]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(v){const x=()=>{if(["delete","view","edit"].includes(v.name))v.visible=!1,n.value.configs.operation.btns=[...n.value.configs.operation.btns];else{const N=[];n.value.configs.operation.btns.forEach(R=>{R.name!=v.name&&N.push(R)}),n.value.configs.operation.btns=N}};te.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{x()}})}const b=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),w=t.computed(()=>b.value.fields?.length?(b.value.fields.forEach(v=>{v.show||(v.show={}),v.show.list||(v.show.list={})}),b.value.fields):[]),C={mounted:v=>v.focus()},y=t.ref({});function A(){const v=Object.keys(y.value);if(v.length)for(let x in v){const N=w.value.filter(R=>R.name==x);if(N&&N[0]){let R=y.value[x];Object.keys(R).forEach(g=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),g=="showIndex"?N[0].show.list.index=R[g]:g=="showWidth"?N[0].show.list.width=R[g]:g=="fixed"?N[0].show.list.fixed=R[g]:g=="align"?N[0].show.list.align=R[g]:N[0][g]=R[g]})}}y.value={}}function V(v,x){A();const N={};x=="showIndex"?N[x]=v.show?.list?.index:x=="showWidth"?N[x]=v.show?.list?.width:x=="fixed"?N[x]=v.show?.list?.fixed:x=="align"?N[x]=v.show?.list?.align:N[x]=v[x]||"",y.value[v.name]=N}function k(v,x){if(!v||!x){y.value={};return}const N=y.value[v.name][x];v.show||(v.show={}),v.show.list||(v.show.list={}),x=="showIndex"?v.show.list.index=N:x=="showWidth"?v.show.list.width=N:x=="fixed"?v.show.list.fixed=N:x=="align"?v.show.list.align=N:v[x]=N,y.value={}}function u(v,x){return x=="showIndex"?v.show?.list?.index:x=="showWidth"?v.show?.list?.width:x=="fixed"?v.show?.list?.fixed:x=="align"?v.show?.list?.align:v[x]}function S(v,x){w.value.filter(R=>R.name==v.name).forEach(R=>{R[x]=!R[x]})}const M=t.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:v=>{const x=M.value.options.filter(N=>N.value==v);return x[0]?x[0].label:v}});return(v,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),g=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-input"),O=t.resolveComponent("a-form-item"),_=t.resolveComponent("a-col"),$=t.resolveComponent("a-input-number"),I=t.resolveComponent("a-checkbox"),j=t.resolveComponent("a-row"),P=t.resolveComponent("a-select"),E=t.resolveComponent("ToolOutlined"),J=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Mr,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[8]||(x[8]=[t.createTextVNode("工具设置")])),_:1}),t.createElementVNode("div",_r,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,F=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:z=>r("left",F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(z=>d("left",F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(g,{class:t.normalizeClass(["btn","tool-add"]),size:"small",onClick:x[0]||(x[0]=F=>c("left"))},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),t.createVNode(g,{class:t.normalizeClass(["btn","tool-add","right"]),onClick:x[1]||(x[1]=F=>c("right")),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,F=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:F.name,class:["btn","right",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size,ref_for:!0},F.props||{},{onClick:z=>r("right",F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(z=>d("right",F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[9]||(x[9]=[t.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createBlock(j,{key:0},{default:t.withCtx(()=>[t.createVNode(_,{span:7},{default:t.withCtx(()=>[t.createVNode(O,{label:"操作标题"},{default:t.withCtx(()=>[t.createVNode(T,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:5},{default:t.withCtx(()=>[t.createVNode(O,{label:"显示宽度",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":x[2]||(x[2]=F=>n.value.configs.operation.width=F)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:6},{default:t.withCtx(()=>[t.createVNode(O,{label:"显示按钮数量",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":x[3]||(x[3]=F=>n.value.configs.operation.count=F)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(_,{span:5},{default:t.withCtx(()=>[t.createVNode(O,{label:"是否显示"},{default:t.withCtx(()=>[t.createVNode(I,{checked:n.value.configs.operation.visible,"onUpdate:checked":x[4]||(x[4]=F=>n.value.configs.operation.visible=F)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[10]||(x[10]=[t.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createElementBlock("div",Tr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value.configs.operation.btns,F=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size||"small",ref_for:!0},F.props||{},{onClick:z=>f(F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(z=>m(F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(g,{class:t.normalizeClass(["btn","btn-add"]),onClick:x[5]||(x[5]=F=>p()),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[11]||(x[11]=[t.createTextVNode("表头设置")])),_:1}),x[12]||(x[12]=t.createTextVNode(" 数据模型:")),t.createVNode(P,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":x[6]||(x[6]=F=>n.value.dataModel=F)},null,8,["options","value"]),t.createVNode(J,{columns:i.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:F})=>[["showIndex","showWidth","align","fixed"].includes(F.key)?(t.openBlock(),t.createElementBlock("span",Ir,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(F.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:F,record:z})=>[["showIndex","showWidth"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!y.value[z.name]||!Object.keys(y.value[z.name]).includes(F.dataIndex))&&!u(z,F.dataIndex)&&"empty"]),onClick:pe=>V(z,F.dataIndex)},[y.value[z.name]&&Object.keys(y.value[z.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock($,{key:0,value:y.value[z.name][F.dataIndex],"onUpdate:value":pe=>y.value[z.name][F.dataIndex]=pe,onBlur:pe=>k(z,F.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[C]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u(z,F.dataIndex)),1)],64))],10,Fr)):["isList","isQuery","isSort"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",Dr,[t.createVNode(I,{checked:z[F.dataIndex],onClick:pe=>S(z,F.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!y.value[z.name]||!Object.keys(y.value[z.name]).includes(F.dataIndex))&&!u(z,F.dataIndex)&&"empty"]),onClick:pe=>V(z,F.dataIndex)},[y.value[z.name]&&Object.keys(y.value[z.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(P,{key:0,value:z.show.list[F.dataIndex],"onUpdate:value":pe=>z.show.list[F.dataIndex]=pe,allowClear:!0,options:F.options,onBlur:x[7]||(x[7]=pe=>k())},null,8,["value","onUpdate:value","options"])),[[C]]):(t.openBlock(),t.createElementBlock("span",Pr,t.toDisplayString(F.showLabel(F.options,u(z,F.dataIndex))),1))],10,$r)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(wi,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Ur={class:"unione-table-tools"},jr={class:"unione-table-data"},zr={key:0,class:"unione-table-opts"},$l=ie(t.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:i}){const n=Le(),l=a,o=t.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=t.computed(()=>o.value.props||{}),r=t.computed(()=>o.value.rowKey||l.rowKey||"id"),c=t.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),d=t.computed(()=>{const B=l.dataList||[];return!B.length&&c.value?c.value.data().body||[]:B}),h=t.computed(()=>{if(o.value.operation==!1||!Array.isArray(o.value.operation?.btns))return{visible:!1};const B=K.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),T=[];let O=(o.value.operation?.btns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_));if(O.forEach(_=>{T.push(_.name)}),T.includes("edit")||O.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),T.includes("view")||O.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),T.includes("delete")||O.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const _=O.filter(I=>I.name=="edit")[0];if(_.visible&&(_.action||(_.action={}),_.action.type||(_.action.type="route"),!_.action.href)){const I=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",j=l.editor.model.value;_.action.link=n.editPageUrl+"?psn="+I+"&model="+j+"&id={row."+l.rowKey+"}"}const $=O.filter(I=>I.name=="view")[0];if($.visible&&($.action||($.action={}),$.action.type||($.action.type="route"),!$.action.href)){const I=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";$.action.link=n.viewPageUrl+"?psn="+I+"&model=view&id={row."+l.rowKey+"}"}}return O=O.filter(_=>_.visible!=!1).sort((_,$)=>{const I=_.index||1,j=$.index||1;return I-j}),B.count&&(O.length>B.count+1?(B.btns=O.slice(0,B.count),B.more.items=O.slice(B.count,O.length),B.more.visible=!0):(B.btns=O,B.more.visible=!1)),B}),f=t.computed(()=>{let B=[];o.value.columns?.length&&(B=[...o.value.columns]);const T=[];B.forEach((_,$)=>{_.dataIndex=_.name,_.convert&&(_.dataIndex=_.name+"Label",_.convertObj=new Qe(_.convert),_.customCell=(I,j,P)=>{const E=K.utils.obj.getValue(I,P.name);_.convertObj&&(I[P.dataIndex]==null||I[P.dataIndex]==null)&&E!=null&&E!=null&&(E+"").length>0&&(I[P.dataIndex]=E,_.convertObj.convert(E).then(J=>{J&&K.utils.obj.setValue(I,P.dataIndex,J)}))}),_.sort?.enable&&(_.sorter=!0,_.sort.multiple&&(_.sorter={},_.sorter.multiple=_.sort.multiple),_.sort.defoult&&(_.defaultSortOrder=_.sort.asc?"ascend":"descend")),_.customRender=({record:I,column:j})=>K.utils.obj.getValue(I,j.dataIndex)||"--",_.fkey?.enable&&(_.fkey.labelName&&(_.dataIndex=pn(_.fkey.labelName)),_.fkey.labelTitle&&(_.title=_.fkey.labelTitle),_.customRender=({record:I,column:j})=>I&&I[j.name+"FEntry"]&&I[j.name+"FEntry"][j.dataIndex]||"--",_.fkey.fields?.forEach((I,j)=>{if(!I.name)return;const P=pn(I.name),E={fkName:_.name,title:I.title,name:P,dataIndex:I.name,width:I.width,index:I.index||$+j+1,customRender:({record:J,column:F})=>{if(J&&J[F.fkName+"FEntry"]){const z=J[F.fkName+"FEntry"][F.name];if(z)return I.convertObj&&I.convertObj.convert(z)||z}return"--"}};I.convert&&(I.convertObj=new Qe(I.convert)),T.push(E)}))}),T.forEach(_=>{B.splice(_.index,0,_)});const O=K.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return O&&O.visible!=!1&&(O.customRender=_=>V.value?(V.value.current-1)*V.value.pageSize+_.index+1:_.index,B=[O,...B]),h.value&&h.value.visible!=!1&&B.push({fixed:"right",align:"center",...h.value,name:"operation"}),B}),p=t.computed(()=>{if(o.value.leftBtns===!1||!Array.isArray(o.value.leftBtns))return[];const B=[],T=[];if((o.value.leftBtns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_)).forEach(_=>{_.visible!=!1&&B.push(_),T.push(_.name),_.name=="delBatch"&&!k.value&&(_.visible=!1)}),!T.includes("add")){const _={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};B.splice(0,0,_)}if(!T.includes("delBatch")&&k.value){const _={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};B.splice(1,0,_)}if(l.editor&&l.editor.type.value!="code"){const _=B.filter($=>$.name=="add")[0];if(_.visible&&(_.action||(_.action={}),_.action.type||(_.action.type="route"),!_.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",I=l.editor.model.value;_.action.link=n.addPageUrl+"?psn="+$+"&model="+I}}return B});function m({btn:B,event:T}){if(n.isDebug&&console.log("unione table left btn click",B,T),B.name=="delBatch"){if(!u.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(u.value.selectedRowKeys).then(()=>{R(),N(!0)});return}te.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+u.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(B.name,{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const b=t.computed(()=>{if(o.value.rightBtns===!1||!Array.isArray(o.value.rightBtns))return[];const B=[],T=[];if((o.value.rightBtns||[]).map(_=>(typeof _=="string"&&(_={name:_,visible:!1}),_)).forEach(_=>{_.visible!=!1&&B.push(_),T.push(_.name)}),!T.includes("impData")){const _={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};B.splice(1,0,_)}if(!T.includes("expData")){const _={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};B.splice(2,0,_)}if(!T.includes("downTmpl")){const _={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};B.splice(3,0,_)}return B});function w({btn:B,event:T}){n.isDebug&&console.log("unione table right btn click",B,T),M(B.name,{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("rightBtnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:B,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const C=t.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),y=t.ref({}),A=t.ref(null),V=t.computed(()=>K.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:B=>"共"+B+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),k=t.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),u=t.ref({selectedRowKeys:[],selectedRowList:[],onChange:(B,T)=>{u.value.selectedRowKeys=B,u.value.selectedRowList=T},getCheckboxProps:B=>({disabled:B.checkable})}),S=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=i;function v({btn:B,event:T},O){if(n.isDebug&&console.log("unione table opt btn click",B,T),B.name=="delete"){if(c.value){c.value.deleteByIds([O[r.value]]).then(()=>{R(),u.value.selectedRowKeys=u.value.selectedRowKeys.filter(_=>_!=O[r.value]),u.value.selectedRowList=u.value.selectedRowList.filter(_=>_[r.value]!=O[r.value])});return}te.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(B.name,{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(B.name,{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:B,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}function x(B,T,O,_){console.log("tableChanged",B,T,O,_),A.value={page:B.current,pageSize:B.pageSize},O&&(Array.isArray(O)?(A.value.sorts=[],O.forEach($=>{A.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):O.column&&(A.value.sorts=[{name:O.column.name,asc:O.order=="ascend"}])),R(),M("change",{pagination:B,filters:T,sorter:O,event:_})}function N(B=!1){B?(u.value.selectedRowKeys=[],u.value.selectedRowList=[]):te.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${u.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{u.value.selectedRowKeys=[],u.value.selectedRowList=[]}})}function R(){if(c.value){const B={page:V.value.current,pageSize:V.value.pageSize,keywords:y.value.keywords,body:y.value.params||{}};A.value?.page&&(B.page=A.value.page),A.value?.pageSize&&(B.pageSize=A.value.pageSize),A.value?.sorts&&(B.sorts=A.value.sorts),console.log("dataStorage find params",B),c.value.find(B)}}t.onMounted(()=>{f.value?.forEach(B=>{B.sort?.enable&&B.sort.defoult&&(A.value||(A.value={},A.value.sorts||(A.value.sorts=[]),A.value.sorts.push({name:B.name,asc:B.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",B=>{console.log("table-list-search",B),y.value=B||{},R()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),y.value={},R(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),R()})});function g(){return{keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}}return e({getSelected:g,clearSelected:N}),(B,T)=>{const O=t.resolveComponent("unione-btn"),_=t.resolveComponent("DownOutlined"),$=t.resolveComponent("a-button"),I=t.resolveComponent("a-dropdown"),j=t.resolveComponent("a-table");return t.openBlock(),t.createBlock(ft,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",Ur,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,P=>(t.openBlock(),t.createBlock(O,{key:P.name,class:"btn",widget:P,editor:a.editor,onClick:m,preset:S,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),u.value.selectedRowKeys.length?(t.openBlock(),t.createElementBlock("span",{key:0,class:"selected-info",onClick:T[0]||(T[0]=P=>N())},"当前选中记录("+t.toDisplayString(u.value.selectedRowKeys.length)+")",1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.value,P=>(t.openBlock(),t.createBlock(O,{key:P.name,class:"btn right",widget:P,editor:a.editor,onClick:w,preset:S,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),t.createElementVNode("div",jr,[f.value&&f.value.length?(t.openBlock(),t.createBlock(j,t.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":d.value,"row-selection":k.value?u.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:V.value,onChange:x},C.value),{bodyCell:t.withCtx(({column:P,record:E})=>[P.name==="operation"?(t.openBlock(),t.createElementBlock("div",zr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.btns,J=>(t.openBlock(),t.createBlock(O,{key:J.name,class:"opt",widget:J,editor:a.editor,onClick:F=>v(F,E),preset:S,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(t.openBlock(),t.createBlock(I,{key:0,trigger:[h.value.more.trigger||"hover"],class:t.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.more.items,J=>(t.openBlock(),t.createBlock(O,{key:J.name,class:"item",widget:J,editor:a.editor,onClick:F=>v(F,E),type:"text",preset:S,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode($,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h.value.more.title)+" ",1),t.createVNode(_)]),_:1})]),_:2},1032,["trigger","class"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):t.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(Lr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-ea916a8b"]]);class Ue{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:i,onClose:n,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(he.EDITOR_COMPONENT,he.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(he.EDITOR_COMPONENT,he.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const d=document.createElement("div");d.classList.add("dialog-title");const h=document.createElement("span");h.append(document.createTextNode(e));const f=document.createElement("i");f.onclick=()=>{n&&n(),this._dispose()},d.append(h),d.append(f),c.append(d);const p=document.createElement("div");p.classList.add("dialog-option");for(let C=0;C<i.length;C++){const y=i[C],A=document.createElement("div");if(A.classList.add("dialog-option__item"),y.label){const k=document.createElement("span");k.append(document.createTextNode(y.label)),A.append(k),y.required&&k.classList.add("dialog-option__item--require")}let V;y.type==="select"?(V=document.createElement("select"),y.options?.forEach(k=>{const u=document.createElement("option");u.value=k.value,u.label=k.label,V.append(u)})):y.type==="textarea"?V=document.createElement("textarea"):(V=document.createElement("input"),V.type=y.type),y.width&&(V.style.width=`${y.width}px`),y.height&&(V.style.height=`${y.height}px`),V.name=y.name,V.value=y.value||"",V instanceof HTMLSelectElement||(V.placeholder=y.placeholder||""),A.append(V),p.append(A),this.inputList.push(V)}c.append(p);const m=document.createElement("div");m.classList.add("dialog-menu");const b=document.createElement("button");b.classList.add("dialog-menu__cancel"),b.append(document.createTextNode("取消")),b.type="button",b.onclick=()=>{l&&l(),this._dispose()},m.append(b);const w=document.createElement("button");w.append(document.createTextNode("确定")),w.type="submit",w.onclick=()=>{if(o){const C=this.inputList.map(y=>({name:y.name,value:y.value}));o(C)}this._dispose()},m.append(w),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function qr(a){switch(a){case"comment":case"prolog":case"doctype":case"cdata":return{color:"#008000",italic:!0};case"namespace":return{opacity:.7};case"string":return{color:"#A31515"};case"punctuation":case"operator":return{color:"#393A34"};case"url":case"symbol":case"number":case"boolean":case"variable":case"constant":case"inserted":return{color:"#36acaa"};case"atrule":case"keyword":case"attr-value":return{color:"#0000ff"};case"function":return{color:"#b9a40a"};case"deleted":case"tag":return{color:"#9a050f"};case"selector":return{color:"#00009f"};case"important":return{color:"#e90",bold:!0};case"italic":return{italic:!0};case"class-name":case"property":return{color:"#2B91AF"};case"attr-name":case"regex":case"entity":return{color:"#ff0000"};default:return null}}function Qr(a){const e=[];function i(n){for(let l=0;l<n.length;l++){const o=n[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))i(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...qr(s)})}}}return i(a),e}const Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAnFBMVEUAAAAAAAAAgIBVVVVAQFU3SVs8S1o9R1w+Rlg6SlpASFg+RlU6SVc7RVg8Rlg+Rlg/R1g9SFY+SFg+SFc8SFc+Rlg8SFY8RlY+R1g+R1Y+Rlg8Rlc+SFg9R1c9SFc9R1c+R1c9R1Y9R1c8R1c9R1g9R1g9R1c9R1c8R1c9R1c9SFc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///96K4o3AAAAMnRSTlMAAQIDDA4RGR0fICEjNDc6PUdOUlVXWWJrc3R7gI2Sm6GxvMLDyc3R09vd3+309fr8/RCh/swAAAABYktHRDM31XxeAAAAZElEQVQY02NgIA4Iq+joqooh+KJ6Etw8UvricAElWRApowkXUFRAM0LQQI4DmW8EByjKmNlYUfUxSupzQZmsWvxgER0RmKQa2BZ2QwGYAJ+uPC+nkLoyE1w/l4K2noY0C3H+BAAncAfEJkWhEAAAAABJRU5ErkJggg==",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",xc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",Cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAz1BMVEUAAAAAAAAAgIBAQFU7Tk43SVs8RFU6SlpASFg+RlU8RFo6SVdAR1U6RVU+SVg8RlU7RVg+RlY9SFg8R1c9R1c9R1Y8Rlg+SFc+R1g9R1c9Rlc8SFg9SFc9R1Y8R1g+Rlc+SFg9R1c9R1Y8Rlg+R1c8Rlc+SFc9R1g9R1c8Rlc+R1g9SFc8R1c9R1g9Rlc9R1Y+SFc9R1c9R1Y9SFc8R1Y9R1c9R1c+SFc9R1g9R1c9R1c9R1Y9R1c8R1c9R1Y9R1c9R1c9R1c9R1c9R1f////kTFPbAAAAQ3RSTlMAAQIMDQ4eHyAhIiMkMDEzNF9gYWRlZmdrbG1udXZ3eICBgoOEmJmam5ydpKWmp7Gys7S5uru8y8zN5ebn6Onq9/3+2KlzWgAAAAFiS0dERPm0mMEAAAD9SURBVBgZhcFte4FgGIDhK1aUDbMxM8VMsXdmtlj01P3//9N60nHQJ+fJWfVBsFwGgxpl7bXINgz/RNYtjirTdDe0yTjuPp0YFCofElQpVGfyZnAwFZcTrjySa6cBJfOkifazq1Jixt9k6jIk5/R6NjkvtYAHsdFulIjqoDXkHgi2aI6SjLLRIh/4+kW7k1wXLVwAyxCtJ7lbtM0nEGzRHCUZZaNFPjAQB62jRNQ12qX0gZq45Oxut05ulFpk1vsLSsx4hdZKZ5Q8J1fknsTjhCdjDirvMjcpmC/yalAwJknsNcg0RnEyNjhqrkSicBOJrJqUWX1/sfD7Fuf8A/JKIgzf/RoEAAAAAElFTkSuQmCC",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",Sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",Bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",Nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",Vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",Pl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",Rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Ul="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",Ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",Oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",Mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",_c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",Tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",Fc=["title"],Dc=["title"],$c={class:"options"},Pc=["title"],Lc={class:"options"},Uc={class:"options"},jc=["title"],zc=["title"],qc=["title"],Qc=["title"],Kc=["title"],Wc={class:"options"},Yc={class:"options"},Hc={class:"options"},Gc={class:"options"},Jc={class:"options"},Xc={class:"menu-item__search__collapse__search"},Zc={class:"arrow-left"},ed={class:"arrow-right"},td=ie(t.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const i=a,n=t.ref(),l=t.computed(()=>{let R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return i.items&&(i.items.length>1?R=i.items:i.items[0]=="simple"&&(R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),R});function o(){return n.value?.clientHeight}function s(){return n.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(R,g){console.log("exec cmd "+R+",params:",g),R!="Separator"&&Array.isArray(g)?i.editor?.command["execute"+R](g[0],g[1]):i.editor?.command["execute"+R](g)}function d(R,g){const B=g.target.getBoundingClientRect(),T=n.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=B.height+B.top+"px"}let h=!0,f;function p(){h?(h=!1,f=window.setTimeout(()=>{h=!0,i.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(f)}function m(){h=!0,window.clearTimeout(f),i.editor?.command.executePainter({isDblclick:!0})}function b(){new Ue({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:R=>{const g=R.find(B=>B.name==="value")?.value;g&&i.editor?.command.executeInsertElementList([{type:he.ElementType.LATEX,value:g}])}})}function w(R){i.editor?.command.executeInsertElementList([{type:R,checkbox:{value:!1},value:""}])}function C(R,g){const B=g.target.getBoundingClientRect(),T=n.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=B.height+B.top+"px";const O=Ca();T.firstChild.childNodes.forEach(_=>{const $=_.attributes.getNamedItem("label-format").value;_.innerText=O.format($),_.onclick=()=>{i.editor?.command.executeInsertElementList([{type:he.ElementType.DATE,dateFormat:_.attributes.getNamedItem("data-format").value,valueList:[{value:_.innerText.trim()}]}])}})}function y(){new Ue({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:R=>{const g=R.find(j=>j.name==="type")?.value;if(!g)return;const B=R.find(j=>j.name==="width")?.value,T=R.find(j=>j.name==="height")?.value;if(!T)return;const O=R.find(j=>j.name==="src")?.value,_=R.find(j=>j.name==="srcdoc")?.value,$={type:g};if($.type===he.BlockType.IFRAME){if(!O&&!_)return;$.iframeBlock={src:O,srcdoc:_}}else if($.type===he.BlockType.VIDEO){if(!O)return;$.videoBlock={src:O}}const I={type:he.ElementType.BLOCK,value:"",height:Number(T),block:$};B&&(I.width=Number(B)),i.editor?.command.executeInsertElementList([I])}})}function A(R){const g=R.target.getBoundingClientRect(),B=n.value.querySelector(".menu-item__table__collapse");B.style.display="block",B.style.top=g.height+g.top+"px",B.style.left=g.left-270/2+"px";const T=n.value.querySelector(".menu-item__table__collapse .table-close"),O=n.value.querySelector(".menu-item__table__collapse .table-select"),_=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(P=>{$.push(P.childNodes)});let I=0,j=0;_.onmousemove=P=>{const{offsetX:z,offsetY:pe}=P;$.forEach(tt=>{tt.forEach(L=>{L.classList.remove("active")})}),I=Math.ceil(z/22)||1,j=Math.ceil(pe/26)||1,$.forEach((tt,L)=>{tt.forEach((Me,ne)=>{ne<I&&L<j&&Me.classList.add("active")})}),O.innerText=`${j}×${I}`},_.onclick=()=>{B.style.display="none",i.editor?.command.executeInsertTable(j,I)},T.onclick=P=>{P.stopPropagation(),B.style.display="none"}}function V(){const R=n.value.querySelector(".menu-item__image .image");R.click(),R.onchange=function(){const g=R.files[0],B=new FileReader;B.readAsDataURL(g),B.onload=function(){const T=new Image,O=B.result;T.src=O,T.onload=function(){i.editor?.command.executeImage({value:O,width:T.width,height:T.height}),R.value=""}}}}function k(){new Ue({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:i.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:R=>{const g=R.find(T=>T.name==="name")?.value;if(!g)return;const B=R.find(T=>T.name==="url")?.value;B&&i.editor?.command.executeHyperlink({type:he.ElementType.HYPERLINK,value:"",url:B,valueList:he.splitText(g).map(T=>({value:T,size:16}))})}})}function u(R){R==="add"?new Ue({title:"水印",data:[{type:"text",label:"内容",name:"data",required:!0,placeholder:"请输入内容"},{type:"color",label:"颜色",name:"color",required:!0,value:"#AEB5C0"},{type:"number",label:"字体大小",name:"size",required:!0,value:"120"},{type:"number",label:"透明度",name:"opacity",required:!0,value:"0.3"},{type:"select",label:"重复",name:"repeat",value:"0",required:!1,options:[{label:"不重复",value:"0"},{label:"重复",value:"1"}]},{type:"number",label:"水平间隔",name:"horizontalGap",required:!1,value:"10"},{type:"number",label:"垂直间隔",name:"verticalGap",required:!1,value:"10"}],onConfirm:g=>{if(~g.findIndex(_=>!_.value))return;const T=g.reduce((_,$)=>(_[$.name]=$.value,_),{}),O=T.repeat==="1";i.editor?.command.executeAddWatermark({data:T.data,color:T.color,size:Number(T.size),opacity:Number(T.opacity),repeat:O,gap:O&&T.horizontalGap&&T.verticalGap?[Number(T.horizontalGap),Number(T.verticalGap)]:void 0})}}):i.editor?.command.executeDeleteWatermark()}function S(){new Ue({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:R=>{const g=R.find(_=>_.name==="codeblock")?.value;if(!g)return;const B=Ol.tokenize(g,Ol.languages.javascript),T=Qr(B),O=[];for(let _=0;_<T.length;_++){const $=T[_],I=he.splitText($.content);for(let j=0;j<I.length;j++){const E={value:I[j]};$.color&&(E.color=$.color),$.bold&&(E.bold=!0),$.italic&&(E.italic=!0),O.push(E)}}O.unshift({value:`
2
+ `}),i.editor?.command.executeInsertElementList(O)}})}function M(R){const g=R.target.getBoundingClientRect(),B=n.value.querySelector(".menu-item__search__collapse");B.style.display="block",B.style.top=g.height+g.top+"px",B.style.left=g.left-260/2+"px";const T=n.value.querySelector(".menu-item__search__collapse__search input"),O=n.value.querySelector(".menu-item__search__collapse__replace input"),_=B.querySelector(".search-result");T.focus();const $=()=>{const I=i.editor?.command.getSearchNavigateInfo();if(I){const{index:j,count:P}=I;_.innerText=`${j}/${P}`}else _.innerText=""};B.querySelector("span").onclick=()=>{B.style.display="none",T.value="",O.value="",i.editor?.command.executeSearch(null),$()},T.oninput=()=>{i.editor?.command.executeSearch(T.value||null),$()},T.onkeydown=I=>{I.key==="Enter"&&(i.editor?.command.executeSearch(T.value||null),$())},B.querySelector("button").onclick=()=>{const I=T.value,j=O.value;I&&j&&I!==j&&i.editor?.command.executeReplace(j)},B.querySelector(".arrow-left").onclick=()=>{i.editor?.command.executeSearchNavigatePre(),$()},B.querySelector(".arrow-right").onclick=()=>{i.editor?.command.executeSearchNavigateNext(),$()}}function v(){const R=n.value.querySelector(".menu-item__color .input-color");R.oninput=function(){i.editor?.command.executeColor(R.value)},R.click()}function x(){const R=n.value.querySelector(".menu-item__highlight .input-highlight");R.oninput=function(){i.editor?.command.executeHighlight(R.value)},R.click()}function N(R){switch(R){case he.ControlType.TEXT:new Ue({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const B=g.find(O=>O.name==="placeholder")?.value;if(!B)return;const T=g.find(O=>O.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,value:T?[{value:T}]:null,placeholder:B}})}});break;case he.ControlType.SELECT:new Ue({title:"列举控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
3
3
  [{
4
4
  "value":"有",
5
5
  "code":"98175"
6
- }]`}],onConfirm:k=>{const S=k.find(_=>_.name==="placeholder")?.value;if(!S)return;const T=k.find(_=>_.name==="valueSets")?.value;if(!T)return;const O=k.find(_=>_.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,code:O,value:null,placeholder:S,valueSets:JSON.parse(T)}})}});break;case he.ControlType.CHECKBOX:new Ue({title:"复选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值,多个值以英文逗号分割"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
6
+ }]`}],onConfirm:g=>{const B=g.find(_=>_.name==="placeholder")?.value;if(!B)return;const T=g.find(_=>_.name==="valueSets")?.value;if(!T)return;const O=g.find(_=>_.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,code:O,value:null,placeholder:B,valueSets:JSON.parse(T)}})}});break;case he.ControlType.CHECKBOX:new Ue({title:"复选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值,多个值以英文逗号分割"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
7
7
  [{
8
8
  "value":"有",
9
9
  "code":"98175"
10
- }]`}],onConfirm:k=>{const S=k.find(O=>O.name==="valueSets")?.value;if(!S)return;const T=k.find(O=>O.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,code:T,value:null,valueSets:JSON.parse(S)}})}});break;case he.ControlType.RADIO:new Ue({title:"单选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
10
+ }]`}],onConfirm:g=>{const B=g.find(O=>O.name==="valueSets")?.value;if(!B)return;const T=g.find(O=>O.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,code:T,value:null,valueSets:JSON.parse(B)}})}});break;case he.ControlType.RADIO:new Ue({title:"单选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
11
11
  [{
12
12
  "value":"有",
13
13
  "code":"98175"
14
- }]`}],onConfirm:k=>{const S=k.find(O=>O.name==="valueSets")?.value;if(!S)return;const T=k.find(O=>O.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,code:T,value:null,valueSets:JSON.parse(S)}})}});break;case he.ControlType.DATE:new Ue({title:"日期控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"},{type:"select",label:"日期格式",name:"dateFormat",value:"yyyy-MM-dd hh:mm:ss",required:!0,options:[{label:"yyyy-MM-dd hh:mm:ss",value:"yyyy-MM-dd hh:mm:ss"},{label:"yyyy-MM-dd",value:"yyyy-MM-dd"}]}],onConfirm:k=>{const S=k.find(_=>_.name==="placeholder")?.value;if(!S)return;const T=k.find(_=>_.name==="value")?.value||"",O=k.find(_=>_.name==="dateFormat")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,dateFormat:O,value:T?[{value:T}]:null,placeholder:S}})}});break;case he.ControlType.NUMBER:new Ue({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:k=>{const S=k.find(O=>O.name==="placeholder")?.value;if(!S)return;const T=k.find(O=>O.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:V,value:T?[{value:T}]:null,placeholder:S}})}});break}}return t.onMounted(()=>{window.addEventListener("click",V=>{const k=n.value?.querySelector(".visible");!k||k.contains(V.target)||k.classList.remove("visible")},{capture:!0}),i.editor&&(i.editor.listener.rangeStyleChange=V=>{t.nextTick(()=>{if(V.type===he.ElementType.TEXT){const k=n.value,S=k.querySelector(".menu-item__font .select");S&&(S.textContent=V.font);const T=k.querySelector(".menu-item__size .select");if(T){const F={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};T.textContent=F[V.size]||"小四"}const O=k.querySelector(".menu-item__bold");O&&O.classList.toggle("active",V.bold);const _=k.querySelector(".menu-item__italic");_&&_.classList.toggle("active",V.italic);const $=k.querySelector(".menu-item__underline");$&&$.classList.toggle("active",V.underline);const I=k.querySelector(".menu-item__strikeout");I&&I.classList.toggle("active",V.strikeout);const j=k.querySelector(".menu-item__color span");j&&(j.style.backgroundColor=V.color||"#000000");const P=k.querySelector(".menu-item__highlight span");P&&(P.style.backgroundColor=V.highlight);const E=k.querySelector(".menu-item__title .select");if(E){const F={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};E.textContent=F[V.level]||"正文"}["left","center","right","alignment","justify"].forEach(F=>{const z=k.querySelector(`.menu-item__${F}`);z&&z.classList.toggle("active",V.rowFlex===F)})}})})}),e({getHeight:o,getWidth:s}),(V,k)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"dom",ref:n,class:"unione-rich-toolbar menu","editor-component":"menu"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(S,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[S=="Undo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__undo",key:S,title:`撤销(${t.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:k[0]||(k[0]=O=>c("Undo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Kr)})`})},null,4)],8,Fc)):t.createCommentVNode("",!0),S=="Redo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__redo",key:S,title:`重做(${t.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:k[1]||(k[1]=O=>c("Redo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Wr)})`})},null,4)],8,Dc)):t.createCommentVNode("",!0),S=="Painter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__painter",key:S,title:"格式刷(双击可连续使用)",onClick:u,onDblclick:m},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Yr)})`})},null,4)],32)):t.createCommentVNode("",!0),S=="Format"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__format",key:S,title:"清除格式",onClick:k[2]||(k[2]=O=>c("Format")),"data-item":"Format"},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Hr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Divider"?(t.openBlock(),t.createElementBlock("div",{class:"menu-divider",key:S+T,"data-item":"Divider"})):t.createCommentVNode("",!0),S=="Font"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__font",onClick:k[19]||(k[19]=O=>d("menu-item__font",O)),style:{display:"none"},key:S},[k[99]||(k[99]=t.createElementVNode("span",{class:"select",title:"字体"},"微软雅黑",-1)),t.createElementVNode("div",{class:"options",ref_for:!0,ref:"fontOptions"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:k[3]||(k[3]=O=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),t.createElementVNode("li",{onClick:k[4]||(k[4]=O=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),t.createElementVNode("li",{onClick:k[5]||(k[5]=O=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),t.createElementVNode("li",{onClick:k[6]||(k[6]=O=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),t.createElementVNode("li",{onClick:k[7]||(k[7]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:k[8]||(k[8]=O=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),t.createElementVNode("li",{onClick:k[9]||(k[9]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:k[10]||(k[10]=O=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),t.createElementVNode("li",{onClick:k[11]||(k[11]=O=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),t.createElementVNode("li",{onClick:k[12]||(k[12]=O=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),t.createElementVNode("li",{onClick:k[13]||(k[13]=O=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),t.createElementVNode("li",{onClick:k[14]||(k[14]=O=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),t.createElementVNode("li",{onClick:k[15]||(k[15]=O=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),t.createElementVNode("li",{onClick:k[16]||(k[16]=O=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),t.createElementVNode("li",{onClick:k[17]||(k[17]=O=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),t.createElementVNode("li",{onClick:k[18]||(k[18]=O=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):t.createCommentVNode("",!0),S=="Size"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size",onClick:k[36]||(k[36]=O=>d("menu-item__size",O)),key:S},[k[100]||(k[100]=t.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),t.createElementVNode("div",$c,[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:k[20]||(k[20]=O=>c("Size",56))},"初号"),t.createElementVNode("li",{onClick:k[21]||(k[21]=O=>c("Size",48))},"小初"),t.createElementVNode("li",{onClick:k[22]||(k[22]=O=>c("Size",34))},"一号"),t.createElementVNode("li",{onClick:k[23]||(k[23]=O=>c("Size",32))},"小一"),t.createElementVNode("li",{onClick:k[24]||(k[24]=O=>c("Size",29))},"二号"),t.createElementVNode("li",{onClick:k[25]||(k[25]=O=>c("Size",24))},"小二"),t.createElementVNode("li",{onClick:k[26]||(k[26]=O=>c("Size",21))},"三号"),t.createElementVNode("li",{onClick:k[27]||(k[27]=O=>c("Size",20))},"小三"),t.createElementVNode("li",{onClick:k[28]||(k[28]=O=>c("Size",18))},"四号"),t.createElementVNode("li",{onClick:k[29]||(k[29]=O=>c("Size",16))},"小四"),t.createElementVNode("li",{onClick:k[30]||(k[30]=O=>c("Size",14))},"五号"),t.createElementVNode("li",{onClick:k[31]||(k[31]=O=>c("Size",12))},"小五"),t.createElementVNode("li",{onClick:k[32]||(k[32]=O=>c("Size",10))},"六号"),t.createElementVNode("li",{onClick:k[33]||(k[33]=O=>c("Size",8))},"小六"),t.createElementVNode("li",{onClick:k[34]||(k[34]=O=>c("Size",7))},"七号"),t.createElementVNode("li",{onClick:k[35]||(k[35]=O=>c("Size",6))},"八号")])])])):t.createCommentVNode("",!0),S=="SizeAdd"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:k[37]||(k[37]=O=>c("SizeAdd")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Gr)})`})},null,4)])):t.createCommentVNode("",!0),S=="SizeMinus"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:k[38]||(k[38]=O=>c("SizeMinus")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Jr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Bold"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:k[39]||(k[39]=O=>c("Bold")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Xr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Italic"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:k[40]||(k[40]=O=>c("Italic")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Zr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Underline"?(t.openBlock(),t.createElementBlock("div",{title:`下划线(${t.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:k[46]||(k[46]=O=>d("menu-item__underline",O)),"data-item":"Underline",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ec)})`})},null,4),k[101]||(k[101]=t.createElementVNode("span",{class:"select"},null,-1)),t.createElementVNode("div",Lc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-decoration-style":"solid",onClick:k[41]||(k[41]=O=>c("Underline",{style:"solid"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Pl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"double",onClick:k[42]||(k[42]=O=>c("Underline",{style:"double"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Rc)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dashed",onClick:k[43]||(k[43]=O=>c("Underline",{style:"dashed"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dotted",onClick:k[44]||(k[44]=O=>c("Underline",{style:"dotted"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"wavy",onClick:k[45]||(k[45]=O=>c("Underline",{style:"wavy"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ec)})`})},null,4)])])])],8,Pc)):t.createCommentVNode("",!0),S=="Strikeout"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:k[47]||(k[47]=O=>c("Strikeout")),"data-item":"Strikeout",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(tc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Superscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:k[48]||(k[48]=O=>c("Superscript")),"data-item":"Superscript",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ic)})`})},null,4)])):t.createCommentVNode("",!0),S=="Subscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:k[49]||(k[49]=O=>c("Subscript")),"data-item":"Subscript",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(nc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Color"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:v,"data-item":"Color",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(lc)})`})},null,4),k[102]||(k[102]=t.createElementVNode("span",null,null,-1)),k[103]||(k[103]=t.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):t.createCommentVNode("",!0),S=="Highlight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:x,"data-item":"Highlight",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(oc)})`})},null,4),k[104]||(k[104]=t.createElementVNode("span",null,null,-1)),k[105]||(k[105]=t.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):t.createCommentVNode("",!0),S=="Title"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__title",onClick:k[57]||(k[57]=O=>d("menu-item__title",O)),"data-item":"Title",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(sc)})`})},null,4),k[106]||(k[106]=t.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),t.createElementVNode("div",Uc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{style:{"font-size":"16px"},onClick:k[50]||(k[50]=O=>c("Title",null))},"正文"),t.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:k[51]||(k[51]=O=>c("Title","first"))},"标题1"),t.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:k[52]||(k[52]=O=>c("Title","second"))},"标题2"),t.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:k[53]||(k[53]=O=>c("Title","third"))},"标题3"),t.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:k[54]||(k[54]=O=>c("Title","fourth"))},"标题4"),t.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:k[55]||(k[55]=O=>c("Title","fifth"))},"标题5"),t.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:k[56]||(k[56]=O=>c("Title","sixth"))},"标题6")])])])):t.createCommentVNode("",!0),S=="RowFlexLeft"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__left",onClick:k[58]||(k[58]=O=>c("RowFlex","left")),title:`左对齐(${t.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ac)})`})},null,4)],8,jc)):t.createCommentVNode("",!0),S=="RowFlexCenter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__center",onClick:k[59]||(k[59]=O=>c("RowFlex","center")),title:`居中对齐(${t.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(rc)})`})},null,4)],8,zc)):t.createCommentVNode("",!0),S=="RowFlexRight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__right",onClick:k[60]||(k[60]=O=>c("RowFlex","right")),title:`右对齐(${t.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(cc)})`})},null,4)],8,qc)):t.createCommentVNode("",!0),S=="RowFlexAlignment"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:k[61]||(k[61]=O=>c("RowFlex","alignment")),title:`两端对齐(${t.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(dc)})`})},null,4)],8,Qc)):t.createCommentVNode("",!0),S=="RowFlexJustify"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:k[62]||(k[62]=O=>c("RowFlex","justify")),title:`分散对齐(${t.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(hc)})`})},null,4)],8,Kc)):t.createCommentVNode("",!0),S=="RowMargin"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:k[71]||(k[71]=O=>d("menu-item__row-margin",O)),"data-item":"RowMargin",key:S},[t.createElementVNode("i",{title:"行间距",style:t.normalizeStyle({backgroundImage:`url(${t.unref(fc)})`})},null,4),t.createElementVNode("div",Wc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-rowmargin":"1",onClick:k[63]||(k[63]=O=>c("RowMargin",1))},"1"),t.createElementVNode("li",{"data-rowmargin":"1.25",onClick:k[64]||(k[64]=O=>c("RowMargin",1.25))},"1.25"),t.createElementVNode("li",{"data-rowmargin":"1.5",onClick:k[65]||(k[65]=O=>c("RowMargin",1.5))},"1.5"),t.createElementVNode("li",{"data-rowmargin":"1.75",onClick:k[66]||(k[66]=O=>c("RowMargin",1.75))},"1.75"),t.createElementVNode("li",{"data-rowmargin":"2",onClick:k[67]||(k[67]=O=>c("RowMargin",2))},"2"),t.createElementVNode("li",{"data-rowmargin":"2.5",onClick:k[68]||(k[68]=O=>c("RowMargin",2.5))},"2.5"),t.createElementVNode("li",{"data-rowmargin":"3",onClick:k[69]||(k[69]=O=>c("RowMargin",3))},"3"),t.createElementVNode("li",{"data-rowmargin":"5",onClick:k[70]||(k[70]=O=>c("RowMargin",5))},"5")])])])):t.createCommentVNode("",!0),S=="List"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__list",onClick:k[77]||(k[77]=O=>d("menu-item__list",O)),key:S},[t.createElementVNode("i",{title:"列表",style:t.normalizeStyle({backgroundImage:`url(${t.unref(uc)})`})},null,4),t.createElementVNode("div",Yc,[t.createElementVNode("ul",null,[k[112]||(k[112]=t.createElementVNode("li",null,[t.createElementVNode("label",null,"取消列表")],-1)),t.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:k[72]||(k[72]=O=>c("List",["ol","decimal"]))},k[107]||(k[107]=[t.createElementVNode("label",null,"有序列表:",-1),t.createElementVNode("ol",null,[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"checkbox",onClick:k[73]||(k[73]=O=>c("List",["ul","checkbox"]))},k[108]||(k[108]=[t.createElementVNode("label",null,"复选框列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☑️ '"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"disc",onClick:k[74]||(k[74]=O=>c("List",["ul","disc"]))},k[109]||(k[109]=[t.createElementVNode("label",null,"实心圆点列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"disc"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"circle",onClick:k[75]||(k[75]=O=>c("List",["ul","circle"]))},k[110]||(k[110]=[t.createElementVNode("label",null,"空心圆点列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"circle"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"square",onClick:k[76]||(k[76]=O=>c("List",["ul","square"]))},k[111]||(k[111]=[t.createElementVNode("label",null,"空心方块列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[t.createElementVNode("li",null,"________")],-1)]))])])])):t.createCommentVNode("",!0),S=="Table"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__table",onClick:y,key:S},[t.createElementVNode("i",{title:"表格",style:t.normalizeStyle({backgroundImage:`url(${t.unref(mc)})`})},null,4),k[113]||(k[113]=t.createStaticVNode('<div class="menu-item__table__collapse" data-v-9be2b83f><div class="table-close" data-v-9be2b83f>×</div><div class="table-title" data-v-9be2b83f><span class="table-select" data-v-9be2b83f>插入</span><span data-v-9be2b83f>表格</span></div><div class="table-panel" data-v-9be2b83f><table data-v-9be2b83f><tbody data-v-9be2b83f><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr></tbody></table></div></div>',1))])):t.createCommentVNode("",!0),S=="Image"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__image",onClick:R,key:S},[t.createElementVNode("i",{title:"图片",style:t.normalizeStyle({backgroundImage:`url(${t.unref(pc)})`})},null,4),k[114]||(k[114]=t.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):t.createCommentVNode("",!0),S=="Hyperlink"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:g,key:S},[t.createElementVNode("i",{title:"超链接",style:t.normalizeStyle({backgroundImage:`url(${t.unref(gc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Separator"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:k[84]||(k[84]=O=>d("menu-item__separator",O)),key:S},[t.createElementVNode("i",{title:"分割线",style:t.normalizeStyle({backgroundImage:`url(${t.unref(kc)})`})},null,4),t.createElementVNode("div",Hc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-separator":"0,0",onClick:k[78]||(k[78]=O=>c("Separator",[0,0]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Pl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"1,1",onClick:k[79]||(k[79]=O=>c("Separator",[1,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"3,1",onClick:k[80]||(k[80]=O=>c("Separator",[3,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"4,4",onClick:k[81]||(k[81]=O=>c("Separator",[4,4]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Oc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:k[82]||(k[82]=O=>c("Separator",[7,3,3,3]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Mc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:k[83]||(k[83]=O=>c("Separator",[6,2,2,2,2,2]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(_c)})`})},null,4)])])])])):t.createCommentVNode("",!0),S=="Watermark"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:k[87]||(k[87]=O=>d("menu-item__watermark",O)),key:S},[t.createElementVNode("i",{title:"水印(添加、删除)",style:t.normalizeStyle({backgroundImage:`url(${t.unref(bc)})`})},null,4),t.createElementVNode("div",Gc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-menu":"add",onClick:k[85]||(k[85]=O=>p("add"))},"添加水印"),t.createElementVNode("li",{"data-menu":"delete",onClick:k[86]||(k[86]=O=>p("delete"))},"删除水印")])])])):t.createCommentVNode("",!0),S=="Codeblock"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:N,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(yc)})`})},null,4)])):t.createCommentVNode("",!0),S=="PageBreak"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(wc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Control"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__control",onClick:k[94]||(k[94]=O=>d("menu-item__control",O)),key:S},[t.createElementVNode("i",{title:"控件",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ac)})`})},null,4),t.createElementVNode("div",Jc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-control":"text",onClick:k[88]||(k[88]=O=>B("text"))},"文本"),t.createElementVNode("li",{"data-control":"number",onClick:k[89]||(k[89]=O=>B("number"))},"数值"),t.createElementVNode("li",{"data-control":"select",onClick:k[90]||(k[90]=O=>B("select"))},"列举"),t.createElementVNode("li",{"data-control":"date",onClick:k[91]||(k[91]=O=>B("date"))},"日期"),t.createElementVNode("li",{"data-control":"checkbox",onClick:k[92]||(k[92]=O=>B("checkbox"))},"复选框"),t.createElementVNode("li",{"data-control":"radio",onClick:k[93]||(k[93]=O=>B("radio"))},"单选框")])])])):t.createCommentVNode("",!0),S=="Checkbox"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:k[95]||(k[95]=O=>A("checkbox")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(xc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Radio"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:k[96]||(k[96]=O=>A("radio")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Cc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Latex"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:b,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(vc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Date"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__date",onClick:k[97]||(k[97]=O=>C("menu-item__date",O)),key:S},[t.createElementVNode("i",{title:"日期",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Sc)})`})},null,4),k[115]||(k[115]=t.createElementVNode("div",{class:"options"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),t.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):t.createCommentVNode("",!0),S=="Block"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:w,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Bc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Search"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:M,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Nc)})`})},null,4)])):t.createCommentVNode("",!0),S=="SearchCollapse"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:S},[t.createElementVNode("div",Xc,[k[116]||(k[116]=t.createElementVNode("input",{type:"text"},null,-1)),k[117]||(k[117]=t.createElementVNode("label",{class:"search-result"},null,-1)),t.createElementVNode("div",Zc,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tc)})`})},null,4)]),t.createElementVNode("div",ed,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ic)})`})},null,4)]),k[118]||(k[118]=t.createElementVNode("span",null,"×",-1))]),k[119]||(k[119]=t.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[t.createElementVNode("input",{type:"text"}),t.createElementVNode("button",null,"替换")],-1))])):t.createCommentVNode("",!0),S=="Print"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:k[98]||(k[98]=O=>c("Print")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Vc)})`})},null,4)])):t.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-9be2b83f"]]),id=ie(t.defineComponent({__name:"richText",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},model:{type:String,default:"edit"},options:{type:Object,default:()=>({})},toolbar:{type:Array,default:()=>["simple"]}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a,{expose:e}){const i=a,n=t.useModel(a,"value"),l=t.ref(!1),o=t.computed(()=>i.editor?.widget(i.wid)||i.widget||{}),s=t.computed(()=>i.editor?.model.value||i.model);t.computed(()=>o.value.props||{});const r=t.ref(),c=t.ref(),d=t.ref(),h=t.ref();t.onMounted(()=>{t.nextTick(()=>{f()}),window.addEventListener("click",()=>{l.value=!1})});function f(){const u=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;d.value.style.height=m+2+"px",console.log("width:"+u+",height:"+m);const b=JSON.parse(JSON.stringify(i.options));h.value=new he.Editor(d.value,[],{mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:u,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...b}),h.value.listener.contentChange=()=>{h.value.command.getValueAsync().then(({data:A})=>{n.value=JSON.stringify(A)})},n.value&&(typeof n.value=="string"?h.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}return t.watch(n,()=>{l.value==!1&&n.value&&h.value&&(typeof n.value=="string"?h.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}),t.watch(s,()=>{h.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(u,m)=>(t.openBlock(),t.createBlock(ht,{class:"unione-rich-text",model:i.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=t.withModifiers(b=>l.value=!0,["stop"]))},{default:t.withCtx(()=>[(s.value=="edit"||s.value=="run")&&h.value?(t.openBlock(),t.createBlock(td,{key:0,ref_key:"canvasMenuDom",ref:c,editor:h.value,items:a.toolbar},null,8,["editor","items"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"canvasEditorDom",ref:d,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-d2704ee4"]]),nd={class:"page-setting-dialog"},_t=t.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const i=a,n=t.computed(()=>i.editor?.model?.value),l=K.useSession(),o=t.computed(()=>l.getPrincipal()),s=t.ref(!1);t.provide("closeSetting",()=>{i.editor?.save().then(u=>{s.value=!1})});function r(){s.value=!0}function c(){i.editor?.save().then(u=>{console.log("res",u)})}function d(){i.editor?.save().then(u=>{console.log("res",u)})}const h=t.ref("");function f(u){h.value||(h.value=n.value),u?i.editor?.setModel("edit"):i.editor?.setModel(h.value)}return(u,m)=>{const b=t.resolveComponent("SettingOutlined"),A=t.resolveComponent("a-tooltip"),C=t.resolveComponent("SaveOutlined"),w=t.resolveComponent("FormOutlined"),y=t.resolveComponent("StopOutlined"),R=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-page",n.value])},[n.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(A,{key:0,title:a.settingTitle},{default:t.withCtx(()=>[t.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):t.createCommentVNode("",!0),n.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(A,{key:1,title:"保存页面"},{default:t.withCtx(()=>[t.createVNode(C,{class:"btn-save",onClick:c})]),_:1})):t.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(A,{key:2,title:"编辑页面"},{default:t.withCtx(()=>[t.createVNode(w,{class:"btn-edit",onClick:m[0]||(m[0]=g=>f(!0))})]),_:1})):t.createCommentVNode("",!0),n.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(A,{key:3,title:"退出编辑"},{default:t.withCtx(()=>[t.createVNode(y,{class:"btn-edit",onClick:m[1]||(m[1]=g=>f(!1))})]),_:1})):t.createCommentVNode("",!0),t.renderSlot(u.$slots,"default"),n.value=="edit"?(t.openBlock(),t.createBlock(R,{key:4,title:i.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=g=>s.value=g),centered:"",width:"85%",onOk:d},{default:t.withCtx(()=>[t.createElementVNode("div",nd,[t.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),ld={class:"unione-props-setting data-field-manage"},od={key:0},sd={key:1},ad={key:2},rd={key:3},cd={key:4},dd={key:5},hd={key:6},fd=["onClick"],ud=["onClick"],pd=["onClick"],md={key:1},gd=ie(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),i=t.useModel(a,"modelValue"),n=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(m=>{n.value.selectedRowKeys.includes(m)||n.value.selectedRowKeys.push(m);const b=[];i.value.forEach(A=>{!u.includes(A.name)&&n.value.selectedRowKeys.includes(A.name)&&b.push(A.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(A=>!b.includes(A)))})}}),l={mounted:u=>u.focus()},o=t.ref({});function s(){const u=Object.keys(o.value);if(u.length)for(let m in u){const b=i.value.filter(A=>A.name==m);if(b&&b[0]){let A=o.value[m];Object.keys(A).forEach(C=>{b[0][C]=A[C]})}}o.value={}}function r(u,m){s();const b={};b[m]=u[m]||"",o.value[u.name]=b}function c(u,m){if(!u||!m){o.value={};return}const b=o.value[u.name][m];if(m=="name"&&i.value.filter(C=>C[m]==b&&C.name!=u.name).length>0){te.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}u[m]=b,o.value={}}function d(u,m){i.value.filter(A=>A.name==u.name).forEach(A=>{A[m]=!A[m]})}function h(){if(s(),i.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};i.value.push(m),o.value[m.name]={name:"new_"}}function f(){if(!n.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}te.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{i.value=i.value.filter(u=>!n.value.selectedRowKeys.includes(u.name)),n.value.selectedRowKeys=[]}})}return(u,m)=>{const b=t.resolveComponent("a-button"),A=t.resolveComponent("a-tooltip"),C=t.resolveComponent("a-input"),w=t.resolveComponent("a-input-number"),y=t.resolveComponent("a-select-option"),R=t.resolveComponent("a-select"),g=t.resolveComponent("a-checkbox"),p=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ld,[t.createVNode(b,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:t.withCtx(()=>m[1]||(m[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:t.withCtx(()=>m[2]||(m[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(p,{columns:e.value,"data-source":i.value,pagination:!1,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:t.withCtx(({column:N})=>[N.key==="name"?(t.openBlock(),t.createElementBlock("span",od,[m[3]||(m[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="title"?(t.openBlock(),t.createElementBlock("span",sd,[m[4]||(m[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="descs"?(t.openBlock(),t.createElementBlock("span",ad,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="dataLen"?(t.openBlock(),t.createElementBlock("span",rd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="dataPrec"?(t.openBlock(),t.createElementBlock("span",cd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="defaultValue"?(t.openBlock(),t.createElementBlock("span",dd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="dataType"?(t.openBlock(),t.createElementBlock("span",hd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(N.title),1)])):t.createCommentVNode("",!0),N.key==="isPk"?(t.openBlock(),t.createBlock(A,{key:7,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[m[5]||(m[5]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1024)):t.createCommentVNode("",!0),N.key==="isFk"?(t.openBlock(),t.createBlock(A,{key:8,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1024)):t.createCommentVNode("",!0),N.key==="isNull"?(t.openBlock(),t.createBlock(A,{key:9,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1024)):t.createCommentVNode("",!0),N.key==="syncDbEnable"?(t.openBlock(),t.createBlock(A,{key:10,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:N,text:M,record:v})=>[["name","title","descs","defaultValue"].includes(N.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(C,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":x=>o.value[v.name][N.dataIndex]=x,onBlur:x=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M||" "),1)],64))],10,fd)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(N.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(w,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":x=>o.value[v.name][N.dataIndex]=x,onBlur:x=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M||" "),1)],64))],10,ud)):["dataType"].includes(N.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(R,{key:0,value:v[N.dataIndex],"onUpdate:value":x=>v[N.dataIndex]=x,onBlur:m[0]||(m[0]=x=>c())},{default:t.withCtx(()=>[t.createVNode(y,{key:"String",value:"String"}),t.createVNode(y,{key:"Long",value:"Long"}),t.createVNode(y,{key:"Short",value:"Short"}),t.createVNode(y,{key:"Integer",value:"Integer"}),t.createVNode(y,{key:"Float",value:"Float"}),t.createVNode(y,{key:"Double",value:"Double"}),t.createVNode(y,{key:"Date",value:"Date"}),t.createVNode(y,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",md,t.toDisplayString(M),1))],10,pd)):["syncDbEnable","isFk","isPk"].includes(N.dataIndex)?(t.openBlock(),t.createBlock(g,{key:3,checked:v[N.dataIndex],onClick:x=>d(v,N.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(N.dataIndex)?(t.openBlock(),t.createBlock(g,{key:4,checked:!v[N.dataIndex],onClick:x=>d(v,N.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),kd={class:"unione-props-setting data-field-setting"},bd={key:0},yd=["onClick"],wd={class:"field-txt"},Ad=["onClick"],xd={key:1,class:"field-txt"},Cd=["onClick"],vd={key:1},Sd=["onClick"],Bd={key:0,class:"field-txt"},Nd={key:4,class:"edit-field"},Vd={key:0},Rd=["onClick"],Ed=ie(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:w})=>w+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=t.useModel(a,"modelValue"),n={mounted:w=>w.focus()},l=t.ref({});function o(){const w=Object.keys(l.value);if(w.length)for(let y in w){const R=i.value.filter(g=>g.name==y);if(R&&R[0]){let g=l.value[y];Object.keys(g).forEach(p=>{p=="convertName"?(R[0].convert||(R[0].convert={}),R[0].convert.type=g[p]):R[0][p]=g[p]})}}l.value={}}function s(w,y){o();const R={};y=="convertName"?(w.convert||(w.convert={}),R[y]=w.convert?.type):R[y]=w[y]||"",l.value[w.name]=R}function r(w,y){{l.value={};return}}function c(w,y){i.value.filter(g=>g.name==w.name).forEach(g=>{g[y]=!g[y]})}const d=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function h(w,y){const R=i.value.filter(p=>p.name==w.name);R.forEach(p=>{y!="isSort"?p[y]=!0:p[y]=!p[y]});const g=R[0];if(!(!g||y=="isSort")){switch(d.value.prop=y,d.value.field=w,g.show||(g.show={}),y){case"isQuery":g.show.query||(g.show.query={}),d.value.show=g.show.query,d.value.title=`查询设置/${w.title}(${w.name})`;break;case"isForm":g.show.form||(g.show.form={}),d.value.show=g.show.form,d.value.title=`表单设置/${w.title}(${w.name})`;break;case"isView":g.show.view||(g.show.view={}),d.value.show=g.show.view,d.value.title=`详情设置/${w.title}(${w.name})`;break;case"isList":g.show.list||(g.show.list={}),d.value.show=g.show.list,d.value.title=`列头设置/${w.title}(${w.name})`;break}d.value.visible=!0}}const f=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:w=>{const y=f.value.options.filter(R=>R.value==w);return y[0]?y[0].label:w}}),u=t.ref({visible:!1,field:{},props:{},showInfo:w=>{let y="";return w.rules&&(y=w.rules.filter(R=>R.enable).length||""),y&&(y="("+y+")"),y},toSetting:()=>{const w=u.value.props,y={name:"range",trigger:w.trigger,whitespace:w.whitespace,message:w.rangeMessage};w.rangeMin!=null&&w.rangeMin!=null&&(y.min=w.rangeMin,y.enable=!0),w.rangeMax!=null&&w.rangeMax!=null&&(y.max=w.rangeMax,y.enable=!0);const R={name:"reg",trigger:w.trigger,whitespace:w.whitespace,message:w.regMessage};w.regExpress&&(R.pattern=w.regExpress,R.enable=!0),u.value.field.rules=[y,R],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(w){u.value.visible=!0,u.value.field=w;const y=w.rules||[],R={trigger:"change",whitespace:!0};y.forEach(g=>{g.name=="reg"&&(R.trigger=g.trigger,R.whitespace=g.whitespace,R.regExpress=g.pattern,R.regMessage=g.message),g.name=="range"&&(R.rangeMin=g.min,R.rangeMax=g.max,R.rangeMessage=g.message)}),u.value.props=R}const b=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:w=>{const y=b.value.widgets.filter(R=>R.value==w);return y[0]?y[0].label:w},toSetting:()=>{}}),A=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{A.value.convert.options||(A.value.convert.options=[]),A.value.convert.options.push({label:"",value:""})},toDelOption:(w,y)=>{A.value.convert.options.splice(w,1)},toSetting:()=>{A.value.visible=!1}});function C(w){A.value.visible=!0,A.value.field=w,A.value.convert=w.convert||{}}return(w,y)=>{const R=t.resolveComponent("ToolOutlined"),g=t.resolveComponent("a-button"),p=t.resolveComponent("a-select"),N=t.resolveComponent("a-checkbox"),M=t.resolveComponent("a-table"),v=t.resolveComponent("a-input-number"),x=t.resolveComponent("a-form-item"),B=t.resolveComponent("a-input"),V=t.resolveComponent("a-form"),k=t.resolveComponent("a-modal"),S=t.resolveComponent("a-col"),T=t.resolveComponent("a-row"),O=t.resolveComponent("a-select-option"),_=t.resolveComponent("a-divider"),$=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createElementBlock("div",kd,[t.createVNode(M,{columns:e.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:I})=>[["widget","queryType","rules","convertName"].includes(I.key)?(t.openBlock(),t.createElementBlock("span",bd,[t.createVNode(R),t.createTextVNode(" "+t.toDisplayString(I.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:I,text:j,record:P})=>[["rules"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!u.value.showInfo(P)&&"empty"]),onClick:E=>m(P)},[t.createElementVNode("span",wd,t.toDisplayString(u.value.showInfo(P)),1),u.value.showInfo(P)?(t.openBlock(),t.createBlock(g,{key:0,type:"link"},{default:t.withCtx(()=>y[22]||(y[22]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,yd)):["widget"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!j&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:P[I.dataIndex],"onUpdate:value":E=>P[I.dataIndex]=E,allowClear:!0,options:b.value.widgets,onBlur:y[0]||(y[0]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",xd,t.toDisplayString(b.value.widgetName(j)),1))],10,Ad)):["queryType"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[P.isQuery?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!j&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:P[I.dataIndex],"onUpdate:value":E=>P[I.dataIndex]=E,allowClear:!0,options:f.value.options,onBlur:y[1]||(y[1]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",vd,t.toDisplayString(f.value.showLabel(j)),1))],10,Cd)):t.createCommentVNode("",!0)],64)):["convertName"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!P.convert?.type&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:P.convert.type,"onUpdate:value":E=>P.convert.type=E,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:y[2]||(y[2]=E=>r())},null,8,["value","onUpdate:value"])),[[n]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[P.convert?.type?(t.openBlock(),t.createElementBlock("span",Bd,t.toDisplayString(P.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),P.convert?.type?(t.openBlock(),t.createBlock(g,{key:1,type:"link",onClick:t.withModifiers(E=>C(P),["stop"])},{default:t.withCtx(()=>y[23]||(y[23]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Sd)):["isQuery","isForm","isView","isList","isSort"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",Nd,[t.createVNode(N,{checked:P[I.dataIndex],onClick:E=>c(P,I.dataIndex)},null,8,["checked","onClick"]),t.createVNode(g,{type:"link",onClick:E=>h(P,I.dataIndex)},{default:t.withCtx(()=>y[24]||(y[24]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(k,{visible:d.value.visible,"onUpdate:visible":y[9]||(y[9]=I=>d.value.visible=I),title:d.value.title,onOk:d.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(x,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(v,{value:d.value.show.index,"onUpdate:value":y[3]||(y[3]=I=>d.value.show.index=I)},null,8,["value"])]),_:1}),["isQuery"].includes(d.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(B,{value:d.value.show.width,"onUpdate:value":y[4]||(y[4]=I=>d.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(B,{value:d.value.show.labelWidth,"onUpdate:value":y[5]||(y[5]=I=>d.value.show.labelWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(B,{value:d.value.show.valueWidth,"onUpdate:value":y[6]||(y[6]=I=>d.value.show.valueWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.fixed,"onUpdate:value":y[7]||(y[7]=I=>d.value.show.fixed=I),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.align,"onUpdate:value":y[8]||(y[8]=I=>d.value.show.align=I),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(k,{visible:A.value.visible,"onUpdate:visible":y[11]||(y[11]=I=>A.value.visible=I),title:A.value.convert.type=="dict"?"字典设置":"选项设置",onOk:A.value.toSetting},{default:t.withCtx(()=>[A.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",Vd,[t.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:A.value.toAddOption},{default:t.withCtx(()=>y[25]||(y[25]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(M,{columns:A.value.optionColumn,"data-source":A.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:I,text:j,record:P,index:E})=>[I.dataIndex==="label"?(t.openBlock(),t.createBlock(B,{key:0,value:P.label,"onUpdate:value":J=>P.label=J,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="value"?(t.openBlock(),t.createBlock(B,{key:1,value:P.value,"onUpdate:value":J=>P.value=J,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:J=>A.value.toDelOption(E,P)},"删除",8,Rd)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),A.value.convert.type=="dict"?(t.openBlock(),t.createBlock(V,{key:1,model:A.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(T,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(S,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(x,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(B,{value:A.value.convert.dict,"onUpdate:value":y[10]||(y[10]=I=>A.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(k,{visible:b.value.visible,"onUpdate:visible":y[13]||(y[13]=I=>b.value.visible=I),title:"控件设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[b.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(x,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(p,{value:b.value.props.mode,"onUpdate:value":y[12]||(y[12]=I=>b.value.props.mode=I),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(O,{value:"multiple"},{default:t.withCtx(()=>y[26]||(y[26]=[t.createTextVNode("多选")])),_:1}),t.createVNode(O,{value:"tags"},{default:t.withCtx(()=>y[27]||(y[27]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(k,{visible:u.value.visible,"onUpdate:visible":y[21]||(y[21]=I=>u.value.visible=I),title:"规则设置",onOk:u.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>y[28]||(y[28]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(x,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode($,{value:u.value.props.trigger,"onUpdate:value":y[14]||(y[14]=I=>u.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.whitespace,"onUpdate:value":y[15]||(y[15]=I=>u.value.props.whitespace=I),checked:u.value.props.whitespace},{default:t.withCtx(()=>y[29]||(y[29]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>y[30]||(y[30]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(x,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(v,{value:u.value.props.rangeMin,"onUpdate:value":y[16]||(y[16]=I=>u.value.props.rangeMin=I)},null,8,["value"]),y[31]||(y[31]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(v,{value:u.value.props.rangeMax,"onUpdate:value":y[17]||(y[17]=I=>u.value.props.rangeMax=I)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(B,{value:u.value.props.rangeMessage,"onUpdate:value":y[18]||(y[18]=I=>u.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>y[32]||(y[32]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(x,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(B,{value:u.value.props.regExpress,"onUpdate:value":y[19]||(y[19]=I=>u.value.props.regExpress=I)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(B,{value:u.value.props.regMessage,"onUpdate:value":y[20]||(y[20]=I=>u.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Od={class:"unione-props-setting data-field"},Md=ie(t.defineComponent({__name:"dataField",props:t.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(i,n)=>{const l=t.resolveComponent("OrderedListOutlined"),o=t.resolveComponent("a-tab-pane"),s=t.resolveComponent("ToolOutlined"),r=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Od,[t.createVNode(r,null,{default:t.withCtx(()=>[t.createVNode(o,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(l),n[2]||(n[2]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(gd,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),t.createVNode(o,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(s),n[3]||(n[3]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(Ed,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),_d={key:0,class:"data-model-list"},Td=["onClick"],Id=ie(t.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const i=t.computed(()=>l.editor.dataModels()),n=t.ref({sn:"new_",title:"新建数据",fields:[]});t.onMounted(()=>{i.value&&i.value[0]&&(n.value=i.value[0])});const l=a;function o(f){n.value=f}function s(){if(i.value.length>=l.limit){te.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=va.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};n.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=t.ref(),d=t.inject("closeSetting");function h(){c.value.validate().then(f=>{d&&d()})}return e({toSaving:h}),(f,u)=>{const m=t.resolveComponent("a-input"),b=t.resolveComponent("a-form-item"),A=t.resolveComponent("a-textarea"),C=t.resolveComponent("a-form");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(t.openBlock(),t.createElementBlock("div",_d,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,w=>(t.openBlock(),t.createElementBlock("div",{key:w.sn,class:t.normalizeClass(["title",n.value&&n.value.sn==w.sn&&"slt"]),onClick:y=>o(w)},t.toDisplayString(w.title),11,Td))),128)),t.createElementVNode("div",{class:"title btn-add",onClick:s},"+")])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[t.createVNode(C,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:t.withCtx(()=>[t.createVNode(b,{label:"数据标题",name:"title",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.title,"onUpdate:value":u[0]||(u[0]=w=>n.value.title=w)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.name,"onUpdate:value":u[1]||(u[1]=w=>n.value.name=w)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.url,"onUpdate:value":u[2]||(u[2]=w=>n.value.url=w)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据说明",name:"descs"},{default:t.withCtx(()=>[t.createVNode(A,{value:n.value.descs,"onUpdate:value":u[3]||(u[3]=w=>n.value.descs=w)},null,8,["value"])]),_:1})]),_:1},8,["model"]),t.createVNode(Md,{modelValue:n.value.fields,"onUpdate:modelValue":u[4]||(u[4]=w=>n.value.fields=w)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Fd={class:"unione-props-setting unione-page-setting"},Tt=ie(t.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref({});return t.onMounted(()=>{i.value=e.editor.define.value}),(n,l)=>{const o=t.resolveComponent("a-form-item"),s=t.resolveComponent("a-input"),r=t.resolveComponent("a-switch"),c=t.resolveComponent("a-textarea"),d=t.resolveComponent("a-form"),h=t.resolveComponent("a-tab-pane"),f=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Fd,[t.createVNode(f,{type:"card"},{default:t.withCtx(()=>[t.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:t.withCtx(()=>[t.createVNode(d,{model:i.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[i.value.sn&&i.value.sn!="new_"?(t.openBlock(),t.createBlock(o,{key:0,label:"页面编码"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.value.sn)+"/V"+t.toDisplayString(i.value.vers),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(o,{label:"页面标题",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.title,"onUpdate:value":l[0]||(l[0]=u=>i.value.title=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"页面组件",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.component,"onUpdate:value":l[1]||(l[1]=u=>i.value.component=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"icon图标"},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.icon,"onUpdate:value":l[2]||(l[2]=u=>i.value.icon=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"是否全局"},{default:t.withCtx(()=>[t.createVNode(r,{checked:i.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>i.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"是否模版"},{default:t.withCtx(()=>[t.createVNode(r,{checked:i.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>i.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"页面备注"},{default:t.withCtx(()=>[t.createVNode(c,{value:i.value.descs,"onUpdate:value":l[5]||(l[5]=u=>i.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),t.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:t.withCtx(()=>[t.createVNode(Id,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),jl=ie(t.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},n=new dt,l=t.computed(()=>n.$widgetList.value||[]);t.watch(()=>e.pageDefine,s=>{s&&n.load(o.value,s)});const o=t.ref("new_");return t.onMounted(()=>{const s=t.inject("route");console.log("unione page view route",s),o.value=e.psn||s?.query?.psn||s?.meta?.psn||"new_",console.log("unione page view,psn:"+o.value),n.setModel("run"),n.load(o.value,e.pageDefine||i)}),(s,r)=>(t.openBlock(),t.createBlock(_t,{class:"unione-page-view","setting-title":"页面设置",editor:t.unref(n)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,c=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.render||c.widget),{key:c.wid,wid:c.wid,widget:c,editor:t.unref(n)},null,8,["wid","widget","editor"]))),128))]),_:2},[t.unref(n)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Dd={class:"form-btns"},zl=t.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1},storage:{type:Object,required:!1},fields:{type:Array,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1},setting:{type:Object,required:!1}},emits:["submit","save","reset","back","btnClick"],setup(a,{expose:e,emit:i}){const n=t.inject("router"),l=K.useDialog(),o=a,s=i,r={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-form"};function c(){if(o.fields?.length){const y={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields,setting:o.setting||{}};r.configs.widgets=[y]}o.storage&&(r.configs.dsnList=["primary"],d.dataManager().use("primary","form").store(o.storage)),r.configs.btns=o.btns||[],o.btns==!1&&(r.configs.btns=!1),r.configs.event=o.event||{}}const d=new dt,h=t.computed(()=>d.$widgetList.value||[]),f=t.ref({}),u=t.computed(()=>{const y=d.define.value?.configs?.btns||[],R=y.map(g=>g.name);if(!R.includes("save")){const g={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};y.splice(g.index,0,g)}if(!R.includes("submit")){const g={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let p=g.index||1;y.splice(p,0,g)}if(!R.includes("reset")){const g={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};y.splice(g.index,0,g)}if(!R.includes("back")){const g={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};y.splice(g.index,0,g)}return d.model.value=="view"&&y.filter(g=>["save","submit","reset"].includes(g.name)).forEach(g=>{g.visible=!1}),y});async function m({btn:y,event:R}){if(y.name=="save"){const g=await b();g.success&&g.body&&(f.value.id=g.body),s("save",{btn:y,event:R,formData:f.value})}y.name=="reset"&&(A(),s("reset",{btn:y,event:R})),y.name=="back"&&(C(),s("back",{btn:y,event:R})),y.name=="submit"&&l.confirm({content:"提交当前表单吗?",onOk:async()=>{const g=await b();g.success&&g.body&&(f.value.id=g.body),s("submit",{btn:y,event:R,formData:f.value})}}),s("btnClick",{btn:y,event:R})}async function b(){const y=d.dataManager().form();f.value={};for(let R in y){const g=await y[R].validate();if(d.dataManager().psn()==R){for(let p in f)g[p]=f.value[p];f.value=g}else f.value[R]=g}return d.dataManager().primary().save({data:f.value,params:d.dataManager().params})}function A(y){d.dataManager().primary().reset(y)}function C(){n.back()}t.watch(()=>o.pageDefine,y=>{y&&d.load(w.value,y)});const w=t.ref("new_");return t.onMounted(()=>{const y=t.inject("route");console.log("unione page form route",y),w.value=o.psn||y?.query?.psn||y?.meta?.psn||"new_",console.log("unione page form,psn:"+w.value),d.setModel(y?.query?.model||y?.meta?.model||"run");const R={...o.params||{},...y?.query||{},...y?.params||{}};d.dataManager().params(R),c(),d.load(w.value,o.pageDefine||r)}),e({save:b,toReset:A,toBack:C}),(y,R)=>{const g=t.resolveComponent("unione-btn");return t.openBlock(),t.createBlock(_t,{class:"unione-page-form","setting-title":"页面设置",editor:t.unref(d)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,p=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(p.widget),{key:p.wid,wid:p.wid,widget:p,editor:t.unref(d)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Dd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.name},[p.visible!=!1?(t.openBlock(),t.createBlock(g,{key:0,widget:p,editor:t.unref(d),ctx:{},onClick:m},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128))])]),_:2},[t.unref(d)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(d)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),$d=["onMouseover"],Pd={key:0,class:"node-opts"},Ld={key:2,class:"tree-empty"},Ud={class:"form-warp"},jd={class:"form-btns"},ql=ie(t.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=t.inject("router"),o=a,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function r(){if(o.fields?.length){const D={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields};s.configs.widgets=[D]}s.configs.dsnList=["primary"],c.dataManager().use("primary","form").store(o.storage),s.configs.btns=o.btns||[],o.btns==!1&&(s.configs.btns=!1),s.configs.opts=o.opts||[],o.opts==!1&&(s.configs.opts=!1),s.configs.event=o.event||{},s.configs.setting=o.setting||{}}const c=new dt,d=t.ref(!1),h=t.ref([]),f=t.ref({}),u=t.ref(null),m=t.ref(null),b=t.ref([]),A=t.ref([]),C=t.ref(0),w=t.computed(()=>{const D={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,autoselect:!1,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...o.setting?.tree||{}};return c.define.value?.configs?.tree||D}),y=t.computed(()=>w.value.searchEnable),R=t.computed(()=>{const D=c.define.value?.configs?.opts;if(typeof D=="boolean"&&D==!1)return!1;const Q=(D||[]).map(Y=>typeof Y=="string"?{name:Y,visible:!1}:Y),G=[];return Q.forEach(Y=>{G.push(Y.name)}),console.log("opts addBtn",Q),Q.filter(Y=>Y.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),g=t.computed(()=>{const D=c.define.value?.configs?.opts;if(typeof D=="boolean"&&D==!1)return[];const Q=(D||[]).map(X=>typeof X=="string"?{name:X,visible:!1}:X),G=[],Y=[];return Q.forEach(X=>{Y.push(X.name),X.name!="add"&&G.push(X)}),Y.includes("delete")||G.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),Y.includes("child")||G.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",G),G});function p({btn:D,event:Q},G){Q.stopPropagation();const Y=f.value[G[w.value.idField]];if(console.log("onTreeMenuClick,btn:",D),console.log("onTreeMenuClick,node:",G),console.log("onTreeMenuClick,curentNode:",Y),D.name=="child"){if(_.value.preCreate&&_.value.preCreate(Y)==!1)return;const X=f.value[Y[w.value.idField]];X.isLeaf=!1,u.value={},u.value[w.value.pidField]=X[w.value.idField],u.value[w.value.labelField]="新建...",u.value[w.value.idField]="new_"+C.value,u.value.parentNode=X,C.value=C.value+1,X.children||(X.children=[],A.value.push(X[w.value.idField])),_.value.createNode&&_.value.createNode(u.value,X,c.dataManager().params()),f.value[u.value[w.value.idField]]=u.value,X.children.push(u.value),b.value=[u.value[w.value.idField]],c.dataManager().primary().setValue(u.value)}D.name=="delete"&&L(Y),j("btnClick",{btn:D,event:Q,node:Y})}function N(D,{expanded:Q,node:G}){Q&&(u.value=G.dataRef,c.dataManager().primary().setValue(u.value),T())}function M(D,Q){Q.selected?(u.value=Q.node.dataRef,c.dataManager().primary().setValue(u.value)):u.value&&(b.value=[u.value[w.value.idField]]),j("treeClick",{keys:D,event:Q}),j("select",{keys:D,event:Q})}const v=t.computed(()=>{if(o.storage?.orderBy){const D=o.storage.orderBy.split(" ");return[{name:D[0],asc:D[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>o.params,()=>{d.value&&(h.value=[],f.value={},u.value=null,b.value=[],A.value=[],C.value=0,c.dataManager().params(o.params||{}),console.log("params changed props.params",o.params),T())}),t.watch(()=>u.value,()=>{console.log("active node changed",u.value),B(!u.value)});const x=t.ref(null);t.watch(x,()=>{x.value&&u.value&&c.dataManager().primary().setValue(u.value)});function B(D=!0){const Q=c.dataManager().form();for(let G in Q)Q[G].setDisabled(D)}function V(){if(!(_.value.preCreate&&_.value.preCreate()==!1)){if(u.value={},u.value[w.value.pidField]=-1,u.value[w.value.labelField]="新建...",u.value[w.value.idField]="new_"+C.value,C.value=C.value+1,_.value.createNode&&_.value.createNode(u.value,null,c.dataManager().params()),u.value[w.value.pidField]==-1)h.value.push(u.value);else{const D=f.value[u.value[w.value.pidField]];D?(D.children||(D.children=[]),D.children.push(u.value)):h.value.push(u.value)}b.value=[u.value[w.value.idField]],f.value[u.value[w.value.idField]]=u.value,c.dataManager().primary().setValue(u.value)}}const k=t.ref(""),S=At(D=>{c.dataManager().primary().find({page:1,pageSize:9999,keywords:D||k.value,needCount:!1,body:w.value.async==!1?null:{},sorts:v.value}).then(Q=>{if(f.value={},h.value=[],Q.body?.length){const G={};Q.body.forEach(Y=>{G[Y[w.value.idField]]=Y}),Q.body.forEach(Y=>{const X=G[Y[w.value.pidField]];X?(X.children||(X.children=[],X.isLeaf=!1),X.children.push(Y)):h.value.push(Y)})}})},400);function T(){return new Promise((D,Q)=>{const G={};if(G[w.value.pidField]=o.params[w.value.pidField]||-1,u.value){if(u.value.children?.length||w.value.async==!1){D(u.value.children);return}G[w.value.pidField]=u.value[w.value.idField],c.dataManager().primary().find({page:1,pageSize:999,body:G,sorts:v.value}).then(Y=>{u.value.children=Y.body||[],u.value.children.forEach(X=>{X.isLeaf=!!X[w.value.leafField],f.value[X[w.value.idField]]=X,X.parentNode=f.value[X[w.value.pidField]]}),D(Y.body)})}else{const Y=w.value.async==!1?null:{page:1,pageSize:999,body:G,sorts:v.value};c.dataManager().primary().find(Y).then(X=>{if(w.value.async==!1){if(h.value=[],X.body?.length){const Ie={};X.body.forEach(wt=>{Ie[wt[w.value.idField]]=wt}),X.body.forEach(wt=>{const Mt=Ie[wt[w.value.pidField]];Mt?(Mt.children||(Mt.children=[],Mt.isLeaf=!1),Mt.children.push(wt)):h.value.push(wt)})}D(X.body)}else h.value=X.body||[],h.value.forEach(Ie=>{Ie.isLeaf=!!Ie[w.value.leafField],f.value[Ie[w.value.idField]]=Ie}),D(X.body)})}})}const O=t.computed(()=>c.$widgetList.value||[]),_=t.computed(()=>{const D={...c.define.value?.configs?.event||{}};for(const Q in D)D[Q]&&typeof D[Q]!="function"&&D[Q].enable&&D[Q].scriptText&&(Q=="createNode"&&(D[Q]=new Function("node","parent","params",D[Q].scriptText)),Q=="preCreate"?D[Q]=new Function("parent",D[Q].scriptText):D[Q]=new Function("data","event",D[Q].scriptText));return D}),$=t.computed(()=>c.define.value?.configs?.setting||o.setting||{});t.provide("pageSetting",$.value);const I=t.computed(()=>{const D=c.define.value?.configs?.btns;if(typeof D=="boolean"&&D==!1)return[];const Q=(c.define.value?.configs?.btns||[]).map(Y=>typeof Y=="string"?{name:Y,visible:!1}:{size:"default",...Y}),G=Q.map(Y=>Y.name);if(!G.includes("save")){const Y={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};Q.splice(Y.index,0,Y)}if(!G.includes("reset")){const Y={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};Q.splice(Y.index,0,Y)}if(!G.includes("back")){const Y={title:"返回",type:"default",index:Q.length,visible:!0,size:"default",name:"back"};Q.splice(Y.index,0,Y)}return c.model.value=="view"&&Q.filter(Y=>["save","submit","reset"].includes(Y.name)).forEach(Y=>{Y.visible=!1}),Q}),j=i;function P({btn:D,event:Q}){D.name=="save"&&E({btn:D,event:Q}),D.name=="reset",D.name=="back"&&F(),j("btnClick",{btn:D,event:Q})}async function E(D){const Q=c.dataManager().form();let G={...u.value};for(let Y in Q){const X=await Q[Y].validate();if(c.dataManager().psn()==Y)for(let Ie in X)G[Ie]=X[Ie];else G[Y]=X}if(G[w.value.pidField]&&(G[w.value.pidField]+"").startsWith("new_")){n.error({content:"请先保存父节点!"});return}G[w.value.idField]&&(G[w.value.idField]+"").startsWith("new_")&&delete G[w.value.idField],delete G.parentNode,delete G.children,G[w.value.leafField]=G[w.value.leafField]?1:0,_.value.preSave&&_.value.preSave(G,D),console.log("=======form data=====",G),c.dataManager().primary().save({data:G}).then(Y=>{console.log("save result:",Y),u.value[w.value.idField]=Y.body,b.value=[Y.body],f.value[Y.body]=u.value,u.value.children?.forEach(X=>{X[w.value.pidField]=Y.body}),_.value.postSaved&&_.value.postSaved(G,D)})}function J(){}function F(){l.back()}function z(){return c.dataManager().primary()}function pe(D){f.value[D[w.value.idField]]={...f.value[D[w.value.idField]],...D}}function tt(D){return f.value[D]}function L(D){_.value.preDelete&&_.value.preDelete(D)==!1||(D[w.value.idField]&&(D[w.value.idField]+"").startsWith("new_")?(D.parentNode?D.parentNode.children=D.parentNode.children.filter(Q=>Q[w.value.idField]!=D[w.value.idField]):h.value=h.value.filter(Q=>Q[w.value.idField]!=D[w.value.idField]),delete f.value[D[w.value.idField]]):c.dataManager().primary().deleteByIds([D[w.value.idField]]).then(()=>{if(D.parentNode){const Q=f.value[D[w.value.pidField]];Q.children=Q.children.filter(G=>G[w.value.idField]!=D[w.value.idField])}else h.value=h.value.filter(Q=>Q[w.value.idField]!=D[w.value.idField]);delete f.value[D[w.value.idField]]}))}function Oe(){h.value=[],f.value={},u.value=null,m.value=null,b.value=[],A.value=[],C.value=0,T().then(D=>{if(D&&D[0]&&w.value.selectable&&w.value.autoselect){const Q={...D[0],dataRef:D[0]};b.value=[D[0].id],j("select",{keys:b.value,event:{node:Q}})}})}const ne=t.ref("new_");return t.onMounted(()=>{const D=t.inject("route");console.log("unione page tree route",D),ne.value=o.psn||D?.query?.psn||D?.meta?.psn||"new_",console.log("unione page tree,psn:"+ne.value),c.setModel(D?.query?.model||D?.meta?.model||"run");const Q={...o.params||{},...D?.query||{},...D?.params||{}};c.dataManager().params(Q),r(),c.load(ne.value,s),t.nextTick(()=>{B(!0)}),T().then(G=>{if(G&&G[0]&&w.value.selectable&&w.value.autoselect){const Y={...G[0],dataRef:G[0]};b.value=[G[0].id],j("select",{keys:b.value,event:{node:Y}})}}),d.value=!0}),e({storage:z,save:E,toBack:F,toReset:J,setNode:pe,getNode:tt,delNode:L,reload:Oe}),(D,Q)=>{const G=t.resolveComponent("SearchOutlined"),Y=t.resolveComponent("a-input"),X=t.resolveComponent("unione-btn"),Ie=t.resolveComponent("a-badge"),wt=t.resolveComponent("a-tree"),Mt=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(_t,{class:"unione-page-tree","setting-title":"页面设置",editor:t.unref(c)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"tree-warp",onContextmenu:Q[4]||(Q[4]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot(D.$slots,"tree-top",{},void 0,!0),y.value?(t.openBlock(),t.createBlock(Y,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:k.value,"onUpdate:value":Q[0]||(Q[0]=de=>k.value=de),onChange:t.unref(S),onPressEnter:t.unref(S)},{suffix:t.withCtx(()=>[t.createVNode(G)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createBlock(X,{key:1,widget:R.value,onClick:V},null,8,["widget"])):t.createCommentVNode("",!0),t.createVNode(wt,{"show-line":w.value.showLine,"show-icon":w.value.showIcon,disabled:w.value.disabled,blockNode:!0,draggable:w.value.draggable,multiple:w.value.multiple,selectable:w.value.selectable,checkable:w.value.checkable,fieldNames:{title:w.value.labelField,key:w.value.idField},selectedKeys:b.value,"onUpdate:selectedKeys":Q[2]||(Q[2]=de=>b.value=de),expandedKeys:A.value,"onUpdate:expandedKeys":Q[3]||(Q[3]=de=>A.value=de),"tree-data":h.value,onExpand:N,onSelect:M},t.createSlots({icon:t.withCtx(({dataRef:de})=>[de[w.value.iconField]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(de[w.value.iconField]),{key:0,class:"node-icon"})):t.createCommentVNode("",!0)]),_:2},[g.value?.length?{name:"title",fn:t.withCtx(({dataRef:de})=>[t.createElementVNode("div",{class:"node-label",onMouseover:()=>m.value=de,onMouseleave:Q[1]||(Q[1]=()=>m.value=null)},[t.createVNode(Ie,{dot:de[w.value.badgeDot],count:de[w.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(de[w.value.labelField]),1)]),_:2},1032,["dot","count"]),u.value&&u.value[w.value.idField]==de[w.value.idField]||m.value&&m.value[w.value.idField]==de[w.value.idField]?(t.openBlock(),t.createElementBlock("div",Pd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,El=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!_.value.btnVisible||_.value.btnVisible(El,de)?(t.openBlock(),t.createBlock(X,{key:El.name,widget:El,ctx:{node:de},onClick:Mp=>p(Mp,de)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],40,$d)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"]),!h.value||!h.value.length?(t.openBlock(),t.createElementBlock("div",Ld,[t.renderSlot(D.$slots,"tree-empty",{},()=>[t.createVNode(Mt)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",Ud,[t.renderSlot(D.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,de=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(de.widget),{key:de.wid,wid:de.wid,widget:de,editor:t.unref(c)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",jd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,de=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:de.name},[de.visible!=!1?(t.openBlock(),t.createBlock(X,{key:0,widget:de,editor:t.unref(c),disabled:!u.value,ctx:{},onClick:P},null,8,["widget","editor","disabled"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(c)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(c)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-b8b0a371"]]),Ql=t.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},selection:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:i}){const n=a,l=t.ref(null),o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(n.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=n.fields.filter(R=>R.isQuery),o.configs.widgets[0].btns=n.queryBtns||[],o.configs.widgets[0].params=n.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const y=n.fields.filter(R=>R.isPk)[0];y&&y.name&&(o.configs.widgets[1].dataKey=y.name),o.configs.widgets[1].columns=n.fields.filter(R=>R.hidden!=!0),o.configs.widgets[1].operation=n.operation,n.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=n.leftBtns==!1?!1:n.leftBtns||[],o.configs.widgets[1].rightBtns=n.rightBtns==!1?!1:n.rightBtns||[],r.dataManager().use("primary","list").store(n.storage)}}const r=new dt,c=t.computed(()=>r.$widgetList.value||[]),d=i;function h(y){d("btnClick",y)}const f=t.ref("new_");t.onMounted(()=>{const y=t.inject("route");console.log("unione page view route",y),f.value=n.psn||y?.query?.psn||y?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),r.setModel(y?.query?.model||y?.meta?.model||"run");const R={...n.params||{},...y?.query||{},...y?.params||{}};r.dataManager().params(R),s(),r.load(f.value,o)});function u(){return r.dataManager().use("primary","list")}function m(y){y?r.ebus.$emit("table-list-search",y):r.ebus.$emit("table-list-reload")}function b(y){r.dataManager().params(y),r.ebus.$emit("query-form-params",y),r.ebus.$emit("table-list-search",{params:y})}function A(){return l.value?l.value[0]:null}function C(){return l.value?l.value[0].getSelected():null}function w(){l.value&&l.value[0].clearSelected()}return e({storage:u,editor:r,reload:m,setParams:b,getTable:A,getSelected:C,clearSelected:w}),(y,R)=>(t.openBlock(),t.createBlock(_t,{class:"unione-page-list","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,g=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:g.wid},[g.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(g.widget),{key:0,wid:g.wid,widget:g,editor:t.unref(r),onBtnClick:h,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(g.widget),{key:1,wid:g.wid,widget:g,editor:t.unref(r),onBtnClick:h},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),Kl=t.defineComponent({__name:"todo",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},flowKey:{type:String,required:!1},flowVers:{type:Number,required:!1},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=K.useSession(),o=new Qe({types:"dict",dictName:"FLOWLITETASKSTATUS"}),s=a,r=t.ref(null),c=t.ref(null),d=t.ref(null),h={sn:"new_",title:"我的待办",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"primary",primary:!0,fields:[{title:"接收时间",name:"time",widget:"a-range-picker",props:{showTime:!0,format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss",placeholder:["开始时间","结束时间"]}}]},{widget:"unione-table",dsn:"primary",columns:[{title:"流程类别",name:"instance.category",convert:{types:"dict",dictName:"FLOWLITECATEGORY"}},{title:"流程名称",name:"instance.title"},{title:"提交人",name:"instance.commitUserName"},{title:"提交时间",name:"instance.commitTime"},{title:"节点名称",name:"title"},{title:"接收时间",name:"created"},{title:"处理状态",name:"handleStatus",customCell:(x,B,V)=>{o.convert(x.status).then(k=>{const S=[];k&&S.push(k),x.handleUserId&&S.push("已签收"),S.length>0&&(x[V.dataIndex]=S.join("/"))})}}],leftBtns:["delBatch","add",{title:"批量审核",name:"auditBatch",type:"primary",props:{danger:!0}},{title:"批量签收",name:"signBatch",type:"primary"},{title:"批量放弃",name:"waiveBatch",type:"primary"}],rightBtns:["impData","downTmpl"],operation:{title:"操作",width:250,btns:["edit","delete",{title:"签收",name:"sign",event:{visible:x=>!x.row.handleUserId}},{title:"放弃",name:"waive",props:{danger:!0},event:{visible:x=>!!x.row.handleUserId}},{title:"意见",name:"opinion"},{title:"审核",name:"audit",type:"primary"}],count:4,more:{layout:"vertical"}}}],dsnList:["primary"]},component:"unione-flow-todo"};function f(){K.axios.flow({url:`/api/engine/profile/${s.flowKey}${s.flowVers?"/"+s.flowVers:""}`,method:"post"}).then(x=>{if(console.log("loaded flow tmpl info",x),x.success){const B=x.body.busiField;B&&B.forEach(V=>{V.visible!=!1&&(V.index!=null&&V.index!=null?h.configs.widgets[1].columns.splice(V.index,0,{title:V.title,name:"instance.busiData."+V.name}):h.configs.widgets[1].columns.push({title:V.title,name:"instance.busiData."+V.name}))}),l.setStorage("page-define-flow-todo:"+s.flowKey,JSON.stringify(h.configs)),u.load(y.value,h)}})}const u=new dt,m=t.computed(()=>u.$widgetList.value||[]),b=i;function A(x){const{btn:B,row:V,keys:k}=x;if(B.name=="audit"&&c.value.open(V?V.id:k,{flowKey:V?.instance?.sn,nodeKey:V?.sn,nodeTitle:V?.title}),B.name=="auditBatch"&&c.value.open(k,{nodeTitle:"批量审核"}),B.name=="sign"&&C(V.id),B.name=="signBatch"){if(k.length==0){n.warning("请选择要签收的任务");return}C(k)}if(B.name=="waive"&&w(V.id),B.name=="waiveBatch"){if(k.length==0){n.warning("请选择要放弃的任务");return}w(k)}B.name=="opinion"&&d.value.open({busiKey:V.instance.busiKey}),b("btnClick",x)}function C(x){const B={};Array.isArray(x)?B.taskIds=x:B.taskId=x,n.confirm({content:"确定签收吗?",onOk:()=>{K.axios.flow({url:"/api/engine/task/sign",method:"post",data:B}).then(V=>{V.success?(n.success("签收成功"),g()):n.error(V.msg)})}})}function w(x){const B={};Array.isArray(x)?B.taskIds=x:B.taskId=x,n.confirm({content:"确定签收吗?",onOk:()=>{K.axios.flow({url:"/api/engine/task/waive",method:"post",data:B}).then(V=>{V.success?(n.success("操作成功"),g()):n.error(V.msg)})}})}const y=t.ref("new_");t.onMounted(()=>{const x=t.inject("route");console.log("unione flow todo route",x),y.value=s.psn||x?.query?.psn||x?.meta?.psn||"new_",console.log("unione flow todo psn:"+y.value),u.setModel(x?.query?.model||x?.meta?.model||"run");const B={...s.params||{},...x?.query||{},...x?.params||{}};u.dataManager().params(B),s.leftBtns&&Array.isArray(s.leftBtns)&&(h.configs.widgets[1].leftBtns=[...h.configs.widgets[1].leftBtns,...s.leftBtns]),s.rightBtns&&Array.isArray(s.rightBtns)&&(h.configs.widgets[1].rightBtns=[...h.configs.widgets[1].rightBtns,...s.rightBtns]),s.operation&&typeof s.operation=="object"&&(h.configs.widgets[1].operation={...h.configs.widgets[1].operation,...s.operation}),u.dataManager().use("primary","list").store({ctx:"flow",controller:"/api/engine/task",findUrl:"/todo",findParams:[{name:"flowSn",value:s.flowKey}]}),s.flowKey?f():u.load(y.value,h)});function R(){return u.dataManager().use("primary","list")}function g(x){v(),x?u.ebus.$emit("table-list-search",x):u.ebus.$emit("table-list-reload")}function p(x){u.dataManager().params(x),u.ebus.$emit("query-form-params",x),u.ebus.$emit("table-list-search",{params:x})}function N(){return r.value?r.value[0]:null}function M(){return r.value?r.value[0].getSelected():null}function v(){r.value&&r.value[0].clearSelected(!0)}return e({storage:R,editor:u,reload:g,setParams:p,getTable:N,getSelected:M,clearSelected:v}),(x,B)=>{const V=t.resolveComponent("UnioneFlowAudit"),k=t.resolveComponent("UnioneFlowOpinion");return t.openBlock(),t.createBlock(_t,{class:"unione-flow-todo","setting-title":"页面设置",editor:t.unref(u)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.wid},[S.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.widget),{key:0,wid:S.wid,widget:S,editor:t.unref(u),onBtnClick:A,ref_for:!0,ref_key:"table",ref:r},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.widget),{key:1,wid:S.wid,widget:S,editor:t.unref(u),onBtnClick:A},null,40,["wid","widget","editor"]))],64))),128)),t.createVNode(V,{ref_key:"audit",ref:c,onSuccess:B[0]||(B[0]=S=>g())},null,512),t.createVNode(k,{ref_key:"opinion",ref:d},null,512)]),_:2},[t.unref(u)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(u)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),zd={class:"handel-opinion"},qd={key:0,class:"preset-opinions"},Qd={class:"ok"},Kd={class:"reject"},Wd=t.defineComponent({name:"FlowAudit",__name:"audit",props:{vars:{type:Object,required:!1}},emits:["success"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=a,o=i,s=t.ref("审核"),r=t.ref(!1),c=t.ref(),d=t.ref({flowKey:"",nodeKey:""}),h=t.ref([]),f=t.ref(),u=t.ref({data:{handelOpinion:""},rules:{handelOpinion:[{required:!0,message:"请输入处理意见"}]}});function m(){r.value=!1}function b(y,{flowKey:R,nodeKey:g,nodeTitle:p}={}){if(c.value=y,s.value=p||"审核",!y){n.error("任务id不能为空");return}r.value=!0,d.value.flowKey=R,d.value.nodeKey=g,u.value.data.handelOpinion="",A()}function A(){const{flowKey:y,nodeKey:R}=d.value;K.axios.flow({url:`/api/engine/opinion/preset/${y||"-1"}/${R||"-1"}`,method:"post"}).then(g=>{h.value=g.body})}function C(y){u.value.data.handelOpinion=y.optxt}function w(y){const R=s.value;f.value.validate().then(()=>{n.confirm({content:`确定提交${R},并${y?"同意":"拒绝"}该申请么?`,onOk:()=>{const g={result:y,opinion:u.value.data.handelOpinion,vars:l.vars};Array.isArray(c.value)?g.taskIds=c.value:g.taskId=c.value,K.axios.flow({url:"/api/engine/task/submit",method:"post",data:g}).then(p=>{p.success?(n.success(`提交${R}成功`),m(),o("success")):n.error(p.msg)})}})})}return e({open:b}),(y,R)=>{const g=t.resolveComponent("a-textarea"),p=t.resolveComponent("a-form-item"),N=t.resolveComponent("a-tag"),M=t.resolveComponent("a-form"),v=t.resolveComponent("a-button"),x=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(x,{title:s.value,visible:r.value,"onUpdate:visible":R[3]||(R[3]=B=>r.value=B),width:600,rootClassName:"flow-audit-drawer"},{footer:t.withCtx(()=>[t.createVNode(v,{type:"primary",onClick:R[1]||(R[1]=B=>w(!0))},{default:t.withCtx(()=>R[4]||(R[4]=[t.createTextVNode("同意")])),_:1}),t.createVNode(v,{type:"primary",danger:"",onClick:R[2]||(R[2]=B=>w(!1))},{default:t.withCtx(()=>R[5]||(R[5]=[t.createTextVNode("拒绝")])),_:1})]),default:t.withCtx(()=>[t.createVNode(M,{layout:"vertical",model:u.value.data,rules:u.value.rules,ref_key:"formRef",ref:f},{default:t.withCtx(()=>[t.createElementVNode("div",zd,[t.createVNode(p,{label:"处理意见:",name:"handelOpinion"},{default:t.withCtx(()=>[t.createVNode(g,{value:u.value.data.handelOpinion,"onUpdate:value":R[0]||(R[0]=B=>u.value.data.handelOpinion=B),autoSize:"",rows:10,placeholder:"请输入处理意见"},null,8,["value"])]),_:1})]),h.value&&h.value.length?(t.openBlock(),t.createElementBlock("div",qd,[t.createVNode(p,{label:"预设意见:"},{default:t.withCtx(()=>[t.createElementVNode("div",Qd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(B=>B.types==1),B=>(t.openBlock(),t.createBlock(N,{key:B.id,color:"success",onClick:V=>C(B)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1032,["onClick"]))),128))]),t.createElementVNode("div",Kd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(B=>B.types==2),B=>(t.openBlock(),t.createBlock(N,{key:B.id,color:"orange",onClick:V=>C(B)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1032,["onClick"]))),128))])]),_:1})])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])]),_:1},8,["title","visible"])}}}),Yd={key:0,class:"flow-options"},Hd={class:"flow-task"},Gd={class:"node"},Jd={class:"user"},Xd={class:"time"},Zd={class:"content"},eh={key:1,class:"flow-options"},th={class:"flow-task"},ih={class:"user"},nh={class:"time"},lh={class:"content"},oh={key:0,class:"flow-title"},sh={class:"flow-task"},ah={class:"node"},rh={class:"user"},ch={class:"time"},dh={class:"content"},hh=t.defineComponent({name:"FlowOpinion",__name:"opinion",props:t.mergeModels({busiKey:{type:String,required:!1},flowId:{type:String,required:!1},taskId:{type:String,required:!1}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a,{expose:e}){const i=a,n=t.ref(!0),l=t.ref([]),o=t.ref({}),s=t.ref([]),r=t.useModel(a,"visible"),c=t.ref({busiKey:"",flowId:"",taskId:""}),d=t.computed(()=>({busiKey:c.value.busiKey||i.busiKey,flowId:c.value.flowId||i.flowId,taskId:c.value.taskId||i.taskId}));function h(){r.value=!1}function f({busiKey:m,flowId:b,taskId:A}={}){c.value.busiKey=m,c.value.flowId=b,c.value.taskId=A,r.value=!0,n.value=!0,u()}function u(){if(l.value=[],o.value={},s.value=[],!d.value.busiKey&&!d.value.flowId&&!d.value.taskId)return;let m="",b="";d.value.busiKey?(m="/api/engine/opinion/busiKey/"+d.value.busiKey,b="busiKey"):d.value.flowId?(m="/api/engine/opinion/flow/"+d.value.flowId,b="flow"):d.value.taskId&&(m="/api/engine/opinion/task/"+d.value.taskId,b="task"),K.axios.flow({url:m,method:"post"}).then(A=>{if(A.success)if(b=="busiKey"){s.value=A.body;for(let C=0;C<s.value.length&&n.value;C++)if(s.value[C].tasks?.length){for(let w=0;w<s.value[C].tasks.length;w++)if(s.value[C].tasks[w].opinions?.length){n.value=!1;break}}}else if(b=="flow"){if(l.value=A.body,l.value?.length){for(let C=0;C<l.value.length;C++)if(l.value[C].opinions?.length){n.value=!1;break}}}else b=="task"&&(o.value=A.body,o.value.opinions?.length&&(n.value=!1))})}return t.watch(i,()=>{u()}),t.onMounted(()=>{u()}),e({open:f,close:h}),(m,b)=>{const A=t.resolveComponent("a-timeline-item"),C=t.resolveComponent("a-timeline"),w=t.resolveComponent("a-empty"),y=t.resolveComponent("a-button"),R=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(R,{title:"处理意见",visible:r.value,"onUpdate:visible":b[0]||(b[0]=g=>r.value=g),width:600,rootClassName:"flow-opinion-drawer"},{footer:t.withCtx(()=>[t.createVNode(y,{onClick:h,class:"btn-close"},{default:t.withCtx(()=>b[1]||(b[1]=[t.createTextVNode("关闭")])),_:1})]),default:t.withCtx(()=>[l.value?.length?(t.openBlock(),t.createElementBlock("div",Yd,[t.createElementVNode("div",Hd,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,g=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:g.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.opinions,p=>(t.openBlock(),t.createBlock(A,{key:p.id},{default:t.withCtx(()=>[t.createElementVNode("div",Gd,"节点:"+t.toDisplayString(g.title),1),t.createElementVNode("div",Jd,"处理人:"+t.toDisplayString(p.userName),1),t.createElementVNode("div",Xd,"处理时间:"+t.toDisplayString(p.handleTime),1),t.createElementVNode("div",Zd,"处理意见:"+t.toDisplayString(p.optxt),1)]),_:2},1024))),128))],64))),128))]),_:1})])])):t.createCommentVNode("",!0),o.value?.id?(t.openBlock(),t.createElementBlock("div",eh,[t.createElementVNode("div",th,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.opinions,g=>(t.openBlock(),t.createBlock(A,{key:g.id},{default:t.withCtx(()=>[t.createElementVNode("div",ih,"处理人:"+t.toDisplayString(g.userName),1),t.createElementVNode("div",nh,"处理时间:"+t.toDisplayString(g.handleTime),1),t.createElementVNode("div",lh,"处理意见:"+t.toDisplayString(g.optxt),1)]),_:2},1024))),128))]),_:1})])])):t.createCommentVNode("",!0),s.value?.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(s.value,g=>(t.openBlock(),t.createElementBlock("div",{class:"flow-options",key:g.id},[s.value.length>1?(t.openBlock(),t.createElementBlock("div",oh,t.toDisplayString(g.title)+",提交时间:"+t.toDisplayString(g.commitTime)+t.toDisplayString(g.completeTime?",完成时间:"+g.completeTime:""),1)):t.createCommentVNode("",!0),t.createElementVNode("div",sh,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.tasks,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.opinions,N=>(t.openBlock(),t.createBlock(A,{key:N.id},{default:t.withCtx(()=>[t.createElementVNode("div",ah,"节点:"+t.toDisplayString(p.title),1),t.createElementVNode("div",rh,"处理人:"+t.toDisplayString(N.userName),1),t.createElementVNode("div",ch,"处理时间:"+t.toDisplayString(N.handleTime),1),t.createElementVNode("div",dh,"处理意见:"+t.toDisplayString(N.optxt),1)]),_:2},1024))),128))],64))),128))]),_:2},1024)])]))),128)):t.createCommentVNode("",!0),n.value?(t.openBlock(),t.createBlock(w,{key:3})):t.createCommentVNode("",!0)]),_:1},8,["visible"])}}}),xt={release(a){return K.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return K.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return K.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},fh={class:"unione-page list-page"},uh=ie(t.defineComponent({__name:"list",setup(a){const e=Le(),i=K.useDialog(),n=t.inject("router"),l=t.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),o=t.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});t.onMounted(()=>{r()});const s=t.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){s.value.loading=!0,xt.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(g=>{s.value.data=g.body,s.value.pagination.total=g.total*1}).finally(()=>{s.value.loading=!1})}function c(g){s.value.pagination.current=g.pagination.current,s.value.pagination.pageSize=g.pagination.pageSize,r()}function d({params:g,keywords:p}){s.value.pagination.current=1,s.value.params=g,s.value.keywords=p,r()}function h({btn:g,event:p,row:N}){console.log("table btn click",g,p,N),(g.name=="add"||g.name=="edit")&&n.push({path:"/dev/data/define/edit",query:N?{id:N.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&f(N),g.name=="view"&&n.push({path:e.listPageUrl,query:{psn:N.sn+":list",model:"preview"}})}function f(g){i.confirm({content:"确定要发布当前数据么?",onOk:()=>{xt.release([g.id]).then(p=>{p.success?(i.success({title:"发布成功",content:p.body}),r()):i.error({title:"发布失败",content:p.body})})}})}const u=t.ref(!1),m=t.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=t.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),A=t.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function C(g){!g||!Object.keys(g).length||!g.dsId||(te.message.loading("数据加载中..."),A.value.params=g,A.value.loading=!0,xt.loadFromDb(g).then(p=>{A.value.loading=!1,te.message.destroy(),p.success?(p.body.forEach(N=>{N.checkable=!!N.id}),A.value.data=p.body,A.value.pagination.total=p.body.length):te.message.error(p.message)}))}function w(g){A.value.pagination.current=g.pagination.current,A.value.pagination.pageSize=g.pagination.pageSize}const y=t.ref();function R({btn:g}){if(g.name!="imp")return;const p=y.value.getSelected();p?.keys?.length?i.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{te.message.loading("数据导入中..."),xt.impFromDb({dsId:A.value.params.dsId,tables:p.keys.join()}).then(N=>{te.message.destroy(),N.success?(i.success({content:N.message}),s.value.pagination.current=1,r()):i.error({context:N.message})})}}):i.error({content:"请选择目标记录!"})}return(g,p)=>{const N=t.resolveComponent("UnioneQuery"),M=t.resolveComponent("UnioneTable"),v=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",fh,[t.createVNode(N,{widget:l.value,onQuery:d,onReset:d},null,8,["widget"]),t.createVNode(M,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),t.createVNode(v,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=x=>u.value=x),placement:"left"},{default:t.withCtx(()=>[t.createVNode(N,{widget:m.value,onQuery:C,onReset:C,onBtnClick:R,class:"load-table-form"},null,8,["widget"]),t.createVNode(M,{widget:b.value,dataList:A.value.data,loading:A.value.loading,pagination:A.value.pagination,onChange:w,rowKey:"name",ref_key:"loadTableObj",ref:y},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),ph={class:"unione-props-setting data-field-manage"},mh={key:0},gh={key:1},kh=["onClick"],bh=["onClick"],yh=["onClick"],wh={key:1},Ah=ie(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),i=t.useModel(a,"modelValue"),n=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{n.value.selectedRowKeys.includes(b)||n.value.selectedRowKeys.push(b);const A=[];i.value.forEach(C=>{!m.includes(C.name)&&n.value.selectedRowKeys.includes(C.name)&&A.push(C.name)}),A.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(C=>!A.includes(C)))})}}),l={mounted:m=>m.focus()},o=t.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let b in m){const A=i.value.filter(C=>C.name==b);if(A&&A[0]){let C=o.value[b];Object.keys(C).forEach(w=>{A[0][w]=C[w]})}}o.value={}}function r(m,b){s();const A={};A[b]=m[b]||"",o.value[m.name]=A}function c(m,b){if(!m||!b){o.value={};return}const A=o.value[m.name][b];if(b=="name"&&i.value.filter(w=>w[b]==A&&w.name!=m.name).length>0){te.Modal.warn({title:"提示信息",content:"字段名称["+A+"]已存在"});return}m[b]=A,o.value={}}function d(m,b){const A=i.value.filter(C=>C.name==m.name)[0];return b=="isFk"?A.configs?.fkey?.enable:A[b]==1}function h(m,b){const A=i.value.filter(C=>C.name==m.name)[0];b=="isFk"?(A.configs||(A.configs={}),A.configs.fkey||(A.configs.fkey={}),A.configs.fkey.enable=!A.configs.fkey.enable):A[b]!=1?A[b]=1:A[b]=0}function f(){if(s(),i.value.filter(A=>A.name=="new_").length>0){o.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};i.value.push(b),o.value[b.name]={name:"new_"}}function u(){if(!n.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}te.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{i.value=i.value.filter(m=>!n.value.selectedRowKeys.includes(m.name)),n.value.selectedRowKeys=[]}})}return(m,b)=>{const A=t.resolveComponent("a-button"),C=t.resolveComponent("a-tooltip"),w=t.resolveComponent("a-input"),y=t.resolveComponent("a-input-number"),R=t.resolveComponent("a-select-option"),g=t.resolveComponent("a-select"),p=t.resolveComponent("a-checkbox"),N=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ph,[t.createVNode(A,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:t.withCtx(()=>b[1]||(b[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(A,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:t.withCtx(()=>b[2]||(b[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(N,{columns:e.value,"data-source":i.value,pagination:!0,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:M})=>[["name","title"].includes(M.key)?(t.openBlock(),t.createElementBlock("span",mh,[b[3]||(b[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(t.openBlock(),t.createElementBlock("span",gh,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),M.key==="isPk"?(t.openBlock(),t.createBlock(C,{key:2,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[b[4]||(b[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="isFk"?(t.openBlock(),t.createBlock(C,{key:3,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="isNull"?(t.openBlock(),t.createBlock(C,{key:4,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="syncEnable"?(t.openBlock(),t.createBlock(C,{key:5,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:M,text:v,record:x})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(w,{key:0,value:o.value[x.name][M.dataIndex],"onUpdate:value":B=>o.value[x.name][M.dataIndex]=B,onBlur:B=>c(x,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(v||" "),1)],64))],10,kh)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[x.name][M.dataIndex],"onUpdate:value":B=>o.value[x.name][M.dataIndex]=B,onBlur:B=>c(x,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(v||" "),1)],64))],10,bh)):["dataType"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(g,{key:0,value:x[M.dataIndex],"onUpdate:value":B=>x[M.dataIndex]=B,onBlur:b[0]||(b[0]=B=>c())},{default:t.withCtx(()=>[t.createVNode(R,{key:"String",value:"String"}),t.createVNode(R,{key:"Long",value:"Long"}),t.createVNode(R,{key:"Short",value:"Short"}),t.createVNode(R,{key:"Integer",value:"Integer"}),t.createVNode(R,{key:"Float",value:"Float"}),t.createVNode(R,{key:"Double",value:"Double"}),t.createVNode(R,{key:"Date",value:"Date"}),t.createVNode(R,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",wh,t.toDisplayString(v),1))],10,yh)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(p,{key:3,checked:d(x,M.dataIndex),onClick:B=>h(x,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(p,{key:4,checked:!d(x,M.dataIndex),onClick:B=>h(x,M.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Wl=1024;let xh=0,mn=class{constructor(e,i){this.from=e,this.to=i}};class oe{constructor(e={}){this.id=xh++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Re.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}oe.closedBy=new oe({deserialize:a=>a.split(" ")}),oe.openedBy=new oe({deserialize:a=>a.split(" ")}),oe.group=new oe({deserialize:a=>a.split(" ")}),oe.isolate=new oe({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),oe.contextHash=new oe({perNode:!0}),oe.lookAhead=new oe({perNode:!0}),oe.mounted=new oe({perNode:!0});class Ai{constructor(e,i,n){this.tree=e,this.overlay=i,this.parser=n}static get(e){return e&&e.props&&e.props[oe.mounted.id]}}const Ch=Object.create(null);class Re{constructor(e,i,n,l=0){this.name=e,this.props=i,this.id=n,this.flags=l}static define(e){let i=e.props&&e.props.length?Object.create(null):Ch,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Re(e.name||"",i,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(oe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let n in e)for(let l of n.split(" "))i[l]=e[n];return n=>{for(let l=n.prop(oe.group),o=-1;o<(l?l.length:0);o++){let s=i[o<0?n.name:l[o]];if(s)return s}}}}Re.none=new Re("",Object.create(null),0,8);class gn{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let n of this.types){let l=null;for(let o of e){let s=o(n);s&&(l||(l=Object.assign({},n.props)),l[s[0].id]=s[1])}i.push(l?new Re(n.name,l,n.id,n.flags):n)}return new gn(i)}}const xi=new WeakMap,Yl=new WeakMap;var ye;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(ye||(ye={}));class ge{constructor(e,i,n,l,o){if(this.type=e,this.children=i,this.positions=n,this.length=l,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,r]of o)this.props[typeof s=="number"?s:s.id]=r}}toString(){let e=Ai.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let n of this.children){let l=n.toString();l&&(i&&(i+=","),i+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new yn(this.topNode,e)}cursorAt(e,i=0,n=0){let l=xi.get(this)||this.topNode,o=new yn(l);return o.moveTo(e,i),xi.set(this,o._tree),o}get topNode(){return new Fe(this,0,0,null)}resolve(e,i=0){let n=ei(xi.get(this)||this.topNode,e,i,!1);return xi.set(this,n),n}resolveInner(e,i=0){let n=ei(Yl.get(this)||this.topNode,e,i,!0);return Yl.set(this,n),n}resolveStack(e,i=0){return Bh(this,e,i)}iterate(e){let{enter:i,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&ye.IncludeAnonymous)>0;for(let c=this.cursor(s|ye.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||i(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&n&&(r||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:An(Re.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,l)=>new ge(this.type,i,n,l,this.propValues),e.makeTree||((i,n,l)=>new ge(Re.none,i,n,l)))}static build(e){return Nh(e)}}ge.empty=new ge(Re.none,[],[],0);class kn{constructor(e,i){this.buffer=e,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new kn(this.buffer,this.index)}}class ft{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return Re.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],n=this.buffer[e+3],l=this.set.types[i],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,i,n,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=i&&!(Hl(o,l,s[c+1],s[c+2])&&(r=c,n>0));c=s[c+3]);return r}slice(e,i,n){let l=this.buffer,o=new Uint16Array(i-e),s=0;for(let r=e,c=0;r<i;){o[c++]=l[r++],o[c++]=l[r++]-n;let d=o[c++]=l[r++]-n;o[c++]=l[r++]-e,s=Math.max(s,d)}return new ft(o,s,this.set)}}function Hl(a,e,i,n){switch(a){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function ei(a,e,i,n){for(var l;a.from==a.to||(i<1?a.from>=e:a.from>e)||(i>-1?a.to<=e:a.to<e);){let s=!n&&a instanceof Fe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:ye.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Fe&&s.index<0&&((l=r.enter(e,i,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,i,o);if(!s)return a;a=s}}class Gl{cursor(e=0){return new yn(this,e)}getChild(e,i=null,n=null){let l=Jl(this,e,i,n);return l.length?l[0]:null}getChildren(e,i=null,n=null){return Jl(this,e,i,n)}resolve(e,i=0){return ei(this,e,i,!1)}resolveInner(e,i=0){return ei(this,e,i,!0)}matchContext(e){return bn(this,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),n=this;for(;i;){let l=i.lastChild;if(!l||l.to!=i.to)break;l.type.isError&&l.from==l.to?(n=i,i=l.prevSibling):i=l}return n}get node(){return this}get next(){return this.parent}}class Fe extends Gl{constructor(e,i,n,l){super(),this._tree=e,this.from=i,this.index=n,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,n,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,d=i>0?r.length:-1;e!=d;e+=i){let h=r[e],f=c[e]+s.from;if(Hl(l,n,f,f+h.length)){if(h instanceof ft){if(o&ye.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,i,n-f,l);if(u>-1)return new ut(new vh(s,h,e,f),null,u)}else if(o&ye.IncludeAnonymous||!h.type.isAnonymous||wn(h)){let u;if(!(o&ye.IgnoreMounts)&&(u=Ai.get(h))&&!u.overlay)return new Fe(u.tree,f,e,s);let m=new Fe(h,f,e,s);return o&ye.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(i<0?h.children.length-1:0,i,n,l)}}}if(o&ye.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+i:e=i<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,i,n=0){let l;if(!(n&ye.IgnoreOverlays)&&(l=Ai.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((i>0?s<=o:s<o)&&(i<0?r>=o:r>o))return new Fe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jl(a,e,i,n){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(i!=null){for(let s=!1;!s;)if(s=l.type.is(i),!l.nextSibling())return o}for(;;){if(n!=null&&l.type.is(n))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return n==null?o:[]}}function bn(a,e,i=e.length-1){for(let n=a.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class vh{constructor(e,i,n,l){this.parent=e,this.buffer=i,this.index=n,this.start=l}}class ut extends Gl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,n){super(),this.context=e,this._parent=i,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,i,n){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,i-this.context.start,n);return o<0?null:new ut(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,i,n=0){if(n&ye.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new ut(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ut(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new ut(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:n}=this.context,l=this.index+4,o=n.buffer[this.index+3];if(o>l){let s=n.buffer[this.index+1];e.push(n.slice(l,o,s)),i.push(0)}return new ge(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Xl(a){if(!a.length)return null;let e=0,i=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>i.from||s.to<i.to)&&(i=s,e=o)}let n=i instanceof Fe&&i.index<0?null:i.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Sh(l,i)}class Sh{constructor(e,i){this.heads=e,this.node=i}get next(){return Xl(this.heads)}}function Bh(a,e,i){let n=a.resolveInner(e,i),l=null;for(let o=n instanceof Fe?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[n])).push(s.resolve(e,i)),o=s}else{let s=Ai.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Fe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(ei(r,e,i,!1))}}return l?Xl(l):n}class yn{get name(){return this.type.name}constructor(e,i=0){if(this.mode=i,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:n,buffer:l}=this.buffer;return this.type=i||l.set.types[l.buffer[e]],this.from=n+l.buffer[e+1],this.to=n+l.buffer[e+2],!0}yield(e){return e?e instanceof Fe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,n,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,i-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,n=this.mode){return this.buffer?n&ye.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ye.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ye.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,n=this.stack.length-1;if(e<0){let l=n<0?0:this.stack[n]+4;if(this.index!=l)return this.yieldBuf(i.findChild(l,this.index,-1,0,4))}else{let l=i.buffer[this.index+3];if(l<(n<0?i.buffer.length:i.buffer[this.stack[n]+3]))return this.yieldBuf(l)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,n,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(l.buffer.buffer[o+3]<this.index)return!1;({index:i,parent:n}=l)}else({index:i,_parent:n}=this._tree);for(;n;{index:i,_parent:n}=n)if(i>-1)for(let o=i+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let r=n._tree.children[o];if(this.mode&ye.IncludeAnonymous||r instanceof ft||!r.type.isAnonymous||wn(r))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,n=0;if(e&&e.context==this.buffer)e:for(let l=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==l){if(l==this.index)return s;i=s,n=o+1;break e}l=this.stack[--o]}for(let l=n;l<this.stack.length;l++)i=new ut(this.buffer,i,this.stack[l]);return this.bufferNode=new ut(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){for(let n=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(l=!0)}for(;l&&i&&i(this),l=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,l=!0}}}matchContext(e){if(!this.buffer)return bn(this.node,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return bn(this.node,e,l);let s=n[i.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function wn(a){return a.children.some(e=>e instanceof ft||!e.type.isAnonymous||wn(e))}function Nh(a){var e;let{buffer:i,nodeSet:n,maxBufferLength:l=Wl,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(i)?new kn(i,i.length):i,c=n.types,d=0,h=0;function f(p,N,M,v,x,B){let{id:V,start:k,end:S,size:T}=r,O=h;for(;T<0;)if(r.next(),T==-1){let P=o[V];M.push(P),v.push(k-p);return}else if(T==-3){d=V;return}else if(T==-4){h=V;return}else throw new RangeError(`Unrecognized record size: ${T}`);let _=c[V],$,I,j=k-p;if(S-k<=l&&(I=C(r.pos-N,x))){let P=new Uint16Array(I.size-I.skip),E=r.pos-I.size,J=P.length;for(;r.pos>E;)J=w(I.start,P,J);$=new ft(P,S-I.start,n),j=I.start-p}else{let P=r.pos-T;r.next();let E=[],J=[],F=V>=s?V:-1,z=0,pe=S;for(;r.pos>P;)F>=0&&r.id==F&&r.size>=0?(r.end<=pe-l&&(b(E,J,k,z,r.end,pe,F,O),z=E.length,pe=r.end),r.next()):B>2500?u(k,P,E,J):f(k,P,E,J,F,B+1);if(F>=0&&z>0&&z<E.length&&b(E,J,k,z,k,pe,F,O),E.reverse(),J.reverse(),F>-1&&z>0){let tt=m(_);$=An(_,E,J,0,E.length,0,S-k,tt,tt)}else $=A(_,E,J,S-k,O-S)}M.push($),v.push(j)}function u(p,N,M,v){let x=[],B=0,V=-1;for(;r.pos>N;){let{id:k,start:S,end:T,size:O}=r;if(O>4)r.next();else{if(V>-1&&S<V)break;V<0&&(V=T-l),x.push(k,S,T),B++,r.next()}}if(B){let k=new Uint16Array(B*4),S=x[x.length-2];for(let T=x.length-3,O=0;T>=0;T-=3)k[O++]=x[T],k[O++]=x[T+1]-S,k[O++]=x[T+2]-S,k[O++]=O;M.push(new ft(k,x[2]-S,n)),v.push(S-p)}}function m(p){return(N,M,v)=>{let x=0,B=N.length-1,V,k;if(B>=0&&(V=N[B])instanceof ge){if(!B&&V.type==p&&V.length==v)return V;(k=V.prop(oe.lookAhead))&&(x=M[B]+V.length+k)}return A(p,N,M,v,x)}}function b(p,N,M,v,x,B,V,k){let S=[],T=[];for(;p.length>v;)S.push(p.pop()),T.push(N.pop()+M-x);p.push(A(n.types[V],S,T,B-x,k-B)),N.push(x-M)}function A(p,N,M,v,x=0,B){if(d){let V=[oe.contextHash,d];B=B?[V].concat(B):[V]}if(x>25){let V=[oe.lookAhead,x];B=B?[V].concat(B):[V]}return new ge(p,N,M,v,B)}function C(p,N){let M=r.fork(),v=0,x=0,B=0,V=M.end-l,k={size:0,start:0,skip:0};e:for(let S=M.pos-p;M.pos>S;){let T=M.size;if(M.id==N&&T>=0){k.size=v,k.start=x,k.skip=B,B+=4,v+=4,M.next();continue}let O=M.pos-T;if(T<0||O<S||M.start<V)break;let _=M.id>=s?4:0,$=M.start;for(M.next();M.pos>O;){if(M.size<0)if(M.size==-3)_+=4;else break e;else M.id>=s&&(_+=4);M.next()}x=$,v+=T,B+=_}return(N<0||v==p)&&(k.size=v,k.start=x,k.skip=B),k.size>4?k:void 0}function w(p,N,M){let{id:v,start:x,end:B,size:V}=r;if(r.next(),V>=0&&v<s){let k=M;if(V>4){let S=r.pos-(V-4);for(;r.pos>S;)M=w(p,N,M)}N[--M]=k,N[--M]=B-p,N[--M]=x-p,N[--M]=v}else V==-3?d=v:V==-4&&(h=v);return M}let y=[],R=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,y,R,-1,0);let g=(e=a.length)!==null&&e!==void 0?e:y.length?R[0]+y[0].length:0;return new ge(c[a.topID],y.reverse(),R.reverse(),g)}const Zl=new WeakMap;function Ci(a,e){if(!a.isAnonymous||e instanceof ft||e.type!=a)return 1;let i=Zl.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=a||!(n instanceof ge)){i=1;break}i+=Ci(a,n)}Zl.set(e,i)}return i}function An(a,e,i,n,l,o,s,r,c){let d=0;for(let b=n;b<l;b++)d+=Ci(a,e[b]);let h=Math.ceil(d*1.5/8),f=[],u=[];function m(b,A,C,w,y){for(let R=C;R<w;){let g=R,p=A[R],N=Ci(a,b[R]);for(R++;R<w;R++){let M=Ci(a,b[R]);if(N+M>=h)break;N+=M}if(R==g+1){if(N>h){let M=b[g];m(M.children,M.positions,0,M.children.length,A[g]+y);continue}f.push(b[g])}else{let M=A[R-1]+b[R-1].length-p;f.push(An(a,b,A,g,R,p,M,null,c))}u.push(p+y-o)}}return m(e,i,n,l,0),(r||c)(f,u,s)}class Ct{constructor(e,i,n,l,o=!1,s=!1){this.from=e,this.to=i,this.tree=n,this.offset=l,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],n=!1){let l=[new Ct(0,e.length,e,0,!1,n)];for(let o of i)o.to>e.length&&l.push(o);return l}static applyChanges(e,i,n=128){if(!i.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,d=0;;r++){let h=r<i.length?i[r]:null,f=h?h.fromA:1e9;if(f-c>=n)for(;s&&s.from<f;){let u=s;if(c>=u.from||f<=u.to||d){let m=Math.max(u.from,c)-d,b=Math.min(u.to,f)-d;u=m>=b?null:new Ct(m,b,u.tree,u.offset+d,r>0,!!h)}if(u&&l.push(u),s.to>f)break;s=o<e.length?e[o++]:null}if(!h)break;c=h.toA,d=h.toA-h.toB}return l}}class eo{startParse(e,i,n){return typeof e=="string"&&(e=new Vh(e)),n=n?n.length?n.map(l=>new mn(l.from,l.to)):[new mn(0,0)]:[new mn(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let l=this.startParse(e,i,n);for(;;){let o=l.advance();if(o)return o}}}class Vh{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new oe({perNode:!0});class vi{constructor(e,i,n,l,o,s,r,c,d,h=0,f){this.p=e,this.stack=i,this.state=n,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let l=e.parser.context;return new vi(e,[],i,n,n,0,[],0,l?new to(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let n=e>>19,l=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let r=o.dynamicPrecedence(l);if(r&&(this.score+=r),n==0){this.pushState(o.getGoto(this.state,l,!0),this.reducePos),l<o.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(l,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((i=this.p.parser.nodeSet.types[l])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let f=c?this.stack[c-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,d,m,u+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,i,n,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,r=this.buffer.length;if(r==0&&s.parent&&(r=s.bufferBase-s.parent.bufferBase,s=s.parent),r>0&&s.buffer[r-4]==0&&s.buffer[r-1]>-1){if(i==n)return;if(s.buffer[r-2]>=i){s.buffer[r-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,i,n,l);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let r=!1;for(let c=s;c>0&&this.buffer[c-2]>n;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,l>4&&(l-=4)}this.buffer[s]=e,this.buffer[s+1]=i,this.buffer[s+2]=n,this.buffer[s+3]=l}}shift(e,i,n,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(i,n),i<=this.p.parser.maxNode&&this.buffer.push(i,n,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||i<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,n),this.shiftContext(i,n),i<=s.maxNode&&this.buffer.push(i,n,l,4)}}apply(e,i,n,l){e&65536?this.reduce(e):this.shift(e,i,n,l)}useNode(e,i){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(i,l),this.buffer.push(n,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),l=e.bufferBase+i;for(;e&&l==e.bufferBase;)e=e.parent;return new vi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,n?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new Rh(this);;){let n=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(n==0)return!1;if(!(n&65536))return!0;i.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<i.length;o+=2)(s=i[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(i[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<i.length;o+=2){let s=i[o+1];l.some((r,c)=>c&1&&r==s)||l.push(i[o],s)}i=l}let n=[];for(let l=0;l<i.length&&n.length<4;l+=2){let o=i[l+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(i[l],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if(!(i&65536))return!1;if(!e.validAction(this.state,i)){let n=i>>19,l=i&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;i=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],n=(l,o)=>{if(!i.includes(l))return i.push(l),e.allActions(l,s=>{if(!(s&393216))if(s&65536){let r=(s>>19)-o;if(r>1){let c=s&65535,d=this.stack.length-r*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return r<<19|65536|c}}else{let r=n(s,o+1);if(r!=null)return r}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new to(this.curContext.tracker,e);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class to{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class Rh{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=l}}class Si{constructor(e,i,n){this.stack=e,this.pos=i,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new Si(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Si(this.stack,this.pos,this.index)}}function Bi(a,e=Uint16Array){if(typeof a!="string")return a;let i=null;for(let n=0,l=0;n<a.length;){let o=0;for(;;){let s=a.charCodeAt(n++),r=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,r=!0),o+=c,r)break;o*=46}i?i[l++]=o:i=new e(o)}return i}class Ni{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const io=new Ni;class Eh{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=io,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let n=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!l)return null;let s=this.ranges[--l];o-=n.from-s.to,n=s}for(;i<0?o>n.to:o>=n.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-n.to,n=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,n,l;if(i>=0&&i<this.chunk.length)n=this.pos+e,l=this.chunk.charCodeAt(i);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=n;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-n)),l=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),l}acceptToken(e,i=0){let n=i?this.resolveOffset(i,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=io,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,i){if(e>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let n="";for(let l of this.ranges){if(l.from>=i)break;l.to>e&&(n+=this.input.read(Math.max(l.from,e),Math.min(l.to,i)))}return n}}class It{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;Oh(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}It.prototype.contextual=It.prototype.fallback=It.prototype.extend=!1,It.prototype.fallback=It.prototype.extend=!1;function Oh(a,e,i,n,l,o){let s=0,r=1<<n,{dialect:c}=i.p.parser;e:for(;r&a[s];){let d=a[s+1];for(let m=s+3;m<d;m+=2)if((a[m+1]&r)>0){let b=a[m];if(c.allows(b)&&(e.token.value==-1||e.token.value==b||Mh(b,e.token.value,l,o))){e.acceptToken(b);break}}let h=e.next,f=0,u=a[s+2];if(e.next<0&&u>f&&a[d+u*3-3]==65535){s=a[d+u*3-1];continue e}for(;f<u;){let m=f+u>>1,b=d+m+(m<<1),A=a[b],C=a[b+1]||65536;if(h<A)u=m;else if(h>=C)f=m+1;else{s=a[b+2],e.advance();continue e}}break}}function no(a,e,i){for(let n=e,l;(l=a[n])!=65535;n++)if(l==i)return n-e;return-1}function Mh(a,e,i,n){let l=no(i,n,e);return l<0||no(i,n,a)<l}const Me=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let xn=null;function lo(a,e,i){let n=a.cursor(ye.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(a.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:a.length}}class _h{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lo(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lo(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let n=this.trees[i],l=this.index[i];if(l==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[l],s=this.start[i]+n.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof ge){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(oe.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[i]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[i]++,this.nextStart=s+o.length}}}class Th{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Ni)}getActions(e){let i=0,n=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if(!(1<<d&s))continue;let h=o[d],f=this.tokens[d];if(!(n&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=s||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=s,f.context=r),f.lookAhead>f.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let u=i;if(f.extended>-1&&(i=this.addActions(e,f.extended,f.end,i)),i=this.addActions(e,f.value,f.end,i),!h.extend&&(n=f,i>u))break}}for(;this.actions.length>i;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new Ni,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,i=this.addActions(e,n.value,n.end,i)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new Ni,{pos:n,p:l}=e;return i.start=n,i.end=Math.min(n+1,l.stream.end),i.value=n==l.stream.end?l.parser.eofTerm:0,i}updateCachedToken(e,i,n){let l=this.stream.clipPos(n.pos);if(i.token(this.stream.reset(l,e),n),e.value>-1){let{parser:o}=n.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let r=o.specializers[s](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,i,n,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=i,this.actions[l++]=n,l}addActions(e,i,n,l){let{state:o}=e,{parser:s}=e.p,{data:r}=s;for(let c=0;c<2;c++)for(let d=s.stateSlot(o,c?2:1);;d+=3){if(r[d]==65535)if(r[d+1]==1)d=nt(r,d+2);else{l==0&&r[d+1]==2&&(l=this.putAction(nt(r,d+2),i,n,l));break}r[d]==i&&(l=this.putAction(nt(r,d+1),i,n,l))}return l}}class Ih{constructor(e,i,n,l){this.parser=e,this.input=i,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Eh(i,l),this.tokens=new Th(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[vi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new _h(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let r=e[s];for(;;){if(this.tokens.mainToken=null,r.pos>i)n.push(r);else{if(this.advanceStack(r,n,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!n.length){let s=l&&Dh(l);if(s)return Me&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Me&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&l){let s=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,n);if(s)return Me&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((r,c)=>c.score-r.score);n.length>s;)n.pop();n.some(r=>r.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let r=n[s];for(let c=s+1;c<n.length;c++){let d=n[c];if(r.sameState(d)||r.buffer.length>500&&d.buffer.length>500)if((r.score-d.score||r.buffer.length-d.buffer.length)>0)n.splice(c--,1);else{n.splice(s--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let l=e.pos,{parser:o}=this,s=Me?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!d||(f.prop(oe.contextHash)||0)==h))return e.useNode(f,u),Me&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof ge)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof ge&&f.positions[0]==0)f=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Me&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let h=c[d++],f=c[d++],u=c[d++],m=d==c.length||!n,b=m?e:e.split(),A=this.tokens.mainToken;if(b.apply(h,f,A?A.start:b.pos,u),Me&&console.log(s+this.stackID(b)+` (via ${h&65536?`reduce of ${o.getName(h&65535)}`:"shift"} for ${o.getName(f)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?i.push(b):n.push(b)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return oo(e,i),!0}}runRecovery(e,i,n){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=i[s<<1],d=i[(s<<1)+1],h=Me?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Me&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let f=r.split(),u=h;for(let m=0;f.forceReduce()&&m<10&&(Me&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,n));m++)Me&&(u=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(c))Me&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>r.pos?(d==r.pos&&(d++,c=0),r.recoverByDelete(c,d),Me&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),oo(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),ge.build({buffer:Si.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let i=(xn||(xn=new WeakMap)).get(e);return i||xn.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function oo(a,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==a.pos&&n.sameState(a)){e[i].score<a.score&&(e[i]=a);return}}e.push(a)}class Fh{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Vi extends eo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let r=0;r<e.repeatNodeCount;r++)i.push("");let n=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<i.length;r++)l.push([]);function o(r,c,d){l[r].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let r of e.nodeProps){let c=r[0];typeof c=="string"&&(c=oe[c]);for(let d=1;d<r.length;){let h=r[d++];if(h>=0)o(h,c,r[d++]);else{let f=r[d+-h];for(let u=-h;u>0;u--)o(r[d++],c,f);d++}}}this.nodeSet=new gn(i.map((r,c)=>Re.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:n.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Wl;let s=Bi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(so),this.states=Bi(e.states,Uint32Array),this.data=Bi(e.stateData),this.goto=Bi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new It(s,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,n){let l=new Ih(this,e,i,n);for(let o of this.wrappers)l=o(l,e,i,n);return l}getGoto(e,i,n=!1){let l=this.goto;if(i>=l[0])return-1;for(let o=l[i+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&n)return c;for(let d=o+(s>>1);o<d;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,i){let n=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=n[o])==65535)if(n[o+1]==1)s=n[o=nt(n,o+2)];else{if(n[o+1]==2)return nt(n,o+2);break}if(s==i||s==0)return nt(n,o+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,n=>n==i?!0:null)}allActions(e,i){let n=this.stateSlot(e,4),l=n?i(n):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=nt(this.data,o+2);else break;l=i(nt(this.data,o+1))}return l}nextStates(e){let i=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=nt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let l=this.data[n+1];i.some((o,s)=>s&1&&o==l)||i.push(this.data[n],l)}}return i}configure(e){let i=Object.assign(Object.create(Vi.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=n}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(n=>{let l=e.tokenizers.find(o=>o.from==n);return l?l.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,l)=>{let o=e.specializers.find(r=>r.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return i.specializers[l]=so(s),s})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),n=i.map(()=>!1);if(e)for(let o of e.split(" ")){let s=i.indexOf(o);s>=0&&(n[s]=!0)}let l=null;for(let o=0;o<i.length;o++)if(!n[o])for(let s=this.dialects[i[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Fh(e,n,l)}static deserialize(e){return new Vi(e)}}function nt(a,e){return a[e]|a[e+1]<<16}function Dh(a){let e=null;for(let i of a){let n=i.p.stoppedAt;(i.pos==i.p.stream.end||n!=null&&i.pos>n)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}function so(a){if(a.external){let e=a.extend?1:0;return(i,n)=>a.external(i,n)<<1|e}return a.get}let $h=0;class De{constructor(e,i,n,l){this.name=e,this.set=i,this.base=n,this.modified=l,this.id=$h++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let n=typeof e=="string"?e:"?";if(e instanceof De&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let l=new De(n,[],null,[]);if(l.set.push(l),i)for(let o of i.set)l.set.push(o);return l}static defineModifier(e){let i=new Ri(e);return n=>n.modified.indexOf(i)>-1?n:Ri.get(n.base||n,n.modified.concat(i).sort((l,o)=>l.id-o.id))}}let Ph=0;class Ri{constructor(e){this.name=e,this.instances=[],this.id=Ph++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(r=>r.base==e&&Lh(i,r.modified));if(n)return n;let l=[],o=new De(e.name,l,e,i);for(let r of i)r.instances.push(o);let s=Uh(i);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ri.get(r,c));return o}}function Lh(a,e){return a.length==e.length&&a.every((i,n)=>i==e[n])}function Uh(a){let e=[[]];for(let i=0;i<a.length;i++)for(let n=0,l=e.length;n<l;n++)e.push(e[n].concat(a[i]));return e.sort((i,n)=>n.length-i.length)}function ao(a){let e=Object.create(null);for(let i in a){let n=a[i];Array.isArray(n)||(n=[n]);for(let l of i.split(" "))if(l){let o=[],s=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){s=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(o.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+l);let h=new Cn(n,s,c>0?o.slice(0,c):null);e[d]=h.sort(e[d])}}return jh.add(e)}const jh=new oe;class Cn{constructor(e,i,n,l){this.tags=e,this.mode=i,this.context=n,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Cn.empty=new Cn([],2,null);function ro(a,e){let i=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))i[o.tag.id]=o.class;else for(let s of o.tag)i[s.id]=o.class;let{scope:n,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let d=i[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:n}}const q=De.define,Ei=q(),pt=q(),co=q(pt),ho=q(pt),mt=q(),Oi=q(mt),vn=q(mt),Ke=q(),vt=q(Ke),We=q(),Ye=q(),Sn=q(),ti=q(Sn),Mi=q(),U={comment:Ei,lineComment:q(Ei),blockComment:q(Ei),docComment:q(Ei),name:pt,variableName:q(pt),typeName:co,tagName:q(co),propertyName:ho,attributeName:q(ho),className:q(pt),labelName:q(pt),namespace:q(pt),macroName:q(pt),literal:mt,string:Oi,docString:q(Oi),character:q(Oi),attributeValue:q(Oi),number:vn,integer:q(vn),float:q(vn),bool:q(mt),regexp:q(mt),escape:q(mt),color:q(mt),url:q(mt),keyword:We,self:q(We),null:q(We),atom:q(We),unit:q(We),modifier:q(We),operatorKeyword:q(We),controlKeyword:q(We),definitionKeyword:q(We),moduleKeyword:q(We),operator:Ye,derefOperator:q(Ye),arithmeticOperator:q(Ye),logicOperator:q(Ye),bitwiseOperator:q(Ye),compareOperator:q(Ye),updateOperator:q(Ye),definitionOperator:q(Ye),typeOperator:q(Ye),controlOperator:q(Ye),punctuation:Sn,separator:q(Sn),bracket:ti,angleBracket:q(ti),squareBracket:q(ti),paren:q(ti),brace:q(ti),content:Ke,heading:vt,heading1:q(vt),heading2:q(vt),heading3:q(vt),heading4:q(vt),heading5:q(vt),heading6:q(vt),contentSeparator:q(Ke),list:q(Ke),quote:q(Ke),emphasis:q(Ke),strong:q(Ke),link:q(Ke),monospace:q(Ke),strikethrough:q(Ke),inserted:q(),deleted:q(),changed:q(),invalid:q(),meta:Mi,documentMeta:q(Mi),annotation:q(Mi),processingInstruction:q(Mi),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let a in U){let e=U[a];e instanceof De&&(e.name=a)}ro([{tag:U.link,class:"tok-link"},{tag:U.heading,class:"tok-heading"},{tag:U.emphasis,class:"tok-emphasis"},{tag:U.strong,class:"tok-strong"},{tag:U.keyword,class:"tok-keyword"},{tag:U.atom,class:"tok-atom"},{tag:U.bool,class:"tok-bool"},{tag:U.url,class:"tok-url"},{tag:U.labelName,class:"tok-labelName"},{tag:U.inserted,class:"tok-inserted"},{tag:U.deleted,class:"tok-deleted"},{tag:U.literal,class:"tok-literal"},{tag:U.string,class:"tok-string"},{tag:U.number,class:"tok-number"},{tag:[U.regexp,U.escape,U.special(U.string)],class:"tok-string2"},{tag:U.variableName,class:"tok-variableName"},{tag:U.local(U.variableName),class:"tok-variableName tok-local"},{tag:U.definition(U.variableName),class:"tok-variableName tok-definition"},{tag:U.special(U.variableName),class:"tok-variableName2"},{tag:U.definition(U.propertyName),class:"tok-propertyName tok-definition"},{tag:U.typeName,class:"tok-typeName"},{tag:U.namespace,class:"tok-namespace"},{tag:U.className,class:"tok-className"},{tag:U.macroName,class:"tok-macroName"},{tag:U.propertyName,class:"tok-propertyName"},{tag:U.operator,class:"tok-operator"},{tag:U.comment,class:"tok-comment"},{tag:U.meta,class:"tok-meta"},{tag:U.invalid,class:"tok-invalid"},{tag:U.punctuation,class:"tok-punctuation"}]);const zh=ao({String:U.string,Number:U.number,"True False":U.bool,PropertyName:U.propertyName,Null:U.null,",":U.separator,"[ ]":U.squareBracket,"{ }":U.brace}),qh=Vi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[zh],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Bn=[],fo=[];(()=>{let a="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<a.length;e++)(e%2?fo:Bn).push(i=i+a[e])})();function Qh(a){if(a<768)return!1;for(let e=0,i=Bn.length;;){let n=e+i>>1;if(a<Bn[n])i=n;else if(a>=fo[n])e=n+1;else return!0;if(e==i)return!1}}function uo(a){return a>=127462&&a<=127487}const po=8205;function Kh(a,e,i=!0,n=!0){return(i?mo:Wh)(a,e,n)}function mo(a,e,i){if(e==a.length)return e;e&&go(a.charCodeAt(e))&&ko(a.charCodeAt(e-1))&&e--;let n=Nn(a,e);for(e+=bo(n);e<a.length;){let l=Nn(a,e);if(n==po||l==po||i&&Qh(l))e+=bo(l),n=l;else if(uo(l)){let o=0,s=e-2;for(;s>=0&&uo(Nn(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Wh(a,e,i){for(;e>0;){let n=mo(a,e-2,i);if(n<e)return n;e--}return 0}function Nn(a,e){let i=a.charCodeAt(e);if(!ko(i)||e+1==a.length)return i;let n=a.charCodeAt(e+1);return go(n)?(i-55296<<10)+(n-56320)+65536:i}function go(a){return a>=56320&&a<57344}function ko(a){return a>=55296&&a<56320}function bo(a){return a<65536?1:2}class le{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,n){[e,i]=Ft(this,e,i);let l=[];return this.decompose(0,e,l,2),n.length&&n.decompose(0,n.length,l,3),this.decompose(i,this.length,l,1),He.from(l,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Ft(this,e,i);let n=[];return this.decompose(e,i,n,0),He.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),l=new ii(this),o=new ii(e);for(let s=i,r=i;;){if(l.next(s),o.next(s),s=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(r+=l.value.length,l.done||r>=n)return!0}}iter(e=1){return new ii(this,e)}iterRange(e,i=this.length){return new wo(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let l=this.line(e).from;n=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new Ao(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?le.empty:e.length<=32?new me(e):He.from(me.split(e,[]))}}class me extends le{constructor(e,i=Yh(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((i?n:r)>=e)return new Hh(l,r,n,s);l=r+1,n++}}decompose(e,i,n,l){let o=e<=0&&i>=this.length?this:new me(yo(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=_i(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new me(r,s.length+o.length));else{let c=r.length>>1;n.push(new me(r.slice(0,c)),new me(r.slice(c)))}}else n.push(o)}replace(e,i,n){if(!(n instanceof me))return super.replace(e,i,n);[e,i]=Ft(this,e,i);let l=_i(this.text,_i(n.text,yo(this.text,0,e)),i),o=this.length+n.length-(i-e);return l.length<=32?new me(l,o):He.from(me.split(l,[]),o)}sliceString(e,i=this.length,n=`
14
+ }]`}],onConfirm:g=>{const B=g.find(O=>O.name==="valueSets")?.value;if(!B)return;const T=g.find(O=>O.name==="code")?.value;i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,code:T,value:null,valueSets:JSON.parse(B)}})}});break;case he.ControlType.DATE:new Ue({title:"日期控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"},{type:"select",label:"日期格式",name:"dateFormat",value:"yyyy-MM-dd hh:mm:ss",required:!0,options:[{label:"yyyy-MM-dd hh:mm:ss",value:"yyyy-MM-dd hh:mm:ss"},{label:"yyyy-MM-dd",value:"yyyy-MM-dd"}]}],onConfirm:g=>{const B=g.find(_=>_.name==="placeholder")?.value;if(!B)return;const T=g.find(_=>_.name==="value")?.value||"",O=g.find(_=>_.name==="dateFormat")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,dateFormat:O,value:T?[{value:T}]:null,placeholder:B}})}});break;case he.ControlType.NUMBER:new Ue({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const B=g.find(O=>O.name==="placeholder")?.value;if(!B)return;const T=g.find(O=>O.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:he.ElementType.CONTROL,value:"",control:{type:R,value:T?[{value:T}]:null,placeholder:B}})}});break}}return t.onMounted(()=>{window.addEventListener("click",R=>{const g=n.value?.querySelector(".visible");!g||g.contains(R.target)||g.classList.remove("visible")},{capture:!0}),i.editor&&(i.editor.listener.rangeStyleChange=R=>{t.nextTick(()=>{if(R.type===he.ElementType.TEXT){const g=n.value,B=g.querySelector(".menu-item__font .select");B&&(B.textContent=R.font);const T=g.querySelector(".menu-item__size .select");if(T){const F={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};T.textContent=F[R.size]||"小四"}const O=g.querySelector(".menu-item__bold");O&&O.classList.toggle("active",R.bold);const _=g.querySelector(".menu-item__italic");_&&_.classList.toggle("active",R.italic);const $=g.querySelector(".menu-item__underline");$&&$.classList.toggle("active",R.underline);const I=g.querySelector(".menu-item__strikeout");I&&I.classList.toggle("active",R.strikeout);const j=g.querySelector(".menu-item__color span");j&&(j.style.backgroundColor=R.color||"#000000");const P=g.querySelector(".menu-item__highlight span");P&&(P.style.backgroundColor=R.highlight);const E=g.querySelector(".menu-item__title .select");if(E){const F={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};E.textContent=F[R.level]||"正文"}["left","center","right","alignment","justify"].forEach(F=>{const z=g.querySelector(`.menu-item__${F}`);z&&z.classList.toggle("active",R.rowFlex===F)})}})})}),e({getHeight:o,getWidth:s}),(R,g)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"dom",ref:n,class:"unione-rich-toolbar menu","editor-component":"menu"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(B,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[B=="Undo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__undo",key:B,title:`撤销(${t.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:g[0]||(g[0]=O=>c("Undo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Kr)})`})},null,4)],8,Fc)):t.createCommentVNode("",!0),B=="Redo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__redo",key:B,title:`重做(${t.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:g[1]||(g[1]=O=>c("Redo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Wr)})`})},null,4)],8,Dc)):t.createCommentVNode("",!0),B=="Painter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__painter",key:B,title:"格式刷(双击可连续使用)",onClick:p,onDblclick:m},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Yr)})`})},null,4)],32)):t.createCommentVNode("",!0),B=="Format"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__format",key:B,title:"清除格式",onClick:g[2]||(g[2]=O=>c("Format")),"data-item":"Format"},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Hr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Divider"?(t.openBlock(),t.createElementBlock("div",{class:"menu-divider",key:B+T,"data-item":"Divider"})):t.createCommentVNode("",!0),B=="Font"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__font",onClick:g[19]||(g[19]=O=>d("menu-item__font",O)),style:{display:"none"},key:B},[g[99]||(g[99]=t.createElementVNode("span",{class:"select",title:"字体"},"微软雅黑",-1)),t.createElementVNode("div",{class:"options",ref_for:!0,ref:"fontOptions"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:g[3]||(g[3]=O=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),t.createElementVNode("li",{onClick:g[4]||(g[4]=O=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),t.createElementVNode("li",{onClick:g[5]||(g[5]=O=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),t.createElementVNode("li",{onClick:g[6]||(g[6]=O=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),t.createElementVNode("li",{onClick:g[7]||(g[7]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:g[8]||(g[8]=O=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),t.createElementVNode("li",{onClick:g[9]||(g[9]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:g[10]||(g[10]=O=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),t.createElementVNode("li",{onClick:g[11]||(g[11]=O=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),t.createElementVNode("li",{onClick:g[12]||(g[12]=O=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),t.createElementVNode("li",{onClick:g[13]||(g[13]=O=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),t.createElementVNode("li",{onClick:g[14]||(g[14]=O=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),t.createElementVNode("li",{onClick:g[15]||(g[15]=O=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),t.createElementVNode("li",{onClick:g[16]||(g[16]=O=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),t.createElementVNode("li",{onClick:g[17]||(g[17]=O=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),t.createElementVNode("li",{onClick:g[18]||(g[18]=O=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):t.createCommentVNode("",!0),B=="Size"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size",onClick:g[36]||(g[36]=O=>d("menu-item__size",O)),key:B},[g[100]||(g[100]=t.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),t.createElementVNode("div",$c,[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:g[20]||(g[20]=O=>c("Size",56))},"初号"),t.createElementVNode("li",{onClick:g[21]||(g[21]=O=>c("Size",48))},"小初"),t.createElementVNode("li",{onClick:g[22]||(g[22]=O=>c("Size",34))},"一号"),t.createElementVNode("li",{onClick:g[23]||(g[23]=O=>c("Size",32))},"小一"),t.createElementVNode("li",{onClick:g[24]||(g[24]=O=>c("Size",29))},"二号"),t.createElementVNode("li",{onClick:g[25]||(g[25]=O=>c("Size",24))},"小二"),t.createElementVNode("li",{onClick:g[26]||(g[26]=O=>c("Size",21))},"三号"),t.createElementVNode("li",{onClick:g[27]||(g[27]=O=>c("Size",20))},"小三"),t.createElementVNode("li",{onClick:g[28]||(g[28]=O=>c("Size",18))},"四号"),t.createElementVNode("li",{onClick:g[29]||(g[29]=O=>c("Size",16))},"小四"),t.createElementVNode("li",{onClick:g[30]||(g[30]=O=>c("Size",14))},"五号"),t.createElementVNode("li",{onClick:g[31]||(g[31]=O=>c("Size",12))},"小五"),t.createElementVNode("li",{onClick:g[32]||(g[32]=O=>c("Size",10))},"六号"),t.createElementVNode("li",{onClick:g[33]||(g[33]=O=>c("Size",8))},"小六"),t.createElementVNode("li",{onClick:g[34]||(g[34]=O=>c("Size",7))},"七号"),t.createElementVNode("li",{onClick:g[35]||(g[35]=O=>c("Size",6))},"八号")])])])):t.createCommentVNode("",!0),B=="SizeAdd"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:g[37]||(g[37]=O=>c("SizeAdd")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Gr)})`})},null,4)])):t.createCommentVNode("",!0),B=="SizeMinus"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:g[38]||(g[38]=O=>c("SizeMinus")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Jr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Bold"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:g[39]||(g[39]=O=>c("Bold")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Xr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Italic"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:g[40]||(g[40]=O=>c("Italic")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Zr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Underline"?(t.openBlock(),t.createElementBlock("div",{title:`下划线(${t.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:g[46]||(g[46]=O=>d("menu-item__underline",O)),"data-item":"Underline",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ec)})`})},null,4),g[101]||(g[101]=t.createElementVNode("span",{class:"select"},null,-1)),t.createElementVNode("div",Lc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-decoration-style":"solid",onClick:g[41]||(g[41]=O=>c("Underline",{style:"solid"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Pl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"double",onClick:g[42]||(g[42]=O=>c("Underline",{style:"double"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Rc)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dashed",onClick:g[43]||(g[43]=O=>c("Underline",{style:"dashed"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dotted",onClick:g[44]||(g[44]=O=>c("Underline",{style:"dotted"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"wavy",onClick:g[45]||(g[45]=O=>c("Underline",{style:"wavy"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ec)})`})},null,4)])])])],8,Pc)):t.createCommentVNode("",!0),B=="Strikeout"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:g[47]||(g[47]=O=>c("Strikeout")),"data-item":"Strikeout",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(tc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Superscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:g[48]||(g[48]=O=>c("Superscript")),"data-item":"Superscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ic)})`})},null,4)])):t.createCommentVNode("",!0),B=="Subscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:g[49]||(g[49]=O=>c("Subscript")),"data-item":"Subscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(nc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Color"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:v,"data-item":"Color",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(lc)})`})},null,4),g[102]||(g[102]=t.createElementVNode("span",null,null,-1)),g[103]||(g[103]=t.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):t.createCommentVNode("",!0),B=="Highlight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:x,"data-item":"Highlight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(oc)})`})},null,4),g[104]||(g[104]=t.createElementVNode("span",null,null,-1)),g[105]||(g[105]=t.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):t.createCommentVNode("",!0),B=="Title"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__title",onClick:g[57]||(g[57]=O=>d("menu-item__title",O)),"data-item":"Title",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(sc)})`})},null,4),g[106]||(g[106]=t.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),t.createElementVNode("div",Uc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{style:{"font-size":"16px"},onClick:g[50]||(g[50]=O=>c("Title",null))},"正文"),t.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:g[51]||(g[51]=O=>c("Title","first"))},"标题1"),t.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:g[52]||(g[52]=O=>c("Title","second"))},"标题2"),t.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:g[53]||(g[53]=O=>c("Title","third"))},"标题3"),t.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:g[54]||(g[54]=O=>c("Title","fourth"))},"标题4"),t.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:g[55]||(g[55]=O=>c("Title","fifth"))},"标题5"),t.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:g[56]||(g[56]=O=>c("Title","sixth"))},"标题6")])])])):t.createCommentVNode("",!0),B=="RowFlexLeft"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__left",onClick:g[58]||(g[58]=O=>c("RowFlex","left")),title:`左对齐(${t.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ac)})`})},null,4)],8,jc)):t.createCommentVNode("",!0),B=="RowFlexCenter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__center",onClick:g[59]||(g[59]=O=>c("RowFlex","center")),title:`居中对齐(${t.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(rc)})`})},null,4)],8,zc)):t.createCommentVNode("",!0),B=="RowFlexRight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__right",onClick:g[60]||(g[60]=O=>c("RowFlex","right")),title:`右对齐(${t.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(cc)})`})},null,4)],8,qc)):t.createCommentVNode("",!0),B=="RowFlexAlignment"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:g[61]||(g[61]=O=>c("RowFlex","alignment")),title:`两端对齐(${t.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(dc)})`})},null,4)],8,Qc)):t.createCommentVNode("",!0),B=="RowFlexJustify"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:g[62]||(g[62]=O=>c("RowFlex","justify")),title:`分散对齐(${t.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(hc)})`})},null,4)],8,Kc)):t.createCommentVNode("",!0),B=="RowMargin"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:g[71]||(g[71]=O=>d("menu-item__row-margin",O)),"data-item":"RowMargin",key:B},[t.createElementVNode("i",{title:"行间距",style:t.normalizeStyle({backgroundImage:`url(${t.unref(fc)})`})},null,4),t.createElementVNode("div",Wc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-rowmargin":"1",onClick:g[63]||(g[63]=O=>c("RowMargin",1))},"1"),t.createElementVNode("li",{"data-rowmargin":"1.25",onClick:g[64]||(g[64]=O=>c("RowMargin",1.25))},"1.25"),t.createElementVNode("li",{"data-rowmargin":"1.5",onClick:g[65]||(g[65]=O=>c("RowMargin",1.5))},"1.5"),t.createElementVNode("li",{"data-rowmargin":"1.75",onClick:g[66]||(g[66]=O=>c("RowMargin",1.75))},"1.75"),t.createElementVNode("li",{"data-rowmargin":"2",onClick:g[67]||(g[67]=O=>c("RowMargin",2))},"2"),t.createElementVNode("li",{"data-rowmargin":"2.5",onClick:g[68]||(g[68]=O=>c("RowMargin",2.5))},"2.5"),t.createElementVNode("li",{"data-rowmargin":"3",onClick:g[69]||(g[69]=O=>c("RowMargin",3))},"3"),t.createElementVNode("li",{"data-rowmargin":"5",onClick:g[70]||(g[70]=O=>c("RowMargin",5))},"5")])])])):t.createCommentVNode("",!0),B=="List"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__list",onClick:g[77]||(g[77]=O=>d("menu-item__list",O)),key:B},[t.createElementVNode("i",{title:"列表",style:t.normalizeStyle({backgroundImage:`url(${t.unref(uc)})`})},null,4),t.createElementVNode("div",Yc,[t.createElementVNode("ul",null,[g[112]||(g[112]=t.createElementVNode("li",null,[t.createElementVNode("label",null,"取消列表")],-1)),t.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:g[72]||(g[72]=O=>c("List",["ol","decimal"]))},g[107]||(g[107]=[t.createElementVNode("label",null,"有序列表:",-1),t.createElementVNode("ol",null,[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"checkbox",onClick:g[73]||(g[73]=O=>c("List",["ul","checkbox"]))},g[108]||(g[108]=[t.createElementVNode("label",null,"复选框列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☑️ '"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"disc",onClick:g[74]||(g[74]=O=>c("List",["ul","disc"]))},g[109]||(g[109]=[t.createElementVNode("label",null,"实心圆点列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"disc"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"circle",onClick:g[75]||(g[75]=O=>c("List",["ul","circle"]))},g[110]||(g[110]=[t.createElementVNode("label",null,"空心圆点列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"circle"}},[t.createElementVNode("li",null,"________")],-1)])),t.createElementVNode("li",{"data-list-type":"ul","data-list-style":"square",onClick:g[76]||(g[76]=O=>c("List",["ul","square"]))},g[111]||(g[111]=[t.createElementVNode("label",null,"空心方块列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[t.createElementVNode("li",null,"________")],-1)]))])])])):t.createCommentVNode("",!0),B=="Table"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__table",onClick:A,key:B},[t.createElementVNode("i",{title:"表格",style:t.normalizeStyle({backgroundImage:`url(${t.unref(mc)})`})},null,4),g[113]||(g[113]=t.createStaticVNode('<div class="menu-item__table__collapse" data-v-9be2b83f><div class="table-close" data-v-9be2b83f>×</div><div class="table-title" data-v-9be2b83f><span class="table-select" data-v-9be2b83f>插入</span><span data-v-9be2b83f>表格</span></div><div class="table-panel" data-v-9be2b83f><table data-v-9be2b83f><tbody data-v-9be2b83f><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr></tbody></table></div></div>',1))])):t.createCommentVNode("",!0),B=="Image"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__image",onClick:V,key:B},[t.createElementVNode("i",{title:"图片",style:t.normalizeStyle({backgroundImage:`url(${t.unref(pc)})`})},null,4),g[114]||(g[114]=t.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):t.createCommentVNode("",!0),B=="Hyperlink"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:B},[t.createElementVNode("i",{title:"超链接",style:t.normalizeStyle({backgroundImage:`url(${t.unref(gc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Separator"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:g[84]||(g[84]=O=>d("menu-item__separator",O)),key:B},[t.createElementVNode("i",{title:"分割线",style:t.normalizeStyle({backgroundImage:`url(${t.unref(kc)})`})},null,4),t.createElementVNode("div",Hc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-separator":"0,0",onClick:g[78]||(g[78]=O=>c("Separator",[0,0]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Pl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"1,1",onClick:g[79]||(g[79]=O=>c("Separator",[1,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"3,1",onClick:g[80]||(g[80]=O=>c("Separator",[3,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"4,4",onClick:g[81]||(g[81]=O=>c("Separator",[4,4]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Oc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:g[82]||(g[82]=O=>c("Separator",[7,3,3,3]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Mc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:g[83]||(g[83]=O=>c("Separator",[6,2,2,2,2,2]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(_c)})`})},null,4)])])])])):t.createCommentVNode("",!0),B=="Watermark"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:g[87]||(g[87]=O=>d("menu-item__watermark",O)),key:B},[t.createElementVNode("i",{title:"水印(添加、删除)",style:t.normalizeStyle({backgroundImage:`url(${t.unref(bc)})`})},null,4),t.createElementVNode("div",Gc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-menu":"add",onClick:g[85]||(g[85]=O=>u("add"))},"添加水印"),t.createElementVNode("li",{"data-menu":"delete",onClick:g[86]||(g[86]=O=>u("delete"))},"删除水印")])])])):t.createCommentVNode("",!0),B=="Codeblock"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:S,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(yc)})`})},null,4)])):t.createCommentVNode("",!0),B=="PageBreak"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(wc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Control"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__control",onClick:g[94]||(g[94]=O=>d("menu-item__control",O)),key:B},[t.createElementVNode("i",{title:"控件",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ac)})`})},null,4),t.createElementVNode("div",Jc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-control":"text",onClick:g[88]||(g[88]=O=>N("text"))},"文本"),t.createElementVNode("li",{"data-control":"number",onClick:g[89]||(g[89]=O=>N("number"))},"数值"),t.createElementVNode("li",{"data-control":"select",onClick:g[90]||(g[90]=O=>N("select"))},"列举"),t.createElementVNode("li",{"data-control":"date",onClick:g[91]||(g[91]=O=>N("date"))},"日期"),t.createElementVNode("li",{"data-control":"checkbox",onClick:g[92]||(g[92]=O=>N("checkbox"))},"复选框"),t.createElementVNode("li",{"data-control":"radio",onClick:g[93]||(g[93]=O=>N("radio"))},"单选框")])])])):t.createCommentVNode("",!0),B=="Checkbox"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:g[95]||(g[95]=O=>w("checkbox")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(xc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Radio"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:g[96]||(g[96]=O=>w("radio")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Cc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Latex"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:b,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(vc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Date"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__date",onClick:g[97]||(g[97]=O=>C("menu-item__date",O)),key:B},[t.createElementVNode("i",{title:"日期",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Sc)})`})},null,4),g[115]||(g[115]=t.createElementVNode("div",{class:"options"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),t.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):t.createCommentVNode("",!0),B=="Block"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:y,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Bc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Search"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:M,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Nc)})`})},null,4)])):t.createCommentVNode("",!0),B=="SearchCollapse"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:B},[t.createElementVNode("div",Xc,[g[116]||(g[116]=t.createElementVNode("input",{type:"text"},null,-1)),g[117]||(g[117]=t.createElementVNode("label",{class:"search-result"},null,-1)),t.createElementVNode("div",Zc,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tc)})`})},null,4)]),t.createElementVNode("div",ed,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ic)})`})},null,4)]),g[118]||(g[118]=t.createElementVNode("span",null,"×",-1))]),g[119]||(g[119]=t.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[t.createElementVNode("input",{type:"text"}),t.createElementVNode("button",null,"替换")],-1))])):t.createCommentVNode("",!0),B=="Print"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:g[98]||(g[98]=O=>c("Print")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Vc)})`})},null,4)])):t.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-9be2b83f"]]),id=ie(t.defineComponent({__name:"richText",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},model:{type:String,default:"edit"},options:{type:Object,default:()=>({})},toolbar:{type:Array,default:()=>["simple"]}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a,{expose:e}){const i=a,n=t.useModel(a,"value"),l=t.ref(!1),o=t.computed(()=>i.editor?.widget(i.wid)||i.widget||{}),s=t.computed(()=>i.editor?.model.value||i.model);t.computed(()=>o.value.props||{});const r=t.ref(),c=t.ref(),d=t.ref(),h=t.ref();t.onMounted(()=>{t.nextTick(()=>{f()}),window.addEventListener("click",()=>{l.value=!1})});function f(){const p=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;d.value.style.height=m+2+"px",console.log("width:"+p+",height:"+m);const b=JSON.parse(JSON.stringify(i.options));h.value=new he.Editor(d.value,[],{mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:p,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...b}),h.value.listener.contentChange=()=>{h.value.command.getValueAsync().then(({data:w})=>{n.value=JSON.stringify(w)})},n.value&&(typeof n.value=="string"?h.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}return t.watch(n,()=>{l.value==!1&&n.value&&h.value&&(typeof n.value=="string"?h.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}),t.watch(s,()=>{h.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(p,m)=>(t.openBlock(),t.createBlock(ft,{class:"unione-rich-text",model:i.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=t.withModifiers(b=>l.value=!0,["stop"]))},{default:t.withCtx(()=>[(s.value=="edit"||s.value=="run")&&h.value?(t.openBlock(),t.createBlock(td,{key:0,ref_key:"canvasMenuDom",ref:c,editor:h.value,items:a.toolbar},null,8,["editor","items"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"canvasEditorDom",ref:d,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-d2704ee4"]]),nd={class:"page-setting-dialog"},_t=t.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const i=a,n=t.computed(()=>i.editor?.model?.value),l=K.useSession(),o=t.computed(()=>l.getPrincipal()),s=t.ref(!1);t.provide("closeSetting",()=>{i.editor?.save().then(p=>{s.value=!1})});function r(){s.value=!0}function c(){i.editor?.save().then(p=>{console.log("res",p)})}function d(){i.editor?.save().then(p=>{console.log("res",p)})}const h=t.ref("");function f(p){h.value||(h.value=n.value),p?i.editor?.setModel("edit"):i.editor?.setModel(h.value)}return(p,m)=>{const b=t.resolveComponent("SettingOutlined"),w=t.resolveComponent("a-tooltip"),C=t.resolveComponent("SaveOutlined"),y=t.resolveComponent("FormOutlined"),A=t.resolveComponent("StopOutlined"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-page",n.value])},[n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle},{default:t.withCtx(()=>[t.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):t.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:1,title:"保存页面"},{default:t.withCtx(()=>[t.createVNode(C,{class:"btn-save",onClick:c})]),_:1})):t.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:2,title:"编辑页面"},{default:t.withCtx(()=>[t.createVNode(y,{class:"btn-edit",onClick:m[0]||(m[0]=k=>f(!0))})]),_:1})):t.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:3,title:"退出编辑"},{default:t.withCtx(()=>[t.createVNode(A,{class:"btn-edit",onClick:m[1]||(m[1]=k=>f(!1))})]),_:1})):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default"),n.value=="edit"?(t.openBlock(),t.createBlock(V,{key:4,title:i.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:d},{default:t.withCtx(()=>[t.createElementVNode("div",nd,[t.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),ld={class:"unione-props-setting data-field-manage"},od={key:0},sd={key:1},ad={key:2},rd={key:3},cd={key:4},dd={key:5},hd={key:6},fd=["onClick"],ud=["onClick"],pd=["onClick"],md={key:1},gd=ie(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),i=t.useModel(a,"modelValue"),n=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(m=>{n.value.selectedRowKeys.includes(m)||n.value.selectedRowKeys.push(m);const b=[];i.value.forEach(w=>{!p.includes(w.name)&&n.value.selectedRowKeys.includes(w.name)&&b.push(w.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(w=>!b.includes(w)))})}}),l={mounted:p=>p.focus()},o=t.ref({});function s(){const p=Object.keys(o.value);if(p.length)for(let m in p){const b=i.value.filter(w=>w.name==m);if(b&&b[0]){let w=o.value[m];Object.keys(w).forEach(C=>{b[0][C]=w[C]})}}o.value={}}function r(p,m){s();const b={};b[m]=p[m]||"",o.value[p.name]=b}function c(p,m){if(!p||!m){o.value={};return}const b=o.value[p.name][m];if(m=="name"&&i.value.filter(C=>C[m]==b&&C.name!=p.name).length>0){te.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}p[m]=b,o.value={}}function d(p,m){i.value.filter(w=>w.name==p.name).forEach(w=>{w[m]=!w[m]})}function h(){if(s(),i.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};i.value.push(m),o.value[m.name]={name:"new_"}}function f(){if(!n.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}te.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{i.value=i.value.filter(p=>!n.value.selectedRowKeys.includes(p.name)),n.value.selectedRowKeys=[]}})}return(p,m)=>{const b=t.resolveComponent("a-button"),w=t.resolveComponent("a-tooltip"),C=t.resolveComponent("a-input"),y=t.resolveComponent("a-input-number"),A=t.resolveComponent("a-select-option"),V=t.resolveComponent("a-select"),k=t.resolveComponent("a-checkbox"),u=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ld,[t.createVNode(b,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:t.withCtx(()=>m[1]||(m[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:t.withCtx(()=>m[2]||(m[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(u,{columns:e.value,"data-source":i.value,pagination:!1,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:t.withCtx(({column:S})=>[S.key==="name"?(t.openBlock(),t.createElementBlock("span",od,[m[3]||(m[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="title"?(t.openBlock(),t.createElementBlock("span",sd,[m[4]||(m[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="descs"?(t.openBlock(),t.createElementBlock("span",ad,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataLen"?(t.openBlock(),t.createElementBlock("span",rd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataPrec"?(t.openBlock(),t.createElementBlock("span",cd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="defaultValue"?(t.openBlock(),t.createElementBlock("span",dd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataType"?(t.openBlock(),t.createElementBlock("span",hd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="isPk"?(t.openBlock(),t.createBlock(w,{key:7,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[m[5]||(m[5]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isFk"?(t.openBlock(),t.createBlock(w,{key:8,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isNull"?(t.openBlock(),t.createBlock(w,{key:9,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="syncDbEnable"?(t.openBlock(),t.createBlock(w,{key:10,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:S,text:M,record:v})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(S.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,S.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(C,{key:0,value:o.value[v.name][S.dataIndex],"onUpdate:value":x=>o.value[v.name][S.dataIndex]=x,onBlur:x=>c(v,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M||" "),1)],64))],10,fd)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(S.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,S.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[v.name][S.dataIndex],"onUpdate:value":x=>o.value[v.name][S.dataIndex]=x,onBlur:x=>c(v,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M||" "),1)],64))],10,ud)):["dataType"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(S.dataIndex))&&!M&&"empty"]),onClick:x=>r(v,S.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(V,{key:0,value:v[S.dataIndex],"onUpdate:value":x=>v[S.dataIndex]=x,onBlur:m[0]||(m[0]=x=>c())},{default:t.withCtx(()=>[t.createVNode(A,{key:"String",value:"String"}),t.createVNode(A,{key:"Long",value:"Long"}),t.createVNode(A,{key:"Short",value:"Short"}),t.createVNode(A,{key:"Integer",value:"Integer"}),t.createVNode(A,{key:"Float",value:"Float"}),t.createVNode(A,{key:"Double",value:"Double"}),t.createVNode(A,{key:"Date",value:"Date"}),t.createVNode(A,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",md,t.toDisplayString(M),1))],10,pd)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:3,checked:v[S.dataIndex],onClick:x=>d(v,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:4,checked:!v[S.dataIndex],onClick:x=>d(v,S.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),kd={class:"unione-props-setting data-field-setting"},bd={key:0},yd=["onClick"],wd={class:"field-txt"},Ad=["onClick"],xd={key:1,class:"field-txt"},Cd=["onClick"],vd={key:1},Sd=["onClick"],Bd={key:0,class:"field-txt"},Nd={key:4,class:"edit-field"},Vd={key:0},Rd=["onClick"],Ed=ie(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:y})=>y+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),i=t.useModel(a,"modelValue"),n={mounted:y=>y.focus()},l=t.ref({});function o(){const y=Object.keys(l.value);if(y.length)for(let A in y){const V=i.value.filter(k=>k.name==A);if(V&&V[0]){let k=l.value[A];Object.keys(k).forEach(u=>{u=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=k[u]):V[0][u]=k[u]})}}l.value={}}function s(y,A){o();const V={};A=="convertName"?(y.convert||(y.convert={}),V[A]=y.convert?.type):V[A]=y[A]||"",l.value[y.name]=V}function r(y,A){{l.value={};return}}function c(y,A){i.value.filter(k=>k.name==y.name).forEach(k=>{k[A]=!k[A]})}const d=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function h(y,A){const V=i.value.filter(u=>u.name==y.name);V.forEach(u=>{A!="isSort"?u[A]=!0:u[A]=!u[A]});const k=V[0];if(!(!k||A=="isSort")){switch(d.value.prop=A,d.value.field=y,k.show||(k.show={}),A){case"isQuery":k.show.query||(k.show.query={}),d.value.show=k.show.query,d.value.title=`查询设置/${y.title}(${y.name})`;break;case"isForm":k.show.form||(k.show.form={}),d.value.show=k.show.form,d.value.title=`表单设置/${y.title}(${y.name})`;break;case"isView":k.show.view||(k.show.view={}),d.value.show=k.show.view,d.value.title=`详情设置/${y.title}(${y.name})`;break;case"isList":k.show.list||(k.show.list={}),d.value.show=k.show.list,d.value.title=`列头设置/${y.title}(${y.name})`;break}d.value.visible=!0}}const f=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:y=>{const A=f.value.options.filter(V=>V.value==y);return A[0]?A[0].label:y}}),p=t.ref({visible:!1,field:{},props:{},showInfo:y=>{let A="";return y.rules&&(A=y.rules.filter(V=>V.enable).length||""),A&&(A="("+A+")"),A},toSetting:()=>{const y=p.value.props,A={name:"range",trigger:y.trigger,whitespace:y.whitespace,message:y.rangeMessage};y.rangeMin!=null&&y.rangeMin!=null&&(A.min=y.rangeMin,A.enable=!0),y.rangeMax!=null&&y.rangeMax!=null&&(A.max=y.rangeMax,A.enable=!0);const V={name:"reg",trigger:y.trigger,whitespace:y.whitespace,message:y.regMessage};y.regExpress&&(V.pattern=y.regExpress,V.enable=!0),p.value.field.rules=[A,V],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function m(y){p.value.visible=!0,p.value.field=y;const A=y.rules||[],V={trigger:"change",whitespace:!0};A.forEach(k=>{k.name=="reg"&&(V.trigger=k.trigger,V.whitespace=k.whitespace,V.regExpress=k.pattern,V.regMessage=k.message),k.name=="range"&&(V.rangeMin=k.min,V.rangeMax=k.max,V.rangeMessage=k.message)}),p.value.props=V}const b=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:y=>{const A=b.value.widgets.filter(V=>V.value==y);return A[0]?A[0].label:y},toSetting:()=>{}}),w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(y,A)=>{w.value.convert.options.splice(y,1)},toSetting:()=>{w.value.visible=!1}});function C(y){w.value.visible=!0,w.value.field=y,w.value.convert=y.convert||{}}return(y,A)=>{const V=t.resolveComponent("ToolOutlined"),k=t.resolveComponent("a-button"),u=t.resolveComponent("a-select"),S=t.resolveComponent("a-checkbox"),M=t.resolveComponent("a-table"),v=t.resolveComponent("a-input-number"),x=t.resolveComponent("a-form-item"),N=t.resolveComponent("a-input"),R=t.resolveComponent("a-form"),g=t.resolveComponent("a-modal"),B=t.resolveComponent("a-col"),T=t.resolveComponent("a-row"),O=t.resolveComponent("a-select-option"),_=t.resolveComponent("a-divider"),$=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createElementBlock("div",kd,[t.createVNode(M,{columns:e.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:I})=>[["widget","queryType","rules","convertName"].includes(I.key)?(t.openBlock(),t.createElementBlock("span",bd,[t.createVNode(V),t.createTextVNode(" "+t.toDisplayString(I.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:I,text:j,record:P})=>[["rules"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!p.value.showInfo(P)&&"empty"]),onClick:E=>m(P)},[t.createElementVNode("span",wd,t.toDisplayString(p.value.showInfo(P)),1),p.value.showInfo(P)?(t.openBlock(),t.createBlock(k,{key:0,type:"link"},{default:t.withCtx(()=>A[22]||(A[22]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,yd)):["widget"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!j&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:P[I.dataIndex],"onUpdate:value":E=>P[I.dataIndex]=E,allowClear:!0,options:b.value.widgets,onBlur:A[0]||(A[0]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",xd,t.toDisplayString(b.value.widgetName(j)),1))],10,Ad)):["queryType"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[P.isQuery?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!j&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:P[I.dataIndex],"onUpdate:value":E=>P[I.dataIndex]=E,allowClear:!0,options:f.value.options,onBlur:A[1]||(A[1]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",vd,t.toDisplayString(f.value.showLabel(j)),1))],10,Cd)):t.createCommentVNode("",!0)],64)):["convertName"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!l.value[P.name]||!Object.keys(l.value[P.name]).includes(I.dataIndex))&&!P.convert?.type&&"empty"]),onClick:E=>s(P,I.dataIndex)},[l.value[P.name]&&Object.keys(l.value[P.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:P.convert.type,"onUpdate:value":E=>P.convert.type=E,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:A[2]||(A[2]=E=>r())},null,8,["value","onUpdate:value"])),[[n]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[P.convert?.type?(t.openBlock(),t.createElementBlock("span",Bd,t.toDisplayString(P.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),P.convert?.type?(t.openBlock(),t.createBlock(k,{key:1,type:"link",onClick:t.withModifiers(E=>C(P),["stop"])},{default:t.withCtx(()=>A[23]||(A[23]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Sd)):["isQuery","isForm","isView","isList","isSort"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",Nd,[t.createVNode(S,{checked:P[I.dataIndex],onClick:E=>c(P,I.dataIndex)},null,8,["checked","onClick"]),t.createVNode(k,{type:"link",onClick:E=>h(P,I.dataIndex)},{default:t.withCtx(()=>A[24]||(A[24]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(g,{visible:d.value.visible,"onUpdate:visible":A[9]||(A[9]=I=>d.value.visible=I),title:d.value.title,onOk:d.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(x,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(v,{value:d.value.show.index,"onUpdate:value":A[3]||(A[3]=I=>d.value.show.index=I)},null,8,["value"])]),_:1}),["isQuery"].includes(d.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.width,"onUpdate:value":A[4]||(A[4]=I=>d.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.labelWidth,"onUpdate:value":A[5]||(A[5]=I=>d.value.show.labelWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.valueWidth,"onUpdate:value":A[6]||(A[6]=I=>d.value.show.valueWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(u,{value:d.value.show.fixed,"onUpdate:value":A[7]||(A[7]=I=>d.value.show.fixed=I),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(u,{value:d.value.show.align,"onUpdate:value":A[8]||(A[8]=I=>d.value.show.align=I),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(g,{visible:w.value.visible,"onUpdate:visible":A[11]||(A[11]=I=>w.value.visible=I),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",Vd,[t.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>A[25]||(A[25]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(M,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:I,text:j,record:P,index:E})=>[I.dataIndex==="label"?(t.openBlock(),t.createBlock(N,{key:0,value:P.label,"onUpdate:value":J=>P.label=J,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="value"?(t.openBlock(),t.createBlock(N,{key:1,value:P.value,"onUpdate:value":J=>P.value=J,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:J=>w.value.toDelOption(E,P)},"删除",8,Rd)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(R,{key:1,model:w.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(T,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(B,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(x,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(N,{value:w.value.convert.dict,"onUpdate:value":A[10]||(A[10]=I=>w.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(g,{visible:b.value.visible,"onUpdate:visible":A[13]||(A[13]=I=>b.value.visible=I),title:"控件设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[b.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(x,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(u,{value:b.value.props.mode,"onUpdate:value":A[12]||(A[12]=I=>b.value.props.mode=I),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(O,{value:"multiple"},{default:t.withCtx(()=>A[26]||(A[26]=[t.createTextVNode("多选")])),_:1}),t.createVNode(O,{value:"tags"},{default:t.withCtx(()=>A[27]||(A[27]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(g,{visible:p.value.visible,"onUpdate:visible":A[21]||(A[21]=I=>p.value.visible=I),title:"规则设置",onOk:p.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>A[28]||(A[28]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(x,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode($,{value:p.value.props.trigger,"onUpdate:value":A[14]||(A[14]=I=>p.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(S,{value:p.value.props.whitespace,"onUpdate:value":A[15]||(A[15]=I=>p.value.props.whitespace=I),checked:p.value.props.whitespace},{default:t.withCtx(()=>A[29]||(A[29]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>A[30]||(A[30]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(x,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(v,{value:p.value.props.rangeMin,"onUpdate:value":A[16]||(A[16]=I=>p.value.props.rangeMin=I)},null,8,["value"]),A[31]||(A[31]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(v,{value:p.value.props.rangeMax,"onUpdate:value":A[17]||(A[17]=I=>p.value.props.rangeMax=I)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.rangeMessage,"onUpdate:value":A[18]||(A[18]=I=>p.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),t.createVNode(_,{orientation:"left"},{default:t.withCtx(()=>A[32]||(A[32]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(x,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.regExpress,"onUpdate:value":A[19]||(A[19]=I=>p.value.props.regExpress=I)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.regMessage,"onUpdate:value":A[20]||(A[20]=I=>p.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Od={class:"unione-props-setting data-field"},Md=ie(t.defineComponent({__name:"dataField",props:t.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(i,n)=>{const l=t.resolveComponent("OrderedListOutlined"),o=t.resolveComponent("a-tab-pane"),s=t.resolveComponent("ToolOutlined"),r=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Od,[t.createVNode(r,null,{default:t.withCtx(()=>[t.createVNode(o,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(l),n[2]||(n[2]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(gd,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),t.createVNode(o,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(s),n[3]||(n[3]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(Ed,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),_d={key:0,class:"data-model-list"},Td=["onClick"],Id=ie(t.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const i=t.computed(()=>l.editor.dataModels()),n=t.ref({sn:"new_",title:"新建数据",fields:[]});t.onMounted(()=>{i.value&&i.value[0]&&(n.value=i.value[0])});const l=a;function o(f){n.value=f}function s(){if(i.value.length>=l.limit){te.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=va.v4(),p={sn:f,title:"新建数据",name:"new_",fields:[]};n.value=p,console.log("data model added",p),l.editor.dataModel(f,p)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=t.ref(),d=t.inject("closeSetting");function h(){c.value.validate().then(f=>{d&&d()})}return e({toSaving:h}),(f,p)=>{const m=t.resolveComponent("a-input"),b=t.resolveComponent("a-form-item"),w=t.resolveComponent("a-textarea"),C=t.resolveComponent("a-form");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(t.openBlock(),t.createElementBlock("div",_d,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,y=>(t.openBlock(),t.createElementBlock("div",{key:y.sn,class:t.normalizeClass(["title",n.value&&n.value.sn==y.sn&&"slt"]),onClick:A=>o(y)},t.toDisplayString(y.title),11,Td))),128)),t.createElementVNode("div",{class:"title btn-add",onClick:s},"+")])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[t.createVNode(C,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:t.withCtx(()=>[t.createVNode(b,{label:"数据标题",name:"title",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.title,"onUpdate:value":p[0]||(p[0]=y=>n.value.title=y)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.name,"onUpdate:value":p[1]||(p[1]=y=>n.value.name=y)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.url,"onUpdate:value":p[2]||(p[2]=y=>n.value.url=y)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"数据说明",name:"descs"},{default:t.withCtx(()=>[t.createVNode(w,{value:n.value.descs,"onUpdate:value":p[3]||(p[3]=y=>n.value.descs=y)},null,8,["value"])]),_:1})]),_:1},8,["model"]),t.createVNode(Md,{modelValue:n.value.fields,"onUpdate:modelValue":p[4]||(p[4]=y=>n.value.fields=y)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Fd={class:"unione-props-setting unione-page-setting"},Tt=ie(t.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,i=t.ref({});return t.onMounted(()=>{i.value=e.editor.define.value}),(n,l)=>{const o=t.resolveComponent("a-form-item"),s=t.resolveComponent("a-input"),r=t.resolveComponent("a-switch"),c=t.resolveComponent("a-textarea"),d=t.resolveComponent("a-form"),h=t.resolveComponent("a-tab-pane"),f=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Fd,[t.createVNode(f,{type:"card"},{default:t.withCtx(()=>[t.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:t.withCtx(()=>[t.createVNode(d,{model:i.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[i.value.sn&&i.value.sn!="new_"?(t.openBlock(),t.createBlock(o,{key:0,label:"页面编码"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.value.sn)+"/V"+t.toDisplayString(i.value.vers),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(o,{label:"页面标题",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.title,"onUpdate:value":l[0]||(l[0]=p=>i.value.title=p)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"页面组件",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.component,"onUpdate:value":l[1]||(l[1]=p=>i.value.component=p)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"icon图标"},{default:t.withCtx(()=>[t.createVNode(s,{value:i.value.icon,"onUpdate:value":l[2]||(l[2]=p=>i.value.icon=p)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"是否全局"},{default:t.withCtx(()=>[t.createVNode(r,{checked:i.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=p=>i.value.isGlobal=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"是否模版"},{default:t.withCtx(()=>[t.createVNode(r,{checked:i.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=p=>i.value.isTmpl=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"页面备注"},{default:t.withCtx(()=>[t.createVNode(c,{value:i.value.descs,"onUpdate:value":l[5]||(l[5]=p=>i.value.descs=p),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),t.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:t.withCtx(()=>[t.createVNode(Id,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),jl=ie(t.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},n=new ht,l=t.computed(()=>n.$widgetList.value||[]);t.watch(()=>e.pageDefine,s=>{s&&n.load(o.value,s)});const o=t.ref("new_");return t.onMounted(()=>{const s=t.inject("route");console.log("unione page view route",s),o.value=e.psn||s?.query?.psn||s?.meta?.psn||"new_",console.log("unione page view,psn:"+o.value),n.setModel("run"),n.load(o.value,e.pageDefine||i)}),(s,r)=>(t.openBlock(),t.createBlock(_t,{class:"unione-page-view","setting-title":"页面设置",editor:t.unref(n)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,c=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.render||c.widget),{key:c.wid,wid:c.wid,widget:c,editor:t.unref(n)},null,8,["wid","widget","editor"]))),128))]),_:2},[t.unref(n)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Dd={class:"form-btns"},zl=t.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1},storage:{type:Object,required:!1},fields:{type:Array,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1},setting:{type:Object,required:!1}},emits:["submit","save","reset","back","btnClick"],setup(a,{expose:e,emit:i}){const n=t.inject("router"),l=K.useDialog(),o=a,s=i,r={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-form"};function c(){if(o.fields?.length){const V={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields,setting:o.setting||{}};r.configs.widgets=[V]}o.storage&&(r.configs.dsnList=["primary"],d.dataManager().use("primary","form").store(o.storage)),r.configs.btns=o.btns||[],o.btns==!1&&(r.configs.btns=!1),r.configs.event=o.event||{}}const d=new ht,h=t.computed(()=>d.$widgetList.value||[]),f=t.ref({}),p=t.computed(()=>{const V=d.define.value?.configs?.btns||[],k=V.map(u=>u.name);if(!k.includes("save")){const u={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};V.splice(u.index,0,u)}if(!k.includes("submit")){const u={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let S=u.index||1;V.splice(S,0,u)}if(!k.includes("reset")){const u={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};V.splice(u.index,0,u)}if(!k.includes("back")){const u={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};V.splice(u.index,0,u)}return d.model.value=="view"&&V.filter(u=>["save","submit","reset"].includes(u.name)).forEach(u=>{u.visible=!1}),V});async function m({btn:V,event:k}){if(V.name=="save"){const S=await w();S.success&&S.body&&(f.value.id=S.body),s("save",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value});return}if(V.name=="reset"){C(),s("reset",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="back"){y(),s("back",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="submit"){l.confirm({content:"提交当前表单吗?",onOk:async()=>{const S=await w();S.success&&S.body&&(f.value.id=S.body),s("submit",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value})}});return}const u=await b();s("btnClick",{btn:V,event:k,formData:u})}async function b(){const V=d.dataManager().primary().data(),k=d.dataManager().form();f.value={...V};for(let u in k){const S=d.dataManager().data(u).data();d.dataManager().psn()!=u&&(f.value[u]={...S})}return f.value}async function w(){const V=d.dataManager().form();f.value={};for(let k in V){const u=await V[k].validate();d.dataManager().psn()==k?f.value=u:f.value[k]=u}return d.dataManager().primary().save({data:f.value,params:d.dataManager().params})}function C(V){d.dataManager().primary().reset(V)}function y(){n.back()}t.watch(()=>o.pageDefine,V=>{V&&d.load(A.value,V)});const A=t.ref("new_");return t.onMounted(()=>{const V=t.inject("route");console.log("unione page form route",V),A.value=o.psn||V?.query?.psn||V?.meta?.psn||"new_",console.log("unione page form,psn:"+A.value),d.setModel(V?.query?.model||V?.meta?.model||"run");const k={...o.params||{},...V?.query||{},...V?.params||{}};d.dataManager().params(k),c(),d.load(A.value,o.pageDefine||r)}),e({save:w,toReset:C,toBack:y}),(V,k)=>{const u=t.resolveComponent("unione-btn");return t.openBlock(),t.createBlock(_t,{class:"unione-page-form","setting-title":"页面设置",editor:t.unref(d)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,S=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.widget),{key:S.wid,wid:S.wid,widget:S,editor:t.unref(d)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Dd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.name},[S.visible!=!1?(t.openBlock(),t.createBlock(u,{key:0,widget:S,editor:t.unref(d),ctx:{formData:f.value},onClick:m},null,8,["widget","editor","ctx"])):t.createCommentVNode("",!0)],64))),128))])]),_:2},[t.unref(d)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(d)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),$d=["onMouseover"],Pd={key:0,class:"node-opts"},Ld={key:2,class:"tree-empty"},Ud={class:"form-warp"},jd={class:"form-btns"},ql=ie(t.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=t.inject("router"),o=a,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function r(){if(o.fields?.length){const D={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields};s.configs.widgets=[D]}s.configs.dsnList=["primary"],c.dataManager().use("primary","form").store(o.storage),s.configs.btns=o.btns||[],o.btns==!1&&(s.configs.btns=!1),s.configs.opts=o.opts||[],o.opts==!1&&(s.configs.opts=!1),s.configs.event=o.event||{},s.configs.setting=o.setting||{}}const c=new ht,d=t.ref(!1),h=t.ref([]),f=t.ref({}),p=t.ref(null),m=t.ref(null),b=t.ref([]),w=t.ref([]),C=t.ref(0),y=t.computed(()=>{const D={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,autoselect:!1,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...o.setting?.tree||{}};return c.define.value?.configs?.tree||D}),A=t.computed(()=>y.value.searchEnable),V=t.computed(()=>{const D=c.define.value?.configs?.opts;if(typeof D=="boolean"&&D==!1)return!1;const Q=(D||[]).map(H=>typeof H=="string"?{name:H,visible:!1}:H),G=[];return Q.forEach(H=>{G.push(H.name)}),console.log("opts addBtn",Q),Q.filter(H=>H.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),k=t.computed(()=>{const D=c.define.value?.configs?.opts;if(typeof D=="boolean"&&D==!1)return[];const Q=(D||[]).map(X=>typeof X=="string"?{name:X,visible:!1}:X),G=[],H=[];return Q.forEach(X=>{H.push(X.name),X.name!="add"&&G.push(X)}),H.includes("delete")||G.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),H.includes("child")||G.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",G),G});function u(D,Q){const{btn:G,event:H}=D;H.stopPropagation();const X=f.value[Q[y.value.idField]];if(console.log("onTreeMenuClick,btn:",G),console.log("onTreeMenuClick,node:",Q),console.log("onTreeMenuClick,curentNode:",X),G.name=="child"){if(_.value.preCreate&&_.value.preCreate(X)==!1)return;const ge=f.value[X[y.value.idField]];ge.isLeaf=!1,p.value={},p.value[y.value.pidField]=ge[y.value.idField],p.value[y.value.labelField]="新建...",p.value[y.value.idField]="new_"+C.value,p.value.parentNode=ge,C.value=C.value+1,ge.children||(ge.children=[],w.value.push(ge[y.value.idField])),_.value.createNode&&_.value.createNode(p.value,ge,c.dataManager().params()),f.value[p.value[y.value.idField]]=p.value,ge.children.push(p.value),b.value=[p.value[y.value.idField]],c.dataManager().primary().setValue(p.value)}G.name=="delete"&&L(X),j("btnClick",{...D,node:X})}function S(D,{expanded:Q,node:G}){Q&&(p.value=G.dataRef,c.dataManager().primary().setValue(p.value),T())}function M(D,Q){Q.selected?(p.value=Q.node.dataRef,c.dataManager().primary().setValue(p.value)):p.value&&(b.value=[p.value[y.value.idField]]),j("treeClick",{keys:D,event:Q}),j("select",{keys:D,event:Q})}const v=t.computed(()=>{if(o.storage?.orderBy){const D=o.storage.orderBy.split(" ");return[{name:D[0],asc:D[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>o.params,()=>{d.value&&(h.value=[],f.value={},p.value=null,b.value=[],w.value=[],C.value=0,c.dataManager().params(o.params||{}),console.log("params changed props.params",o.params),T())}),t.watch(()=>p.value,()=>{console.log("active node changed",p.value),N(!p.value)});const x=t.ref(null);t.watch(x,()=>{x.value&&p.value&&c.dataManager().primary().setValue(p.value)});function N(D=!0){const Q=c.dataManager().form();for(let G in Q)Q[G].setDisabled(D)}function R(){if(!(_.value.preCreate&&_.value.preCreate()==!1)){if(p.value={},p.value[y.value.pidField]=-1,p.value[y.value.labelField]="新建...",p.value[y.value.idField]="new_"+C.value,C.value=C.value+1,_.value.createNode&&_.value.createNode(p.value,null,c.dataManager().params()),p.value[y.value.pidField]==-1)h.value.push(p.value);else{const D=f.value[p.value[y.value.pidField]];D?(D.children||(D.children=[]),D.children.push(p.value)):h.value.push(p.value)}b.value=[p.value[y.value.idField]],f.value[p.value[y.value.idField]]=p.value,c.dataManager().primary().setValue(p.value)}}const g=t.ref(""),B=At(D=>{c.dataManager().primary().find({page:1,pageSize:9999,keywords:D||g.value,needCount:!1,body:y.value.async==!1?null:{},sorts:v.value}).then(Q=>{if(f.value={},h.value=[],Q.body?.length){const G={};Q.body.forEach(H=>{G[H[y.value.idField]]=H}),Q.body.forEach(H=>{const X=G[H[y.value.pidField]];X?(X.children||(X.children=[],X.isLeaf=!1),X.children.push(H)):h.value.push(H)})}})},400);function T(){return new Promise((D,Q)=>{const G={};if(G[y.value.pidField]=o.params[y.value.pidField]||-1,p.value){if(p.value.children?.length||y.value.async==!1){D(p.value.children);return}G[y.value.pidField]=p.value[y.value.idField],c.dataManager().primary().find({page:1,pageSize:999,body:G,sorts:v.value}).then(H=>{p.value.children=H.body||[],p.value.children.forEach(X=>{X.isLeaf=!!X[y.value.leafField],f.value[X[y.value.idField]]=X,X.parentNode=f.value[X[y.value.pidField]]}),D(H.body)})}else{const H=y.value.async==!1?null:{page:1,pageSize:999,body:G,sorts:v.value};c.dataManager().primary().find(H).then(X=>{if(y.value.async==!1){if(h.value=[],X.body?.length){const ge={};X.body.forEach(dt=>{ge[dt[y.value.idField]]=dt}),X.body.forEach(dt=>{const Mt=ge[dt[y.value.pidField]];Mt?(Mt.children||(Mt.children=[],Mt.isLeaf=!1),Mt.children.push(dt)):h.value.push(dt)})}D(X.body)}else h.value=X.body||[],h.value.forEach(ge=>{ge.isLeaf=!!ge[y.value.leafField],f.value[ge[y.value.idField]]=ge}),D(X.body)})}})}const O=t.computed(()=>c.$widgetList.value||[]),_=t.computed(()=>{const D={...c.define.value?.configs?.event||{}};for(const Q in D)D[Q]&&typeof D[Q]!="function"&&D[Q].enable&&D[Q].scriptText&&(Q=="createNode"&&(D[Q]=new Function("node","parent","params",D[Q].scriptText)),Q=="preCreate"?D[Q]=new Function("parent",D[Q].scriptText):D[Q]=new Function("data","event",D[Q].scriptText));return D}),$=t.computed(()=>c.define.value?.configs?.setting||o.setting||{});t.provide("pageSetting",$.value);const I=t.computed(()=>{const D=c.define.value?.configs?.btns;if(typeof D=="boolean"&&D==!1)return[];const Q=(c.define.value?.configs?.btns||[]).map(H=>typeof H=="string"?{name:H,visible:!1}:{size:"default",...H}),G=Q.map(H=>H.name);if(!G.includes("save")){const H={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};Q.splice(H.index,0,H)}if(!G.includes("reset")){const H={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};Q.splice(H.index,0,H)}if(!G.includes("back")){const H={title:"返回",type:"default",index:Q.length,visible:!0,size:"default",name:"back"};Q.splice(H.index,0,H)}return c.model.value=="view"&&Q.filter(H=>["save","submit","reset"].includes(H.name)).forEach(H=>{H.visible=!1}),Q}),j=i;function P(D){const{btn:Q,event:G}=D;Q.name=="save"&&E({btn:Q,event:G}),Q.name=="reset",Q.name=="back"&&F(),j("btnClick",D)}async function E(D){const Q=c.dataManager().form();let G={...p.value};for(let H in Q){const X=await Q[H].validate();if(c.dataManager().psn()==H)for(let ge in X)G[ge]=X[ge];else G[H]=X}if(G[y.value.pidField]&&(G[y.value.pidField]+"").startsWith("new_")){n.error({content:"请先保存父节点!"});return}G[y.value.idField]&&(G[y.value.idField]+"").startsWith("new_")&&delete G[y.value.idField],delete G.parentNode,delete G.children,G[y.value.leafField]=G[y.value.leafField]?1:0,_.value.preSave&&_.value.preSave(G,D),console.log("=======form data=====",G),c.dataManager().primary().save({data:G}).then(H=>{console.log("save result:",H),p.value[y.value.idField]=H.body,b.value=[H.body],f.value[H.body]=p.value,p.value.children?.forEach(X=>{X[y.value.pidField]=H.body}),_.value.postSaved&&_.value.postSaved(G,D)})}function J(){}function F(){l.back()}function z(){return c.dataManager().primary()}function pe(D){f.value[D[y.value.idField]]={...f.value[D[y.value.idField]],...D}}function tt(D){return f.value[D]}function L(D){_.value.preDelete&&_.value.preDelete(D)==!1||(D[y.value.idField]&&(D[y.value.idField]+"").startsWith("new_")?(D.parentNode?D.parentNode.children=D.parentNode.children.filter(Q=>Q[y.value.idField]!=D[y.value.idField]):h.value=h.value.filter(Q=>Q[y.value.idField]!=D[y.value.idField]),delete f.value[D[y.value.idField]]):c.dataManager().primary().deleteByIds([D[y.value.idField]]).then(()=>{if(D.parentNode){const Q=f.value[D[y.value.pidField]];Q.children=Q.children.filter(G=>G[y.value.idField]!=D[y.value.idField])}else h.value=h.value.filter(Q=>Q[y.value.idField]!=D[y.value.idField]);delete f.value[D[y.value.idField]]}))}function Me(){h.value=[],f.value={},p.value=null,m.value=null,b.value=[],w.value=[],C.value=0,T().then(D=>{if(D&&D[0]&&y.value.selectable&&y.value.autoselect){const Q={...D[0],dataRef:D[0]};b.value=[D[0].id],j("select",{keys:b.value,event:{node:Q}})}})}const ne=t.ref("new_");return t.onMounted(()=>{const D=t.inject("route");console.log("unione page tree route",D),ne.value=o.psn||D?.query?.psn||D?.meta?.psn||"new_",console.log("unione page tree,psn:"+ne.value),c.setModel(D?.query?.model||D?.meta?.model||"run");const Q={...o.params||{},...D?.query||{},...D?.params||{}};c.dataManager().params(Q),r(),c.load(ne.value,s),t.nextTick(()=>{N(!0)}),T().then(G=>{if(G&&G[0]&&y.value.selectable&&y.value.autoselect){const H={...G[0],dataRef:G[0]};b.value=[G[0].id],j("select",{keys:b.value,event:{node:H}})}}),d.value=!0}),e({storage:z,save:E,toBack:F,toReset:J,setNode:pe,getNode:tt,delNode:L,reload:Me}),(D,Q)=>{const G=t.resolveComponent("SearchOutlined"),H=t.resolveComponent("a-input"),X=t.resolveComponent("unione-btn"),ge=t.resolveComponent("a-badge"),dt=t.resolveComponent("a-tree"),Mt=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(_t,{class:"unione-page-tree","setting-title":"页面设置",editor:t.unref(c)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"tree-warp",onContextmenu:Q[4]||(Q[4]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot(D.$slots,"tree-top",{},void 0,!0),A.value?(t.openBlock(),t.createBlock(H,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:g.value,"onUpdate:value":Q[0]||(Q[0]=de=>g.value=de),onChange:t.unref(B),onPressEnter:t.unref(B)},{suffix:t.withCtx(()=>[t.createVNode(G)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),V.value?(t.openBlock(),t.createBlock(X,{key:1,widget:V.value,onClick:R},null,8,["widget"])):t.createCommentVNode("",!0),t.createVNode(dt,{"show-line":y.value.showLine,"show-icon":y.value.showIcon,disabled:y.value.disabled,blockNode:!0,draggable:y.value.draggable,multiple:y.value.multiple,selectable:y.value.selectable,checkable:y.value.checkable,fieldNames:{title:y.value.labelField,key:y.value.idField},selectedKeys:b.value,"onUpdate:selectedKeys":Q[2]||(Q[2]=de=>b.value=de),expandedKeys:w.value,"onUpdate:expandedKeys":Q[3]||(Q[3]=de=>w.value=de),"tree-data":h.value,onExpand:S,onSelect:M},t.createSlots({icon:t.withCtx(({dataRef:de})=>[de[y.value.iconField]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(de[y.value.iconField]),{key:0,class:"node-icon"})):t.createCommentVNode("",!0)]),_:2},[k.value?.length?{name:"title",fn:t.withCtx(({dataRef:de})=>[t.createElementVNode("div",{class:"node-label",onMouseover:()=>m.value=de,onMouseleave:Q[1]||(Q[1]=()=>m.value=null)},[t.createVNode(ge,{dot:de[y.value.badgeDot],count:de[y.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(de[y.value.labelField]),1)]),_:2},1032,["dot","count"]),p.value&&p.value[y.value.idField]==de[y.value.idField]||m.value&&m.value[y.value.idField]==de[y.value.idField]?(t.openBlock(),t.createElementBlock("div",Pd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,El=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!_.value.btnVisible||_.value.btnVisible(El,de)?(t.openBlock(),t.createBlock(X,{key:El.name,widget:El,ctx:{node:de},onClick:Mp=>u(Mp,de)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],40,$d)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"]),!h.value||!h.value.length?(t.openBlock(),t.createElementBlock("div",Ld,[t.renderSlot(D.$slots,"tree-empty",{},()=>[t.createVNode(Mt)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",Ud,[t.renderSlot(D.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.value,de=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(de.widget),{key:de.wid,wid:de.wid,widget:de,editor:t.unref(c)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",jd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,de=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:de.name},[de.visible!=!1?(t.openBlock(),t.createBlock(X,{key:0,widget:de,editor:t.unref(c),disabled:!p.value,ctx:{formData:p.value},onClick:P},null,8,["widget","editor","disabled","ctx"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(c)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(c)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-1d6ecb5e"]]),Ql=t.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},selection:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:i}){const n=a,l=t.ref(null),o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(n.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=n.fields.filter(V=>V.isQuery),o.configs.widgets[0].btns=n.queryBtns||[],o.configs.widgets[0].params=n.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const A=n.fields.filter(V=>V.isPk)[0];A&&A.name&&(o.configs.widgets[1].dataKey=A.name),o.configs.widgets[1].columns=n.fields.filter(V=>V.hidden!=!0),o.configs.widgets[1].operation=n.operation,n.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=n.leftBtns==!1?!1:n.leftBtns||[],o.configs.widgets[1].rightBtns=n.rightBtns==!1?!1:n.rightBtns||[],r.dataManager().use("primary","list").store(n.storage)}}const r=new ht,c=t.computed(()=>r.$widgetList.value||[]),d=i;function h(A){d("btnClick",A)}const f=t.ref("new_");t.onMounted(()=>{const A=t.inject("route");console.log("unione page view route",A),f.value=n.psn||A?.query?.psn||A?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),r.setModel(A?.query?.model||A?.meta?.model||"run");const V={...n.params||{},...A?.query||{},...A?.params||{}};r.dataManager().params(V),s(),r.load(f.value,o)});function p(){return r.dataManager().use("primary","list")}function m(A){A?r.ebus.$emit("table-list-search",A):r.ebus.$emit("table-list-reload")}function b(A){r.dataManager().params(A),r.ebus.$emit("query-form-params",A),r.ebus.$emit("table-list-search",{params:A})}function w(){return l.value?l.value[0]:null}function C(){return l.value?l.value[0].getSelected():null}function y(){l.value&&l.value[0].clearSelected()}return e({storage:p,editor:r,reload:m,setParams:b,getTable:w,getSelected:C,clearSelected:y}),(A,V)=>(t.openBlock(),t.createBlock(_t,{class:"unione-page-list","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.wid},[k.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),Kl=t.defineComponent({__name:"todo",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},flowKey:{type:String,required:!1},flowVers:{type:Number,required:!1},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=K.useSession(),o=new Qe({types:"dict",dictName:"FLOWLITETASKSTATUS"}),s=a,r=t.ref(null),c=t.ref(null),d=t.ref(null),h={sn:"new_",title:"我的待办",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"primary",primary:!0,fields:[{title:"接收时间",name:"time",widget:"a-range-picker",props:{showTime:!0,format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss",placeholder:["开始时间","结束时间"]}}]},{widget:"unione-table",dsn:"primary",columns:[{title:"流程类别",name:"instance.category",convert:{types:"dict",dictName:"FLOWLITECATEGORY"}},{title:"流程名称",name:"instance.title"},{title:"提交人",name:"instance.commitUserName"},{title:"提交时间",name:"instance.commitTime"},{title:"节点名称",name:"title"},{title:"接收时间",name:"created"},{title:"处理状态",name:"handleStatus",customCell:(x,N,R)=>{o.convert(x.status).then(g=>{const B=[];g&&B.push(g),x.handleUserId&&B.push("已签收"),B.length>0&&(x[R.dataIndex]=B.join("/"))})}}],leftBtns:["delBatch","add",{title:"批量审核",name:"auditBatch",type:"primary",props:{danger:!0}},{title:"批量签收",name:"signBatch",type:"primary"},{title:"批量放弃",name:"waiveBatch",type:"primary"}],rightBtns:["impData","downTmpl"],operation:{title:"操作",width:250,btns:["edit","delete",{title:"签收",name:"sign",event:{visible:x=>!x.row.handleUserId}},{title:"放弃",name:"waive",props:{danger:!0},event:{visible:x=>!!x.row.handleUserId}},{title:"意见",name:"opinion"},{title:"审核",name:"audit",type:"primary"}],count:4,more:{layout:"vertical"}}}],dsnList:["primary"]},component:"unione-flow-todo"};function f(){K.axios.flow({url:`/api/engine/profile/${s.flowKey}${s.flowVers?"/"+s.flowVers:""}`,method:"post"}).then(x=>{if(console.log("loaded flow tmpl info",x),x.success){const N=x.body.busiField;N&&N.forEach(R=>{R.visible!=!1&&(R.index!=null&&R.index!=null?h.configs.widgets[1].columns.splice(R.index,0,{title:R.title,name:"instance.busiData."+R.name}):h.configs.widgets[1].columns.push({title:R.title,name:"instance.busiData."+R.name}))}),l.setStorage("page-define-flow-todo:"+s.flowKey,JSON.stringify(h.configs)),p.load(A.value,h)}})}const p=new ht,m=t.computed(()=>p.$widgetList.value||[]),b=i;function w(x){const{btn:N,row:R,keys:g}=x;if(N.name=="audit"&&c.value.open(R?R.id:g,{flowKey:R?.instance?.sn,nodeKey:R?.sn,nodeTitle:R?.title}),N.name=="auditBatch"&&c.value.open(g,{nodeTitle:"批量审核"}),N.name=="sign"&&C(R.id),N.name=="signBatch"){if(g.length==0){n.warning("请选择要签收的任务");return}C(g)}if(N.name=="waive"&&y(R.id),N.name=="waiveBatch"){if(g.length==0){n.warning("请选择要放弃的任务");return}y(g)}N.name=="opinion"&&d.value.open({busiKey:R.instance.busiKey}),b("btnClick",x)}function C(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,n.confirm({content:"确定签收吗?",onOk:()=>{K.axios.flow({url:"/api/engine/task/sign",method:"post",data:N}).then(R=>{R.success?(n.success("签收成功"),k()):n.error(R.msg)})}})}function y(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,n.confirm({content:"确定签收吗?",onOk:()=>{K.axios.flow({url:"/api/engine/task/waive",method:"post",data:N}).then(R=>{R.success?(n.success("操作成功"),k()):n.error(R.msg)})}})}const A=t.ref("new_");t.onMounted(()=>{const x=t.inject("route");console.log("unione flow todo route",x),A.value=s.psn||x?.query?.psn||x?.meta?.psn||"new_",console.log("unione flow todo psn:"+A.value),p.setModel(x?.query?.model||x?.meta?.model||"run");const N={...s.params||{},...x?.query||{},...x?.params||{}};p.dataManager().params(N),s.leftBtns&&Array.isArray(s.leftBtns)&&(h.configs.widgets[1].leftBtns=[...h.configs.widgets[1].leftBtns,...s.leftBtns]),s.rightBtns&&Array.isArray(s.rightBtns)&&(h.configs.widgets[1].rightBtns=[...h.configs.widgets[1].rightBtns,...s.rightBtns]),s.operation&&typeof s.operation=="object"&&(h.configs.widgets[1].operation={...h.configs.widgets[1].operation,...s.operation}),p.dataManager().use("primary","list").store({ctx:"flow",controller:"/api/engine/task",findUrl:"/todo",findParams:[{name:"flowSn",value:s.flowKey}]}),s.flowKey?f():p.load(A.value,h)});function V(){return p.dataManager().use("primary","list")}function k(x){v(),x?p.ebus.$emit("table-list-search",x):p.ebus.$emit("table-list-reload")}function u(x){p.dataManager().params(x),p.ebus.$emit("query-form-params",x),p.ebus.$emit("table-list-search",{params:x})}function S(){return r.value?r.value[0]:null}function M(){return r.value?r.value[0].getSelected():null}function v(){r.value&&r.value[0].clearSelected(!0)}return e({storage:V,editor:p,reload:k,setParams:u,getTable:S,getSelected:M,clearSelected:v}),(x,N)=>{const R=t.resolveComponent("UnioneFlowAudit"),g=t.resolveComponent("UnioneFlowOpinion");return t.openBlock(),t.createBlock(_t,{class:"unione-flow-todo","setting-title":"页面设置",editor:t.unref(p)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,B=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:B.wid},[B.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:0,wid:B.wid,widget:B,editor:t.unref(p),onBtnClick:w,ref_for:!0,ref_key:"table",ref:r},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:1,wid:B.wid,widget:B,editor:t.unref(p),onBtnClick:w},null,40,["wid","widget","editor"]))],64))),128)),t.createVNode(R,{ref_key:"audit",ref:c,onSuccess:N[0]||(N[0]=B=>k())},null,512),t.createVNode(g,{ref_key:"opinion",ref:d},null,512)]),_:2},[t.unref(p)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Tt,{editor:t.unref(p)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),zd={class:"handel-opinion"},qd={key:0,class:"preset-opinions"},Qd={class:"ok"},Kd={class:"reject"},Wd=t.defineComponent({name:"FlowAudit",__name:"audit",props:{vars:{type:Object,required:!1}},emits:["success"],setup(a,{expose:e,emit:i}){const n=K.useDialog(),l=a,o=i,s=t.ref("审核"),r=t.ref(!1),c=t.ref(),d=t.ref({flowKey:"",nodeKey:""}),h=t.ref([]),f=t.ref(),p=t.ref({data:{handelOpinion:""},rules:{handelOpinion:[{required:!0,message:"请输入处理意见"}]}});function m(){r.value=!1}function b(A,{flowKey:V,nodeKey:k,nodeTitle:u}={}){if(c.value=A,s.value=u||"审核",!A){n.error("任务id不能为空");return}r.value=!0,d.value.flowKey=V,d.value.nodeKey=k,p.value.data.handelOpinion="",w()}function w(){const{flowKey:A,nodeKey:V}=d.value;K.axios.flow({url:`/api/engine/opinion/preset/${A||"-1"}/${V||"-1"}`,method:"post"}).then(k=>{h.value=k.body})}function C(A){p.value.data.handelOpinion=A.optxt}function y(A){const V=s.value;f.value.validate().then(()=>{n.confirm({content:`确定提交${V},并${A?"同意":"拒绝"}该申请么?`,onOk:()=>{const k={result:A,opinion:p.value.data.handelOpinion,vars:l.vars};Array.isArray(c.value)?k.taskIds=c.value:k.taskId=c.value,K.axios.flow({url:"/api/engine/task/submit",method:"post",data:k}).then(u=>{u.success?(n.success(`提交${V}成功`),m(),o("success")):n.error(u.msg)})}})})}return e({open:b}),(A,V)=>{const k=t.resolveComponent("a-textarea"),u=t.resolveComponent("a-form-item"),S=t.resolveComponent("a-tag"),M=t.resolveComponent("a-form"),v=t.resolveComponent("a-button"),x=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(x,{title:s.value,visible:r.value,"onUpdate:visible":V[3]||(V[3]=N=>r.value=N),width:600,rootClassName:"flow-audit-drawer"},{footer:t.withCtx(()=>[t.createVNode(v,{type:"primary",onClick:V[1]||(V[1]=N=>y(!0))},{default:t.withCtx(()=>V[4]||(V[4]=[t.createTextVNode("同意")])),_:1}),t.createVNode(v,{type:"primary",danger:"",onClick:V[2]||(V[2]=N=>y(!1))},{default:t.withCtx(()=>V[5]||(V[5]=[t.createTextVNode("拒绝")])),_:1})]),default:t.withCtx(()=>[t.createVNode(M,{layout:"vertical",model:p.value.data,rules:p.value.rules,ref_key:"formRef",ref:f},{default:t.withCtx(()=>[t.createElementVNode("div",zd,[t.createVNode(u,{label:"处理意见:",name:"handelOpinion"},{default:t.withCtx(()=>[t.createVNode(k,{value:p.value.data.handelOpinion,"onUpdate:value":V[0]||(V[0]=N=>p.value.data.handelOpinion=N),autoSize:"",rows:10,placeholder:"请输入处理意见"},null,8,["value"])]),_:1})]),h.value&&h.value.length?(t.openBlock(),t.createElementBlock("div",qd,[t.createVNode(u,{label:"预设意见:"},{default:t.withCtx(()=>[t.createElementVNode("div",Qd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==1),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"success",onClick:R=>C(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))]),t.createElementVNode("div",Kd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==2),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"orange",onClick:R=>C(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))])]),_:1})])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])]),_:1},8,["title","visible"])}}}),Yd={key:0,class:"flow-options"},Hd={class:"flow-task"},Gd={class:"node"},Jd={class:"user"},Xd={class:"time"},Zd={class:"content"},eh={key:1,class:"flow-options"},th={class:"flow-task"},ih={class:"user"},nh={class:"time"},lh={class:"content"},oh={key:0,class:"flow-title"},sh={class:"flow-task"},ah={class:"node"},rh={class:"user"},ch={class:"time"},dh={class:"content"},hh=t.defineComponent({name:"FlowOpinion",__name:"opinion",props:t.mergeModels({busiKey:{type:String,required:!1},flowId:{type:String,required:!1},taskId:{type:String,required:!1}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a,{expose:e}){const i=a,n=t.ref(!0),l=t.ref([]),o=t.ref({}),s=t.ref([]),r=t.useModel(a,"visible"),c=t.ref({busiKey:"",flowId:"",taskId:""}),d=t.computed(()=>({busiKey:c.value.busiKey||i.busiKey,flowId:c.value.flowId||i.flowId,taskId:c.value.taskId||i.taskId}));function h(){r.value=!1}function f({busiKey:m,flowId:b,taskId:w}={}){c.value.busiKey=m,c.value.flowId=b,c.value.taskId=w,r.value=!0,n.value=!0,p()}function p(){if(l.value=[],o.value={},s.value=[],!d.value.busiKey&&!d.value.flowId&&!d.value.taskId)return;let m="",b="";d.value.busiKey?(m="/api/engine/opinion/busiKey/"+d.value.busiKey,b="busiKey"):d.value.flowId?(m="/api/engine/opinion/flow/"+d.value.flowId,b="flow"):d.value.taskId&&(m="/api/engine/opinion/task/"+d.value.taskId,b="task"),K.axios.flow({url:m,method:"post"}).then(w=>{if(w.success)if(b=="busiKey"){s.value=w.body;for(let C=0;C<s.value.length&&n.value;C++)if(s.value[C].tasks?.length){for(let y=0;y<s.value[C].tasks.length;y++)if(s.value[C].tasks[y].opinions?.length){n.value=!1;break}}}else if(b=="flow"){if(l.value=w.body,l.value?.length){for(let C=0;C<l.value.length;C++)if(l.value[C].opinions?.length){n.value=!1;break}}}else b=="task"&&(o.value=w.body,o.value.opinions?.length&&(n.value=!1))})}return t.watch(i,()=>{p()}),t.onMounted(()=>{p()}),e({open:f,close:h}),(m,b)=>{const w=t.resolveComponent("a-timeline-item"),C=t.resolveComponent("a-timeline"),y=t.resolveComponent("a-empty"),A=t.resolveComponent("a-button"),V=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(V,{title:"处理意见",visible:r.value,"onUpdate:visible":b[0]||(b[0]=k=>r.value=k),width:600,rootClassName:"flow-opinion-drawer"},{footer:t.withCtx(()=>[t.createVNode(A,{onClick:h,class:"btn-close"},{default:t.withCtx(()=>b[1]||(b[1]=[t.createTextVNode("关闭")])),_:1})]),default:t.withCtx(()=>[l.value?.length?(t.openBlock(),t.createElementBlock("div",Yd,[t.createElementVNode("div",Hd,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.opinions,u=>(t.openBlock(),t.createBlock(w,{key:u.id},{default:t.withCtx(()=>[t.createElementVNode("div",Gd,"节点:"+t.toDisplayString(k.title),1),t.createElementVNode("div",Jd,"处理人:"+t.toDisplayString(u.userName),1),t.createElementVNode("div",Xd,"处理时间:"+t.toDisplayString(u.handleTime),1),t.createElementVNode("div",Zd,"处理意见:"+t.toDisplayString(u.optxt),1)]),_:2},1024))),128))],64))),128))]),_:1})])])):t.createCommentVNode("",!0),o.value?.id?(t.openBlock(),t.createElementBlock("div",eh,[t.createElementVNode("div",th,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.opinions,k=>(t.openBlock(),t.createBlock(w,{key:k.id},{default:t.withCtx(()=>[t.createElementVNode("div",ih,"处理人:"+t.toDisplayString(k.userName),1),t.createElementVNode("div",nh,"处理时间:"+t.toDisplayString(k.handleTime),1),t.createElementVNode("div",lh,"处理意见:"+t.toDisplayString(k.optxt),1)]),_:2},1024))),128))]),_:1})])])):t.createCommentVNode("",!0),s.value?.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(s.value,k=>(t.openBlock(),t.createElementBlock("div",{class:"flow-options",key:k.id},[s.value.length>1?(t.openBlock(),t.createElementBlock("div",oh,t.toDisplayString(k.title)+",提交时间:"+t.toDisplayString(k.commitTime)+t.toDisplayString(k.completeTime?",完成时间:"+k.completeTime:""),1)):t.createCommentVNode("",!0),t.createElementVNode("div",sh,[t.createVNode(C,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.tasks,u=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:u.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.opinions,S=>(t.openBlock(),t.createBlock(w,{key:S.id},{default:t.withCtx(()=>[t.createElementVNode("div",ah,"节点:"+t.toDisplayString(u.title),1),t.createElementVNode("div",rh,"处理人:"+t.toDisplayString(S.userName),1),t.createElementVNode("div",ch,"处理时间:"+t.toDisplayString(S.handleTime),1),t.createElementVNode("div",dh,"处理意见:"+t.toDisplayString(S.optxt),1)]),_:2},1024))),128))],64))),128))]),_:2},1024)])]))),128)):t.createCommentVNode("",!0),n.value?(t.openBlock(),t.createBlock(y,{key:3})):t.createCommentVNode("",!0)]),_:1},8,["visible"])}}}),xt={release(a){return K.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return K.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return K.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},fh={class:"unione-page list-page"},uh=ie(t.defineComponent({__name:"list",setup(a){const e=Le(),i=K.useDialog(),n=t.inject("router"),l=t.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),o=t.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});t.onMounted(()=>{r()});const s=t.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){s.value.loading=!0,xt.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(k=>{s.value.data=k.body,s.value.pagination.total=k.total*1}).finally(()=>{s.value.loading=!1})}function c(k){s.value.pagination.current=k.pagination.current,s.value.pagination.pageSize=k.pagination.pageSize,r()}function d({params:k,keywords:u}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=u,r()}function h({btn:k,event:u,row:S}){console.log("table btn click",k,u,S),(k.name=="add"||k.name=="edit")&&n.push({path:"/dev/data/define/edit",query:S?{id:S.id}:{}}),k.name=="impFromDb"&&(p.value=!0),k.name=="release"&&f(S),k.name=="view"&&n.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(k){i.confirm({content:"确定要发布当前数据么?",onOk:()=>{xt.release([k.id]).then(u=>{u.success?(i.success({title:"发布成功",content:u.body}),r()):i.error({title:"发布失败",content:u.body})})}})}const p=t.ref(!1),m=t.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=t.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),w=t.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function C(k){!k||!Object.keys(k).length||!k.dsId||(te.message.loading("数据加载中..."),w.value.params=k,w.value.loading=!0,xt.loadFromDb(k).then(u=>{w.value.loading=!1,te.message.destroy(),u.success?(u.body.forEach(S=>{S.checkable=!!S.id}),w.value.data=u.body,w.value.pagination.total=u.body.length):te.message.error(u.message)}))}function y(k){w.value.pagination.current=k.pagination.current,w.value.pagination.pageSize=k.pagination.pageSize}const A=t.ref();function V({btn:k}){if(k.name!="imp")return;const u=A.value.getSelected();u?.keys?.length?i.confirm({content:"确定导入选中的"+u.keys.length+"条记录么?",onOk:()=>{te.message.loading("数据导入中..."),xt.impFromDb({dsId:w.value.params.dsId,tables:u.keys.join()}).then(S=>{te.message.destroy(),S.success?(i.success({content:S.message}),s.value.pagination.current=1,r()):i.error({context:S.message})})}}):i.error({content:"请选择目标记录!"})}return(k,u)=>{const S=t.resolveComponent("UnioneQuery"),M=t.resolveComponent("UnioneTable"),v=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",fh,[t.createVNode(S,{widget:l.value,onQuery:d,onReset:d},null,8,["widget"]),t.createVNode(M,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),t.createVNode(v,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":u[0]||(u[0]=x=>p.value=x),placement:"left"},{default:t.withCtx(()=>[t.createVNode(S,{widget:m.value,onQuery:C,onReset:C,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),t.createVNode(M,{widget:b.value,dataList:w.value.data,loading:w.value.loading,pagination:w.value.pagination,onChange:y,rowKey:"name",ref_key:"loadTableObj",ref:A},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),ph={class:"unione-props-setting data-field-manage"},mh={key:0},gh={key:1},kh=["onClick"],bh=["onClick"],yh=["onClick"],wh={key:1},Ah=ie(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),i=t.useModel(a,"modelValue"),n=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{n.value.selectedRowKeys.includes(b)||n.value.selectedRowKeys.push(b);const w=[];i.value.forEach(C=>{!m.includes(C.name)&&n.value.selectedRowKeys.includes(C.name)&&w.push(C.name)}),w.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(C=>!w.includes(C)))})}}),l={mounted:m=>m.focus()},o=t.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let b in m){const w=i.value.filter(C=>C.name==b);if(w&&w[0]){let C=o.value[b];Object.keys(C).forEach(y=>{w[0][y]=C[y]})}}o.value={}}function r(m,b){s();const w={};w[b]=m[b]||"",o.value[m.name]=w}function c(m,b){if(!m||!b){o.value={};return}const w=o.value[m.name][b];if(b=="name"&&i.value.filter(y=>y[b]==w&&y.name!=m.name).length>0){te.Modal.warn({title:"提示信息",content:"字段名称["+w+"]已存在"});return}m[b]=w,o.value={}}function d(m,b){const w=i.value.filter(C=>C.name==m.name)[0];return b=="isFk"?w.configs?.fkey?.enable:w[b]==1}function h(m,b){const w=i.value.filter(C=>C.name==m.name)[0];b=="isFk"?(w.configs||(w.configs={}),w.configs.fkey||(w.configs.fkey={}),w.configs.fkey.enable=!w.configs.fkey.enable):w[b]!=1?w[b]=1:w[b]=0}function f(){if(s(),i.value.filter(w=>w.name=="new_").length>0){o.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};i.value.push(b),o.value[b.name]={name:"new_"}}function p(){if(!n.value.selectedRowKeys.length){te.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}te.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{i.value=i.value.filter(m=>!n.value.selectedRowKeys.includes(m.name)),n.value.selectedRowKeys=[]}})}return(m,b)=>{const w=t.resolveComponent("a-button"),C=t.resolveComponent("a-tooltip"),y=t.resolveComponent("a-input"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-select-option"),k=t.resolveComponent("a-select"),u=t.resolveComponent("a-checkbox"),S=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ph,[t.createVNode(w,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:t.withCtx(()=>b[1]||(b[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(w,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:t.withCtx(()=>b[2]||(b[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(S,{columns:e.value,"data-source":i.value,pagination:!0,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:M})=>[["name","title"].includes(M.key)?(t.openBlock(),t.createElementBlock("span",mh,[b[3]||(b[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(t.openBlock(),t.createElementBlock("span",gh,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),M.key==="isPk"?(t.openBlock(),t.createBlock(C,{key:2,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[b[4]||(b[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="isFk"?(t.openBlock(),t.createBlock(C,{key:3,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="isNull"?(t.openBlock(),t.createBlock(C,{key:4,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0),M.key==="syncEnable"?(t.openBlock(),t.createBlock(C,{key:5,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:M,text:v,record:x})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:N=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[x.name][M.dataIndex],"onUpdate:value":N=>o.value[x.name][M.dataIndex]=N,onBlur:N=>c(x,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(v||" "),1)],64))],10,kh)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:N=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(A,{key:0,value:o.value[x.name][M.dataIndex],"onUpdate:value":N=>o.value[x.name][M.dataIndex]=N,onBlur:N=>c(x,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(v||" "),1)],64))],10,bh)):["dataType"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:N=>r(x,M.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(k,{key:0,value:x[M.dataIndex],"onUpdate:value":N=>x[M.dataIndex]=N,onBlur:b[0]||(b[0]=N=>c())},{default:t.withCtx(()=>[t.createVNode(V,{key:"String",value:"String"}),t.createVNode(V,{key:"Long",value:"Long"}),t.createVNode(V,{key:"Short",value:"Short"}),t.createVNode(V,{key:"Integer",value:"Integer"}),t.createVNode(V,{key:"Float",value:"Float"}),t.createVNode(V,{key:"Double",value:"Double"}),t.createVNode(V,{key:"Date",value:"Date"}),t.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",wh,t.toDisplayString(v),1))],10,yh)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(u,{key:3,checked:d(x,M.dataIndex),onClick:N=>h(x,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(u,{key:4,checked:!d(x,M.dataIndex),onClick:N=>h(x,M.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Wl=1024;let xh=0,mn=class{constructor(e,i){this.from=e,this.to=i}};class oe{constructor(e={}){this.id=xh++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ee.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}oe.closedBy=new oe({deserialize:a=>a.split(" ")}),oe.openedBy=new oe({deserialize:a=>a.split(" ")}),oe.group=new oe({deserialize:a=>a.split(" ")}),oe.isolate=new oe({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),oe.contextHash=new oe({perNode:!0}),oe.lookAhead=new oe({perNode:!0}),oe.mounted=new oe({perNode:!0});class Ai{constructor(e,i,n){this.tree=e,this.overlay=i,this.parser=n}static get(e){return e&&e.props&&e.props[oe.mounted.id]}}const Ch=Object.create(null);class Ee{constructor(e,i,n,l=0){this.name=e,this.props=i,this.id=n,this.flags=l}static define(e){let i=e.props&&e.props.length?Object.create(null):Ch,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ee(e.name||"",i,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(oe.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let n in e)for(let l of n.split(" "))i[l]=e[n];return n=>{for(let l=n.prop(oe.group),o=-1;o<(l?l.length:0);o++){let s=i[o<0?n.name:l[o]];if(s)return s}}}}Ee.none=new Ee("",Object.create(null),0,8);class gn{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let n of this.types){let l=null;for(let o of e){let s=o(n);s&&(l||(l=Object.assign({},n.props)),l[s[0].id]=s[1])}i.push(l?new Ee(n.name,l,n.id,n.flags):n)}return new gn(i)}}const xi=new WeakMap,Yl=new WeakMap;var we;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(we||(we={}));class ke{constructor(e,i,n,l,o){if(this.type=e,this.children=i,this.positions=n,this.length=l,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,r]of o)this.props[typeof s=="number"?s:s.id]=r}}toString(){let e=Ai.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let n of this.children){let l=n.toString();l&&(i&&(i+=","),i+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new yn(this.topNode,e)}cursorAt(e,i=0,n=0){let l=xi.get(this)||this.topNode,o=new yn(l);return o.moveTo(e,i),xi.set(this,o._tree),o}get topNode(){return new Fe(this,0,0,null)}resolve(e,i=0){let n=ei(xi.get(this)||this.topNode,e,i,!1);return xi.set(this,n),n}resolveInner(e,i=0){let n=ei(Yl.get(this)||this.topNode,e,i,!0);return Yl.set(this,n),n}resolveStack(e,i=0){return Bh(this,e,i)}iterate(e){let{enter:i,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&we.IncludeAnonymous)>0;for(let c=this.cursor(s|we.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||i(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&n&&(r||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:An(Ee.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,l)=>new ke(this.type,i,n,l,this.propValues),e.makeTree||((i,n,l)=>new ke(Ee.none,i,n,l)))}static build(e){return Nh(e)}}ke.empty=new ke(Ee.none,[],[],0);class kn{constructor(e,i){this.buffer=e,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new kn(this.buffer,this.index)}}class ut{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return Ee.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],n=this.buffer[e+3],l=this.set.types[i],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,i,n,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=i&&!(Hl(o,l,s[c+1],s[c+2])&&(r=c,n>0));c=s[c+3]);return r}slice(e,i,n){let l=this.buffer,o=new Uint16Array(i-e),s=0;for(let r=e,c=0;r<i;){o[c++]=l[r++],o[c++]=l[r++]-n;let d=o[c++]=l[r++]-n;o[c++]=l[r++]-e,s=Math.max(s,d)}return new ut(o,s,this.set)}}function Hl(a,e,i,n){switch(a){case-2:return i<e;case-1:return n>=e&&i<e;case 0:return i<e&&n>e;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function ei(a,e,i,n){for(var l;a.from==a.to||(i<1?a.from>=e:a.from>e)||(i>-1?a.to<=e:a.to<e);){let s=!n&&a instanceof Fe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:we.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Fe&&s.index<0&&((l=r.enter(e,i,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,i,o);if(!s)return a;a=s}}class Gl{cursor(e=0){return new yn(this,e)}getChild(e,i=null,n=null){let l=Jl(this,e,i,n);return l.length?l[0]:null}getChildren(e,i=null,n=null){return Jl(this,e,i,n)}resolve(e,i=0){return ei(this,e,i,!1)}resolveInner(e,i=0){return ei(this,e,i,!0)}matchContext(e){return bn(this,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),n=this;for(;i;){let l=i.lastChild;if(!l||l.to!=i.to)break;l.type.isError&&l.from==l.to?(n=i,i=l.prevSibling):i=l}return n}get node(){return this}get next(){return this.parent}}class Fe extends Gl{constructor(e,i,n,l){super(),this._tree=e,this.from=i,this.index=n,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,n,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,d=i>0?r.length:-1;e!=d;e+=i){let h=r[e],f=c[e]+s.from;if(Hl(l,n,f,f+h.length)){if(h instanceof ut){if(o&we.ExcludeBuffers)continue;let p=h.findChild(0,h.buffer.length,i,n-f,l);if(p>-1)return new pt(new vh(s,h,e,f),null,p)}else if(o&we.IncludeAnonymous||!h.type.isAnonymous||wn(h)){let p;if(!(o&we.IgnoreMounts)&&(p=Ai.get(h))&&!p.overlay)return new Fe(p.tree,f,e,s);let m=new Fe(h,f,e,s);return o&we.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(i<0?h.children.length-1:0,i,n,l)}}}if(o&we.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+i:e=i<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,i,n=0){let l;if(!(n&we.IgnoreOverlays)&&(l=Ai.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((i>0?s<=o:s<o)&&(i<0?r>=o:r>o))return new Fe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Jl(a,e,i,n){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(i!=null){for(let s=!1;!s;)if(s=l.type.is(i),!l.nextSibling())return o}for(;;){if(n!=null&&l.type.is(n))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return n==null?o:[]}}function bn(a,e,i=e.length-1){for(let n=a.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class vh{constructor(e,i,n,l){this.parent=e,this.buffer=i,this.index=n,this.start=l}}class pt extends Gl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,n){super(),this.context=e,this._parent=i,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,i,n){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,i-this.context.start,n);return o<0?null:new pt(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,i,n=0){if(n&we.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return o<0?null:new pt(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new pt(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new pt(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:n}=this.context,l=this.index+4,o=n.buffer[this.index+3];if(o>l){let s=n.buffer[this.index+1];e.push(n.slice(l,o,s)),i.push(0)}return new ke(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Xl(a){if(!a.length)return null;let e=0,i=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>i.from||s.to<i.to)&&(i=s,e=o)}let n=i instanceof Fe&&i.index<0?null:i.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Sh(l,i)}class Sh{constructor(e,i){this.heads=e,this.node=i}get next(){return Xl(this.heads)}}function Bh(a,e,i){let n=a.resolveInner(e,i),l=null;for(let o=n instanceof Fe?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[n])).push(s.resolve(e,i)),o=s}else{let s=Ai.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Fe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(ei(r,e,i,!1))}}return l?Xl(l):n}class yn{get name(){return this.type.name}constructor(e,i=0){if(this.mode=i,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:n,buffer:l}=this.buffer;return this.type=i||l.set.types[l.buffer[e]],this.from=n+l.buffer[e+1],this.to=n+l.buffer[e+2],!0}yield(e){return e?e instanceof Fe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,n,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,i-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,n=this.mode){return this.buffer?n&we.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&we.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&we.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,n=this.stack.length-1;if(e<0){let l=n<0?0:this.stack[n]+4;if(this.index!=l)return this.yieldBuf(i.findChild(l,this.index,-1,0,4))}else{let l=i.buffer[this.index+3];if(l<(n<0?i.buffer.length:i.buffer[this.stack[n]+3]))return this.yieldBuf(l)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,n,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(l.buffer.buffer[o+3]<this.index)return!1;({index:i,parent:n}=l)}else({index:i,_parent:n}=this._tree);for(;n;{index:i,_parent:n}=n)if(i>-1)for(let o=i+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let r=n._tree.children[o];if(this.mode&we.IncludeAnonymous||r instanceof ut||!r.type.isAnonymous||wn(r))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,n=0;if(e&&e.context==this.buffer)e:for(let l=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==l){if(l==this.index)return s;i=s,n=o+1;break e}l=this.stack[--o]}for(let l=n;l<this.stack.length;l++)i=new pt(this.buffer,i,this.stack[l]);return this.bufferNode=new pt(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){for(let n=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(l=!0)}for(;l&&i&&i(this),l=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,l=!0}}}matchContext(e){if(!this.buffer)return bn(this.node,e);let{buffer:i}=this.buffer,{types:n}=i.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return bn(this.node,e,l);let s=n[i.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function wn(a){return a.children.some(e=>e instanceof ut||!e.type.isAnonymous||wn(e))}function Nh(a){var e;let{buffer:i,nodeSet:n,maxBufferLength:l=Wl,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(i)?new kn(i,i.length):i,c=n.types,d=0,h=0;function f(u,S,M,v,x,N){let{id:R,start:g,end:B,size:T}=r,O=h;for(;T<0;)if(r.next(),T==-1){let P=o[R];M.push(P),v.push(g-u);return}else if(T==-3){d=R;return}else if(T==-4){h=R;return}else throw new RangeError(`Unrecognized record size: ${T}`);let _=c[R],$,I,j=g-u;if(B-g<=l&&(I=C(r.pos-S,x))){let P=new Uint16Array(I.size-I.skip),E=r.pos-I.size,J=P.length;for(;r.pos>E;)J=y(I.start,P,J);$=new ut(P,B-I.start,n),j=I.start-u}else{let P=r.pos-T;r.next();let E=[],J=[],F=R>=s?R:-1,z=0,pe=B;for(;r.pos>P;)F>=0&&r.id==F&&r.size>=0?(r.end<=pe-l&&(b(E,J,g,z,r.end,pe,F,O),z=E.length,pe=r.end),r.next()):N>2500?p(g,P,E,J):f(g,P,E,J,F,N+1);if(F>=0&&z>0&&z<E.length&&b(E,J,g,z,g,pe,F,O),E.reverse(),J.reverse(),F>-1&&z>0){let tt=m(_);$=An(_,E,J,0,E.length,0,B-g,tt,tt)}else $=w(_,E,J,B-g,O-B)}M.push($),v.push(j)}function p(u,S,M,v){let x=[],N=0,R=-1;for(;r.pos>S;){let{id:g,start:B,end:T,size:O}=r;if(O>4)r.next();else{if(R>-1&&B<R)break;R<0&&(R=T-l),x.push(g,B,T),N++,r.next()}}if(N){let g=new Uint16Array(N*4),B=x[x.length-2];for(let T=x.length-3,O=0;T>=0;T-=3)g[O++]=x[T],g[O++]=x[T+1]-B,g[O++]=x[T+2]-B,g[O++]=O;M.push(new ut(g,x[2]-B,n)),v.push(B-u)}}function m(u){return(S,M,v)=>{let x=0,N=S.length-1,R,g;if(N>=0&&(R=S[N])instanceof ke){if(!N&&R.type==u&&R.length==v)return R;(g=R.prop(oe.lookAhead))&&(x=M[N]+R.length+g)}return w(u,S,M,v,x)}}function b(u,S,M,v,x,N,R,g){let B=[],T=[];for(;u.length>v;)B.push(u.pop()),T.push(S.pop()+M-x);u.push(w(n.types[R],B,T,N-x,g-N)),S.push(x-M)}function w(u,S,M,v,x=0,N){if(d){let R=[oe.contextHash,d];N=N?[R].concat(N):[R]}if(x>25){let R=[oe.lookAhead,x];N=N?[R].concat(N):[R]}return new ke(u,S,M,v,N)}function C(u,S){let M=r.fork(),v=0,x=0,N=0,R=M.end-l,g={size:0,start:0,skip:0};e:for(let B=M.pos-u;M.pos>B;){let T=M.size;if(M.id==S&&T>=0){g.size=v,g.start=x,g.skip=N,N+=4,v+=4,M.next();continue}let O=M.pos-T;if(T<0||O<B||M.start<R)break;let _=M.id>=s?4:0,$=M.start;for(M.next();M.pos>O;){if(M.size<0)if(M.size==-3)_+=4;else break e;else M.id>=s&&(_+=4);M.next()}x=$,v+=T,N+=_}return(S<0||v==u)&&(g.size=v,g.start=x,g.skip=N),g.size>4?g:void 0}function y(u,S,M){let{id:v,start:x,end:N,size:R}=r;if(r.next(),R>=0&&v<s){let g=M;if(R>4){let B=r.pos-(R-4);for(;r.pos>B;)M=y(u,S,M)}S[--M]=g,S[--M]=N-u,S[--M]=x-u,S[--M]=v}else R==-3?d=v:R==-4&&(h=v);return M}let A=[],V=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,A,V,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:A.length?V[0]+A[0].length:0;return new ke(c[a.topID],A.reverse(),V.reverse(),k)}const Zl=new WeakMap;function Ci(a,e){if(!a.isAnonymous||e instanceof ut||e.type!=a)return 1;let i=Zl.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=a||!(n instanceof ke)){i=1;break}i+=Ci(a,n)}Zl.set(e,i)}return i}function An(a,e,i,n,l,o,s,r,c){let d=0;for(let b=n;b<l;b++)d+=Ci(a,e[b]);let h=Math.ceil(d*1.5/8),f=[],p=[];function m(b,w,C,y,A){for(let V=C;V<y;){let k=V,u=w[V],S=Ci(a,b[V]);for(V++;V<y;V++){let M=Ci(a,b[V]);if(S+M>=h)break;S+=M}if(V==k+1){if(S>h){let M=b[k];m(M.children,M.positions,0,M.children.length,w[k]+A);continue}f.push(b[k])}else{let M=w[V-1]+b[V-1].length-u;f.push(An(a,b,w,k,V,u,M,null,c))}p.push(u+A-o)}}return m(e,i,n,l,0),(r||c)(f,p,s)}class Ct{constructor(e,i,n,l,o=!1,s=!1){this.from=e,this.to=i,this.tree=n,this.offset=l,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],n=!1){let l=[new Ct(0,e.length,e,0,!1,n)];for(let o of i)o.to>e.length&&l.push(o);return l}static applyChanges(e,i,n=128){if(!i.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,d=0;;r++){let h=r<i.length?i[r]:null,f=h?h.fromA:1e9;if(f-c>=n)for(;s&&s.from<f;){let p=s;if(c>=p.from||f<=p.to||d){let m=Math.max(p.from,c)-d,b=Math.min(p.to,f)-d;p=m>=b?null:new Ct(m,b,p.tree,p.offset+d,r>0,!!h)}if(p&&l.push(p),s.to>f)break;s=o<e.length?e[o++]:null}if(!h)break;c=h.toA,d=h.toA-h.toB}return l}}class eo{startParse(e,i,n){return typeof e=="string"&&(e=new Vh(e)),n=n?n.length?n.map(l=>new mn(l.from,l.to)):[new mn(0,0)]:[new mn(0,e.length)],this.createParse(e,i||[],n)}parse(e,i,n){let l=this.startParse(e,i,n);for(;;){let o=l.advance();if(o)return o}}}class Vh{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new oe({perNode:!0});class vi{constructor(e,i,n,l,o,s,r,c,d,h=0,f){this.p=e,this.stack=i,this.state=n,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,i)=>i%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,i,n=0){let l=e.parser.context;return new vi(e,[],i,n,n,0,[],0,l?new to(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,i){this.stack.push(this.state,i,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var i;let n=e>>19,l=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let r=o.dynamicPrecedence(l);if(r&&(this.score+=r),n==0){this.pushState(o.getGoto(this.state,l,!0),this.reducePos),l<o.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(l,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((i=this.p.parser.nodeSet.types[l])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let f=c?this.stack[c-1]:0,p=this.bufferBase+this.buffer.length-f;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,d,m,p+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,i,n,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,r=this.buffer.length;if(r==0&&s.parent&&(r=s.bufferBase-s.parent.bufferBase,s=s.parent),r>0&&s.buffer[r-4]==0&&s.buffer[r-1]>-1){if(i==n)return;if(s.buffer[r-2]>=i){s.buffer[r-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,i,n,l);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let r=!1;for(let c=s;c>0&&this.buffer[c-2]>n;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,l>4&&(l-=4)}this.buffer[s]=e,this.buffer[s+1]=i,this.buffer[s+2]=n,this.buffer[s+3]=l}}shift(e,i,n,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(i,n),i<=this.p.parser.maxNode&&this.buffer.push(i,n,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||i<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,n),this.shiftContext(i,n),i<=s.maxNode&&this.buffer.push(i,n,l,4)}}apply(e,i,n,l){e&65536?this.reduce(e):this.shift(e,i,n,l)}useNode(e,i){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(i,l),this.buffer.push(n,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,i=e.buffer.length;for(;i>0&&e.buffer[i-2]>e.reducePos;)i-=4;let n=e.buffer.slice(i),l=e.bufferBase+i;for(;e&&l==e.bufferBase;)e=e.parent;return new vi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,i){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,i,4),this.storeNode(0,this.pos,i,n?8:4),this.pos=this.reducePos=i,this.score-=190}canShift(e){for(let i=new Rh(this);;){let n=this.p.parser.stateSlot(i.state,4)||this.p.parser.hasAction(i.state,e);if(n==0)return!1;if(!(n&65536))return!0;i.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let i=this.p.parser.nextStates(this.state);if(i.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<i.length;o+=2)(s=i[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(i[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<i.length;o+=2){let s=i[o+1];l.some((r,c)=>c&1&&r==s)||l.push(i[o],s)}i=l}let n=[];for(let l=0;l<i.length&&n.length<4;l+=2){let o=i[l+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(i[l],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,i=e.stateSlot(this.state,5);if(!(i&65536))return!1;if(!e.validAction(this.state,i)){let n=i>>19,l=i&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;i=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(i),!0}findForcedReduction(){let{parser:e}=this.p,i=[],n=(l,o)=>{if(!i.includes(l))return i.push(l),e.allActions(l,s=>{if(!(s&393216))if(s&65536){let r=(s>>19)-o;if(r>1){let c=s&65535,d=this.stack.length-r*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return r<<19|65536|c}}else{let r=n(s,o+1);if(r!=null)return r}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let i=0;i<this.stack.length;i+=3)if(this.stack[i]!=e.stack[i])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(i)))}reduceContext(e,i){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(i)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let i=new to(this.curContext.tracker,e);i.hash!=this.curContext.hash&&this.emitContext(),this.curContext=i}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class to{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class Rh{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let i=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],i,!0);this.state=l}}class Si{constructor(e,i,n){this.stack=e,this.pos=i,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,i=e.bufferBase+e.buffer.length){return new Si(e,i,i-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Si(this.stack,this.pos,this.index)}}function Bi(a,e=Uint16Array){if(typeof a!="string")return a;let i=null;for(let n=0,l=0;n<a.length;){let o=0;for(;;){let s=a.charCodeAt(n++),r=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,r=!0),o+=c,r)break;o*=46}i?i[l++]=o:i=new e(o)}return i}class Ni{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const io=new Ni;class Eh{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=io,this.rangeIndex=0,this.pos=this.chunkPos=i[0].from,this.range=i[0],this.end=i[i.length-1].to,this.readNext()}resolveOffset(e,i){let n=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!l)return null;let s=this.ranges[--l];o-=n.from-s.to,n=s}for(;i<0?o>n.to:o>=n.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-n.to,n=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let i of this.ranges)if(i.to>e)return Math.max(e,i.from);return this.end}peek(e){let i=this.chunkOff+e,n,l;if(i>=0&&i<this.chunk.length)n=this.pos+e,l=this.chunk.charCodeAt(i);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=n;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-n)),l=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),l}acceptToken(e,i=0){let n=i?this.resolveOffset(i,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,i){this.token.value=e,this.token.end=i}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:i}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=i,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),i=this.pos+e.length;this.chunk=i>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,i){if(i?(this.token=i,i.start=e,i.lookAhead=e+1,i.value=i.extended=-1):this.token=io,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,i){if(e>=this.chunkPos&&i<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,i-this.chunkPos);if(e>=this.chunk2Pos&&i<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,i-this.chunk2Pos);if(e>=this.range.from&&i<=this.range.to)return this.input.read(e,i);let n="";for(let l of this.ranges){if(l.from>=i)break;l.to>e&&(n+=this.input.read(Math.max(l.from,e),Math.min(l.to,i)))}return n}}class It{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;Oh(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}It.prototype.contextual=It.prototype.fallback=It.prototype.extend=!1,It.prototype.fallback=It.prototype.extend=!1;function Oh(a,e,i,n,l,o){let s=0,r=1<<n,{dialect:c}=i.p.parser;e:for(;r&a[s];){let d=a[s+1];for(let m=s+3;m<d;m+=2)if((a[m+1]&r)>0){let b=a[m];if(c.allows(b)&&(e.token.value==-1||e.token.value==b||Mh(b,e.token.value,l,o))){e.acceptToken(b);break}}let h=e.next,f=0,p=a[s+2];if(e.next<0&&p>f&&a[d+p*3-3]==65535){s=a[d+p*3-1];continue e}for(;f<p;){let m=f+p>>1,b=d+m+(m<<1),w=a[b],C=a[b+1]||65536;if(h<w)p=m;else if(h>=C)f=m+1;else{s=a[b+2],e.advance();continue e}}break}}function no(a,e,i){for(let n=e,l;(l=a[n])!=65535;n++)if(l==i)return n-e;return-1}function Mh(a,e,i,n){let l=no(i,n,e);return l<0||no(i,n,a)<l}const _e=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let xn=null;function lo(a,e,i){let n=a.cursor(we.IncludeAnonymous);for(n.moveTo(e);;)if(!(i<0?n.childBefore(e):n.childAfter(e)))for(;;){if((i<0?n.to<e:n.from>e)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(a.length,Math.max(n.from+1,e+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:a.length}}class _h{constructor(e,i){this.fragments=e,this.nodeSet=i,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lo(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lo(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let i=this.trees.length-1;if(i<0)return this.nextFragment(),null;let n=this.trees[i],l=this.index[i];if(l==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[l],s=this.start[i]+n.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof ke){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(oe.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[i]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[i]++,this.nextStart=s+o.length}}}class Th{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Ni)}getActions(e){let i=0,n=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if(!(1<<d&s))continue;let h=o[d],f=this.tokens[d];if(!(n&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=s||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=s,f.context=r),f.lookAhead>f.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let p=i;if(f.extended>-1&&(i=this.addActions(e,f.extended,f.end,i)),i=this.addActions(e,f.value,f.end,i),!h.extend&&(n=f,i>p))break}}for(;this.actions.length>i;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new Ni,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,i=this.addActions(e,n.value,n.end,i)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let i=new Ni,{pos:n,p:l}=e;return i.start=n,i.end=Math.min(n+1,l.stream.end),i.value=n==l.stream.end?l.parser.eofTerm:0,i}updateCachedToken(e,i,n){let l=this.stream.clipPos(n.pos);if(i.token(this.stream.reset(l,e),n),e.value>-1){let{parser:o}=n.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let r=o.specializers[s](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,i,n,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=i,this.actions[l++]=n,l}addActions(e,i,n,l){let{state:o}=e,{parser:s}=e.p,{data:r}=s;for(let c=0;c<2;c++)for(let d=s.stateSlot(o,c?2:1);;d+=3){if(r[d]==65535)if(r[d+1]==1)d=nt(r,d+2);else{l==0&&r[d+1]==2&&(l=this.putAction(nt(r,d+2),i,n,l));break}r[d]==i&&(l=this.putAction(nt(r,d+1),i,n,l))}return l}}class Ih{constructor(e,i,n,l){this.parser=e,this.input=i,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Eh(i,l),this.tokens=new Th(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[vi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new _h(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,i=this.minStackPos,n=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let r=e[s];for(;;){if(this.tokens.mainToken=null,r.pos>i)n.push(r);else{if(this.advanceStack(r,n,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!n.length){let s=l&&Dh(l);if(s)return _e&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw _e&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&l){let s=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,n);if(s)return _e&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((r,c)=>c.score-r.score);n.length>s;)n.pop();n.some(r=>r.reducePos>i)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let r=n[s];for(let c=s+1;c<n.length;c++){let d=n[c];if(r.sameState(d)||r.buffer.length>500&&d.buffer.length>500)if((r.score-d.score||r.buffer.length-d.buffer.length)>0)n.splice(c--,1);else{n.splice(s--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,i,n){let l=e.pos,{parser:o}=this,s=_e?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let p=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(p>-1&&f.length&&(!d||(f.prop(oe.contextHash)||0)==h))return e.useNode(f,p),_e&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof ke)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof ke&&f.positions[0]==0)f=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),_e&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let h=c[d++],f=c[d++],p=c[d++],m=d==c.length||!n,b=m?e:e.split(),w=this.tokens.mainToken;if(b.apply(h,f,w?w.start:b.pos,p),_e&&console.log(s+this.stackID(b)+` (via ${h&65536?`reduce of ${o.getName(h&65535)}`:"shift"} for ${o.getName(f)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?i.push(b):n.push(b)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return oo(e,i),!0}}runRecovery(e,i,n){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=i[s<<1],d=i[(s<<1)+1],h=_e?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),_e&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let f=r.split(),p=h;for(let m=0;f.forceReduce()&&m<10&&(_e&&console.log(p+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,n));m++)_e&&(p=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(c))_e&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>r.pos?(d==r.pos&&(d++,c=0),r.recoverByDelete(c,d),_e&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),oo(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),ke.build({buffer:Si.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let i=(xn||(xn=new WeakMap)).get(e);return i||xn.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function oo(a,e){for(let i=0;i<e.length;i++){let n=e[i];if(n.pos==a.pos&&n.sameState(a)){e[i].score<a.score&&(e[i]=a);return}}e.push(a)}class Fh{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class Vi extends eo{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let i=e.nodeNames.split(" ");this.minRepeatTerm=i.length;for(let r=0;r<e.repeatNodeCount;r++)i.push("");let n=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<i.length;r++)l.push([]);function o(r,c,d){l[r].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let r of e.nodeProps){let c=r[0];typeof c=="string"&&(c=oe[c]);for(let d=1;d<r.length;){let h=r[d++];if(h>=0)o(h,c,r[d++]);else{let f=r[d+-h];for(let p=-h;p>0;p--)o(r[d++],c,f);d++}}}this.nodeSet=new gn(i.map((r,c)=>Ee.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:n.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Wl;let s=Bi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(so),this.states=Bi(e.states,Uint32Array),this.data=Bi(e.stateData),this.goto=Bi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new It(s,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,i,n){let l=new Ih(this,e,i,n);for(let o of this.wrappers)l=o(l,e,i,n);return l}getGoto(e,i,n=!1){let l=this.goto;if(i>=l[0])return-1;for(let o=l[i+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&n)return c;for(let d=o+(s>>1);o<d;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,i){let n=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=n[o])==65535)if(n[o+1]==1)s=n[o=nt(n,o+2)];else{if(n[o+1]==2)return nt(n,o+2);break}if(s==i||s==0)return nt(n,o+1)}return 0}stateSlot(e,i){return this.states[e*6+i]}stateFlag(e,i){return(this.stateSlot(e,0)&i)>0}validAction(e,i){return!!this.allActions(e,n=>n==i?!0:null)}allActions(e,i){let n=this.stateSlot(e,4),l=n?i(n):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=nt(this.data,o+2);else break;l=i(nt(this.data,o+1))}return l}nextStates(e){let i=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=nt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let l=this.data[n+1];i.some((o,s)=>s&1&&o==l)||i.push(this.data[n],l)}}return i}configure(e){let i=Object.assign(Object.create(Vi.prototype),this);if(e.props&&(i.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);i.top=n}return e.tokenizers&&(i.tokenizers=this.tokenizers.map(n=>{let l=e.tokenizers.find(o=>o.from==n);return l?l.to:n})),e.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((n,l)=>{let o=e.specializers.find(r=>r.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return i.specializers[l]=so(s),s})),e.contextTracker&&(i.context=e.contextTracker),e.dialect&&(i.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(i.strict=e.strict),e.wrap&&(i.wrappers=i.wrappers.concat(e.wrap)),e.bufferLength!=null&&(i.bufferLength=e.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let i=this.dynamicPrecedences;return i==null?0:i[e]||0}parseDialect(e){let i=Object.keys(this.dialects),n=i.map(()=>!1);if(e)for(let o of e.split(" ")){let s=i.indexOf(o);s>=0&&(n[s]=!0)}let l=null;for(let o=0;o<i.length;o++)if(!n[o])for(let s=this.dialects[i[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Fh(e,n,l)}static deserialize(e){return new Vi(e)}}function nt(a,e){return a[e]|a[e+1]<<16}function Dh(a){let e=null;for(let i of a){let n=i.p.stoppedAt;(i.pos==i.p.stream.end||n!=null&&i.pos>n)&&i.p.parser.stateFlag(i.state,2)&&(!e||e.score<i.score)&&(e=i)}return e}function so(a){if(a.external){let e=a.extend?1:0;return(i,n)=>a.external(i,n)<<1|e}return a.get}let $h=0;class De{constructor(e,i,n,l){this.name=e,this.set=i,this.base=n,this.modified=l,this.id=$h++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let n=typeof e=="string"?e:"?";if(e instanceof De&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let l=new De(n,[],null,[]);if(l.set.push(l),i)for(let o of i.set)l.set.push(o);return l}static defineModifier(e){let i=new Ri(e);return n=>n.modified.indexOf(i)>-1?n:Ri.get(n.base||n,n.modified.concat(i).sort((l,o)=>l.id-o.id))}}let Ph=0;class Ri{constructor(e){this.name=e,this.instances=[],this.id=Ph++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(r=>r.base==e&&Lh(i,r.modified));if(n)return n;let l=[],o=new De(e.name,l,e,i);for(let r of i)r.instances.push(o);let s=Uh(i);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ri.get(r,c));return o}}function Lh(a,e){return a.length==e.length&&a.every((i,n)=>i==e[n])}function Uh(a){let e=[[]];for(let i=0;i<a.length;i++)for(let n=0,l=e.length;n<l;n++)e.push(e[n].concat(a[i]));return e.sort((i,n)=>n.length-i.length)}function ao(a){let e=Object.create(null);for(let i in a){let n=a[i];Array.isArray(n)||(n=[n]);for(let l of i.split(" "))if(l){let o=[],s=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!p)throw new RangeError("Invalid path: "+l);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),f+=p[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+l);let h=new Cn(n,s,c>0?o.slice(0,c):null);e[d]=h.sort(e[d])}}return jh.add(e)}const jh=new oe;class Cn{constructor(e,i,n,l){this.tags=e,this.mode=i,this.context=n,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Cn.empty=new Cn([],2,null);function ro(a,e){let i=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))i[o.tag.id]=o.class;else for(let s of o.tag)i[s.id]=o.class;let{scope:n,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let d=i[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:n}}const q=De.define,Ei=q(),mt=q(),co=q(mt),ho=q(mt),gt=q(),Oi=q(gt),vn=q(gt),Ke=q(),vt=q(Ke),We=q(),Ye=q(),Sn=q(),ti=q(Sn),Mi=q(),U={comment:Ei,lineComment:q(Ei),blockComment:q(Ei),docComment:q(Ei),name:mt,variableName:q(mt),typeName:co,tagName:q(co),propertyName:ho,attributeName:q(ho),className:q(mt),labelName:q(mt),namespace:q(mt),macroName:q(mt),literal:gt,string:Oi,docString:q(Oi),character:q(Oi),attributeValue:q(Oi),number:vn,integer:q(vn),float:q(vn),bool:q(gt),regexp:q(gt),escape:q(gt),color:q(gt),url:q(gt),keyword:We,self:q(We),null:q(We),atom:q(We),unit:q(We),modifier:q(We),operatorKeyword:q(We),controlKeyword:q(We),definitionKeyword:q(We),moduleKeyword:q(We),operator:Ye,derefOperator:q(Ye),arithmeticOperator:q(Ye),logicOperator:q(Ye),bitwiseOperator:q(Ye),compareOperator:q(Ye),updateOperator:q(Ye),definitionOperator:q(Ye),typeOperator:q(Ye),controlOperator:q(Ye),punctuation:Sn,separator:q(Sn),bracket:ti,angleBracket:q(ti),squareBracket:q(ti),paren:q(ti),brace:q(ti),content:Ke,heading:vt,heading1:q(vt),heading2:q(vt),heading3:q(vt),heading4:q(vt),heading5:q(vt),heading6:q(vt),contentSeparator:q(Ke),list:q(Ke),quote:q(Ke),emphasis:q(Ke),strong:q(Ke),link:q(Ke),monospace:q(Ke),strikethrough:q(Ke),inserted:q(),deleted:q(),changed:q(),invalid:q(),meta:Mi,documentMeta:q(Mi),annotation:q(Mi),processingInstruction:q(Mi),definition:De.defineModifier("definition"),constant:De.defineModifier("constant"),function:De.defineModifier("function"),standard:De.defineModifier("standard"),local:De.defineModifier("local"),special:De.defineModifier("special")};for(let a in U){let e=U[a];e instanceof De&&(e.name=a)}ro([{tag:U.link,class:"tok-link"},{tag:U.heading,class:"tok-heading"},{tag:U.emphasis,class:"tok-emphasis"},{tag:U.strong,class:"tok-strong"},{tag:U.keyword,class:"tok-keyword"},{tag:U.atom,class:"tok-atom"},{tag:U.bool,class:"tok-bool"},{tag:U.url,class:"tok-url"},{tag:U.labelName,class:"tok-labelName"},{tag:U.inserted,class:"tok-inserted"},{tag:U.deleted,class:"tok-deleted"},{tag:U.literal,class:"tok-literal"},{tag:U.string,class:"tok-string"},{tag:U.number,class:"tok-number"},{tag:[U.regexp,U.escape,U.special(U.string)],class:"tok-string2"},{tag:U.variableName,class:"tok-variableName"},{tag:U.local(U.variableName),class:"tok-variableName tok-local"},{tag:U.definition(U.variableName),class:"tok-variableName tok-definition"},{tag:U.special(U.variableName),class:"tok-variableName2"},{tag:U.definition(U.propertyName),class:"tok-propertyName tok-definition"},{tag:U.typeName,class:"tok-typeName"},{tag:U.namespace,class:"tok-namespace"},{tag:U.className,class:"tok-className"},{tag:U.macroName,class:"tok-macroName"},{tag:U.propertyName,class:"tok-propertyName"},{tag:U.operator,class:"tok-operator"},{tag:U.comment,class:"tok-comment"},{tag:U.meta,class:"tok-meta"},{tag:U.invalid,class:"tok-invalid"},{tag:U.punctuation,class:"tok-punctuation"}]);const zh=ao({String:U.string,Number:U.number,"True False":U.bool,PropertyName:U.propertyName,Null:U.null,",":U.separator,"[ ]":U.squareBracket,"{ }":U.brace}),qh=Vi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[zh],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Bn=[],fo=[];(()=>{let a="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<a.length;e++)(e%2?fo:Bn).push(i=i+a[e])})();function Qh(a){if(a<768)return!1;for(let e=0,i=Bn.length;;){let n=e+i>>1;if(a<Bn[n])i=n;else if(a>=fo[n])e=n+1;else return!0;if(e==i)return!1}}function uo(a){return a>=127462&&a<=127487}const po=8205;function Kh(a,e,i=!0,n=!0){return(i?mo:Wh)(a,e,n)}function mo(a,e,i){if(e==a.length)return e;e&&go(a.charCodeAt(e))&&ko(a.charCodeAt(e-1))&&e--;let n=Nn(a,e);for(e+=bo(n);e<a.length;){let l=Nn(a,e);if(n==po||l==po||i&&Qh(l))e+=bo(l),n=l;else if(uo(l)){let o=0,s=e-2;for(;s>=0&&uo(Nn(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Wh(a,e,i){for(;e>0;){let n=mo(a,e-2,i);if(n<e)return n;e--}return 0}function Nn(a,e){let i=a.charCodeAt(e);if(!ko(i)||e+1==a.length)return i;let n=a.charCodeAt(e+1);return go(n)?(i-55296<<10)+(n-56320)+65536:i}function go(a){return a>=56320&&a<57344}function ko(a){return a>=55296&&a<56320}function bo(a){return a<65536?1:2}class le{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,n){[e,i]=Ft(this,e,i);let l=[];return this.decompose(0,e,l,2),n.length&&n.decompose(0,n.length,l,3),this.decompose(i,this.length,l,1),He.from(l,this.length-(i-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=Ft(this,e,i);let n=[];return this.decompose(e,i,n,0),He.from(n,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),l=new ii(this),o=new ii(e);for(let s=i,r=i;;){if(l.next(s),o.next(s),s=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(r+=l.value.length,l.done||r>=n)return!0}}iter(e=1){return new ii(this,e)}iterRange(e,i=this.length){return new wo(this,e,i)}iterLines(e,i){let n;if(e==null)n=this.iter();else{i==null&&(i=this.lines+1);let l=this.line(e).from;n=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new Ao(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?le.empty:e.length<=32?new me(e):He.from(me.split(e,[]))}}class me extends le{constructor(e,i=Yh(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,n,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((i?n:r)>=e)return new Hh(l,r,n,s);l=r+1,n++}}decompose(e,i,n,l){let o=e<=0&&i>=this.length?this:new me(yo(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=_i(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new me(r,s.length+o.length));else{let c=r.length>>1;n.push(new me(r.slice(0,c)),new me(r.slice(c)))}}else n.push(o)}replace(e,i,n){if(!(n instanceof me))return super.replace(e,i,n);[e,i]=Ft(this,e,i);let l=_i(this.text,_i(n.text,yo(this.text,0,e)),i),o=this.length+n.length-(i-e);return l.length<=32?new me(l,o):He.from(me.split(l,[]),o)}sliceString(e,i=this.length,n=`
15
15
  `){[e,i]=Ft(this,e,i);let l="";for(let o=0,s=0;o<=i&&s<this.text.length;s++){let r=this.text[s],c=o+r.length;o>e&&s&&(l+=n),e<c&&i>o&&(l+=r.slice(Math.max(0,e-o),i-o)),o=c+1}return l}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],l=-1;for(let o of e)n.push(o),l+=o.length+1,n.length==32&&(i.push(new me(n,l)),n=[],l=-1);return l>-1&&i.push(new me(n,l)),i}}class He extends le{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,l){for(let o=0;;o++){let s=this.children[o],r=l+s.length,c=n+s.lines-1;if((i?c:r)>=e)return s.lineInner(e,i,n,l);l=r+1,n=c+1}}decompose(e,i,n,l){for(let o=0,s=0;s<=i&&o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e<=c&&i>=s){let d=l&((s<=e?1:0)|(c>=i?2:0));s>=e&&c<=i&&!d?n.push(r):r.decompose(e-s,i-s,n,d)}s=c+1}}replace(e,i,n){if([e,i]=Ft(this,e,i),n.lines<this.lines)for(let l=0,o=0;l<this.children.length;l++){let s=this.children[l],r=o+s.length;if(e>=o&&i<=r){let c=s.replace(e-o,i-o,n),d=this.lines-s.lines+c.lines;if(c.lines<d>>4&&c.lines>d>>6){let h=this.children.slice();return h[l]=c,new He(h,this.length-(i-e)+n.length)}return super.replace(o,r,c)}o=r+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
16
- `){[e,i]=Ft(this,e,i);let l="";for(let o=0,s=0;o<this.children.length&&s<=i;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=n),e<c&&i>s&&(l+=r.sliceString(e-s,i-s,n)),s=c+1}return l}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof He))return 0;let n=0,[l,o,s,r]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=i,o+=i){if(l==s||o==r)return n;let c=this.children[l],d=e.children[o];if(c!=d)return n+c.scanIdentical(d,i);n+=c.length+1}}static from(e,i=e.reduce((n,l)=>n+l.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let b of e)b.flatten(m);return new me(m,i)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,d=-1,h=[];function f(m){let b;if(m.lines>o&&m instanceof He)for(let A of m.children)f(A);else m.lines>s&&(c>s||!c)?(u(),r.push(m)):m instanceof me&&c&&(b=h[h.length-1])instanceof me&&m.lines+b.lines<=32?(c+=m.lines,d+=m.length+1,h[h.length-1]=new me(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>l&&u(),c+=m.lines,d+=m.length+1,h.push(m))}function u(){c!=0&&(r.push(h.length==1?h[0]:He.from(h,d)),d=-1,c=h.length=0)}for(let m of e)f(m);return u(),r.length==1?r[0]:new He(r,i)}}le.empty=new me([""],0);function Yh(a){let e=-1;for(let i of a)e+=i.length+1;return e}function _i(a,e,i=0,n=1e9){for(let l=0,o=0,s=!0;o<a.length&&l<=n;o++){let r=a[o],c=l+r.length;c>=i&&(c>n&&(r=r.slice(0,n-l)),l<i&&(r=r.slice(i-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function yo(a,e,i){return _i(a,[""],e,i)}class ii{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof me?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,l=this.nodes[n],o=this.offsets[n],s=o>>1,r=l instanceof me?l.text.length:l.children.length;if(s==(i>0?r:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
17
- `,this;e--}else if(l instanceof me){let c=l.text[s+(i<0?-1:0)];if(this.offsets[n]+=i,c.length>Math.max(0,e))return this.value=e==0?c:i>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(i<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(i>0?1:(c instanceof me?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wo{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new ii(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*i,this.value=l.length<=n?l:i<0?l.slice(l.length-n):l.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ao{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:l}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(le.prototype[Symbol.iterator]=function(){return this.iter()},ii.prototype[Symbol.iterator]=wo.prototype[Symbol.iterator]=Ao.prototype[Symbol.iterator]=function(){return this});class Hh{constructor(e,i,n,l){this.from=e,this.to=i,this.number=n,this.text=l}get length(){return this.to-this.from}}function Ft(a,e,i){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,i))]}function lt(a,e,i=!0,n=!0){return Kh(a,e,i,n)}const Vn=/\r\n?|\n/;var _e=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(_e||(_e={}));class ot{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,l=0;i<this.sections.length;){let o=this.sections[i++],s=this.sections[i++];s<0?(e(n,l,o),l+=o):l+=s,n+=o}}iterChangedRanges(e,i=!1){Rn(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],l=this.sections[i++];l<0?e.push(n,l):e.push(l,n)}return new ot(e)}composeDesc(e){return this.empty?e:e.empty?this:xo(this,e)}mapDesc(e,i=!1){return e.empty?this:En(this,e,i)}mapPos(e,i=-1,n=_e.Simple){let l=0,o=0;for(let s=0;s<this.sections.length;){let r=this.sections[s++],c=this.sections[s++],d=l+r;if(c<0){if(d>e)return o+(e-l);o+=r}else{if(n!=_e.Simple&&d>=e&&(n==_e.TrackDel&&l<e&&d>e||n==_e.TrackBefore&&l<e||n==_e.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!r)return e==l||i<0?o:o+c;o+=c}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,i=e){for(let n=0,l=0;n<this.sections.length&&l<=i;){let o=this.sections[n++],s=this.sections[n++],r=l+o;if(s>=0&&l<=i&&r>=e)return l<e&&r>i?"cover":!0;l=r}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],l=this.sections[i++];e+=(e?" ":"")+n+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ot(e)}static create(e){return new ot(e)}}class we extends ot{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Rn(this,(i,n,l,o,s)=>e=e.replace(l,l+(n-i),s),!1),e}mapDesc(e,i=!1){return En(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let l=0,o=0;l<i.length;l+=2){let s=i[l],r=i[l+1];if(r>=0){i[l]=r,i[l+1]=s;let c=l>>1;for(;n.length<c;)n.push(le.empty);n.push(s?e.slice(o,o+s):le.empty)}o+=s}return new we(i,n)}compose(e){return this.empty?e:e.empty?this:xo(this,e,!0)}map(e,i=!1){return e.empty?this:En(this,e,i,!0)}iterChanges(e,i=!1){Rn(this,e,i)}get desc(){return ot.create(this.sections)}filter(e){let i=[],n=[],l=[],o=new ni(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let h=Math.min(o.len,c-r);ve(l,h,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;ve(i,h,f),f>0&&gt(n,i,o.text),o.forward(h),r+=h}let d=e[s++];for(;r<d;){if(o.done)break e;let h=Math.min(o.len,d-r);ve(i,h,-1),ve(l,h,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(h),r+=h}}return{changes:new we(i,n),filtered:ot.create(l)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],l=this.sections[i+1];l<0?e.push(n):l==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let l=[],o=[],s=0,r=null;function c(h=!1){if(!h&&!l.length)return;s<i&&ve(l,i-s,-1);let f=new we(l,o);r=r?r.compose(f.map(r)):f,l=[],o=[],s=0}function d(h){if(Array.isArray(h))for(let f of h)d(f);else if(h instanceof we){if(h.length!=i)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${i})`);c(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:m}=h;if(f>u||f<0||u>i)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${i})`);let b=m?typeof m=="string"?le.of(m.split(n||Vn)):m:le.empty,A=b.length;if(f==u&&A==0)return;f<s&&c(),f>s&&ve(l,f-s,-1),ve(l,u-f,A),gt(o,l,b),s=u}}return d(e),c(!r),r}static empty(e){return new we(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")i.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,r)=>r&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;n.length<l;)n.push(le.empty);n[l]=le.of(o.slice(1)),i.push(o[0],n[l].length)}}}return new we(i,n)}static createSet(e,i){return new we(e,i)}}function ve(a,e,i,n=!1){if(e==0&&i<=0)return;let l=a.length-2;l>=0&&i<=0&&i==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=i:n?(a[l]+=e,a[l+1]+=i):a.push(e,i)}function gt(a,e,i){if(i.length==0)return;let n=e.length-2>>1;if(n<a.length)a[a.length-1]=a[a.length-1].append(i);else{for(;a.length<n;)a.push(le.empty);a.push(i)}}function Rn(a,e,i){let n=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let d=l,h=o,f=le.empty;for(;d+=r,h+=c,c&&n&&(f=f.append(n[s-2>>1])),!(i||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,d,o,h,f),l=d,o=h}}}function En(a,e,i,n=!1){let l=[],o=n?[]:null,s=new ni(a),r=new ni(e);for(let c=-1;;){if(s.done&&r.len||r.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&r.ins==-1){let d=Math.min(s.len,r.len);ve(l,d,-1),s.forward(d),r.forward(d)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!i))){let d=r.len;for(ve(l,r.ins,-1);d;){let h=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=h&&(ve(l,0,s.ins),o&&gt(o,l,s.text),c=s.i),s.forward(h),d-=h}r.next()}else if(s.ins>=0){let d=0,h=s.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);d+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;ve(l,d,c<s.i?s.ins:0),o&&c<s.i&&gt(o,l,s.text),c=s.i,s.forward(s.len-h)}else{if(s.done&&r.done)return o?we.createSet(l,o):ot.create(l);throw new Error("Mismatched change set lengths")}}}function xo(a,e,i=!1){let n=[],l=i?[]:null,o=new ni(a),s=new ni(e);for(let r=!1;;){if(o.done&&s.done)return l?we.createSet(n,l):ot.create(n);if(o.ins==0)ve(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)ve(n,0,s.ins,r),l&&gt(l,n,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let c=Math.min(o.len2,s.len),d=n.length;if(o.ins==-1){let h=s.ins==-1?-1:s.off?0:s.ins;ve(n,c,h,r),l&&h&&gt(l,n,s.text)}else s.ins==-1?(ve(n,o.off?0:o.len,c,r),l&&gt(l,n,o.textBit(c))):(ve(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&gt(l,n,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||n.length>d),o.forward2(c),s.forward(c)}}}}class ni{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?le.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?le.empty:i[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class St{constructor(e,i,n){this.from=e,this.to=i,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let n,l;return this.empty?n=l=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),n==this.from&&l==this.to?this:new St(n,l,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return H.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return H.range(this.anchor,n)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,i,n){return new St(e,i,n)}}class H{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:H.create(this.ranges.map(n=>n.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,i=!0){return H.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,H.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(i=>St.fromJSON(i)),e.main)}static single(e,i=e){return new H([H.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=n:o.from<n)return H.normalized(e.slice(),i);n=o.to}return new H(e,i)}static cursor(e,i=0,n,l){return St.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(l??16777215)<<6)}static range(e,i,n,l){let o=(n??16777215)<<6|(l==null?7:Math.min(6,l));return i<e?St.create(i,e,48|o):St.create(e,i,(i>e?8:0)|o)}static normalized(e,i=0){let n=e[i];e.sort((l,o)=>l.from-o.from),i=e.indexOf(n);for(let l=1;l<e.length;l++){let o=e[l],s=e[l-1];if(o.empty?o.from<=s.to:o.from<s.to){let r=s.from,c=Math.max(o.to,s.to);l<=i&&i--,e.splice(--l,2,o.anchor>o.head?H.range(c,r):H.range(r,c))}}return new H(e,i)}}function Co(a,e){for(let i of a.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let On=0;class Z{constructor(e,i,n,l,o){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=l,this.id=On++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Z(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:Mn),!!e.static,e.enables)}of(e){return new Ti([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ti(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ti(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Mn(a,e){return a==e||a.length==e.length&&a.every((i,n)=>i===e[n])}class Ti{constructor(e,i,n,l){this.dependencies=e,this.facet=i,this.type=n,this.value=l,this.id=On++}dynamicSlot(e){var i;let n=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,d=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?d=!0:((i=e[f.id])!==null&&i!==void 0?i:1)&1||h.push(e[f.id]);return{create(f){return f.values[s]=n(f),1},update(f,u){if(c&&u.docChanged||d&&(u.docChanged||u.selection)||_n(f,h)){let m=n(f);if(r?!vo(m,f.values[s],l):!l(m,f.values[s]))return f.values[s]=m,1}return 0},reconfigure:(f,u)=>{let m,b=u.config.address[o];if(b!=null){let A=$i(u,b);if(this.dependencies.every(C=>C instanceof Z?u.facet(C)===f.facet(C):C instanceof Bt?u.field(C,!1)==f.field(C,!1):!0)||(r?vo(m=n(f),A,l):l(m=n(f),A)))return f.values[s]=A,0}else m=n(f);return f.values[s]=m,1}}}}function vo(a,e,i){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(!i(a[n],e[n]))return!1;return!0}function _n(a,e){let i=!1;for(let n of e)oi(a,n)&1&&(i=!0);return i}function Gh(a,e,i){let n=i.map(c=>a[c.id]),l=i.map(c=>c.type),o=n.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let d=[];for(let h=0;h<n.length;h++){let f=$i(c,n[h]);if(l[h]==2)for(let u of f)d.push(u);else d.push(f)}return e.combine(d)}return{create(c){for(let d of n)oi(c,d);return c.values[s]=r(c),1},update(c,d){if(!_n(c,o))return 0;let h=r(c);return e.compare(h,c.values[s])?0:(c.values[s]=h,1)},reconfigure(c,d){let h=_n(c,n),f=d.config.facets[e.id],u=d.facet(e);if(f&&!h&&Mn(i,f))return c.values[s]=u,0;let m=r(c);return e.compare(m,u)?(c.values[s]=u,0):(c.values[s]=m,1)}}}const Ii=Z.define({static:!0});class Bt{constructor(e,i,n,l,o){this.id=e,this.createF=i,this.updateF=n,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let i=new Bt(On++,e.create,e.update,e.compare||((n,l)=>n===l),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(Ii).find(n=>n.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,l)=>{let o=n.values[i],s=this.updateF(o,l);return this.compareF(o,s)?0:(n.values[i]=s,1)},reconfigure:(n,l)=>{let o=n.facet(Ii),s=l.facet(Ii),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(n.values[i]=r.create(n),1):l.config.address[this.id]!=null?(n.values[i]=l.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,Ii.of({field:this,create:e})]}get extension(){return this}}const Nt={lowest:4,low:3,default:2,high:1,highest:0};function li(a){return e=>new So(e,a)}const Jh={highest:li(Nt.highest),high:li(Nt.high),default:li(Nt.default),low:li(Nt.low),lowest:li(Nt.lowest)};class So{constructor(e,i){this.inner=e,this.prec=i}}class Fi{of(e){return new Tn(this,e)}reconfigure(e){return Fi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Tn{constructor(e,i){this.compartment=e,this.inner=i}}class Di{constructor(e,i,n,l,o,s){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let l=[],o=Object.create(null),s=new Map;for(let u of Xh(e,i,s))u instanceof Bt?l.push(u):(o[u.facet.id]||(o[u.facet.id]=[])).push(u);let r=Object.create(null),c=[],d=[];for(let u of l)r[u.id]=d.length<<1,d.push(m=>u.slot(m));let h=n?.config.facets;for(let u in o){let m=o[u],b=m[0].facet,A=h&&h[u]||[];if(m.every(C=>C.type==0))if(r[b.id]=c.length<<1|1,Mn(A,m))c.push(n.facet(b));else{let C=b.combine(m.map(w=>w.value));c.push(n&&b.compare(C,n.facet(b))?n.facet(b):C)}else{for(let C of m)C.type==0?(r[C.id]=c.length<<1|1,c.push(C.value)):(r[C.id]=d.length<<1,d.push(w=>C.dynamicSlot(w)));r[b.id]=d.length<<1,d.push(C=>Gh(C,b,m))}}let f=d.map(u=>u(r));return new Di(e,s,f,r,c,o)}}function Xh(a,e,i){let n=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let d=n[c].indexOf(s);d>-1&&n[c].splice(d,1),s instanceof Tn&&i.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let d of s)o(d,r);else if(s instanceof Tn){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(s.compartment)||s.inner;i.set(s.compartment,d),o(d,r)}else if(s instanceof So)o(s.inner,s.prec);else if(s instanceof Bt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Ti)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,Nt.default);else{let d=s.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,r)}}return o(a,Nt.default),n.reduce((s,r)=>s.concat(r))}function oi(a,e){if(e&1)return 2;let i=e>>1,n=a.status[i];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;a.status[i]=4;let l=a.computeSlot(a,a.config.dynamicSlots[i]);return a.status[i]=2|l}function $i(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const Bo=Z.define(),In=Z.define({combine:a=>a.some(e=>e),static:!0}),No=Z.define({combine:a=>a.length?a[0]:void 0,static:!0}),Vo=Z.define(),Ro=Z.define(),Eo=Z.define(),Oo=Z.define({combine:a=>a.length?a[0]:!1});class Dt{constructor(e,i){this.type=e,this.value=i}static define(){return new Zh}}class Zh{of(e){return new Dt(this,e)}}class ef{constructor(e){this.map=e}of(e){return new be(this,e)}}class be{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new be(this.type,i)}is(e){return this.type==e}static define(e={}){return new ef(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let l of e){let o=l.map(i);o&&n.push(o)}return n}}be.reconfigure=be.define(),be.appendConfig=be.define();class Se{constructor(e,i,n,l,o,s){this.startState=e,this.changes=i,this.selection=n,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Co(n,i.newLength),o.some(r=>r.type==Se.time)||(this.annotations=o.concat(Se.time.of(Date.now())))}static create(e,i,n,l,o,s){return new Se(e,i,n,l,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(Se.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}Se.time=Dt.define(),Se.userEvent=Dt.define(),Se.addToHistory=Dt.define(),Se.remote=Dt.define();function tf(a,e){let i=[];for(let n=0,l=0;;){let o,s;if(n<a.length&&(l==e.length||e[l]>=a[n]))o=a[n++],s=a[n++];else if(l<e.length)o=e[l++],s=e[l++];else return i;!i.length||i[i.length-1]<o?i.push(o,s):i[i.length-1]<s&&(i[i.length-1]=s)}}function Mo(a,e,i){var n;let l,o,s;return i?(l=e.changes,o=we.empty(e.changes.length),s=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),o=a.changes.mapDesc(e.changes,!0),s=a.changes.compose(l)),{changes:s,selection:e.selection?e.selection.map(o):(n=a.selection)===null||n===void 0?void 0:n.map(l),effects:be.mapEffects(a.effects,l).concat(be.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Fn(a,e,i){let n=e.selection,l=$t(e.annotations);return e.userEvent&&(l=l.concat(Se.userEvent.of(e.userEvent))),{changes:e.changes instanceof we?e.changes:we.of(e.changes||[],i,a.facet(No)),selection:n&&(n instanceof H?n:H.single(n.anchor,n.head)),effects:$t(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function _o(a,e,i){let n=Fn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(i=!1);let s=!!e[o].sequential;n=Mo(n,Fn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=Se.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return lf(i?nf(l):l)}function nf(a){let e=a.startState,i=!0;for(let l of e.facet(Vo)){let o=l(a);if(o===!1){i=!1;break}Array.isArray(o)&&(i=i===!0?o:tf(i,o))}if(i!==!0){let l,o;if(i===!1)o=a.changes.invertedDesc,l=we.empty(e.doc.length);else{let s=a.changes.filter(i);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=Se.create(e,l,a.selection&&a.selection.map(o),be.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(Ro);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof Se?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Se?a=o[0]:a=_o(e,$t(o),!1)}return a}function lf(a){let e=a.startState,i=e.facet(Eo),n=a;for(let l=i.length-1;l>=0;l--){let o=i[l](a);o&&Object.keys(o).length&&(n=Mo(n,Fn(e,o,a.changes.newLength),!0))}return n==a?a:Se.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const of=[];function $t(a){return a==null?of:Array.isArray(a)?a:[a]}var st=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(st||(st={}));const sf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dn;try{Dn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function af(a){if(Dn)return Dn.test(a);for(let e=0;e<a.length;e++){let i=a[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||sf.test(i)))return!0}return!1}function rf(a){return e=>{if(!/\S/.test(e))return st.Space;if(af(e))return st.Word;for(let i=0;i<a.length;i++)if(e.indexOf(a[i])>-1)return st.Word;return st.Other}}class ae{constructor(e,i,n,l,o,s){this.config=e,this.doc=i,this.selection=n,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)oi(this,r<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return oi(this,n),$i(this,n)}update(...e){return _o(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:l}=i;for(let r of e.effects)r.is(Fi.reconfigure)?(i&&(l=new Map,i.compartments.forEach((c,d)=>l.set(d,c)),i=null),l.set(r.value.compartment,r.value.extension)):r.is(be.reconfigure)?(i=null,n=r.value):r.is(be.appendConfig)&&(i=null,n=$t(n).concat(r.value));let o;i?o=e.startState.values.slice():(i=Di.resolve(n,l,this),o=new ae(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(In)?e.newSelection:e.newSelection.asSingle();new ae(i,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:H.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),l=this.changes(n.changes),o=[n.range],s=$t(n.effects);for(let r=1;r<i.ranges.length;r++){let c=e(i.ranges[r]),d=this.changes(c.changes),h=d.map(l);for(let u=0;u<r;u++)o[u]=o[u].map(h);let f=l.mapDesc(d,!0);o.push(c.range.map(f)),l=l.compose(h),s=be.mapEffects(s,h).concat(be.mapEffects($t(c.effects),f))}return{changes:l,selection:H.create(o,i.mainIndex),effects:s}}changes(e=[]){return e instanceof we?e:we.of(e,this.doc.length,this.facet(ae.lineSeparator))}toText(e){return le.of(e.split(this.facet(ae.lineSeparator)||Vn))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(oi(this,i),$i(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let l=e[n];l instanceof Bt&&this.config.address[l.id]!=null&&(i[n]=l.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let s=n[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return ae.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:i.extensions?l.concat([i.extensions]):l})}static create(e={}){let i=Di.resolve(e.extensions||[],new Map),n=e.doc instanceof le?e.doc:le.of((e.doc||"").split(i.staticFacet(ae.lineSeparator)||Vn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return Co(l,n.length),i.staticFacet(In)||(l=l.asSingle()),new ae(i,n,l,i.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(ae.tabSize)}get lineBreak(){return this.facet(ae.lineSeparator)||`
18
- `}get readOnly(){return this.facet(Oo)}phrase(e,...i){for(let n of this.facet(ae.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>i.length?n:i[o-1]})),e}languageDataAt(e,i,n=-1){let l=[];for(let o of this.facet(Bo))for(let s of o(this,i,n))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return rf(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-n,r=e-n;for(;s>0;){let c=lt(i,s,!1);if(o(i.slice(c,s))!=st.Word)break;s=c}for(;r<l;){let c=lt(i,r);if(o(i.slice(r,c))!=st.Word)break;r=c}return s==r?null:H.range(s+n,r+n)}}ae.allowMultipleSelections=In,ae.tabSize=Z.define({combine:a=>a.length?a[0]:4}),ae.lineSeparator=No,ae.readOnly=Oo,ae.phrases=Z.define({compare(a,e){let i=Object.keys(a),n=Object.keys(e);return i.length==n.length&&i.every(l=>a[l]==e[l])}}),ae.languageData=Bo,ae.changeFilter=Vo,ae.transactionFilter=Ro,ae.transactionExtender=Eo,Fi.reconfigure=be.define();class Pt{eq(e){return this==e}range(e,i=e){return si.create(e,i,this)}}Pt.prototype.startSide=Pt.prototype.endSide=0,Pt.prototype.point=!1,Pt.prototype.mapMode=_e.TrackDel;class si{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new si(e,i,n)}}function $n(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Pn{constructor(e,i,n,l){this.from=e,this.to=i,this.value=n,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,l=0){let o=n?this.to:this.from;for(let s=l,r=o.length;;){if(s==r)return s;let c=s+r>>1,d=o[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-i;if(c==s)return d>=0?s:r;d>=0?r=c:s=c+1}}between(e,i,n,l){for(let o=this.findIndex(i,-1e9,!0),s=this.findIndex(n,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,i){let n=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let d=this.value[c],h=this.from[c]+e,f=this.to[c]+e,u,m;if(h==f){let b=i.mapPos(h,d.startSide,d.mapMode);if(b==null||(u=m=b,d.startSide!=d.endSide&&(m=i.mapPos(h,d.endSide),m<u)))continue}else if(u=i.mapPos(h,d.startSide),m=i.mapPos(f,d.endSide),u>m||u==m&&d.startSide>0&&d.endSide<=0)continue;(m-u||d.endSide-d.startSide)<0||(s<0&&(s=u),d.point&&(r=Math.max(r,m-u)),n.push(d),l.push(u-s),o.push(m-s))}return{mapped:n.length?new Pn(l,o,n,r):null,pos:s}}}class fe{constructor(e,i,n,l){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=l}static create(e,i,n,l){return new fe(e,i,n,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(i.length==0&&!s)return this;if(n&&(i=i.slice().sort($n)),this.isEmpty)return i.length?fe.of(i):this;let r=new Io(this,null,-1).goto(0),c=0,d=[],h=new Pi;for(;r.value||c<i.length;)if(c<i.length&&(r.from-i[c].from||r.startSide-i[c].value.startSide)>=0){let f=i[c++];h.addInner(f.from,f.to,f.value)||d.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==i.length||this.chunkEnd(r.chunkIndex)<i[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||d.push(si.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?fe.empty:this.nextLayer.update({add:d,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],l=-1;for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],c=this.chunk[s],d=e.touchesRange(r,r+c.length);if(d===!1)l=Math.max(l,c.maxPoint),i.push(c),n.push(e.mapPos(r));else if(d===!0){let{mapped:h,pos:f}=c.map(r,e);h&&(l=Math.max(l,h.maxPoint),i.push(h),n.push(f))}}let o=this.nextLayer.map(e);return i.length==0?o:new fe(n,i,o||fe.empty,l)}between(e,i,n){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(i>=o&&e<=o+s.length&&s.between(o,e-o,i-o,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ai.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ai.from(e).goto(i)}static compare(e,i,n,l,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),r=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),c=To(s,r,n),d=new ri(s,c,o),h=new ri(r,c,o);n.iterGaps((f,u,m)=>Fo(d,f,h,u,m,l)),n.empty&&n.length==0&&Fo(d,0,h,0,0,l)}static eq(e,i,n=0,l){l==null&&(l=999999999);let o=e.filter(h=>!h.isEmpty&&i.indexOf(h)<0),s=i.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=To(o,s),c=new ri(o,r,0).goto(n),d=new ri(s,r,0).goto(n);for(;;){if(c.to!=d.to||!Un(c.active,d.active)||c.point&&(!d.point||!c.point.eq(d.point)))return!1;if(c.to>l)return!0;c.next(),d.next()}}static spans(e,i,n,l,o=-1){let s=new ri(e,null,o).goto(i),r=i,c=s.openStart;for(;;){let d=Math.min(s.to,n);if(s.point){let h=s.activeForPoint(s.to),f=s.pointFrom<i?h.length+1:s.point.startSide<0?h.length:Math.min(h.length,c);l.point(r,d,s.point,h,f,s.pointRank),c=Math.min(s.openEnd(d),h.length)}else d>r&&(l.span(r,d,s.active,c),c=s.openEnd(d));if(s.to>n)return c+(s.point&&s.to>n?1:0);r=s.to,s.next()}}static of(e,i=!1){let n=new Pi;for(let l of e instanceof si?[e]:i?cf(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return fe.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=fe.empty;l=l.nextLayer)i=new fe(l.chunkPos,l.chunk,i,Math.max(l.maxPoint,i.maxPoint));return i}}fe.empty=new fe([],[],null,-1);function cf(a){if(a.length>1)for(let e=a[0],i=1;i<a.length;i++){let n=a[i];if($n(e,n)>0)return a.slice().sort($n);e=n}return a}fe.empty.nextLayer=fe.empty;class Pi{finishChunk(e){this.chunks.push(new Pn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,n){this.addInner(e,i,n)||(this.nextLayer||(this.nextLayer=new Pi)).add(e,i,n)}addInner(e,i,n){let l=e-this.lastTo||n.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=i,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let n=i.value.length-1;return this.last=i.value[n],this.lastFrom=i.from[n]+e,this.lastTo=i.to[n]+e,!0}finish(){return this.finishInner(fe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=fe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function To(a,e,i){let n=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&n.set(o.chunk[s],o.chunkPos[s]);let l=new Set;for(let o of e)for(let s=0;s<o.chunk.length;s++){let r=n.get(o.chunk[s]);r!=null&&(i?i.mapPos(r):r)==o.chunkPos[s]&&!i?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class Io{constructor(e,i,n,l=0){this.layer=e,this.skip=i,this.minPoint=n,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,n){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!n||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],i=this.layer.chunk[this.chunkIndex],n=e+i.from[this.rangeIndex];if(this.from=n,this.to=e+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class ai{constructor(e){this.heap=e}static from(e,i=null,n=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&l.push(new Io(s,i,n,o));return l.length==1?l[0]:new ai(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let n of this.heap)n.goto(e,i);for(let n=this.heap.length>>1;n>=0;n--)Ln(this.heap,n);return this.next(),this}forward(e,i){for(let n of this.heap)n.forward(e,i);for(let n=this.heap.length>>1;n>=0;n--)Ln(this.heap,n);(this.to-e||this.value.endSide-i)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ln(this.heap,0)}}}function Ln(a,e){for(let i=a[e];;){let n=(e<<1)+1;if(n>=a.length)break;let l=a[n];if(n+1<a.length&&l.compare(a[n+1])>=0&&(l=a[n+1],n++),i.compare(l)<0)break;a[n]=i,a[e]=l,e=n}}class ri{constructor(e,i,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=ai.from(e,i,n)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){Li(this.active,e),Li(this.activeTo,e),Li(this.activeRank,e),this.minActive=Do(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:l,rank:o}=this.cursor;for(;i<this.activeRank.length&&(o-this.activeRank[i]||l-this.activeTo[i])>0;)i++;Ui(this.active,i,n),Ui(this.activeTo,i,l),Ui(this.activeRank,i,o),e&&Ui(e,i,this.cursor.from),this.minActive=Do(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),n&&Li(n,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let l=n.length-1;l>=0&&n[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&i.push(this.active[n]);return i.reverse()}openEnd(e){let i=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)i++;return i}}function Fo(a,e,i,n,l,o){a.goto(e),i.goto(n);let s=n+l,r=n,c=n-e;for(;;){let d=a.to+c-i.to,h=d||a.endSide-i.endSide,f=h<0?a.to+c:i.to,u=Math.min(f,s);if(a.point||i.point?a.point&&i.point&&(a.point==i.point||a.point.eq(i.point))&&Un(a.activeForPoint(a.to),i.activeForPoint(i.to))||o.comparePoint(r,u,a.point,i.point):u>r&&!Un(a.active,i.active)&&o.compareRange(r,u,a.active,i.active),f>s)break;(d||a.openEnd!=i.openEnd)&&o.boundChange&&o.boundChange(f),r=f,h<=0&&a.next(),h>=0&&i.next()}}function Un(a,e){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(a[i]!=e[i]&&!a[i].eq(e[i]))return!1;return!0}function Li(a,e){for(let i=e,n=a.length-1;i<n;i++)a[i]=a[i+1];a.pop()}function Ui(a,e,i){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=i}function Do(a,e){let i=-1,n=1e9;for(let l=0;l<e.length;l++)(e[l]-n||a[l].endSide-a[i].endSide)<0&&(i=l,n=e[l]);return i}function df(a,e,i,n){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?i-o%i:1,l=lt(a,l)}return n===!0?-1:a.length}const jn="ͼ",$o=typeof Symbol>"u"?"__"+jn:Symbol.for(jn),zn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Po=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class kt{constructor(e,i){this.rules=[];let{finish:n}=i||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,d){let h=[],f=/^@(\w+)\b/.exec(s[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return c.push(s[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(A=>s.map(C=>A.replace(/&/,C))).reduce((A,C)=>A.concat(C)),b,c);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),b,h,u)}else b!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,A=>"-"+A.toLowerCase())+": "+b+";")}(h.length||u)&&c.push((n&&!f&&!d?s.map(n):s).join(", ")+" {"+h.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
16
+ `){[e,i]=Ft(this,e,i);let l="";for(let o=0,s=0;o<this.children.length&&s<=i;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=n),e<c&&i>s&&(l+=r.sliceString(e-s,i-s,n)),s=c+1}return l}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof He))return 0;let n=0,[l,o,s,r]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=i,o+=i){if(l==s||o==r)return n;let c=this.children[l],d=e.children[o];if(c!=d)return n+c.scanIdentical(d,i);n+=c.length+1}}static from(e,i=e.reduce((n,l)=>n+l.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let b of e)b.flatten(m);return new me(m,i)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,d=-1,h=[];function f(m){let b;if(m.lines>o&&m instanceof He)for(let w of m.children)f(w);else m.lines>s&&(c>s||!c)?(p(),r.push(m)):m instanceof me&&c&&(b=h[h.length-1])instanceof me&&m.lines+b.lines<=32?(c+=m.lines,d+=m.length+1,h[h.length-1]=new me(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>l&&p(),c+=m.lines,d+=m.length+1,h.push(m))}function p(){c!=0&&(r.push(h.length==1?h[0]:He.from(h,d)),d=-1,c=h.length=0)}for(let m of e)f(m);return p(),r.length==1?r[0]:new He(r,i)}}le.empty=new me([""],0);function Yh(a){let e=-1;for(let i of a)e+=i.length+1;return e}function _i(a,e,i=0,n=1e9){for(let l=0,o=0,s=!0;o<a.length&&l<=n;o++){let r=a[o],c=l+r.length;c>=i&&(c>n&&(r=r.slice(0,n-l)),l<i&&(r=r.slice(i-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function yo(a,e,i){return _i(a,[""],e,i)}class ii{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof me?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,l=this.nodes[n],o=this.offsets[n],s=o>>1,r=l instanceof me?l.text.length:l.children.length;if(s==(i>0?r:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
17
+ `,this;e--}else if(l instanceof me){let c=l.text[s+(i<0?-1:0)];if(this.offsets[n]+=i,c.length>Math.max(0,e))return this.value=e==0?c:i>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(i<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(i>0?1:(c instanceof me?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class wo{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new ii(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*i,this.value=l.length<=n?l:i<0?l.slice(l.length-n):l.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ao{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:l}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(le.prototype[Symbol.iterator]=function(){return this.iter()},ii.prototype[Symbol.iterator]=wo.prototype[Symbol.iterator]=Ao.prototype[Symbol.iterator]=function(){return this});class Hh{constructor(e,i,n,l){this.from=e,this.to=i,this.number=n,this.text=l}get length(){return this.to-this.from}}function Ft(a,e,i){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,i))]}function lt(a,e,i=!0,n=!0){return Kh(a,e,i,n)}const Vn=/\r\n?|\n/;var Te=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Te||(Te={}));class ot{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,l=0;i<this.sections.length;){let o=this.sections[i++],s=this.sections[i++];s<0?(e(n,l,o),l+=o):l+=s,n+=o}}iterChangedRanges(e,i=!1){Rn(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],l=this.sections[i++];l<0?e.push(n,l):e.push(l,n)}return new ot(e)}composeDesc(e){return this.empty?e:e.empty?this:xo(this,e)}mapDesc(e,i=!1){return e.empty?this:En(this,e,i)}mapPos(e,i=-1,n=Te.Simple){let l=0,o=0;for(let s=0;s<this.sections.length;){let r=this.sections[s++],c=this.sections[s++],d=l+r;if(c<0){if(d>e)return o+(e-l);o+=r}else{if(n!=Te.Simple&&d>=e&&(n==Te.TrackDel&&l<e&&d>e||n==Te.TrackBefore&&l<e||n==Te.TrackAfter&&d>e))return null;if(d>e||d==e&&i<0&&!r)return e==l||i<0?o:o+c;o+=c}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,i=e){for(let n=0,l=0;n<this.sections.length&&l<=i;){let o=this.sections[n++],s=this.sections[n++],r=l+o;if(s>=0&&l<=i&&r>=e)return l<e&&r>i?"cover":!0;l=r}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],l=this.sections[i++];e+=(e?" ":"")+n+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ot(e)}static create(e){return new ot(e)}}class Ae extends ot{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Rn(this,(i,n,l,o,s)=>e=e.replace(l,l+(n-i),s),!1),e}mapDesc(e,i=!1){return En(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let l=0,o=0;l<i.length;l+=2){let s=i[l],r=i[l+1];if(r>=0){i[l]=r,i[l+1]=s;let c=l>>1;for(;n.length<c;)n.push(le.empty);n.push(s?e.slice(o,o+s):le.empty)}o+=s}return new Ae(i,n)}compose(e){return this.empty?e:e.empty?this:xo(this,e,!0)}map(e,i=!1){return e.empty?this:En(this,e,i,!0)}iterChanges(e,i=!1){Rn(this,e,i)}get desc(){return ot.create(this.sections)}filter(e){let i=[],n=[],l=[],o=new ni(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let h=Math.min(o.len,c-r);Se(l,h,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;Se(i,h,f),f>0&&kt(n,i,o.text),o.forward(h),r+=h}let d=e[s++];for(;r<d;){if(o.done)break e;let h=Math.min(o.len,d-r);Se(i,h,-1),Se(l,h,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(h),r+=h}}return{changes:new Ae(i,n),filtered:ot.create(l)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i],l=this.sections[i+1];l<0?e.push(n):l==0?e.push([n]):e.push([n].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,n){let l=[],o=[],s=0,r=null;function c(h=!1){if(!h&&!l.length)return;s<i&&Se(l,i-s,-1);let f=new Ae(l,o);r=r?r.compose(f.map(r)):f,l=[],o=[],s=0}function d(h){if(Array.isArray(h))for(let f of h)d(f);else if(h instanceof Ae){if(h.length!=i)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${i})`);c(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:p=f,insert:m}=h;if(f>p||f<0||p>i)throw new RangeError(`Invalid change range ${f} to ${p} (in doc of length ${i})`);let b=m?typeof m=="string"?le.of(m.split(n||Vn)):m:le.empty,w=b.length;if(f==p&&w==0)return;f<s&&c(),f>s&&Se(l,f-s,-1),Se(l,p-f,w),kt(o,l,b),s=p}}return d(e),c(!r),r}static empty(e){return new Ae(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")i.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,r)=>r&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)i.push(o[0],0);else{for(;n.length<l;)n.push(le.empty);n[l]=le.of(o.slice(1)),i.push(o[0],n[l].length)}}}return new Ae(i,n)}static createSet(e,i){return new Ae(e,i)}}function Se(a,e,i,n=!1){if(e==0&&i<=0)return;let l=a.length-2;l>=0&&i<=0&&i==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=i:n?(a[l]+=e,a[l+1]+=i):a.push(e,i)}function kt(a,e,i){if(i.length==0)return;let n=e.length-2>>1;if(n<a.length)a[a.length-1]=a[a.length-1].append(i);else{for(;a.length<n;)a.push(le.empty);a.push(i)}}function Rn(a,e,i){let n=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let d=l,h=o,f=le.empty;for(;d+=r,h+=c,c&&n&&(f=f.append(n[s-2>>1])),!(i||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,d,o,h,f),l=d,o=h}}}function En(a,e,i,n=!1){let l=[],o=n?[]:null,s=new ni(a),r=new ni(e);for(let c=-1;;){if(s.done&&r.len||r.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&r.ins==-1){let d=Math.min(s.len,r.len);Se(l,d,-1),s.forward(d),r.forward(d)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!i))){let d=r.len;for(Se(l,r.ins,-1);d;){let h=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=h&&(Se(l,0,s.ins),o&&kt(o,l,s.text),c=s.i),s.forward(h),d-=h}r.next()}else if(s.ins>=0){let d=0,h=s.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);d+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;Se(l,d,c<s.i?s.ins:0),o&&c<s.i&&kt(o,l,s.text),c=s.i,s.forward(s.len-h)}else{if(s.done&&r.done)return o?Ae.createSet(l,o):ot.create(l);throw new Error("Mismatched change set lengths")}}}function xo(a,e,i=!1){let n=[],l=i?[]:null,o=new ni(a),s=new ni(e);for(let r=!1;;){if(o.done&&s.done)return l?Ae.createSet(n,l):ot.create(n);if(o.ins==0)Se(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)Se(n,0,s.ins,r),l&&kt(l,n,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let c=Math.min(o.len2,s.len),d=n.length;if(o.ins==-1){let h=s.ins==-1?-1:s.off?0:s.ins;Se(n,c,h,r),l&&h&&kt(l,n,s.text)}else s.ins==-1?(Se(n,o.off?0:o.len,c,r),l&&kt(l,n,o.textBit(c))):(Se(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&kt(l,n,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||n.length>d),o.forward2(c),s.forward(c)}}}}class ni{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?le.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?le.empty:i[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class St{constructor(e,i,n){this.from=e,this.to=i,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,i=-1){let n,l;return this.empty?n=l=e.mapPos(this.from,i):(n=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),n==this.from&&l==this.to?this:new St(n,l,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return Y.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return Y.range(this.anchor,n)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Y.range(e.anchor,e.head)}static create(e,i,n){return new St(e,i,n)}}class Y{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:Y.create(this.ranges.map(n=>n.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Y([this.main],0)}addRange(e,i=!0){return Y.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,Y.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Y(e.ranges.map(i=>St.fromJSON(i)),e.main)}static single(e,i=e){return new Y([Y.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=n:o.from<n)return Y.normalized(e.slice(),i);n=o.to}return new Y(e,i)}static cursor(e,i=0,n,l){return St.create(e,e,(i==0?0:i<0?8:16)|(n==null?7:Math.min(6,n))|(l??16777215)<<6)}static range(e,i,n,l){let o=(n??16777215)<<6|(l==null?7:Math.min(6,l));return i<e?St.create(i,e,48|o):St.create(e,i,(i>e?8:0)|o)}static normalized(e,i=0){let n=e[i];e.sort((l,o)=>l.from-o.from),i=e.indexOf(n);for(let l=1;l<e.length;l++){let o=e[l],s=e[l-1];if(o.empty?o.from<=s.to:o.from<s.to){let r=s.from,c=Math.max(o.to,s.to);l<=i&&i--,e.splice(--l,2,o.anchor>o.head?Y.range(c,r):Y.range(r,c))}}return new Y(e,i)}}function Co(a,e){for(let i of a.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let On=0;class Z{constructor(e,i,n,l,o){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=l,this.id=On++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Z(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:Mn),!!e.static,e.enables)}of(e){return new Ti([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ti(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ti(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Mn(a,e){return a==e||a.length==e.length&&a.every((i,n)=>i===e[n])}class Ti{constructor(e,i,n,l){this.dependencies=e,this.facet=i,this.type=n,this.value=l,this.id=On++}dynamicSlot(e){var i;let n=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,d=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?d=!0:((i=e[f.id])!==null&&i!==void 0?i:1)&1||h.push(e[f.id]);return{create(f){return f.values[s]=n(f),1},update(f,p){if(c&&p.docChanged||d&&(p.docChanged||p.selection)||_n(f,h)){let m=n(f);if(r?!vo(m,f.values[s],l):!l(m,f.values[s]))return f.values[s]=m,1}return 0},reconfigure:(f,p)=>{let m,b=p.config.address[o];if(b!=null){let w=$i(p,b);if(this.dependencies.every(C=>C instanceof Z?p.facet(C)===f.facet(C):C instanceof Bt?p.field(C,!1)==f.field(C,!1):!0)||(r?vo(m=n(f),w,l):l(m=n(f),w)))return f.values[s]=w,0}else m=n(f);return f.values[s]=m,1}}}}function vo(a,e,i){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(!i(a[n],e[n]))return!1;return!0}function _n(a,e){let i=!1;for(let n of e)oi(a,n)&1&&(i=!0);return i}function Gh(a,e,i){let n=i.map(c=>a[c.id]),l=i.map(c=>c.type),o=n.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let d=[];for(let h=0;h<n.length;h++){let f=$i(c,n[h]);if(l[h]==2)for(let p of f)d.push(p);else d.push(f)}return e.combine(d)}return{create(c){for(let d of n)oi(c,d);return c.values[s]=r(c),1},update(c,d){if(!_n(c,o))return 0;let h=r(c);return e.compare(h,c.values[s])?0:(c.values[s]=h,1)},reconfigure(c,d){let h=_n(c,n),f=d.config.facets[e.id],p=d.facet(e);if(f&&!h&&Mn(i,f))return c.values[s]=p,0;let m=r(c);return e.compare(m,p)?(c.values[s]=p,0):(c.values[s]=m,1)}}}const Ii=Z.define({static:!0});class Bt{constructor(e,i,n,l,o){this.id=e,this.createF=i,this.updateF=n,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let i=new Bt(On++,e.create,e.update,e.compare||((n,l)=>n===l),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(Ii).find(n=>n.field==this);return(i?.create||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:n=>(n.values[i]=this.create(n),1),update:(n,l)=>{let o=n.values[i],s=this.updateF(o,l);return this.compareF(o,s)?0:(n.values[i]=s,1)},reconfigure:(n,l)=>{let o=n.facet(Ii),s=l.facet(Ii),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(n.values[i]=r.create(n),1):l.config.address[this.id]!=null?(n.values[i]=l.field(this),0):(n.values[i]=this.create(n),1)}}}init(e){return[this,Ii.of({field:this,create:e})]}get extension(){return this}}const Nt={lowest:4,low:3,default:2,high:1,highest:0};function li(a){return e=>new So(e,a)}const Jh={highest:li(Nt.highest),high:li(Nt.high),default:li(Nt.default),low:li(Nt.low),lowest:li(Nt.lowest)};class So{constructor(e,i){this.inner=e,this.prec=i}}class Fi{of(e){return new Tn(this,e)}reconfigure(e){return Fi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Tn{constructor(e,i){this.compartment=e,this.inner=i}}class Di{constructor(e,i,n,l,o,s){for(this.base=e,this.compartments=i,this.dynamicSlots=n,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,n){let l=[],o=Object.create(null),s=new Map;for(let p of Xh(e,i,s))p instanceof Bt?l.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let r=Object.create(null),c=[],d=[];for(let p of l)r[p.id]=d.length<<1,d.push(m=>p.slot(m));let h=n?.config.facets;for(let p in o){let m=o[p],b=m[0].facet,w=h&&h[p]||[];if(m.every(C=>C.type==0))if(r[b.id]=c.length<<1|1,Mn(w,m))c.push(n.facet(b));else{let C=b.combine(m.map(y=>y.value));c.push(n&&b.compare(C,n.facet(b))?n.facet(b):C)}else{for(let C of m)C.type==0?(r[C.id]=c.length<<1|1,c.push(C.value)):(r[C.id]=d.length<<1,d.push(y=>C.dynamicSlot(y)));r[b.id]=d.length<<1,d.push(C=>Gh(C,b,m))}}let f=d.map(p=>p(r));return new Di(e,s,f,r,c,o)}}function Xh(a,e,i){let n=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let d=n[c].indexOf(s);d>-1&&n[c].splice(d,1),s instanceof Tn&&i.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let d of s)o(d,r);else if(s instanceof Tn){if(i.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(s.compartment)||s.inner;i.set(s.compartment,d),o(d,r)}else if(s instanceof So)o(s.inner,s.prec);else if(s instanceof Bt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Ti)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,Nt.default);else{let d=s.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,r)}}return o(a,Nt.default),n.reduce((s,r)=>s.concat(r))}function oi(a,e){if(e&1)return 2;let i=e>>1,n=a.status[i];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;a.status[i]=4;let l=a.computeSlot(a,a.config.dynamicSlots[i]);return a.status[i]=2|l}function $i(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const Bo=Z.define(),In=Z.define({combine:a=>a.some(e=>e),static:!0}),No=Z.define({combine:a=>a.length?a[0]:void 0,static:!0}),Vo=Z.define(),Ro=Z.define(),Eo=Z.define(),Oo=Z.define({combine:a=>a.length?a[0]:!1});class Dt{constructor(e,i){this.type=e,this.value=i}static define(){return new Zh}}class Zh{of(e){return new Dt(this,e)}}class ef{constructor(e){this.map=e}of(e){return new ye(this,e)}}class ye{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new ye(this.type,i)}is(e){return this.type==e}static define(e={}){return new ef(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let l of e){let o=l.map(i);o&&n.push(o)}return n}}ye.reconfigure=ye.define(),ye.appendConfig=ye.define();class Be{constructor(e,i,n,l,o,s){this.startState=e,this.changes=i,this.selection=n,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Co(n,i.newLength),o.some(r=>r.type==Be.time)||(this.annotations=o.concat(Be.time.of(Date.now())))}static create(e,i,n,l,o,s){return new Be(e,i,n,l,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(Be.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}Be.time=Dt.define(),Be.userEvent=Dt.define(),Be.addToHistory=Dt.define(),Be.remote=Dt.define();function tf(a,e){let i=[];for(let n=0,l=0;;){let o,s;if(n<a.length&&(l==e.length||e[l]>=a[n]))o=a[n++],s=a[n++];else if(l<e.length)o=e[l++],s=e[l++];else return i;!i.length||i[i.length-1]<o?i.push(o,s):i[i.length-1]<s&&(i[i.length-1]=s)}}function Mo(a,e,i){var n;let l,o,s;return i?(l=e.changes,o=Ae.empty(e.changes.length),s=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),o=a.changes.mapDesc(e.changes,!0),s=a.changes.compose(l)),{changes:s,selection:e.selection?e.selection.map(o):(n=a.selection)===null||n===void 0?void 0:n.map(l),effects:ye.mapEffects(a.effects,l).concat(ye.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Fn(a,e,i){let n=e.selection,l=$t(e.annotations);return e.userEvent&&(l=l.concat(Be.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ae?e.changes:Ae.of(e.changes||[],i,a.facet(No)),selection:n&&(n instanceof Y?n:Y.single(n.anchor,n.head)),effects:$t(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function _o(a,e,i){let n=Fn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(i=!1);let s=!!e[o].sequential;n=Mo(n,Fn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=Be.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return lf(i?nf(l):l)}function nf(a){let e=a.startState,i=!0;for(let l of e.facet(Vo)){let o=l(a);if(o===!1){i=!1;break}Array.isArray(o)&&(i=i===!0?o:tf(i,o))}if(i!==!0){let l,o;if(i===!1)o=a.changes.invertedDesc,l=Ae.empty(e.doc.length);else{let s=a.changes.filter(i);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=Be.create(e,l,a.selection&&a.selection.map(o),ye.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(Ro);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof Be?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Be?a=o[0]:a=_o(e,$t(o),!1)}return a}function lf(a){let e=a.startState,i=e.facet(Eo),n=a;for(let l=i.length-1;l>=0;l--){let o=i[l](a);o&&Object.keys(o).length&&(n=Mo(n,Fn(e,o,a.changes.newLength),!0))}return n==a?a:Be.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const of=[];function $t(a){return a==null?of:Array.isArray(a)?a:[a]}var st=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(st||(st={}));const sf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dn;try{Dn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function af(a){if(Dn)return Dn.test(a);for(let e=0;e<a.length;e++){let i=a[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||sf.test(i)))return!0}return!1}function rf(a){return e=>{if(!/\S/.test(e))return st.Space;if(af(e))return st.Word;for(let i=0;i<a.length;i++)if(e.indexOf(a[i])>-1)return st.Word;return st.Other}}class ae{constructor(e,i,n,l,o,s){this.config=e,this.doc=i,this.selection=n,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)oi(this,r<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return oi(this,n),$i(this,n)}update(...e){return _o(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:l}=i;for(let r of e.effects)r.is(Fi.reconfigure)?(i&&(l=new Map,i.compartments.forEach((c,d)=>l.set(d,c)),i=null),l.set(r.value.compartment,r.value.extension)):r.is(ye.reconfigure)?(i=null,n=r.value):r.is(ye.appendConfig)&&(i=null,n=$t(n).concat(r.value));let o;i?o=e.startState.values.slice():(i=Di.resolve(n,l,this),o=new ae(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(In)?e.newSelection:e.newSelection.asSingle();new ae(i,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:Y.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),l=this.changes(n.changes),o=[n.range],s=$t(n.effects);for(let r=1;r<i.ranges.length;r++){let c=e(i.ranges[r]),d=this.changes(c.changes),h=d.map(l);for(let p=0;p<r;p++)o[p]=o[p].map(h);let f=l.mapDesc(d,!0);o.push(c.range.map(f)),l=l.compose(h),s=ye.mapEffects(s,h).concat(ye.mapEffects($t(c.effects),f))}return{changes:l,selection:Y.create(o,i.mainIndex),effects:s}}changes(e=[]){return e instanceof Ae?e:Ae.of(e,this.doc.length,this.facet(ae.lineSeparator))}toText(e){return le.of(e.split(this.facet(ae.lineSeparator)||Vn))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(oi(this,i),$i(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let l=e[n];l instanceof Bt&&this.config.address[l.id]!=null&&(i[n]=l.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let s=n[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return ae.create({doc:e.doc,selection:Y.fromJSON(e.selection),extensions:i.extensions?l.concat([i.extensions]):l})}static create(e={}){let i=Di.resolve(e.extensions||[],new Map),n=e.doc instanceof le?e.doc:le.of((e.doc||"").split(i.staticFacet(ae.lineSeparator)||Vn)),l=e.selection?e.selection instanceof Y?e.selection:Y.single(e.selection.anchor,e.selection.head):Y.single(0);return Co(l,n.length),i.staticFacet(In)||(l=l.asSingle()),new ae(i,n,l,i.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(ae.tabSize)}get lineBreak(){return this.facet(ae.lineSeparator)||`
18
+ `}get readOnly(){return this.facet(Oo)}phrase(e,...i){for(let n of this.facet(ae.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>i.length?n:i[o-1]})),e}languageDataAt(e,i,n=-1){let l=[];for(let o of this.facet(Bo))for(let s of o(this,i,n))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return rf(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-n,r=e-n;for(;s>0;){let c=lt(i,s,!1);if(o(i.slice(c,s))!=st.Word)break;s=c}for(;r<l;){let c=lt(i,r);if(o(i.slice(r,c))!=st.Word)break;r=c}return s==r?null:Y.range(s+n,r+n)}}ae.allowMultipleSelections=In,ae.tabSize=Z.define({combine:a=>a.length?a[0]:4}),ae.lineSeparator=No,ae.readOnly=Oo,ae.phrases=Z.define({compare(a,e){let i=Object.keys(a),n=Object.keys(e);return i.length==n.length&&i.every(l=>a[l]==e[l])}}),ae.languageData=Bo,ae.changeFilter=Vo,ae.transactionFilter=Ro,ae.transactionExtender=Eo,Fi.reconfigure=ye.define();class Pt{eq(e){return this==e}range(e,i=e){return si.create(e,i,this)}}Pt.prototype.startSide=Pt.prototype.endSide=0,Pt.prototype.point=!1,Pt.prototype.mapMode=Te.TrackDel;class si{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new si(e,i,n)}}function $n(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Pn{constructor(e,i,n,l){this.from=e,this.to=i,this.value=n,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,l=0){let o=n?this.to:this.from;for(let s=l,r=o.length;;){if(s==r)return s;let c=s+r>>1,d=o[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-i;if(c==s)return d>=0?s:r;d>=0?r=c:s=c+1}}between(e,i,n,l){for(let o=this.findIndex(i,-1e9,!0),s=this.findIndex(n,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,i){let n=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let d=this.value[c],h=this.from[c]+e,f=this.to[c]+e,p,m;if(h==f){let b=i.mapPos(h,d.startSide,d.mapMode);if(b==null||(p=m=b,d.startSide!=d.endSide&&(m=i.mapPos(h,d.endSide),m<p)))continue}else if(p=i.mapPos(h,d.startSide),m=i.mapPos(f,d.endSide),p>m||p==m&&d.startSide>0&&d.endSide<=0)continue;(m-p||d.endSide-d.startSide)<0||(s<0&&(s=p),d.point&&(r=Math.max(r,m-p)),n.push(d),l.push(p-s),o.push(m-s))}return{mapped:n.length?new Pn(l,o,n,r):null,pos:s}}}class fe{constructor(e,i,n,l){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=l}static create(e,i,n,l){return new fe(e,i,n,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(i.length==0&&!s)return this;if(n&&(i=i.slice().sort($n)),this.isEmpty)return i.length?fe.of(i):this;let r=new Io(this,null,-1).goto(0),c=0,d=[],h=new Pi;for(;r.value||c<i.length;)if(c<i.length&&(r.from-i[c].from||r.startSide-i[c].value.startSide)>=0){let f=i[c++];h.addInner(f.from,f.to,f.value)||d.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==i.length||this.chunkEnd(r.chunkIndex)<i[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||d.push(si.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?fe.empty:this.nextLayer.update({add:d,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],l=-1;for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],c=this.chunk[s],d=e.touchesRange(r,r+c.length);if(d===!1)l=Math.max(l,c.maxPoint),i.push(c),n.push(e.mapPos(r));else if(d===!0){let{mapped:h,pos:f}=c.map(r,e);h&&(l=Math.max(l,h.maxPoint),i.push(h),n.push(f))}}let o=this.nextLayer.map(e);return i.length==0?o:new fe(n,i,o||fe.empty,l)}between(e,i,n){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(i>=o&&e<=o+s.length&&s.between(o,e-o,i-o,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ai.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ai.from(e).goto(i)}static compare(e,i,n,l,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),r=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),c=To(s,r,n),d=new ri(s,c,o),h=new ri(r,c,o);n.iterGaps((f,p,m)=>Fo(d,f,h,p,m,l)),n.empty&&n.length==0&&Fo(d,0,h,0,0,l)}static eq(e,i,n=0,l){l==null&&(l=999999999);let o=e.filter(h=>!h.isEmpty&&i.indexOf(h)<0),s=i.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=To(o,s),c=new ri(o,r,0).goto(n),d=new ri(s,r,0).goto(n);for(;;){if(c.to!=d.to||!Un(c.active,d.active)||c.point&&(!d.point||!c.point.eq(d.point)))return!1;if(c.to>l)return!0;c.next(),d.next()}}static spans(e,i,n,l,o=-1){let s=new ri(e,null,o).goto(i),r=i,c=s.openStart;for(;;){let d=Math.min(s.to,n);if(s.point){let h=s.activeForPoint(s.to),f=s.pointFrom<i?h.length+1:s.point.startSide<0?h.length:Math.min(h.length,c);l.point(r,d,s.point,h,f,s.pointRank),c=Math.min(s.openEnd(d),h.length)}else d>r&&(l.span(r,d,s.active,c),c=s.openEnd(d));if(s.to>n)return c+(s.point&&s.to>n?1:0);r=s.to,s.next()}}static of(e,i=!1){let n=new Pi;for(let l of e instanceof si?[e]:i?cf(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return fe.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=fe.empty;l=l.nextLayer)i=new fe(l.chunkPos,l.chunk,i,Math.max(l.maxPoint,i.maxPoint));return i}}fe.empty=new fe([],[],null,-1);function cf(a){if(a.length>1)for(let e=a[0],i=1;i<a.length;i++){let n=a[i];if($n(e,n)>0)return a.slice().sort($n);e=n}return a}fe.empty.nextLayer=fe.empty;class Pi{finishChunk(e){this.chunks.push(new Pn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,n){this.addInner(e,i,n)||(this.nextLayer||(this.nextLayer=new Pi)).add(e,i,n)}addInner(e,i,n){let l=e-this.lastTo||n.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=i,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let n=i.value.length-1;return this.last=i.value[n],this.lastFrom=i.from[n]+e,this.lastTo=i.to[n]+e,!0}finish(){return this.finishInner(fe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=fe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function To(a,e,i){let n=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&n.set(o.chunk[s],o.chunkPos[s]);let l=new Set;for(let o of e)for(let s=0;s<o.chunk.length;s++){let r=n.get(o.chunk[s]);r!=null&&(i?i.mapPos(r):r)==o.chunkPos[s]&&!i?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class Io{constructor(e,i,n,l=0){this.layer=e,this.skip=i,this.minPoint=n,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,n){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!n||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],i=this.layer.chunk[this.chunkIndex],n=e+i.from[this.rangeIndex];if(this.from=n,this.to=e+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class ai{constructor(e){this.heap=e}static from(e,i=null,n=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&l.push(new Io(s,i,n,o));return l.length==1?l[0]:new ai(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let n of this.heap)n.goto(e,i);for(let n=this.heap.length>>1;n>=0;n--)Ln(this.heap,n);return this.next(),this}forward(e,i){for(let n of this.heap)n.forward(e,i);for(let n=this.heap.length>>1;n>=0;n--)Ln(this.heap,n);(this.to-e||this.value.endSide-i)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Ln(this.heap,0)}}}function Ln(a,e){for(let i=a[e];;){let n=(e<<1)+1;if(n>=a.length)break;let l=a[n];if(n+1<a.length&&l.compare(a[n+1])>=0&&(l=a[n+1],n++),i.compare(l)<0)break;a[n]=i,a[e]=l,e=n}}class ri{constructor(e,i,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=ai.from(e,i,n)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){Li(this.active,e),Li(this.activeTo,e),Li(this.activeRank,e),this.minActive=Do(this.active,this.activeTo)}addActive(e){let i=0,{value:n,to:l,rank:o}=this.cursor;for(;i<this.activeRank.length&&(o-this.activeRank[i]||l-this.activeTo[i])>0;)i++;Ui(this.active,i,n),Ui(this.activeTo,i,l),Ui(this.activeRank,i,o),e&&Ui(e,i,this.cursor.from),this.minActive=Do(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),n&&Li(n,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let l=n.length-1;l>=0&&n[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&i.push(this.active[n]);return i.reverse()}openEnd(e){let i=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)i++;return i}}function Fo(a,e,i,n,l,o){a.goto(e),i.goto(n);let s=n+l,r=n,c=n-e;for(;;){let d=a.to+c-i.to,h=d||a.endSide-i.endSide,f=h<0?a.to+c:i.to,p=Math.min(f,s);if(a.point||i.point?a.point&&i.point&&(a.point==i.point||a.point.eq(i.point))&&Un(a.activeForPoint(a.to),i.activeForPoint(i.to))||o.comparePoint(r,p,a.point,i.point):p>r&&!Un(a.active,i.active)&&o.compareRange(r,p,a.active,i.active),f>s)break;(d||a.openEnd!=i.openEnd)&&o.boundChange&&o.boundChange(f),r=f,h<=0&&a.next(),h>=0&&i.next()}}function Un(a,e){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(a[i]!=e[i]&&!a[i].eq(e[i]))return!1;return!0}function Li(a,e){for(let i=e,n=a.length-1;i<n;i++)a[i]=a[i+1];a.pop()}function Ui(a,e,i){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=i}function Do(a,e){let i=-1,n=1e9;for(let l=0;l<e.length;l++)(e[l]-n||a[l].endSide-a[i].endSide)<0&&(i=l,n=e[l]);return i}function df(a,e,i,n){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?i-o%i:1,l=lt(a,l)}return n===!0?-1:a.length}const jn="ͼ",$o=typeof Symbol>"u"?"__"+jn:Symbol.for(jn),zn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Po=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class bt{constructor(e,i){this.rules=[];let{finish:n}=i||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,d){let h=[],f=/^@(\w+)\b/.exec(s[0]),p=f&&f[1]=="keyframes";if(f&&r==null)return c.push(s[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(w=>s.map(C=>w.replace(/&/,C))).reduce((w,C)=>w.concat(C)),b,c);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),b,h,p)}else b!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+b+";")}(h.length||p)&&c.push((n&&!f&&!d?s.map(n):s).join(", ")+" {"+h.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
19
19
  `)}static newName(){let e=Po[$o]||1;return Po[$o]=e+1,jn+e.toString(36)}static mount(e,i,n){let l=e[zn],o=n&&n.nonce;l?o&&l.setNonce(o):l=new hf(e,o),l.mount(Array.isArray(i)?i:[i],e)}}let Lo=new Map;class hf{constructor(e,i){let n=e.ownerDocument||e,l=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=Lo.get(n);if(o)return e[zn]=o;this.sheet=new l.CSSStyleSheet,Lo.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[zn]=this}mount(e,i){let n=this.sheet,l=0,o=0;for(let s=0;s<e.length;s++){let r=e[s],c=this.modules.indexOf(r);if(c<o&&c>-1&&(this.modules.splice(c,1),o--,c=-1),c==-1){if(this.modules.splice(o++,0,r),n)for(let d=0;d<r.rules.length;d++)n.insertRule(r.rules[d],l++)}else{for(;o<c;)l+=this.modules[o++].rules.length;l+=r.rules.length,o++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let s="";for(let c=0;c<this.modules.length;c++)s+=this.modules[c].getRules()+`
20
- `;this.styleTag.textContent=s;let r=i.head||i;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Lt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},qn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ae=0;Ae<10;Ae++)Lt[48+Ae]=Lt[96+Ae]=String(Ae);for(var Ae=1;Ae<=24;Ae++)Lt[Ae+111]="F"+Ae;for(var Ae=65;Ae<=90;Ae++)Lt[Ae]=String.fromCharCode(Ae+32),qn[Ae]=String.fromCharCode(Ae);for(var Qn in Lt)qn.hasOwnProperty(Qn)||(qn[Qn]=Lt[Qn]);function ci(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Kn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function ji(a,e){if(!e.anchorNode)return!1;try{return Kn(a,e.anchorNode)}catch{return!1}}function di(a){return a.nodeType==3?Rt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function hi(a,e,i,n){return i?Uo(a,e,i,n,-1)||Uo(a,e,i,n,1):!1}function Vt(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function zi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function Uo(a,e,i,n,l){for(;;){if(a==i&&e==n)return!0;if(e==(l<0?0:Ge(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=Vt(a)+(l<0?0:1),a=o}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?Ge(a):0}else return!1}}function Ge(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function qi(a,e){let i=e?a.left:a.right;return{left:i,right:i,top:a.top,bottom:a.bottom}}function ff(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function jo(a,e){let i=e.width/a.offsetWidth,n=e.height/a.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-a.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-a.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function uf(a,e,i,n,l,o,s,r){let c=a.ownerDocument,d=c.defaultView||window;for(let h=a,f=!1;h&&!f;)if(h.nodeType==1){let u,m=h==c.body,b=1,A=1;if(m)u=ff(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let y=h.getBoundingClientRect();({scaleX:b,scaleY:A}=jo(h,y)),u={left:y.left,right:y.left+h.clientWidth*b,top:y.top,bottom:y.top+h.clientHeight*A}}let C=0,w=0;if(l=="nearest")e.top<u.top?(w=e.top-(u.top+s),i>0&&e.bottom>u.bottom+w&&(w=e.bottom-u.bottom+s)):e.bottom>u.bottom&&(w=e.bottom-u.bottom+s,i<0&&e.top-w<u.top&&(w=e.top-(u.top+s)));else{let y=e.bottom-e.top,R=u.bottom-u.top;w=(l=="center"&&y<=R?e.top+y/2-R/2:l=="start"||l=="center"&&i<0?e.top-s:e.bottom-R+s)-u.top}if(n=="nearest"?e.left<u.left?(C=e.left-(u.left+o),i>0&&e.right>u.right+C&&(C=e.right-u.right+o)):e.right>u.right&&(C=e.right-u.right+o,i<0&&e.left<u.left+C&&(C=e.left-(u.left+o))):C=(n=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:n=="start"==r?e.left-o:e.right-(u.right-u.left)+o)-u.left,C||w)if(m)d.scrollBy(C,w);else{let y=0,R=0;if(w){let g=h.scrollTop;h.scrollTop+=w/A,R=(h.scrollTop-g)*A}if(C){let g=h.scrollLeft;h.scrollLeft+=C/b,y=(h.scrollLeft-g)*b}e={left:e.left-y,top:e.top-R,right:e.right-y,bottom:e.bottom-R},y&&Math.abs(y-C)<1&&(n="nearest"),R&&Math.abs(R-w)<1&&(l="nearest")}if(m)break;(e.top<u.top||e.bottom>u.bottom||e.left<u.left||e.right>u.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function pf(a){let e=a.ownerDocument,i,n;for(let l=a.parentNode;l&&!(l==e.body||i&&n);)if(l.nodeType==1)!n&&l.scrollHeight>l.clientHeight&&(n=l),!i&&l.scrollWidth>l.clientWidth&&(i=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:i,y:n}}class mf{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:i,focusNode:n}=e;this.set(i,Math.min(e.anchorOffset,i?Ge(i):0),n,Math.min(e.focusOffset,n?Ge(n):0))}set(e,i,n,l){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=l}}let Ut=null;function zo(a){if(a.setActive)return a.setActive();if(Ut)return a.focus(Ut);let e=[];for(let i=a;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(a.focus(Ut==null?{get preventScroll(){return Ut={preventScroll:!0},!0}}:void 0),!Ut){Ut=!1;for(let i=0;i<e.length;){let n=e[i++],l=e[i++],o=e[i++];n.scrollTop!=l&&(n.scrollTop=l),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let qo;function Rt(a,e,i=e){let n=qo||(qo=document.createRange());return n.setEnd(a,i),n.setStart(a,e),n}function jt(a,e,i,n){let l={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=n);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,a.dispatchEvent(o);let s=new KeyboardEvent("keyup",l);return s.synthetic=!0,a.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function gf(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Qo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function kf(a,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Ge(i));;)if(n){if(i.nodeType!=1)return!1;let l=i.childNodes[n-1];l.contentEditable=="false"?n--:(i=l,n=Ge(i))}else{if(i==a)return!0;n=Vt(i),i=i.parentNode}}function Ko(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Wo(a,e){for(let i=a,n=e;;){if(i.nodeType==3&&n>0)return{node:i,offset:n};if(i.nodeType==1&&n>0){if(i.contentEditable=="false")return null;i=i.childNodes[n-1],n=Ge(i)}else if(i.parentNode&&!zi(i))n=Vt(i),i=i.parentNode;else return null}}function Yo(a,e){for(let i=a,n=e;;){if(i.nodeType==3&&n<i.nodeValue.length)return{node:i,offset:n};if(i.nodeType==1&&n<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[n],n=0}else if(i.parentNode&&!zi(i))n=Vt(i)+1,i=i.parentNode;else return null}}class Be{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new Be(e.parentNode,Vt(e),i)}static after(e,i){return new Be(e.parentNode,Vt(e)+1,i)}}const Wn=[];class re{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let i=this.posAtStart;for(let n of this.children){if(n==e)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,i){if(this.flags&2){let n=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:n.firstChild)){let r=re.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,i),s.flags&=-8}if(o=l?l.nextSibling:n.firstChild,i&&!i.written&&i.node==n&&o!=s.dom&&(i.written=!0),s.dom.parentNode==n)for(;o&&o!=s.dom;)o=Ho(o);else n.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:n.firstChild,o&&i&&i.node==n&&(i.written=!0);o;)o=Ho(o)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,i),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,i){let n;if(e==this.dom)n=this.dom.childNodes[i];else{let l=Ge(e)==0?0:i==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;l==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?l=-1:l=1),e=o}l<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!re.get(n);)n=n.nextSibling;if(!n)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==n)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,i,n=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,d=n,h=n;c<this.children.length;c++){let f=this.children[c],u=d+f.length;if(d<e&&u>i)return f.domBoundsAround(e,i,d);if(u>=e&&l==-1&&(l=c,o=d),d>i&&f.dom.parentNode==this.dom){s=c,r=h;break}h=u,d=u+f.breakAfter}return{from:o,to:r<0?n+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let i=this.parent;i;i=i.parent){if(e&&(i.flags|=2),i.flags&1)return;i.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let i=e.parent;if(!i)return e;e=i}}replaceChildren(e,i,n=Wn){this.markDirty();for(let l=e;l<i;l++){let o=this.children[l];o.parent==this&&n.indexOf(o)<0&&o.destroy()}n.length<250?this.children.splice(e,i-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(i));for(let l=0;l<n.length;l++)n[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Go(this.children,e,this.children.length)}childPos(e,i=1){return this.childCursor().findPos(e,i)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,i,n,l,o,s){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}re.prototype.breakAfter=0;function Ho(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Go{constructor(e,i,n){this.children=e,this.pos=i,this.i=n,this.off=0}findPos(e,i=1){for(;;){if(e>this.pos||e==this.pos&&(i>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Jo(a,e,i,n,l,o,s,r,c){let{children:d}=a,h=d.length?d[e]:null,f=o.length?o[o.length-1]:null,u=f?f.breakAfter:s;if(!(e==n&&h&&!s&&!u&&o.length<2&&h.merge(i,l,o.length?f:null,i==0,r,c))){if(n<d.length){let m=d[n];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==n&&(m=m.split(l),l=0),!u&&f&&m.merge(0,l,f,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(f?f.breakAfter=1:s=1),n++}for(h&&(h.breakAfter=s,i>0&&(!s&&o.length&&h.merge(i,h.length,o[0],!1,r,0)?h.breakAfter=o.shift().breakAfter:(i<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(i,h.length,null,!1,r,0),e++));e<n&&o.length;)if(d[n-1].become(o[o.length-1]))n--,o.pop(),c=o.length?0:r;else if(d[e].become(o[0]))e++,o.shift(),r=o.length?0:c;else break;!o.length&&e&&n<d.length&&!d[e-1].breakAfter&&d[n].merge(0,0,d[e-1],!1,r,c)&&e--,(e<n||o.length)&&a.replaceChildren(e,n,o)}}function Xo(a,e,i,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(i,1),{i:d,off:h}=s.findPos(e,-1),f=e-i;for(let u of n)f+=u.length;a.length+=f,Jo(a,d,h,r,c,n,0,l,o)}let Ee=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Yn=typeof document<"u"?document:{documentElement:{style:{}}};const Hn=/Edge\/(\d+)/.exec(Ee.userAgent),Zo=/MSIE \d/.test(Ee.userAgent),Gn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ee.userAgent),Qi=!!(Zo||Gn||Hn),es=!Qi&&/gecko\/(\d+)/i.test(Ee.userAgent),Jn=!Qi&&/Chrome\/(\d+)/.exec(Ee.userAgent),ts="webkitFontSmoothing"in Yn.documentElement.style,is=!Qi&&/Apple Computer/.test(Ee.vendor),ns=is&&(/Mobile\/\w+/.test(Ee.userAgent)||Ee.maxTouchPoints>2);var W={mac:ns||/Mac/.test(Ee.platform),windows:/Win/.test(Ee.platform),linux:/Linux|X11/.test(Ee.platform),ie:Qi,ie_version:Zo?Yn.documentMode||6:Gn?+Gn[1]:Hn?+Hn[1]:0,gecko:es,gecko_version:es?+(/Firefox\/(\d+)/.exec(Ee.userAgent)||[0,0])[1]:0,chrome:!!Jn,chrome_version:Jn?+Jn[1]:0,ios:ns,android:/Android\b/.test(Ee.userAgent),webkit:ts,safari:is,webkit_version:ts?+(/\bAppleWebKit\/(\d+)/.exec(Ee.userAgent)||[0,0])[1]:0,tabSize:Yn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const bf=256;class je extends re{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,i,n){return this.flags&8||n&&(!(n instanceof je)||this.length-(i-e)+n.length>bf||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(i),this.markDirty(),!0)}split(e){let i=new je(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),i.flags|=this.flags&8,i}localPosFromDOM(e,i){return e==this.dom?i:i?this.text.length:0}domAtPos(e){return new Be(this.dom,e)}domBoundsAround(e,i,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,i){return yf(this.dom,e,i)}}class at extends re{constructor(e,i=[],n=0){super(),this.mark=e,this.children=i,this.length=n;for(let l of i)l.setParent(this)}setAttrs(e){if(Qo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let i in this.mark.attrs)e.setAttribute(i,this.mark.attrs[i]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,i){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,i)}merge(e,i,n,l,o,s){return n&&(!(n instanceof at&&n.mark.eq(this.mark))||e&&o<=0||i<this.length&&s<=0)?!1:(Xo(this,e,i,n?n.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let i=[],n=0,l=-1,o=0;for(let r of this.children){let c=n+r.length;c>e&&i.push(n<e?r.split(e-n):r),l<0&&n>=e&&(l=o),n=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new at(this.mark,i,s)}domAtPos(e){return ls(this,e)}coordsAt(e,i){return ss(this,e,i)}}function yf(a,e,i){let n=a.nodeValue.length;e>n&&(e=n);let l=e,o=e,s=0;e==0&&i<0||e==n&&i>=0?W.chrome||W.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):i<0?l--:o<n&&o++;let r=Rt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:i>=0)?0:r.length-1];return W.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,d=>d.width)||c),s?qi(c,s<0):c||null}class Et extends re{static create(e,i,n){return new Et(e,i,n)}constructor(e,i,n){super(),this.widget=e,this.length=i,this.side=n,this.prevWidget=null}split(e){let i=Et.create(this.widget,this.length-e,this.side);return this.length-=e,i}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,i,n,l,o,s){return n&&(!(n instanceof Et)||!this.widget.compare(n.widget)||e>0&&o<=0||i<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-i),!0)}become(e){return e instanceof Et&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return le.empty;let e=this;for(;e.parent;)e=e.parent;let{view:i}=e,n=i&&i.state.doc,l=this.posAtStart;return n?n.slice(l,l+this.length):le.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Be.before(this.dom):Be.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,i){let n=this.widget.coordsAt(this.dom,e,i);if(n)return n;let l=this.dom.getClientRects(),o=null;if(!l.length)return null;let s=this.side?this.side<0:e>0;for(let r=s?l.length-1:0;o=l[r],!(e>0?r==0:r==l.length-1||o.top<o.bottom);r+=s?-1:1);return qi(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class zt extends re{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof zt&&e.side==this.side}split(){return new zt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Be.before(this.dom):Be.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return le.empty}get isHidden(){return!0}}je.prototype.children=Et.prototype.children=zt.prototype.children=Wn;function ls(a,e){let i=a.dom,{children:n}=a,l=0;for(let o=0;l<n.length;l++){let s=n[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==i)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=n[o-1];if(s.dom.parentNode==i)return s.domAtPos(s.length)}for(let o=l;o<n.length;o++){let s=n[o];if(s.dom.parentNode==i)return s.domAtPos(0)}return new Be(i,0)}function os(a,e,i){let n,{children:l}=a;i>0&&e instanceof at&&l.length&&(n=l[l.length-1])instanceof at&&n.mark.eq(e.mark)?os(n,e.children[0],i-1):(l.push(e),e.setParent(a)),a.length+=e.length}function ss(a,e,i){let n=null,l=-1,o=null,s=-1;function r(d,h){for(let f=0,u=0;f<d.children.length&&u<=h;f++){let m=d.children[f],b=u+m.length;b>=h&&(m.children.length?r(m,h-u):(!o||o.isHidden&&(i>0||Af(o,m)))&&(b>h||u==b&&m.getSide()>0)?(o=m,s=h-u):(u<h||u==b&&m.getSide()<0&&!m.isHidden)&&(n=m,l=h-u)),u=b}}r(a,e);let c=(i<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),i):wf(a)}function wf(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let i=di(e);return i[i.length-1]||null}function Af(a,e){let i=a.coordsAt(0,1),n=e.coordsAt(0,1);return i&&n&&n.top<i.bottom}function Xn(a,e){for(let i in a)i=="class"&&e.class?e.class+=" "+a.class:i=="style"&&e.style?e.style+=";"+a.style:e[i]=a[i];return e}const as=Object.create(null);function Ki(a,e,i){if(a==e)return!0;a||(a=as),e||(e=as);let n=Object.keys(a),l=Object.keys(e);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=l.length-(i&&l.indexOf(i)>-1?1:0))return!1;for(let o of n)if(o!=i&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Zn(a,e,i){let n=!1;if(e)for(let l in e)i&&l in i||(n=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(i)for(let l in i)e&&e[l]==i[l]||(n=!0,l=="style"?a.style.cssText=i[l]:a.setAttribute(l,i[l]));return n}function xf(a){let e=Object.create(null);for(let i=0;i<a.attributes.length;i++){let n=a.attributes[i];e[n.name]=n.value}return e}class el{eq(e){return!1}updateDOM(e,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,i,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Je||(Je={}));class Ne extends Pt{constructor(e,i,n,l){super(),this.startSide=e,this.endSide=i,this.widget=n,this.spec=l}get heightRelevant(){return!1}static mark(e){return new fi(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return i+=n&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new bt(e,i,i,n,e.widget||null,!1)}static replace(e){let i=!!e.block,n,l;if(e.isBlockGap)n=-5e8,l=4e8;else{let{start:o,end:s}=rs(e,i);n=(o?i?-3e8:-1:5e8)-1,l=(s?i?2e8:1:-6e8)+1}return new bt(e,n,l,i,e.widget||null,!0)}static line(e){return new ui(e)}static set(e,i=!1){return fe.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ne.none=fe.empty;class fi extends Ne{constructor(e){let{start:i,end:n}=rs(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var i,n;return this==e||e instanceof fi&&this.tagName==e.tagName&&(this.class||((i=this.attrs)===null||i===void 0?void 0:i.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Ki(this.attrs,e.attrs,"class")}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}fi.prototype.point=!1;class ui extends Ne{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ui&&this.spec.class==e.spec.class&&Ki(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}ui.prototype.mapMode=_e.TrackBefore,ui.prototype.point=!0;class bt extends Ne{constructor(e,i,n,l,o,s){super(i,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?i<=0?_e.TrackBefore:_e.TrackAfter:_e.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof bt&&Cf(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}bt.prototype.point=!0;function rs(a,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=a;return i==null&&(i=a.inclusive),n==null&&(n=a.inclusive),{start:i??e,end:n??e}}function Cf(a,e){return a==e||!!(a&&e&&a.compare(e))}function Wi(a,e,i,n=0){let l=i.length-1;l>=0&&i[l]+n>=a?i[l]=Math.max(i[l],e):i.push(a,e)}class ke extends re{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,i,n,l,o,s){if(n){if(!(n instanceof ke))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),Xo(this,e,i,n?n.children.slice():[],o,s),!0}split(e){let i=new ke;if(i.breakAfter=this.breakAfter,this.length==0)return i;let{i:n,off:l}=this.childPos(e);l&&(i.append(this.children[n].split(l),0),this.children[n].merge(l,this.children[n].length,null,!1,0,0),n++);for(let o=n;o<this.children.length;o++)i.append(this.children[o],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,i}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Ki(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,i){os(this,e,i)}addLineDeco(e){let i=e.spec.attributes,n=e.spec.class;i&&(this.attrs=Xn(i,this.attrs||{})),n&&(this.attrs=Xn({class:n},this.attrs||{}))}domAtPos(e){return ls(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,i){var n;this.dom?this.flags&4&&(Qo(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Zn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,i);let l=this.dom.lastChild;for(;l&&re.get(l)instanceof at;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=re.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!W.ios||!this.children.some(o=>o instanceof je))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,i;for(let n of this.children){if(!(n instanceof je)||/[^ -~]/.test(n.text))return null;let l=di(n.dom);if(l.length!=1)return null;e+=l[0].width,i=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:i}:null}coordsAt(e,i){let n=ss(this,e,i);if(!this.children.length&&n&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:n.top+s,bottom:n.bottom-s,left:n.left,right:n.left}}}return n}become(e){return e instanceof ke&&this.children.length==0&&e.children.length==0&&Ki(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,i){for(let n=0,l=0;n<e.children.length;n++){let o=e.children[n],s=l+o.length;if(s>=i){if(o instanceof ke)return o;if(s>i)break}l=s+o.breakAfter}return null}}class rt extends re{constructor(e,i,n){super(),this.widget=e,this.length=i,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,i,n,l,o,s){return n&&(!(n instanceof rt)||!this.widget.compare(n.widget)||e>0&&o<=0||i<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-i),!0)}domAtPos(e){return e==0?Be.before(this.dom):Be.after(this.dom,e==this.length)}split(e){let i=this.length-e;this.length=e;let n=new rt(this.widget,i,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Wn}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):le.empty}domBoundsAround(){return null}become(e){return e instanceof rt&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,i){let n=this.widget.coordsAt(this.dom,e,i);return n||(this.widget instanceof tl?null:qi(this.dom.getBoundingClientRect(),this.length?e==0:i<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:i,endSide:n}=this.deco;return i==n?!1:e<0?i<0:n>0}}class tl extends el{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class pi{constructor(e,i,n,l){this.doc=e,this.pos=i,this.end=n,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=i}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof rt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ke),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Yi(new zt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof rt)&&this.getLine()}buildText(e,i,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(i.slice(i.length-n)),this.getLine().append(Yi(new je(this.text.slice(this.textOff,this.textOff+l)),i),n),this.atCursorPos=!0,this.textOff+=l,e-=l,n=0}}span(e,i,n,l){this.buildText(i-e,n,l),this.pos=i,this.openStart<0&&(this.openStart=l)}point(e,i,n,l,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof bt){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=i-e;if(n instanceof bt)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new rt(n.widget||qt.block,r,n));else{let c=Et.create(n.widget||qt.inline,r,r?0:n.startSide),d=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<i||n.startSide>0),h=!c.isEditable&&(e<i||o>l.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),d&&(f.append(Yi(new zt(1),l),o),o=l.length+Math.max(0,o-l.length)),f.append(Yi(c,l),o),this.atCursorPos=h,this.pendingBuffer=h?e<i||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}static build(e,i,n,l,o){let s=new pi(e,i,n,o);return s.openEnd=fe.spans(l,i,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Yi(a,e){for(let i of e)a=new at(i,[a],a.length);return a}class qt extends el{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qt.inline=new qt("span"),qt.block=new qt("div");var xe=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(xe||(xe={}));const Ot=xe.LTR,il=xe.RTL;function cs(a){let e=[];for(let i=0;i<a.length;i++)e.push(1<<+a[i]);return e}const vf=cs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Sf=cs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),nl=Object.create(null),Xe=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),i=a.charCodeAt(1);nl[e]=i,nl[i]=-e}function ds(a){return a<=247?vf[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Sf[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Bf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class yt{get dir(){return this.level%2?il:Ot}constructor(e,i,n){this.from=e,this.to=i,this.level=n}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,n,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=i&&r.to>=i){if(r.level==n)return s;(o<0||(l!=0?l<0?r.from<i:r.to>i:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function hs(a,e){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++){let n=a[i],l=e[i];if(n.from!=l.from||n.to!=l.to||n.direction!=l.direction||!hs(n.inner,l.inner))return!1}return!0}const ce=[];function Nf(a,e,i,n,l){for(let o=0;o<=n.length;o++){let s=o?n[o-1].to:e,r=o<n.length?n[o].from:i,c=o?256:l;for(let d=s,h=c,f=c;d<r;d++){let u=ds(a.charCodeAt(d));u==512?u=h:u==8&&f==4&&(u=16),ce[d]=u==4?2:u,u&7&&(f=u),h=u}for(let d=s,h=c,f=c;d<r;d++){let u=ce[d];if(u==128)d<r-1&&h==ce[d+1]&&h&24?u=ce[d]=h:ce[d]=256;else if(u==64){let m=d+1;for(;m<r&&ce[m]==64;)m++;let b=d&&h==8||m<i&&ce[m]==8?f==1?1:8:256;for(let A=d;A<m;A++)ce[A]=b;d=m-1}else u==8&&f==1&&(ce[d]=1);h=u,u&7&&(f=u)}}}function Vf(a,e,i,n,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=n.length;s++){let d=s?n[s-1].to:e,h=s<n.length?n[s].from:i;for(let f=d,u,m,b;f<h;f++)if(m=nl[u=a.charCodeAt(f)])if(m<0){for(let A=r-3;A>=0;A-=3)if(Xe[A+1]==-m){let C=Xe[A+2],w=C&2?l:C&4?C&1?o:l:0;w&&(ce[f]=ce[Xe[A]]=w),r=A;break}}else{if(Xe.length==189)break;Xe[r++]=f,Xe[r++]=u,Xe[r++]=c}else if((b=ce[f])==2||b==1){let A=b==l;c=A?0:1;for(let C=r-3;C>=0;C-=3){let w=Xe[C+2];if(w&2)break;if(A)Xe[C+2]|=2;else{if(w&4)break;Xe[C+2]|=4}}}}}function Rf(a,e,i,n){for(let l=0,o=n;l<=i.length;l++){let s=l?i[l-1].to:a,r=l<i.length?i[l].from:e;for(let c=s;c<r;){let d=ce[c];if(d==256){let h=c+1;for(;;)if(h==r){if(l==i.length)break;h=i[l++].to,r=l<i.length?i[l].from:e}else if(ce[h]==256)h++;else break;let f=o==1,u=(h<e?ce[h]:n)==1,m=f==u?f?1:2:n;for(let b=h,A=l,C=A?i[A-1].to:a;b>c;)b==C&&(b=i[--A].from,C=A?i[A-1].to:a),ce[--b]=m;c=h}else o=d,c++}}}function ll(a,e,i,n,l,o,s){let r=n%2?2:1;if(n%2==l%2)for(let c=e,d=0;c<i;){let h=!0,f=!1;if(d==o.length||c<o[d].from){let A=ce[c];A!=r&&(h=!1,f=A==16)}let u=!h&&r==1?[]:null,m=h?n:n+1,b=c;e:for(;;)if(d<o.length&&b==o[d].from){if(f)break e;let A=o[d];if(!h)for(let C=A.to,w=d+1;;){if(C==i)break e;if(w<o.length&&o[w].from==C)C=o[w++].to;else{if(ce[C]==r)break e;break}}if(d++,u)u.push(A);else{A.from>c&&s.push(new yt(c,A.from,m));let C=A.direction==Ot!=!(m%2);ol(a,C?n+1:n,l,A.inner,A.from,A.to,s),c=A.to}b=A.to}else{if(b==i||(h?ce[b]!=r:ce[b]==r))break;b++}u?ll(a,c,b,n+1,l,u,s):c<b&&s.push(new yt(c,b,m)),c=b}else for(let c=i,d=o.length;c>e;){let h=!0,f=!1;if(!d||c>o[d-1].to){let A=ce[c-1];A!=r&&(h=!1,f=A==16)}let u=!h&&r==1?[]:null,m=h?n:n+1,b=c;e:for(;;)if(d&&b==o[d-1].to){if(f)break e;let A=o[--d];if(!h)for(let C=A.from,w=d;;){if(C==e)break e;if(w&&o[w-1].to==C)C=o[--w].from;else{if(ce[C-1]==r)break e;break}}if(u)u.push(A);else{A.to<c&&s.push(new yt(A.to,c,m));let C=A.direction==Ot!=!(m%2);ol(a,C?n+1:n,l,A.inner,A.from,A.to,s),c=A.from}b=A.from}else{if(b==e||(h?ce[b-1]!=r:ce[b-1]==r))break;b--}u?ll(a,b,c,n+1,l,u,s):b<c&&s.push(new yt(b,c,m)),c=b}}function ol(a,e,i,n,l,o,s){let r=e%2?2:1;Nf(a,l,o,n,r),Vf(a,l,o,n,r),Rf(l,o,n,r),ll(a,l,o,e,i,n,s)}function Ef(a,e,i){if(!a)return[new yt(0,0,e==il?1:0)];if(e==Ot&&!i.length&&!Bf.test(a))return fs(a.length);if(i.length)for(;a.length>ce.length;)ce[ce.length]=256;let n=[],l=e==Ot?0:1;return ol(a,l,l,i,0,a.length,n),n}function fs(a){return[new yt(0,a,0)]}let us="";function Of(a,e,i,n,l){var o;let s=n.head-a.from,r=yt.find(e,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),c=e[r],d=c.side(l,i);if(s==d){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;c=e[r=u],s=c.side(!l,i),d=c.side(l,i)}let h=lt(a.text,s,c.forward(l,i));(h<c.from||h>c.to)&&(h=d),us=a.text.slice(Math.min(s,h),Math.max(s,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==d&&f.level+(l?0:1)<c.level?H.cursor(f.side(!l,i)+a.from,f.forward(l,i)?1:-1,f.level):H.cursor(h+a.from,c.forward(l,i)?-1:1,c.level)}function Mf(a,e,i){for(let n=e;n<i;n++){let l=ds(a.charCodeAt(n));if(l==1)return Ot;if(l==2||l==4)return il}return Ot}const ps=Z.define(),ms=Z.define(),gs=Z.define(),ks=Z.define(),sl=Z.define(),bs=Z.define(),ys=Z.define(),al=Z.define(),rl=Z.define(),ws=Z.define({combine:a=>a.some(e=>e)}),_f=Z.define({combine:a=>a.some(e=>e)}),As=Z.define();class Qt{constructor(e,i="nearest",n="nearest",l=5,o=5,s=!1){this.range=e,this.y=i,this.x=n,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Qt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Qt(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Hi=be.define({map:(a,e)=>a.map(e)}),xs=be.define();function Ze(a,e,i){let n=a.facet(ks);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const ct=Z.define({combine:a=>a.length?a[0]:!0});let Tf=0;const Kt=Z.define({combine(a){return a.filter((e,i)=>{for(let n=0;n<i;n++)if(a[n].plugin==e.plugin)return!1;return!0})}});class Wt{constructor(e,i,n,l,o){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Kt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Kt.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=i||{};return new Wt(Tf++,e,n,l,r=>{let c=[];return s&&c.push(mi.of(d=>{let h=d.plugin(r);return h?s(h):Ne.none})),o&&c.push(o(r)),c})}static fromClass(e,i){return Wt.define((n,l)=>new e(n,l),i)}}class cl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(n){if(Ze(i.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(i){Ze(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(n){Ze(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Cs=Z.define(),dl=Z.define(),mi=Z.define(),vs=Z.define(),hl=Z.define(),Ss=Z.define();function Bs(a,e){let i=a.state.facet(Ss);if(!i.length)return i;let n=i.map(o=>o instanceof Function?o(a):o),l=[];return fe.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let d=o-e.from,h=s-e.from,f=l;for(let u=r.length-1;u>=0;u--,c--){let m=r[u].spec.bidiIsolate,b;if(m==null&&(m=Mf(e.text,d,h)),c>0&&f.length&&(b=f[f.length-1]).to==d&&b.direction==m)b.to=h,f=b.inner;else{let A={from:d,to:h,direction:m,inner:[]};f.push(A),f=A.inner}}}}),l}const Ns=Z.define();function Vs(a){let e=0,i=0,n=0,l=0;for(let o of a.state.facet(Ns)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(i=Math.max(i,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:i,top:n,bottom:l}}const gi=Z.define();class $e{constructor(e,i,n,l){this.fromA=e,this.toA=i,this.fromB=n,this.toB=l}join(e){return new $e(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,n=this;for(;i>0;i--){let l=e[i-1];if(!(l.fromA>n.toA)){if(l.toA<n.fromA)break;n=n.join(l),e.splice(i-1,1)}}return e.splice(i,0,n),e}static extendWithRanges(e,i){if(i.length==0)return e;let n=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],d=s-r,h=c?c.fromB:1e9;for(;o<i.length&&i[o]<h;){let f=i[o],u=i[o+1],m=Math.max(r,f),b=Math.min(h,u);if(m<=b&&new $e(m+d,b+d,m,b).addToSet(n),u>h)break;o+=2}if(!c)return n;new $e(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class Gi{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=we.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new $e(o,s,r,c))),this.changedRanges=l}static create(e,i,n){return new Gi(e,i,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Rs extends re{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Ne.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ke],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new $e(0,0,0,e.state.doc.length)],0,null)}update(e){var i;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?l=this.domChanged.newSel.head:!Uf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Ff(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;n=new $e(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(W.ie||W.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=Pf(s,r,e.changes);return n=$e.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,i,n);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||l.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof rt&&s.widget instanceof tl&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,i,n){let l=n?n.range.addToSet(e.slice()):e,o=this.childCursor(i);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:d,fromB:h,toB:f}=r,u,m,b,A;if(n&&n.range.fromB<f&&n.range.toB>h){let g=pi.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),p=pi.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=g.breakAtStart,b=g.openStart,A=p.openEnd;let N=this.compositionView(n);p.breakAtStart?N.breakAfter=1:p.content.length&&N.merge(N.length,N.length,p.content[0],!1,p.openStart,0)&&(N.breakAfter=p.content[0].breakAfter,p.content.shift()),g.content.length&&N.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(N).concat(p.content)}else({content:u,breakAtStart:m,openStart:b,openEnd:A}=pi.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:C,off:w}=o.findPos(d,1),{i:y,off:R}=o.findPos(c,-1);Jo(this,y,R,C,w,u,m,b,A)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let n of i.effects)n.is(xs)&&(this.editContextFormatting=n.value)}compositionView(e){let i=new je(e.text.nodeValue);i.flags|=8;for(let{deco:l}of e.marks)i=new at(l,[i],i.length);let n=new ke;return n.append(i,0),n}fixCompositionDOM(e){let i=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=re.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},n=this.childPos(e.range.fromB,1),l=this.children[n.i];i(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)n=l.childPos(n.off,1),l=l.children[n.i],i(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,l=n==this.dom,o=!l&&!(this.view.state.facet(ct)||this.dom.tabIndex>-1)&&ji(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(l||i||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(r.anchor)),d=r.empty?c:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&If(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Be(f,0),s=!0}let h=this.view.observer.selectionRange;(s||!h.focusNode||(!hi(c.node,c.offset,h.anchorNode,h.anchorOffset)||!hi(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(h.focusNode)&&Lf(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=ci(this.view.root);if(f)if(r.empty){if(W.gecko){let u=Df(c.node,c.offset);if(u&&u!=3){let m=(u==1?Wo:Yo)(c.node,c.offset);m&&(c=new Be(m.node,m.offset))}}f.collapse(c.node,c.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([c,d]=[d,c]),u.setEnd(d.node,d.offset),u.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(u)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Be(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Be(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,n=ci(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let s=ke.find(this,i.head);if(!s)return;let r=s.posAtStart;if(i.head==r||i.head==r+s.length)return;let c=this.coordsAt(i.head,-1),d=this.coordsAt(i.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(i.head+i.assoc);n.collapse(h.node,h.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=i.from&&n.collapse(l,o)}moveToLine(e){let i=this.dom,n;if(e.node!=i)return e;for(let l=e.offset;!n&&l<i.childNodes.length;l++){let o=re.get(i.childNodes[l]);o instanceof ke&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=re.get(i.childNodes[l]);o instanceof ke&&(n=o.domAtPos(o.length))}return n?new Be(n.node,n.offset,!0):e}nearest(e){for(let i=e;i;){let n=re.get(i);if(n&&n.rootView==this)return n;i=i.parentNode}return null}posFromDOM(e,i){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,i)+n.posAtStart}domAtPos(e){let{i,off:n}=this.childCursor().findPos(e,-1);for(;i<this.children.length-1;){let l=this.children[i];if(n<l.length||l instanceof ke)break;i++,n=0}return this.children[i].domAtPos(n)}coordsAt(e,i){let n=null,l=0;for(let o=this.length,s=this.children.length-1;s>=0;s--){let r=this.children[s],c=o-r.breakAfter,d=c-r.length;if(c<e)break;if(d<=e&&(d<e||r.covers(-1))&&(c>e||r.covers(1))&&(!n||r instanceof ke&&!(n instanceof ke&&i>=0)))n=r,l=d;else if(n&&d==e&&c==e&&r instanceof rt&&Math.abs(i)<2){if(r.deco.startSide<0)break;s&&(n=null)}o=d}return n?n.coordsAt(e-l,i):null}coordsForChar(e){let{i,off:n}=this.childPos(e,1),l=this.children[i];if(!(l instanceof ke))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(n,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}n=c}if(!(l instanceof je))return null;let o=lt(l.text,n);if(o==n)return null;let s=Rt(l.dom,n,o).getClientRects();for(let r=0;r<s.length;r++){let c=s[r];if(r==s.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let i=[],{from:n,to:l}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,c=this.view.textDirection==xe.LTR;for(let d=0,h=0;h<this.children.length;h++){let f=this.children[h],u=d+f.length;if(u>l)break;if(d>=n){let m=f.dom.getBoundingClientRect();if(i.push(m.height),s){let b=f.dom.lastChild,A=b?di(b):[];if(A.length){let C=A[A.length-1],w=c?C.right-m.left:m.right-C.left;w>r&&(r=w,this.minWidth=o,this.minWidthFrom=d,this.minWidthTo=u)}}}d=u+f.breakAfter}return i}textDirectionAt(e){let{i}=this.childPos(e,1);return getComputedStyle(this.children[i].dom).direction=="rtl"?xe.RTL:xe.LTR}measureTextSize(){for(let o of this.children)if(o instanceof ke){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),i,n,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=di(e.firstChild)[0];i=e.getBoundingClientRect().height,n=o?o.width/27:7,l=o?o.height:i,e.remove()}),{lineHeight:i,charWidth:n,textHeight:l}}childCursor(e=this.length){let i=this.children.length;return i&&(e-=this.children[--i].length),new Go(this.children,e,i)}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,l=0;;l++){let o=l==i.viewports.length?null:i.viewports[l],s=o?o.from-1:this.length;if(s>n){let r=(i.lineBlockAt(s).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(Ne.replace({widget:new tl(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return Ne.set(e)}updateDeco(){let e=1,i=this.view.state.facet(mi).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(vs).map((o,s)=>{let r=typeof o=="function";return r&&(n=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=n,i.push(fe.join(l))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(As))try{if(d(this.view,e.range,e))return!0}catch(h){Ze(this.view.state,h,"scroll handler")}let{range:i}=e,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),l;if(!n)return;!i.empty&&(l=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,l.left),top:Math.min(n.top,l.top),right:Math.max(n.right,l.right),bottom:Math.max(n.bottom,l.bottom)});let o=Vs(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;uf(this.view.scrollDOM,s,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==xe.LTR)}}function If(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function Es(a,e){let i=a.observer.selectionRange;if(!i.focusNode)return null;let n=Wo(i.focusNode,i.focusOffset),l=Yo(i.focusNode,i.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=re.get(l.node);if(!r||r instanceof je&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=re.get(n.node);!c||c instanceof je&&c.text!=n.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=n,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Ff(a,e,i){let n=Es(a,i);if(!n)return null;let{node:l,from:o,to:s}=n,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(n.from,n.to)!=r)return null;let c=e.invertedDesc,d=new $e(c.mapPos(o),c.mapPos(s),o,s),h=[];for(let f=l.parentNode;;f=f.parentNode){let u=re.get(f);if(u instanceof at)h.push({node:f,deco:u.mark});else{if(u instanceof ke||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:d,text:l,marks:h,line:f};if(f!=a.contentDOM)h.push({node:f,deco:new fi({inclusive:!0,attributes:xf(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Df(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let $f=class{constructor(){this.changes=[]}compareRange(e,i){Wi(e,i,this.changes)}comparePoint(e,i){Wi(e,i,this.changes)}boundChange(e){Wi(e,e,this.changes)}};function Pf(a,e,i){let n=new $f;return fe.compare(a,e,i,n),n.changes}function Lf(a,e){for(let i=a;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function Uf(a,e){let i=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(i=!0)}),i}function jf(a,e,i=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return H.cursor(e);o==0?i=1:o==l.length&&(i=-1);let s=o,r=o;i<0?s=lt(l.text,o,!1):r=lt(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let d=lt(l.text,s,!1);if(n(l.text.slice(d,s))!=c)break;s=d}for(;r<l.length;){let d=lt(l.text,r);if(n(l.text.slice(r,d))!=c)break;r=d}return H.range(s+l.from,r+l.from)}function zf(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function qf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function fl(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function Os(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function Ms(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ul(a,e,i){let n,l,o,s,r=!1,c,d,h,f;for(let b=a.firstChild;b;b=b.nextSibling){let A=di(b);for(let C=0;C<A.length;C++){let w=A[C];l&&fl(l,w)&&(w=Os(Ms(w,l.bottom),l.top));let y=zf(e,w),R=qf(i,w);if(y==0&&R==0)return b.nodeType==3?_s(b,e,i):ul(b,e,i);(!n||s>R||s==R&&o>y)&&(n=b,l=w,o=y,s=R,r=y?e<w.left?C>0:C<A.length-1:!0),y==0?i>w.bottom&&(!h||h.bottom<w.bottom)?(c=b,h=w):i<w.top&&(!f||f.top>w.top)&&(d=b,f=w):h&&fl(h,w)?h=Ms(h,w.bottom):f&&fl(f,w)&&(f=Os(f,w.top))}}if(h&&h.bottom>=i?(n=c,l=h):f&&f.top<=i&&(n=d,l=f),!n)return{node:a,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return _s(n,u,i);if(r&&n.contentEditable!="false")return ul(n,u,i);let m=Array.prototype.indexOf.call(a.childNodes,n)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function _s(a,e,i){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=Rt(a,r,r+1).getClientRects();for(let d=0;d<c.length;d++){let h=c[d];if(h.top==h.bottom)continue;s||(s=e-h.left);let f=(h.top>i?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<o){let u=e>=(h.left+h.right)/2,m=u;if((W.chrome||W.gecko)&&Rt(a,r).getBoundingClientRect().left==h.right&&(m=!u),f<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=f}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function Ts(a,e,i,n=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:d}=a.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>d)return a.state.doc.length;for(let g=a.viewState.heightOracle.textHeight/2,p=!1;c=a.elementAtHeight(u),c.type!=Je.Text;)for(;u=n>0?c.bottom+g:c.top-g,!(u>=0&&u<=d);){if(p)return i?null:0;p=!0,n=-n}f=r+u;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:i?null:Is(a,s,c,h,f);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:i?null:Is(a,s,c,h,f);let b=a.dom.ownerDocument,A=a.root.elementFromPoint?a.root:b,C=A.elementFromPoint(h,f);C&&!a.contentDOM.contains(C)&&(C=null),C||(h=Math.max(s.left+1,Math.min(s.right-1,h)),C=A.elementFromPoint(h,f),C&&!a.contentDOM.contains(C)&&(C=null));let w,y=-1;if(C&&((l=a.docView.nearest(C))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let g=b.caretPositionFromPoint(h,f);g&&({offsetNode:w,offset:y}=g)}else if(b.caretRangeFromPoint){let g=b.caretRangeFromPoint(h,f);g&&({startContainer:w,startOffset:y}=g,(!a.contentDOM.contains(w)||W.safari&&Qf(w,y,h)||W.chrome&&Kf(w,y,h))&&(w=void 0))}w&&(y=Math.min(Ge(w),y))}if(!w||!a.docView.dom.contains(w)){let g=ke.find(a.docView,m);if(!g)return u>c.top+c.height/2?c.to:c.from;({node:w,offset:y}=ul(g.dom,h,f))}let R=a.docView.nearest(w);if(!R)return null;if(R.isWidget&&((o=R.dom)===null||o===void 0?void 0:o.nodeType)==1){let g=R.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?R.posAtStart:R.posAtEnd}else return R.localPosFromDOM(w,y)+R.posAtStart}function Is(a,e,i,n,l){let o=Math.round((n-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&i.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-i.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(i.from,i.to);return i.from+df(s,o,a.state.tabSize)}function Qf(a,e,i){let n,l=a;if(a.nodeType!=3||e!=(n=a.nodeValue.length))return!1;for(;;){let o=l.nextSibling;if(o){if(o.nodeName=="BR")break;return!1}else{let s=l.parentNode;if(!s||s.nodeName=="DIV")break;l=s}}return Rt(a,n-1,n).getBoundingClientRect().right>i}function Kf(a,e,i){if(e!=0)return!1;for(let l=a;;){let o=l.parentNode;if(!o||o.nodeType!=1||o.firstChild!=l)return!1;if(o.classList.contains("cm-line"))break;l=o}let n=a.nodeType==1?a.getBoundingClientRect():Rt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}function Wf(a,e,i){let n=a.lineBlockAt(e);if(Array.isArray(n.type)){let l;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Je.Text&&(l.type!=o.type||(i<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function Yf(a,e,i,n){let l=Wf(a,e.head,e.assoc||-1),o=!n||l.type!=Je.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let s=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),c=a.posAtCoords({x:i==(r==xe.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return H.cursor(c,i?-1:1)}return H.cursor(i?l.to:l.from,i?-1:1)}function Fs(a,e,i,n){let l=a.state.doc.lineAt(e.head),o=a.bidiSpans(l),s=a.textDirectionAt(l.from);for(let r=e,c=null;;){let d=Of(l,o,s,r,i),h=us;if(!d){if(l.number==(i?a.state.doc.lines:1))return r;h=`
21
- `,l=a.state.doc.line(l.number+(i?1:-1)),o=a.bidiSpans(l),d=a.visualLineSide(l,!i)}if(c){if(!c(h))return r}else{if(!n)return d;c=n(h)}r=d}}function Hf(a,e,i){let n=a.state.charCategorizer(e),l=n(i);return o=>{let s=n(o);return l==st.Space&&(l=s),l==s}}function Gf(a,e,i,n){let l=e.head,o=i?1:-1;if(l==(i?a.state.doc.length:0))return H.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),d=a.coordsAtPos(l,e.assoc||-1),h=a.documentTop;if(d)s==null&&(s=d.left-c.left),r=o<0?d.top:d.bottom;else{let m=a.viewState.lineBlockAt(l);s==null&&(s=Math.min(c.right-c.left,a.defaultCharacterWidth*(l-m.from))),r=(o<0?m.top:m.bottom)+h}let f=c.left+s,u=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(u+m)*o,A=Ts(a,{x:f,y:b},!1,o);if(b<c.top||b>c.bottom||(o<0?A<l:A>l)){let C=a.docView.coordsForChar(A),w=!C||b<C.top?-1:1;return H.cursor(A,w,void 0,s)}}}function Ji(a,e,i){for(;;){let n=0;for(let l of a)l.between(e-1,e+1,(o,s,r)=>{if(e>o&&e<s){let c=n||i||(e-o<s-e?-1:1);e=c<0?o:s,n=c}});if(!n)return e}}function pl(a,e,i){let n=Ji(a.state.facet(hl).map(l=>l(a)),i.from,e.head>i.from?-1:1);return n==i.from?i:H.cursor(n,n<i.from?1:-1)}const ki="￿";class Jf{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(ae.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ki}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let l=e;;){this.findPointBefore(n,l);let o=this.text.length;this.readNode(l);let s=l.nextSibling;if(s==i)break;let r=re.get(l),c=re.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:zi(l))||zi(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=i.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=l.exec(i))&&(o=r.index,s=r[0].length),this.append(i.slice(n,o<0?i.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let i=re.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let l=n.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Xf(e,n.node,n.offset)?i:0))}}function Xf(a,e,i){for(;;){if(!e||i<Ge(e))return!1;if(e==a)return!0;i=Vt(e)+1,e=e.parentNode}}class Ds{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class Zf{constructor(e,i,n,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let r=o||s?[]:iu(e),c=new Jf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=nu(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Kn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),d=s&&s.node==r.anchorNode&&s.offset==r.anchorOffset||!Kn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(c,d),u=Math.max(c,d),m=h.from-f,b=h.to-u;(m==0||m==1||f==0)&&(b==0||b==-1||u==e.state.doc.length)&&(c=0,d=e.state.doc.length)}this.newSel=H.single(d,c)}}}function $s(a,e){let i,{newSel:n}=e,l=a.state.selection.main,o=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:r}=e.bounds,c=l.from,d=null;(o===8||W.android&&e.text.length<r-s)&&(c=l.to,d="end");let h=tu(a.state.doc.sliceString(s,r,ki),e.text,c-s,d);h&&(W.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==ki+ki&&h.toB--,i={from:s+h.from,to:s+h.toA,insert:le.of(e.text.slice(h.from,h.toB).split(ki))})}else n&&(!a.hasFocus&&a.state.facet(ct)||n.main.eq(l))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!l.empty&&n&&n.main.empty?i={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(W.mac||W.android)&&i&&i.from==i.to&&i.from==l.head-1&&/^\. ?$/.test(i.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(n&&i.insert.length==2&&(n=H.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:le.of([i.insert.toString().replace("."," ")])}):i&&i.from>=l.from&&i.to<=l.to&&(i.from!=l.from||i.to!=l.to)&&l.to-l.from-(i.to-i.from)<=4?i={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,i.from).append(i.insert).append(a.state.doc.slice(i.to,l.to))}:W.chrome&&i&&i.from==i.to&&i.from==l.head&&i.insert.toString()==`
22
- `&&a.lineWrapping&&(n&&(n=H.single(n.main.anchor-1,n.main.head-1)),i={from:l.from,to:l.to,insert:le.of([" "])}),i)return ml(a,i,n,o);if(n&&!n.main.eq(l)){let s=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(s=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:n,scrollIntoView:s,userEvent:r}),!0}else return!1}function ml(a,e,i,n=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&jt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&jt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&jt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=eu(a,e,i));return a.state.facet(bs).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function eu(a,e,i){let n,l=a.state,o=l.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=o.from<e.from?l.sliceDoc(o.from,e.from):"",c=o.to>e.to?l.sliceDoc(e.to,o.to):"";n=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=i&&i.main.to<=r.newLength?i.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let d=a.state.sliceDoc(e.from,e.to),h,f=i&&Es(a,i.main.head);if(f){let b=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-b}}else h=a.state.doc.lineAt(o.head);let u=o.to-e.to,m=o.to-o.from;n=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:r,range:c||b.map(r)};let A=b.to-u,C=A-d.length;if(b.to-b.from!=m||a.state.sliceDoc(C,A)!=d||b.to>=h.from&&b.from<=h.to)return{range:b};let w=l.changes({from:C,to:A,insert:e.insert}),y=b.to-o.to;return{changes:w,range:c?H.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):b.map(w)}})}else n={changes:r,selection:c&&l.selection.replaceRange(c)}}let s="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,s+=".compose",a.inputState.compositionFirstChange&&(s+=".start",a.inputState.compositionFirstChange=!1)),l.update(n,{userEvent:s,scrollIntoView:!0})}function tu(a,e,i,n){let l=Math.min(a.length,e.length),o=0;for(;o<l&&a.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==l&&a.length==e.length)return null;let s=a.length,r=e.length;for(;s>0&&r>0&&a.charCodeAt(s-1)==e.charCodeAt(r-1);)s--,r--;if(n=="end"){let c=Math.max(0,o-Math.min(s,r));i-=s+c-o}if(s<o&&a.length<e.length){let c=i<=o&&i>=s?o-i:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=i<=o&&i>=r?o-i:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function iu(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:l,focusOffset:o}=a.observer.selectionRange;return i&&(e.push(new Ds(i,n)),(l!=i||o!=n)&&e.push(new Ds(l,o))),e}function nu(a,e){if(a.length==0)return null;let i=a[0].pos,n=a.length==2?a[1].pos:i;return i>-1&&n>-1?H.single(i+e,n+e):null}class lu{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&Au(e.contentDOM.ownerDocument)}handleEvent(e){!uu(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let l of n.observers)l(this.view,i);for(let l of n.handlers){if(i.defaultPrevented)break;if(l(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=ou(e),n=this.handlers,l=this.view.contentDOM;for(let o in i)if(o!="scroll"){let s=!i[o].handlers.length,r=n[o];r&&s!=!r.handlers.length&&(l.removeEventListener(o,this.handleEvent),r=null),r||l.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!i[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&au.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=Ls.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||su.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,jt(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ps(a,e){return(i,n)=>{try{return e.call(a,n,i)}catch(l){Ze(i.state,l)}}}function ou(a){let e=Object.create(null);function i(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of a){let l=n.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&i(r).handlers.push(Ps(n.value,c))}if(s)for(let r in s){let c=s[r];c&&i(r).observers.push(Ps(n.value,c))}}for(let n in ze)i(n).handlers.push(ze[n]);for(let n in Pe)i(n).observers.push(Pe[n]);return e}const Ls=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],su="dthko",au=[16,17,18,20,91,92,224,225],Xi=6;function Zi(a){return Math.max(0,a)*.7+8}function ru(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class cu{constructor(e,i,n,l){this.view=e,this.startEvent=i,this.style=n,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=pf(e.contentDOM),this.atoms=e.state.facet(hl).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(ae.allowMultipleSelections)&&du(e,i),this.dragging=fu(e,i)&&Hs(i)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&ru(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,l=0,o=0,s=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:r}=this.scrollParents.y.getBoundingClientRect());let c=Vs(this.view);e.clientX-c.left<=l+Xi?i=-Zi(l-e.clientX):e.clientX+c.right>=s-Xi&&(i=Zi(e.clientX-s)),e.clientY-c.top<=o+Xi?n=-Zi(o-e.clientY):e.clientY+c.bottom>=r-Xi&&(n=Zi(e.clientY-r)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let i=null;for(let n=0;n<e.ranges.length;n++){let l=e.ranges[n],o=null;if(l.empty){let s=Ji(this.atoms,l.from,0);s!=l.from&&(o=H.cursor(s,-1))}else{let s=Ji(this.atoms,l.from,-1),r=Ji(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=H.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(i||(i=e.ranges.slice()),i[n]=o)}return i?H.create(i,e.mainIndex):e}select(e){let{view:i}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function du(a,e){let i=a.state.facet(ps);return i.length?i[0](e):W.mac?e.metaKey:e.ctrlKey}function hu(a,e){let i=a.state.facet(ms);return i.length?i[0](e):W.mac?!e.altKey:!e.ctrlKey}function fu(a,e){let{main:i}=a.state.selection;if(i.empty)return!1;let n=ci(a.root);if(!n||n.rangeCount==0)return!0;let l=n.getRangeAt(0).getClientRects();for(let o=0;o<l.length;o++){let s=l[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function uu(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,n;i!=a.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(n=re.get(i))&&n.ignoreEvent(e))return!1;return!0}const ze=Object.create(null),Pe=Object.create(null),Us=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function pu(a){let e=a.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{a.focus(),i.remove(),js(a,i.value)},50)}function en(a,e,i){for(let n of a.facet(e))i=n(i,a);return i}function js(a,e){e=en(a.state,al,e);let{state:i}=a,n,l=1,o=i.toText(e),s=o.lines==i.selection.ranges.length;if(gl!=null&&i.selection.ranges.every(c=>c.empty)&&gl==o.toString()){let c=-1;n=i.changeByRange(d=>{let h=i.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let f=i.toText((s?o.line(l++).text:e)+i.lineBreak);return{changes:{from:h.from,insert:f},range:H.cursor(d.from+f.length)}})}else s?n=i.changeByRange(c=>{let d=o.line(l++);return{changes:{from:c.from,to:c.to,insert:d.text},range:H.cursor(c.from+d.length)}}):n=i.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Pe.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},ze.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Pe.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Pe.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},ze.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of a.state.facet(gs))if(i=n(a,e),i)break;if(!i&&e.button==0&&(i=ku(a,e)),i){let n=!a.hasFocus;a.inputState.startMouseSelection(new cu(a,e,i,n)),n&&a.observer.ignore(()=>{zo(a.contentDOM);let o=a.root.activeElement;o&&!o.contains(a.contentDOM)&&o.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function zs(a,e,i,n){if(n==1)return H.cursor(e,i);if(n==2)return jf(a.state,e,i);{let l=ke.find(a.docView,e),o=a.state.doc.lineAt(l?l.posAtEnd:e),s=l?l.posAtStart:o.from,r=l?l.posAtEnd:o.to;return r<a.state.doc.length&&r==o.to&&r++,H.range(s,r)}}let qs=(a,e,i)=>e>=i.top&&e<=i.bottom&&a>=i.left&&a<=i.right;function mu(a,e,i,n){let l=ke.find(a.docView,e);if(!l)return 1;let o=e-l.posAtStart;if(o==0)return 1;if(o==l.length)return-1;let s=l.coordsAt(o,-1);if(s&&qs(i,n,s))return-1;let r=l.coordsAt(o,1);return r&&qs(i,n,r)?1:s&&s.bottom>=n?-1:1}function Qs(a,e){let i=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:mu(a,i,e.clientX,e.clientY)}}const gu=W.ie&&W.ie_version<=11;let Ks=null,Ws=0,Ys=0;function Hs(a){if(!gu)return a.detail;let e=Ks,i=Ys;return Ks=a,Ys=Date.now(),Ws=!e||i>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Ws+1)%3:1}function ku(a,e){let i=Qs(a,e),n=Hs(e),l=a.state.selection;return{update(o){o.docChanged&&(i.pos=o.changes.mapPos(i.pos),l=l.map(o.changes))},get(o,s,r){let c=Qs(a,o),d,h=zs(a,c.pos,c.bias,n);if(i.pos!=c.pos&&!s){let f=zs(a,i.pos,i.bias,n),u=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=u<h.from?H.range(u,m):H.range(m,u)}return s?l.replaceRange(l.main.extend(h.from,h.to)):r&&n==1&&l.ranges.length>1&&(d=bu(l,c.pos))?d:r?l.addRange(h):H.create([h])}}}function bu(a,e){for(let i=0;i<a.ranges.length;i++){let{from:n,to:l}=a.ranges[i];if(n<=e&&l>=e)return H.create(a.ranges.slice(0,i).concat(a.ranges.slice(i+1)),a.mainIndex==i?0:a.mainIndex-(a.mainIndex>i?1:0))}return null}ze.dragstart=(a,e)=>{let{selection:{main:i}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let o=l.posAtStart,s=o+l.length;(o>=i.to||s<=i.from)&&(i=H.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",en(a.state,rl,a.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},ze.dragend=a=>(a.inputState.draggedContent=null,!1);function Gs(a,e,i,n){if(i=en(a.state,al,i),!i)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&hu(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:i},c=a.state.changes(s?[s,r]:r);a.focus(),a.dispatch({changes:c,selection:{anchor:c.mapPos(l,-1),head:c.mapPos(l,1)},userEvent:s?"move.drop":"input.drop"}),a.inputState.draggedContent=null}ze.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),l=0,o=()=>{++l==i.length&&Gs(a,e,n.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<i.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(n[s]=r.result),o()},r.readAsText(i[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Gs(a,e,n,!0),!0}return!1},ze.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let i=Us?null:e.clipboardData;return i?(js(a,i.getData("text/plain")||i.getData("text/uri-list")),!0):(pu(a),!1)};function yu(a,e){let i=a.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),a.focus()},50)}function wu(a){let e=[],i=[],n=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),i.push(l));if(!e.length){let l=-1;for(let{from:o}of a.selection.ranges){let s=a.doc.lineAt(o);s.number>l&&(e.push(s.text),i.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}n=!0}return{text:en(a,rl,e.join(a.lineBreak)),ranges:i,linewise:n}}let gl=null;ze.copy=ze.cut=(a,e)=>{let{text:i,ranges:n,linewise:l}=wu(a.state);if(!i&&!l)return!1;gl=l?i:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Us?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(yu(a,i),!1)};const Js=Dt.define();function Xs(a,e){let i=[];for(let n of a.facet(ys)){let l=n(a,e);l&&i.push(l)}return i.length?a.update({effects:i,annotations:Js.of(!0)}):null}function Zs(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let i=Xs(a.state,e);i?a.dispatch(i):a.update([])}},10)}Pe.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),Zs(a)},Pe.blur=a=>{a.observer.clearSelectionRange(),Zs(a)},Pe.compositionstart=Pe.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Pe.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Pe.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},ze.beforeinput=(a,e)=>{var i,n;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),d=a.posAtDOM(r.endContainer,r.endOffset);return ml(a,{from:c,to:d,insert:a.state.toText(o)},null),!0}}let l;if(W.chrome&&W.android&&(l=Ls.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Pe.compositionend(a,e),20),!1};const ea=new Set;function Au(a){ea.has(a)||(ea.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const ta=["pre-wrap","normal","pre-line","break-spaces"];let Yt=!1;function ia(){Yt=!1}class xu{constructor(e){this.lineWrapping=e,this.doc=le.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let n=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((i-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ta.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let n=0;n<e.length;n++){let l=e[n];l<0?n++:this.heightSamples[Math.floor(l*10)]||(i=!0,this.heightSamples[Math.floor(l*10)]=!0)}return i}refresh(e,i,n,l,o,s){let r=ta.indexOf(e)>-1,c=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=i,this.charWidth=n,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let d=0;d<s.length;d++){let h=s[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Cu{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class et{constructor(e,i,n,l,o){this.from=e,this.length=i,this.top=n,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Je.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof bt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new et(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var ue=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(ue||(ue={}));const tn=.001;class Ve{constructor(e,i,n=2){this.length=e,this.height=i,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>tn&&(Yt=!0),this.height=e)}replace(e,i,n){return Ve.of(n)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,n,l){let o=this,s=n.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:d,fromB:h,toB:f}=l[r],u=o.lineAt(c,ue.ByPosNoHeight,n.setDoc(i),0,0),m=u.to>=d?u:o.lineAt(d,ue.ByPosNoHeight,n,0,0);for(f+=m.to-d,d=m.to;r>0&&u.from<=l[r-1].toA;)c=l[r-1].fromA,h=l[r-1].fromB,r--,c<u.from&&(u=o.lineAt(c,ue.ByPosNoHeight,n,0,0));h+=u.from-c,c=u.from;let b=kl.build(n.setDoc(s),e,h,f);o=nn(o,o.replace(c,d,b))}return o.updateHeight(n,0)}static empty(){return new Te(0,0)}static of(e){if(e.length==1)return e[0];let i=0,n=e.length,l=0,o=0;for(;;)if(i==n)if(l>o*2){let r=e[i-1];r.break?e.splice(--i,1,r.left,null,r.right):e.splice(--i,1,r.left,r.right),n+=1+r.break,l-=r.size}else if(o>l*2){let r=e[n];r.break?e.splice(n,1,r.left,null,r.right):e.splice(n,1,r.left,r.right),n+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[i++];r&&(l+=r.size)}else{let r=e[--n];r&&(o+=r.size)}let s=0;return e[i-1]==null?(s=1,i--):e[i]==null&&(s=1,n++),new vu(Ve.of(e.slice(0,i)),s,Ve.of(e.slice(n)))}}function nn(a,e){return a==e?a:(a.constructor!=e.constructor&&(Yt=!0),e)}Ve.prototype.size=1;class na extends Ve{constructor(e,i,n){super(e,i),this.deco=n}blockAt(e,i,n,l){return new et(l,this.length,n,this.height,this.deco||0)}lineAt(e,i,n,l,o){return this.blockAt(0,n,l,o)}forEachLine(e,i,n,l,o,s){e<=o+this.length&&i>=o&&s(this.blockAt(0,n,l,o))}updateHeight(e,i=0,n=!1,l){return l&&l.from<=i&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Te extends na{constructor(e,i){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,i,n,l){return new et(l,this.length,n,this.height,this.breaks)}replace(e,i,n){let l=n[0];return n.length==1&&(l instanceof Te||l instanceof Ce&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Ce?l=new Te(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Ve.of(n)}updateHeight(e,i=0,n=!1,l){return l&&l.from<=i&&l.more?this.setHeight(l.heights[l.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ce extends Ve{constructor(e){super(e,0)}heightMetrics(e,i){let n=e.doc.lineAt(i).number,l=e.doc.lineAt(i+this.length).number,o=l-n+1,s,r=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*o);s=c/o,this.length>o+1&&(r=(this.height-c)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:l,perLine:s,perChar:r}}blockAt(e,i,n,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(i,l);if(i.lineWrapping){let d=l+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),h=i.doc.lineAt(d),f=r+h.length*c,u=Math.max(n,e-f/2);return new et(h.from,h.length,u,f,0)}else{let d=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:h,length:f}=i.doc.line(o+d);return new et(h,f,n+r*d,r,0)}}lineAt(e,i,n,l,o){if(i==ue.ByHeight)return this.blockAt(e,n,l,o);if(i==ue.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new et(m,b-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),d=n.doc.lineAt(e),h=r+d.length*c,f=d.number-s,u=l+r*f+c*(d.from-o-f);return new et(d.from,d.length,Math.max(l,Math.min(u,l+this.height-h)),h,0)}forEachLine(e,i,n,l,o,s){e=Math.max(e,o),i=Math.min(i,o+this.length);let{firstLine:r,perLine:c,perChar:d}=this.heightMetrics(n,o);for(let h=e,f=l;h<=i;){let u=n.doc.lineAt(h);if(h==e){let b=u.number-r;f+=c*b+d*(e-o-b)}let m=c+d*u.length;s(new et(u.from,u.length,f,m,0)),f+=m,h=u.to+1}}replace(e,i,n){let l=this.length-i;if(l>0){let o=n[n.length-1];o instanceof Ce?n[n.length-1]=new Ce(o.length+l):n.push(null,new Ce(l-1))}if(e>0){let o=n[0];o instanceof Ce?n[0]=new Ce(e+o.length):n.unshift(new Ce(e-1),null)}return Ve.of(n)}decomposeLeft(e,i){i.push(new Ce(e-1),null)}decomposeRight(e,i){i.push(null,new Ce(this.length-e-1))}updateHeight(e,i=0,n=!1,l){let o=i+this.length;if(l&&l.from<=i+this.length&&l.more){let s=[],r=Math.max(i,l.from),c=-1;for(l.from>i&&s.push(new Ce(l.from-i-1).updateHeight(e,i));r<=o&&l.more;){let h=e.doc.lineAt(r).length;s.length&&s.push(null);let f=l.heights[l.index++];c==-1?c=f:Math.abs(f-c)>=tn&&(c=-2);let u=new Te(h,f);u.outdated=!1,s.push(u),r+=h+1}r<=o&&s.push(null,new Ce(o-r).updateHeight(e,r));let d=Ve.of(s);return(c<0||Math.abs(d.height-this.height)>=tn||Math.abs(c-this.heightMetrics(e,i).perLine)>=tn)&&(Yt=!0),nn(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class vu extends Ve{constructor(e,i,n){super(e.length+i+n.length,e.height+n.height,i|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,i,n,l){let o=n+this.left.height;return e<o?this.left.blockAt(e,i,n,l):this.right.blockAt(e,i,o,l+this.left.length+this.break)}lineAt(e,i,n,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=i==ue.ByHeight?e<s:e<r,d=c?this.left.lineAt(e,i,n,l,o):this.right.lineAt(e,i,n,s,r);if(this.break||(c?d.to<r:d.from>r))return d;let h=i==ue.ByPosNoHeight?ue.ByPosNoHeight:ue.ByPos;return c?d.join(this.right.lineAt(r,h,n,s,r)):this.left.lineAt(r,h,n,l,o).join(d)}forEachLine(e,i,n,l,o,s){let r=l+this.left.height,c=o+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,i,n,l,o,s),i>=c&&this.right.forEachLine(e,i,n,r,c,s);else{let d=this.lineAt(c,ue.ByPos,n,l,o);e<d.from&&this.left.forEachLine(e,d.from-1,n,l,o,s),d.to>=e&&d.from<=i&&s(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,r,c,s)}}replace(e,i,n){let l=this.left.length+this.break;if(i<l)return this.balanced(this.left.replace(e,i,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,i-l,n));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of n)o.push(r);if(e>0&&la(o,s-1),i<this.length){let r=o.length;this.decomposeRight(i,o),la(o,r)}return Ve.of(o)}decomposeLeft(e,i){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(n++,e>=n&&i.push(null)),e>n&&this.right.decomposeLeft(e-n,i)}decomposeRight(e,i){let n=this.left.length,l=n+this.break;if(e>=l)return this.right.decomposeRight(e-l,i);e<n&&this.left.decomposeRight(e,i),this.break&&e<l&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?Ve.of(this.break?[e,null,i]:[e,i]):(this.left=nn(this.left,e),this.right=nn(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,n=!1,l){let{left:o,right:s}=this,r=i+o.length+this.break,c=null;return l&&l.from<=i+o.length&&l.more?c=o=o.updateHeight(e,i,n,l):o.updateHeight(e,i,n),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,n,l):s.updateHeight(e,r,n),c?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function la(a,e){let i,n;a[e]==null&&(i=a[e-1])instanceof Ce&&(n=a[e+1])instanceof Ce&&a.splice(e-1,3,new Ce(i.length+1+n.length))}const Su=5;class kl{constructor(e,i){this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,i){if(this.lineStart>-1){let n=Math.min(i,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Te?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Te(n-this.pos,-1)),this.writtenTo=n,i>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,n){if(e<i||n.heightRelevant){let l=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=i-e;n.block?this.addBlock(new na(s,l,n)):(s||o||l>=Su)&&this.addLineDeco(l,o,s)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Te(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,i){let n=new Ce(i-e);return this.oracle.doc.lineAt(e).to==i&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Te)return e;let i=new Te(0,-1);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,n){let l=this.ensureLine();l.length+=n,l.collapsed+=n,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=i,this.writtenTo=this.pos=this.pos+n}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof Te)&&!this.isCovered?this.nodes.push(new Te(0,-1)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let l of this.nodes)l instanceof Te&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,i,n,l){let o=new kl(n,e);return fe.spans(i,n,l,o,0),o.finish(n)}}function Bu(a,e,i){let n=new Nu;return fe.compare(a,e,i,n,0),n.changes}class Nu{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,l){(e<i||n&&n.heightRelevant||l&&l.heightRelevant)&&Wi(e,i,this.changes,5)}}function Vu(a,e){let i=a.getBoundingClientRect(),n=a.ownerDocument,l=n.defaultView||window,o=Math.max(0,i.left),s=Math.min(l.innerWidth,i.right),r=Math.max(0,i.top),c=Math.min(l.innerHeight,i.bottom);for(let d=a.parentNode;d&&d!=n.body;)if(d.nodeType==1){let h=d,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();o=Math.max(o,u.left),s=Math.min(s,u.right),r=Math.max(r,u.top),c=Math.min(d==a.parentNode?l.innerHeight:c,u.bottom)}d=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-i.left,right:Math.max(o,s)-i.left,top:r-(i.top+e),bottom:Math.max(r,c)-(i.top+e)}}function Ru(a){let e=a.getBoundingClientRect(),i=a.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function Eu(a,e){let i=a.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class bl{constructor(e,i,n,l){this.from=e,this.to=i,this.size=n,this.displaySize=l}static same(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++){let l=e[n],o=i[n];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,i){return Ne.replace({widget:new Ou(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class Ou extends el{constructor(e,i){super(),this.size=e,this.vertical=i}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class oa{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=sa,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=xe.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(dl).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new xu(i),this.stateDeco=e.facet(mi).filter(n=>typeof n!="function"),this.heightMap=Ve.empty().applyChanges(this.stateDeco,le.empty,this.heightOracle.setDoc(e.doc),[new $e(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ne.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let n=0;n<=1;n++){let l=n?i.head:i.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new ln(o,s))}}return this.viewports=e.sort((n,l)=>n.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sa:new yl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(bi(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(mi).filter(h=>typeof h!="function");let l=e.changedRanges,o=$e.extendWithRanges(l,Bu(n,this.stateDeco,e?e.changes:we.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ia(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Yt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let c=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<c.from||i.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,i));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_f)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?xe.RTL:xe.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=i.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let d=0,h=0;if(r.width&&r.height){let{scaleX:g,scaleY:p}=jo(i,r);(g>.005&&Math.abs(this.scaleX-g)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=g,this.scaleY=p,d|=16,s=c=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Ko(e.scrollDOM);let b=(this.printing?Eu:Vu)(i,this.paddingTop),A=b.top-this.pixelViewport.top,C=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ru(e.dom))return 0;let y=r.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let g=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(g)&&(s=!0),s||l.lineWrapping&&Math.abs(y-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:N,textHeight:M}=e.docView.measureTextSize();s=p>0&&l.refresh(o,p,N,M,Math.max(5,y/N),g),s&&(e.docView.minWidth=0,d|=16)}A>0&&C>0?h=Math.max(A,C):A<0&&C<0&&(h=Math.min(A,C)),ia();for(let p of this.viewports){let N=p.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(p);this.heightMap=(s?Ve.empty().applyChanges(this.stateDeco,le.empty,this.heightOracle,[new $e(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new Cu(p.from,N))}Yt&&(d|=2)}let R=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new ln(l.lineAt(s-n*1e3,ue.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,ue.ByHeight,o,0,0).to);if(i){let{head:d}=i.range;if(d<c.from||d>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(d,ue.ByPos,o,0,0),u;i.y=="center"?u=(f.top+f.bottom)/2-h/2:i.y=="start"||i.y=="nearest"&&d<c.from?u=f.top:u=f.bottom-h,c=new ln(l.lineAt(u-1e3/2,ue.ByHeight,o,0,0).from,l.lineAt(u+h+1e3/2,ue.ByHeight,o,0,0).to)}}return c}mapViewport(e,i){let n=i.mapPos(e.from,-1),l=i.mapPos(e.to,1);return new ln(this.heightMap.lineAt(n,ue.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,ue.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},n=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,ue.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(i,ue.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||o>=r+Math.max(10,Math.min(n,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let n=[];for(let l of e)i.touchesRange(l.from,l.to)||n.push(new bl(i.mapPos(l.from),i.mapPos(l.to),l.size,l.displaySize));return n}ensureLineGaps(e,i){let n=this.heightOracle.lineWrapping,l=n?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=xe.LTR&&!n)return[];let r=[],c=(h,f,u,m)=>{if(f-h<o)return;let b=this.state.selection.main,A=[b.from];b.empty||A.push(b.to);for(let w of A)if(w>h&&w<f){c(h,w-10,u,m),c(w+10,f,u,m);return}let C=_u(e,w=>w.from>=u.from&&w.to<=u.to&&Math.abs(w.from-h)<o&&Math.abs(w.to-f)<o&&!A.some(y=>w.from<y&&w.to>y));if(!C){if(f<u.to&&i&&n&&i.visibleRanges.some(R=>R.from<=f&&R.to>=f)){let R=i.moveToLineBoundary(H.cursor(f),!1,!0).head;R>h&&(f=R)}let w=this.gapSize(u,h,f,m),y=n||w<2e6?w:2e6;C=new bl(h,f,w,y)}r.push(C)},d=h=>{if(h.length<s||h.type!=Je.Text)return;let f=Mu(h.from,h.to,this.stateDeco);if(f.total<s)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let A=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,w;if(u!=null){let y=sn(f,u),R=((this.visibleBottom-this.visibleTop)/2+A)/h.height;C=y-R,w=y+R}else C=(this.visibleTop-h.top-A)/h.height,w=(this.visibleBottom-h.top+A)/h.height;m=on(f,C),b=on(f,w)}else{let A=f.total*this.heightOracle.charWidth,C=l*this.heightOracle.charWidth,w=0;if(A>2e6)for(let N of e)N.from>=h.from&&N.from<h.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=N.size-N.displaySize);let y=this.pixelViewport.left+w,R=this.pixelViewport.right+w,g,p;if(u!=null){let N=sn(f,u),M=((R-y)/2+C)/A;g=N-M,p=N+M}else g=(y-C)/A,p=(R+C)/A;m=on(f,g),b=on(f,p)}m>h.from&&c(h.from,m,h,f),b<h.to&&c(b,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return r}gapSize(e,i,n,l){let o=sn(l,n)-sn(l,i);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){bl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ne.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let n=[];fe.spans(i,this.viewport.from,this.viewport.to,{span(o,s){n.push({from:o,to:s})},point(){}},20);let l=0;if(n.length!=this.visibleRanges.length)l=12;else for(let o=0;o<n.length&&!(l&8);o++){let s=this.visibleRanges[o],r=n[o];(s.from!=r.from||s.to!=r.to)&&(l|=4,e&&e.mapPos(s.from,-1)==r.from&&e.mapPos(s.to,1)==r.to||(l|=8))}return this.visibleRanges=n,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||bi(this.heightMap.lineAt(e,ue.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(i=>i.top<=e&&i.bottom>=e)||bi(this.heightMap.lineAt(this.scaler.fromDOM(e),ue.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return bi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class ln{constructor(e,i){this.from=e,this.to=i}}function Mu(a,e,i){let n=[],l=a,o=0;return fe.spans(i,a,e,{span(){},point(s,r){s>l&&(n.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(n.push({from:l,to:e}),o+=e-l),{total:o,ranges:n}}function on({total:a,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(a*i);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(n<=r)return o+n;n-=r}}function sn(a,e){let i=0;for(let{from:n,to:l}of a.ranges){if(e<=l){i+=e-n;break}i+=l-n}return i/a.total}function _u(a,e){for(let i of a)if(e(i))return i}const sa={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class yl{constructor(e,i,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let d=i.lineAt(r,ue.ByPos,e,0,0).top,h=i.lineAt(c,ue.ByPos,e,0,0).bottom;return l+=h-d,{from:r,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(i.height-l);for(let r of this.viewports)r.domTop=s+(r.top-o)*this.scale,s=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(e){for(let i=0,n=0,l=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.top)return l+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,l=o.domBottom}}fromDOM(e){for(let i=0,n=0,l=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.domTop)return n+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,l=o.domBottom}}eq(e){return e instanceof yl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,n)=>i.from==e.viewports[n].from&&i.to==e.viewports[n].to):!1}}function bi(a,e){if(e.scale==1)return a;let i=e.toDOM(a.top),n=e.toDOM(a.bottom);return new et(a.from,a.length,i,n-i,Array.isArray(a._content)?a._content.map(l=>bi(l,e)):a._content)}const an=Z.define({combine:a=>a.join(" ")}),wl=Z.define({combine:a=>a.indexOf(!0)>-1}),Al=kt.newName(),aa=kt.newName(),ra=kt.newName(),ca={"&light":"."+aa,"&dark":"."+ra};function xl(a,e,i){return new kt(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,l=>{if(l=="&")return a;if(!i||!i[l])throw new RangeError(`Unsupported selector: ${l}`);return i[l]}):a+" "+n}})}const Tu=xl("."+Al,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ca),Iu={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Cl=W.ie&&W.ie_version<=11;class Fu{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new mf,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let n of i)this.queue.push(n);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new $u(e),e.state.facet(ct)&&(e.contentDOM.editContext=this.editContext.editContext)),Cl&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,n)=>i!=e[n]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,l=this.selectionRange;if(n.state.facet(ct)?n.root.activeElement!=this.dom:!ji(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!n.state.selection.main.empty&&l.focusNode&&hi(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=ci(e.root);if(!i)return!1;let n=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Du(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let l=ji(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&kf(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let n=this.dom;n;)if(n.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=i)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Iu),Cl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Cl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var n;if(!this.delayedAndroidKey){let l=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&jt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,n=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),i==-1?{from:i,to:n}=s:(i=Math.min(s.from,i),n=Math.max(s.to,n)))}return{from:i,to:n,typeOver:l}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),l=this.selectionChanged&&ji(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Zf(this.view,e,i,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,l=$s(this.view,i);return this.view.state==n&&(i.domChanged||i.newSel&&!i.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let i=this.view.docView.nearest(e.target);if(!i||i.ignoreMutation(e))return null;if(i.markDirty(e.type=="attributes"),e.type=="attributes"&&(i.flags|=4),e.type=="childList"){let n=da(i,e.previousSibling||e.target.previousSibling,-1),l=da(i,e.nextSibling||e.target.nextSibling,1);return{from:n?i.posAfter(n):i.posAtStart,to:l?i.posBefore(l):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ct)!=e.state.facet(ct)&&(e.view.contentDOM.editContext=e.state.facet(ct)?this.editContext.editContext:null))}destroy(){var e,i,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function da(a,e,i){for(;e;){let n=re.get(e);if(n&&n.parent==a)return n;let l=e.parentNode;e=l!=a.dom?l:i>0?e.nextSibling:e.previousSibling}return null}function ha(a,e){let i=e.startContainer,n=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return hi(s.node,s.offset,l,o)&&([i,n,l,o]=[l,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:l,focusOffset:o}}function Du(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ha(a,l)}let i=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),i=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",n,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",n,!0),i?ha(a,i):null}class $u{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:r,drifted:!1});let d={from:r,to:c,insert:le.of(n.text.split(`
23
- `))};if(d.from==this.from&&o<this.from?d.from=o:d.to==this.to&&o>this.to&&(d.to=o),d.from==d.to&&!d.insert.length){let h=H.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));h.main.eq(l)||e.dispatch({selection:h,userEvent:"select"});return}if((W.mac||W.android)&&d.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:r,to:c,insert:le.of([n.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);ml(e,d,H.single(this.toEditorPos(n.selectionStart,h),this.toEditorPos(n.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let l=[],o=null;for(let s=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);s<r;s++){let c=e.coordsForChar(s);o=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||o||new DOMRect,l.push(o)}i.updateCharacterBounds(n.rangeStart,l)},this.handlers.textformatupdate=n=>{let l=[];for(let o of n.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(c<d){let h=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(Ne.mark({attributes:{style:h}}).range(c,d))}}}e.dispatch({effects:xs.of(Ne.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let l=ci(n.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,d)=>{if(n)return;let h=d.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(d)){l=this.pendingContextChange=null,i+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(o+=i,s+=i,s<=this.from)this.from+=h,this.to+=h;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),d.toString()),this.to+=h}i+=h}),l&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),l=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(n,l)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(l=>l.forEach(o=>n(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||gf(e.parent)||document,this.viewState=new oa(e.state||ae.create(e)),e.scrollTo&&e.scrollTo.is(Hi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(l=>new cl(l));for(let l of this.plugins)l.update(this);this.observer=new Fu(this),this.inputState=new lu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Rs(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let i=e.length==1&&e[0]instanceof Se?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,n=!1,l,o=this.state;for(let u of e){if(u.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=u.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(u=>u.annotation(Js))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=Xs(o,s),c||(r=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(ae.phrases)!=this.state.facet(ae.phrases))return this.setState(o);l=Gi.create(this,o,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;f=new Qt(m.empty?m:H.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Hi)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=rn.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),i=this.docView.update(l),this.state.facet(gi)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(an)!=l.state.facet(an)&&(this.viewState.mustMeasureContent=!0),(i||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(sl))try{u(l)}catch(m){Ze(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!$s(this,h)&&d.force&&jt(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let i=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new oa(e),this.plugins=e.facet(Kt).map(n=>new cl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Rs(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(Kt),n=e.state.facet(Kt);if(i!=n){let l=[];for(let o of n){let s=i.indexOf(o);if(s<0)l.push(new cl(o));else{let r=this.plugins[s];r.mustUpdate=e,l.push(r)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);i!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(n){Ze(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,n=this.scrollDOM,l=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(s<0)if(Ko(n))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(m=>{try{return m.read(this)}catch(b){return Ze(this.state,b),fa}}),f=Gi.create(this,this.state,[]),u=!1;f.flags|=c,i?i.flags|=c:i=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(h[m]!=fa)try{let b=d[m];b.write&&b.write(h[m],this)}catch(b){Ze(this.state,b)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let b=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(b>1||b<-1){l=l+b,n.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let r of this.state.facet(sl))r(i)}get themeClasses(){return Al+" "+(this.state.facet(wl)?ra:aa)+" "+this.state.facet(an)}updateAttrs(){let e=ua(this,Cs,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ct)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),ua(this,dl,i);let n=this.observer.ignore(()=>{let l=Zn(this.contentDOM,this.contentAttrs,i),o=Zn(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=i,n}showAnnouncements(e){let i=!0;for(let n of e)for(let l of n.effects)if(l.is(se.announce)){i&&(this.announceDOM.textContent=""),i=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(gi);let e=this.state.facet(se.cspNonce);kt.mount(this.root,this.styleModules.concat(Tu).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(n=>n.plugin==e)||null),i&&i.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,i,n){return pl(this,e,Fs(this,e,i,n))}moveByGroup(e,i){return pl(this,e,Fs(this,e,i,n=>Hf(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=n[i?n.length-1:0];return H.cursor(o.side(i,l)+e.from,o.forward(!i,l)?1:-1)}moveToLineBoundary(e,i,n=!0){return Yf(this,e,i,n)}moveVertically(e,i,n){return pl(this,e,Gf(this,e,i,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){return this.readMeasured(),Ts(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let n=this.docView.coordsAt(e,i);if(!n||n.left==n.right)return n;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[yt.find(o,e-l.from,-1,i)];return qi(n,s.dir==xe.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ws)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Pu)return fs(e.length);let i=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||hs(o.isolates,n=Bs(this,e))))return o.order;n||(n=Bs(this,e));let l=Ef(e.text,i,n);return this.bidiCache.push(new rn(e.from,e.to,i,n,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{zo(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,i={}){return Hi.of(new Qt(typeof e=="number"?H.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Hi.of(new Qt(H.cursor(n.from),"start","start",n.top-e,i,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Wt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Wt.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=kt.newName(),l=[an.of(n),gi.of(xl(`.${n}`,e))];return i&&i.dark&&l.push(wl.of(!0)),l}static baseTheme(e){return Jh.lowest(gi.of(xl("."+Al,e,ca)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),l=n&&re.get(n)||re.get(e);return((i=l?.rootView)===null||i===void 0?void 0:i.view)||null}}se.styleModule=gi,se.inputHandler=bs,se.clipboardInputFilter=al,se.clipboardOutputFilter=rl,se.scrollHandler=As,se.focusChangeEffect=ys,se.perLineTextDirection=ws,se.exceptionSink=ks,se.updateListener=sl,se.editable=ct,se.mouseSelectionStyle=gs,se.dragMovesSelection=ms,se.clickAddsSelectionRange=ps,se.decorations=mi,se.outerDecorations=vs,se.atomicRanges=hl,se.bidiIsolatedRanges=Ss,se.scrollMargins=Ns,se.darkTheme=wl,se.cspNonce=Z.define({combine:a=>a.length?a[0]:""}),se.contentAttributes=dl,se.editorAttributes=Cs,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=be.define();const Pu=4096,fa={};class rn{constructor(e,i,n,l,o,s){this.from=e,this.to=i,this.dir=n,this.isolates=l,this.fresh=o,this.order=s}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let n=[],l=e.length?e[e.length-1].dir:xe.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!i.touchesRange(s.from,s.to)&&n.push(new rn(i.mapPos(s.from,1),i.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function ua(a,e,i){for(let n=a.state.facet(e),l=n.length-1;l>=0;l--){let o=n[l],s=typeof o=="function"?o(a):o;s&&Xn(s,i)}return i}class Ht extends Pt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ht.prototype.elementClass="",Ht.prototype.toDOM=void 0,Ht.prototype.mapMode=_e.TrackBefore,Ht.prototype.startSide=Ht.prototype.endSide=-1,Ht.prototype.point=!0;var vl;const Gt=new oe;function Lu(a){return Z.define({combine:a?e=>e.concat(a):void 0})}const Uu=new oe;class qe{constructor(e,i,n=[],l=""){this.data=e,this.name=l,ae.prototype.hasOwnProperty("tree")||Object.defineProperty(ae.prototype,"tree",{get(){return Sl(this)}}),this.parser=i,this.extension=[Xt.of(this),ae.languageData.of((o,s,r)=>{let c=pa(o,s,r),d=c.type.prop(Gt);if(!d)return[];let h=o.facet(d),f=c.type.prop(Uu);if(f){let u=c.resolve(s-c.from,r);for(let m of f)if(m.test(u,o)){let b=o.facet(m.facet);return m.type=="replace"?b:b.concat(h)}}return h})].concat(n)}isActiveAt(e,i,n=-1){return pa(e,i,n).type.prop(Gt)==this.data}findRegions(e){let i=e.facet(Xt);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let n=[],l=(o,s)=>{if(o.prop(Gt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(oe.mounted);if(r){if(r.tree.prop(Gt)==this.data){if(r.overlay)for(let c of r.overlay)n.push({from:c.from+s,to:c.to+s});else n.push({from:s,to:s+o.length});return}else if(r.overlay){let c=n.length;if(l(r.tree,r.overlay[0].from+s),n.length>c)return}}for(let c=0;c<o.children.length;c++){let d=o.children[c];d instanceof ge&&l(d,o.positions[c]+s)}};return l(Sl(e),0),n}get allowsNesting(){return!0}}qe.setState=be.define();function pa(a,e,i){let n=a.facet(Xt),l=Sl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,i,ye.ExcludeBuffers))o.type.isTop&&(l=o);return l}class cn extends qe{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=Lu(e.languageData);return new cn(i,e.parser.configure({props:[Gt.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new cn(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Sl(a){let e=a.field(qe.state,!1);return e?e.tree:ge.empty}class ju{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,i){let n=this.cursorPos-this.string.length;return e<n||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-n,i-n)}}let yi=null;class dn{constructor(e,i,n=[],l,o,s,r,c){this.parser=e,this.state=i,this.fragments=n,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new dn(e,i,[],ge.empty,0,n,[],null)}startParse(){return this.parser.startParse(new ju(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=ge.empty&&this.isDone(i??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(Ct.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(Ct.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=yi;yi=this;try{return e()}finally{yi=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=ma(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,f,u)=>c.push({fromA:d,toA:h,fromB:f,toB:u})),n=Ct.applyChanges(n,c),l=ge.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),f=e.mapPos(d.to,-1);h<f&&r.push({from:h,to:f})}}}return new dn(this.parser,i,n,l,o,s,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:l,to:o}=this.skipped[n];l<e.to&&o>e.from&&(this.fragments=ma(this.fragments,l,o),this.skipped.splice(n--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends eo{createParse(i,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=yi;if(c){for(let d of l)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=s,new ge(Re.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return yi}}function ma(a,e,i){return Ct.applyChanges(a,[{fromA:e,toA:i,fromB:e,toB:i}])}class Jt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new Jt(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=dn.create(e.facet(Xt).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new Jt(n)}}qe.state=Bt.define({create:Jt.init,update(a,e){for(let i of e.effects)if(i.is(qe.setState))return i.value;return e.startState.facet(Xt)!=e.state.facet(Xt)?Jt.init(e.state):a.apply(e)}});let ga=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ga=a=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Bl=typeof navigator<"u"&&(!((vl=navigator.scheduling)===null||vl===void 0)&&vl.isInputPending)?()=>navigator.scheduling.isInputPending():null,zu=Wt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let i=this.view.state.field(qe.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(qe.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=ga(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:l}}=this.view,o=n.field(qe.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!Bl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&n.doc.length>l+1e3,c=o.context.work(()=>Bl&&Bl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-i,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:qe.setState.of(new Jt(o.context))})),this.chunkBudget>0&&!(c&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>Ze(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Xt=Z.define({combine(a){return a.length?a[0]:null},enables:a=>[qe.state,zu,se.contentAttributes.compute([a],e=>{let i=e.facet(a);return i&&i.name?{"data-language":i.name}:{}})]});class qu{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const Qu=new oe;function ka({except:a,units:e=1}={}){return i=>{let n=a&&a.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const Ku=new oe;function Wu(a){let e=a.firstChild,i=a.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?a.to:i.from}:null}class Nl{constructor(e,i){this.specs=e;let n;function l(r){let c=kt.newName();return(n||(n=Object.create(null)))["."+c]=r,c}const o=typeof i.all=="string"?i.all:i.all?l(i.all):void 0,s=i.scope;this.scope=s instanceof qe?r=>r.prop(Gt)==s.data:s?r=>r==s:void 0,this.style=ro(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new kt(n):null,this.themeType=i.themeType}static define(e,i){return new Nl(e,i||{})}}U.meta,U.link,U.heading,U.emphasis,U.strong,U.strikethrough,U.keyword,U.atom,U.bool,U.url,U.contentSeparator,U.labelName,U.literal,U.inserted,U.string,U.deleted,U.regexp,U.escape,U.string,U.variableName,U.variableName,U.typeName,U.namespace,U.className,U.variableName,U.macroName,U.propertyName,U.comment,U.invalid;const Yu=Object.create(null),ba=[Re.none],ya=[],wa=Object.create(null),Hu=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Hu[a]=Gu(Yu,e);function Vl(a,e){ya.indexOf(a)>-1||(ya.push(a),console.warn(e))}function Gu(a,e){let i=[];for(let r of e.split(" ")){let c=[];for(let d of r.split(".")){let h=a[d]||U[d];h?typeof h=="function"?c.length?c=c.map(h):Vl(d,`Modifier ${d} used at start of tag`):c.length?Vl(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Vl(d,`Unknown highlighting tag ${d}`)}for(let d of c)i.push(d)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),l=n+" "+i.map(r=>r.id),o=wa[l];if(o)return o.id;let s=wa[l]=Re.define({id:ba.length,name:n,props:[ao({[n]:i})]});return ba.push(s),s.id}xe.RTL,xe.LTR;const Ju=cn.define({name:"json",parser:qh.configure({props:[Qu.add({Object:ka({except:/^\s*\}/}),Array:ka({except:/^\s*\]/})}),Ku.add({"Object Array":Wu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Xu(){return new qu(Ju)}const Rl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function Zu(){const a=Le();if(a.formRules?.length){const e={};Rl.forEach(n=>{e[n.name]=n});const i=[...Rl];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):i.push(l)}),i}return Rl}const ep={loadAdvances:Zu},tp={class:"unione-props-setting data-field-setting"},ip={key:0},np=["onClick"],lp={class:"field-txt"},op=["onClick"],sp={key:1,class:"field-txt"},ap=["onClick"],rp={key:0,class:"field-txt"},cp={key:3,class:"edit-field"},dp=["onClick"],hp=ie(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([Xu()]),i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.useModel(a,"modelValue"),l={mounted:g=>g.focus()},o=t.ref({});function s(){const g=Object.keys(o.value);if(g.length)for(let p in g){const N=n.value.filter(M=>M.name==p);if(N&&N[0]){let M=o.value[p];Object.keys(M).forEach(v=>{v=="convertName"?(N[0].convert||(N[0].convert={}),N[0].convert.type=M[v]):N[0][v]=M[v]})}}o.value={}}function r(g,p){s();const N={};p=="convertName"?(g.convert||(g.convert={}),N[p]=g.convert?.type):N[p]=g[p]||"",o.value[g.name]=N}function c(g,p){{o.value={};return}}function d(g,p){switch(p){case"query":return g.configs?.query?.enable;case"form":return g.configs?.show?.form?.enable;case"view":return g.configs?.show?.view?.enable;case"list":return g.configs?.show?.list?.enable;case"sort":return g.configs?.sort?.enable}}function h(g,p){switch(p){case"query":g.configs=K.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=K.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=K.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=K.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=K.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const f=t.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(g,p){switch(f.value.prop=p,f.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),p){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),f.value.show=g.configs.query,f.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),f.value.show=g.configs.show.form,f.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),f.value.show=g.configs.show.view,f.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),f.value.show=g.configs.show.list,f.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),f.value.show=g.configs.sort,f.value.title=`排序设置/${g.title}(${g.name})`;break}f.value.visible=!0}const m=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:g=>{const p=m.value.options.filter(N=>N.value==g);return p[0]?p[0].label:g}}),b=t.ref({visible:!1,field:{},props:{},advances:ep.loadAdvances(),showInfo:g=>{let p=0;if(g.configs?.rule){const N=g.configs.rule;N.advance&&p++,typeof N.rangeMin<"u"&&p++,typeof N.rangeMax<"u"&&p++,typeof N.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const g=b.value.props;b.value.field.configs=K.utils.obj.ext(b.value.field.configs,{rule:{...g}}),b.value.visible=!1,b.value.props={}}});function A(g){b.value.visible=!0,b.value.field=g,b.value.props=g.configs?.rule||{}}const C=t.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:g=>{const p=g.configs?.widget?.name,N=C.value.widgets.filter(M=>M.value==p);return N[0]?N[0].label:p},toSetting:(g,p)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=p},toclose:()=>{C.value.visible=!1}});function w(g){C.value.field=g,g.configs=K.utils.obj.ext(g.configs,{widget:{props:{}}}),C.value.widget=g.configs.widget,C.value.visible=!0}const y=t.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(g,p="--")=>y.value.types.filter(N=>N.value==g)[0]?.label||p,toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(g,p)=>{y.value.convert.options.splice(g,1)},toSetting:()=>{y.value.visible=!1}});function R(g){y.value.visible=!0,y.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),y.value.convert=g.configs.convert}return(g,p)=>{const N=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("a-select"),x=t.resolveComponent("a-checkbox"),B=t.resolveComponent("a-table"),V=t.resolveComponent("a-switch"),k=t.resolveComponent("a-form-item"),S=t.resolveComponent("a-select-option"),T=t.resolveComponent("a-input-number"),O=t.resolveComponent("a-form"),_=t.resolveComponent("a-modal"),$=t.resolveComponent("a-input"),I=t.resolveComponent("unione-select-box"),j=t.resolveComponent("a-checkbox-group"),P=t.resolveComponent("unione-section");return t.openBlock(),t.createElementBlock("div",tp,[t.createVNode(B,{columns:i.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:E})=>[["widget","queryType","rules","convertName"].includes(E.key)?(t.openBlock(),t.createElementBlock("span",ip,[t.createVNode(N),t.createTextVNode(" "+t.toDisplayString(E.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:E,text:J,record:F})=>[["rules"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!b.value.showInfo(F)&&"empty"]),onClick:z=>A(F)},[t.createElementVNode("span",lp,t.toDisplayString(b.value.showInfo(F)),1),b.value.showInfo(F)?(t.openBlock(),t.createBlock(M,{key:0,type:"link"},{default:t.withCtx(()=>p[50]||(p[50]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,np)):["widget"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[F.name]||!Object.keys(o.value[F.name]).includes(E.dataIndex))&&!J&&"empty"]),onClick:z=>r(F,E.dataIndex)},[o.value[F.name]&&Object.keys(o.value[F.name]).includes(E.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:F.configs?.widget?.name,allowClear:!0,options:C.value.widgets,onChange:z=>C.value.toSetting(F,z),onBlur:p[0]||(p[0]=z=>c())},null,8,["value","options","onChange"])),[[l]]):(t.openBlock(),t.createElementBlock("span",sp,t.toDisplayString(C.value.widgetName(F)),1)),t.createVNode(M,{type:"link",onClick:t.withModifiers(z=>w(F),["stop"])},{default:t.withCtx(()=>p[51]||(p[51]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])],10,op)):["convertName"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[F.name]||!Object.keys(o.value[F.name]).includes(E.dataIndex))&&!F.convert?.type&&"empty"]),onClick:z=>R(F)},[F.configs?.convert?.types?(t.openBlock(),t.createElementBlock("span",rp,t.toDisplayString(y.value.getTypes(F.configs.convert.types)),1)):t.createCommentVNode("",!0)],10,ap)):["query","form","view","list","sort"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",cp,[t.createVNode(x,{checked:d(F,E.dataIndex),onClick:z=>h(F,E.dataIndex)},null,8,["checked","onClick"]),t.createVNode(M,{type:"link",onClick:z=>u(F,E.dataIndex)},{default:t.withCtx(()=>p[52]||(p[52]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(_,{visible:f.value.visible,"onUpdate:visible":p[14]||(p[14]=E=>f.value.visible=E),width:600,title:f.value.title,onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:t.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:t.withCtx(()=>[t.createVNode(k,{label:"启用状态"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.show.enable,"onUpdate:checked":p[1]||(p[1]=E=>f.value.show.enable=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(t.openBlock(),t.createBlock(k,{key:0,label:"默认排序"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=E=>f.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="sort"?(t.openBlock(),t.createBlock(k,{key:1,label:"排序方式"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.show.asc,"onUpdate:checked":p[3]||(p[3]=E=>f.value.show.asc=E),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(t.openBlock(),t.createBlock(k,{key:2,label:"高级查询"})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(k,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=E=>f.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(k,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.show.visible,"onUpdate:checked":p[5]||(p[5]=E=>f.value.show.visible=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(k,{key:5,label:"查询方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.types,"onUpdate:value":p[6]||(p[6]=E=>f.value.show.types=E)},{default:t.withCtx(()=>[t.createVNode(S,{key:"EQ",value:"EQ"},{default:t.withCtx(()=>p[53]||(p[53]=[t.createTextVNode("精确查询")])),_:1}),t.createVNode(S,{key:"LIKE",value:"LIKE"},{default:t.withCtx(()=>p[54]||(p[54]=[t.createTextVNode("模糊查询")])),_:1}),t.createVNode(S,{key:"LLIKE",value:"LLIKE"},{default:t.withCtx(()=>p[55]||(p[55]=[t.createTextVNode("左模糊")])),_:1}),t.createVNode(S,{key:"RLIKE",value:"RLIKE"},{default:t.withCtx(()=>p[56]||(p[56]=[t.createTextVNode("右模糊")])),_:1}),t.createVNode(S,{key:"RANGE",value:"RANGE"},{default:t.withCtx(()=>p[57]||(p[57]=[t.createTextVNode("范围查询")])),_:1}),t.createVNode(S,{key:"ADVANCE",value:"ADVANCE"},{default:t.withCtx(()=>p[58]||(p[58]=[t.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(k,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:t.withCtx(()=>[t.createVNode(T,{value:f.value.show.index,"onUpdate:value":p[7]||(p[7]=E=>f.value.show.index=E)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.width,"onUpdate:value":p[8]||(p[8]=E=>f.value.show.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,value:f.value.show.width,"onUpdate:value":p[9]||(p[9]=E=>f.value.show.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=E=>f.value.show.labelWidth=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=E=>f.value.show.valueWidth=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:11,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.fixed,"onUpdate:value":p[12]||(p[12]=E=>f.value.show.fixed=E),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(k,{key:12,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.align,"onUpdate:value":p[13]||(p[13]=E=>f.value.show.align=E),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),t.createVNode(_,{visible:y.value.visible,"onUpdate:visible":p[33]||(p[33]=E=>y.value.visible=E),width:600,title:y.value.getTypes(y.value.convert.types,"转换")+"设置",onOk:y.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:y.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(k,{label:"转换类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:y.value.convert.types,"onUpdate:value":p[15]||(p[15]=E=>y.value.convert.types=E),allowClear:!0,options:y.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(y.value.field.widget?.name)?(t.openBlock(),t.createBlock(k,{key:0,label:"是否搜索"},{default:t.withCtx(()=>[t.createVNode(V,{checked:f.value.convert.search,"onUpdate:checked":p[16]||(p[16]=E=>f.value.convert.search=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="option"?(t.openBlock(),t.createBlock(k,{key:1,label:"选项设置"},{default:t.withCtx(()=>[t.createVNode(M,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:t.withCtx(()=>p[59]||(p[59]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(B,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:E,record:J,index:F})=>[E.dataIndex==="label"?(t.openBlock(),t.createBlock($,{key:0,value:J.label,"onUpdate:value":z=>J.label=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),E.dataIndex==="value"?(t.openBlock(),t.createBlock($,{key:1,value:J.value,"onUpdate:value":z=>J.value=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),E.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:z=>y.value.toDelOption(F,J)},"删除",8,dp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):t.createCommentVNode("",!0),["dbtable","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(k,{key:2,label:"数据源"},{default:t.withCtx(()=>[t.createVNode(I,{value:y.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=E=>y.value.convert.dsId=E),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:3,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=E=>y.value.convert.tableName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:4,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=E=>y.value.convert.tableName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"&&["unione-tree-box"].includes(y.value.field.widget?.name)?(t.openBlock(),t.createBlock(k,{key:5,label:"主键字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.idField,"onUpdate:value":p[20]||(p[20]=E=>y.value.convert.idField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"&&["unione-tree-box"].includes(y.value.field.widget?.name)?(t.openBlock(),t.createBlock(k,{key:6,label:"父级字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=E=>y.value.convert.pidField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:7,label:"value字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=E=>y.value.convert.valueField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:8,label:"label字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=E=>y.value.convert.labelField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=E=>y.value.convert.tableField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=E=>y.value.convert.tableWhere=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=E=>y.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=E=>y.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:13,label:"异步加载"},{default:t.withCtx(()=>[t.createVNode(V,{checked:y.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=E=>y.value.convert.isAsync=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(k,{key:14,label:"分页加载"},{default:t.withCtx(()=>[t.createVNode(V,{checked:y.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=E=>y.value.convert.isPaging=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dict"?(t.openBlock(),t.createBlock(k,{key:15,label:"字典名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=E=>y.value.convert.dictName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(k,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.url,"onUpdate:value":p[31]||(p[31]=E=>y.value.convert.url=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(k,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:y.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=E=>y.value.convert.params=E),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(_,{visible:C.value.visible,"onUpdate:visible":p[40]||(p[40]=E=>C.value.visible=E),width:600,title:"控件设置",onOk:C.value.toclose},{default:t.withCtx(()=>[t.createVNode(O,{model:C.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(k,{label:"组件类型"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(v,{value:C.value.widget.name,"onUpdate:value":p[34]||(p[34]=E=>C.value.widget.name=E),allowClear:!0,options:C.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),t.createVNode(k,{label:"输入提示"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=E=>C.value.widget.placeholder=E)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"帮助说明"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.help,"onUpdate:value":p[36]||(p[36]=E=>C.value.widget.help=E)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"提示文本"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=E=>C.value.widget.tooltip=E)},null,8,["value"])]),_:1}),["a-date-picker"].includes(C.value.widget.name)?(t.openBlock(),t.createBlock(k,{key:0,label:"显示格式"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=E=>C.value.field.dataFormat=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),C.value.widget.name=="unione-select-box"?(t.openBlock(),t.createBlock(k,{key:1,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:C.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=E=>C.value.widget.props.mode=E),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(S,{value:"multiple"},{default:t.withCtx(()=>p[60]||(p[60]=[t.createTextVNode("多选")])),_:1}),t.createVNode(S,{value:"tags"},{default:t.withCtx(()=>p[61]||(p[61]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(_,{visible:b.value.visible,"onUpdate:visible":p[49]||(p[49]=E=>b.value.visible=E),width:600,title:"规则设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(P,{title:"基本设置",type:"line"},{default:t.withCtx(()=>[t.createVNode(k,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(j,{value:b.value.props.trigger,"onUpdate:value":p[41]||(p[41]=E=>b.value.props.trigger=E),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(k,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(x,{checked:b.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=E=>b.value.props.whitespace=E)},{default:t.withCtx(()=>p[62]||(p[62]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),t.createVNode(k,{label:"预设类型"},{default:t.withCtx(()=>[t.createVNode(v,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":p[43]||(p[43]=E=>b.value.props.advance=E)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(t.openBlock(),t.createBlock(P,{key:0,title:"数值验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(k,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(T,{value:b.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=E=>b.value.props.rangeMin=E)},null,8,["value"]),p[63]||(p[63]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(T,{value:b.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=E=>b.value.props.rangeMax=E)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=E=>b.value.props.rangeMessage=E)},null,8,["value"])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(P,{title:"正则验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(k,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=E=>b.value.props.regExpress=E)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=E=>b.value.props.regMessage=E)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),fp={class:"unione-props-setting data-field-fkey"},up={key:0},pp=["onClick"],mp=["onClick"],gp=["onClick"],kp=["onClick"],bp=["onClick"],yp=["onClick"],wp=["onClick"],Ap=["onClick"],xp=ie(t.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),n=t.useModel(a,"modelValue"),l=t.computed(()=>n.value.filter(u=>u.configs?.fkey?.enable)||[]),o=t.ref({});function s(){o.value={}}function r(u,m){s();const b={};b[m]=u.configs.fkey[m]||"",o.value[u.name]=b}function c(u,m,b){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=b.name,u.configs.fkey.dsnTitle=b.title,u.configs.fkey.dsnId=b.id}function d(u,m,b,A){u.configs.fkey[m]=b,m=="fieldName"&&(u.configs.fkey.fieldTitle=A.title),m=="labelName"&&(u.configs.fkey.labelTitle=A.title)}function h(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=t.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{f.value.editField[u]=m},onShowFieldChange:(u,m,b)=>{u.name=b.name,u.title=b.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=K.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,m)=>{const b=t.resolveComponent("FormOutlined"),A=t.resolveComponent("unione-select-box"),C=t.resolveComponent("a-button"),w=t.resolveComponent("a-table"),y=t.resolveComponent("a-input-number"),R=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",fp,[t.createVNode(w,{columns:i.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:t.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(t.openBlock(),t.createElementBlock("span",up,[t.createVNode(b),t.createTextVNode(" "+t.toDisplayString(g.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:g,record:p})=>[["dsnName"].includes(g.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:N=>r(p,g.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(g.dataIndex)?(t.openBlock(),t.createBlock(A,{key:0,value:o.value[p.name][g.dataIndex],"onUpdate:value":N=>o.value[p.name][g.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(N,M)=>c(p,N,M)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,pp)):["dsnTitle"].includes(g.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:N=>r(p,g.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(g.dataIndex)?(t.openBlock(),t.createBlock(A,{key:0,value:o.value[p.name][g.dataIndex],"onUpdate:value":N=>o.value[p.name][g.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(N,M)=>c(p,N,M)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,mp)):t.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:N=>r(p,g.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(g.dataIndex)?(t.openBlock(),t.createBlock(A,{key:0,value:o.value[p.name][g.dataIndex],"onUpdate:value":N=>o.value[p.name][g.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>d(p,"fieldName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,gp)):["labelName"].includes(g.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:N=>r(p,g.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(g.dataIndex)?(t.openBlock(),t.createBlock(A,{key:0,value:o.value[p.name][g.dataIndex],"onUpdate:value":N=>o.value[p.name][g.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>d(p,"labelName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(t.openBlock(),t.createBlock(C,{key:0,type:"link",onClick:t.withModifiers(N=>h(p),["stop"])},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,kp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(R,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=g=>f.value.visible=g),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(C,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(w,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:t.withCtx(({column:g,record:p,index:N,text:M})=>[g.dataIndex==="title"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",f.value.editField!="title"&&!M&&"empty"]),onClick:v=>f.value.toEditField(N,g.dataIndex)},[f.value.editField[N]=="title"?(t.openBlock(),t.createBlock(A,{key:0,value:p[p.dataIndex],"onUpdate:value":v=>p[p.dataIndex]=v,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=v=>f.value.editField={}),onSelect:(v,x)=>f.value.onShowFieldChange(p,v,x)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,bp)):t.createCommentVNode("",!0),g.dataIndex==="width"?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",f.value.editField!="width"&&!M&&"empty"]),onClick:v=>f.value.toEditField(N,g.dataIndex)},[f.value.editField[N]=="width"?(t.openBlock(),t.createBlock(y,{key:0,onBlur:m[1]||(m[1]=v=>f.value.editField={}),value:p.width,"onUpdate:value":v=>p.width=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,yp)):t.createCommentVNode("",!0),g.dataIndex==="index"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:v=>f.value.toEditField(N,g.dataIndex)},[f.value.editField[N]=="index"?(t.openBlock(),t.createBlock(y,{key:0,onBlur:m[2]||(m[2]=v=>f.value.editField={}),value:p.index,"onUpdate:value":v=>p.index=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,wp)):t.createCommentVNode("",!0),g.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:3,onClick:v=>f.value.toDelField(N)},"删除",8,Ap)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),Cp={class:"unione-props-setting data-filter"},vp={class:"title"},Sp={class:"name"},Bp={class:"action"},Np=ie(t.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),i=t.useModel(a,"modelValue");function n(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(d){r.value.visible=!0,r.value.filter={...d},r.value.name=d.name}function o(d){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{i.value.splice(d,1)}})}const s=t.ref(),r=t.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(d=>{if(r.value.name){const h=i.value.filter(f=>f.name==r.value.name)[0];if(!h){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&i.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(d).forEach(f=>{h[f]=d[f]})}else{if(i.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}i.value.push(d)}r.value.visible=!1})}});function c(){const d=[];r.value.filter.filter||(r.value.filter.filter=""),d.push("-- @if(isNotEmpty(params."),d.push(r.value.filter.name||"xxx"),d.push(") && !isBlank(params."),d.push(r.value.filter.name||"xxx"),d.push(`)
20
+ `;this.styleTag.textContent=s;let r=i.head||i;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Lt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},qn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xe=0;xe<10;xe++)Lt[48+xe]=Lt[96+xe]=String(xe);for(var xe=1;xe<=24;xe++)Lt[xe+111]="F"+xe;for(var xe=65;xe<=90;xe++)Lt[xe]=String.fromCharCode(xe+32),qn[xe]=String.fromCharCode(xe);for(var Qn in Lt)qn.hasOwnProperty(Qn)||(qn[Qn]=Lt[Qn]);function ci(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Kn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function ji(a,e){if(!e.anchorNode)return!1;try{return Kn(a,e.anchorNode)}catch{return!1}}function di(a){return a.nodeType==3?Rt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function hi(a,e,i,n){return i?Uo(a,e,i,n,-1)||Uo(a,e,i,n,1):!1}function Vt(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function zi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function Uo(a,e,i,n,l){for(;;){if(a==i&&e==n)return!0;if(e==(l<0?0:Ge(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=Vt(a)+(l<0?0:1),a=o}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?Ge(a):0}else return!1}}function Ge(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function qi(a,e){let i=e?a.left:a.right;return{left:i,right:i,top:a.top,bottom:a.bottom}}function ff(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function jo(a,e){let i=e.width/a.offsetWidth,n=e.height/a.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-a.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-a.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function uf(a,e,i,n,l,o,s,r){let c=a.ownerDocument,d=c.defaultView||window;for(let h=a,f=!1;h&&!f;)if(h.nodeType==1){let p,m=h==c.body,b=1,w=1;if(m)p=ff(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let A=h.getBoundingClientRect();({scaleX:b,scaleY:w}=jo(h,A)),p={left:A.left,right:A.left+h.clientWidth*b,top:A.top,bottom:A.top+h.clientHeight*w}}let C=0,y=0;if(l=="nearest")e.top<p.top?(y=e.top-(p.top+s),i>0&&e.bottom>p.bottom+y&&(y=e.bottom-p.bottom+s)):e.bottom>p.bottom&&(y=e.bottom-p.bottom+s,i<0&&e.top-y<p.top&&(y=e.top-(p.top+s)));else{let A=e.bottom-e.top,V=p.bottom-p.top;y=(l=="center"&&A<=V?e.top+A/2-V/2:l=="start"||l=="center"&&i<0?e.top-s:e.bottom-V+s)-p.top}if(n=="nearest"?e.left<p.left?(C=e.left-(p.left+o),i>0&&e.right>p.right+C&&(C=e.right-p.right+o)):e.right>p.right&&(C=e.right-p.right+o,i<0&&e.left<p.left+C&&(C=e.left-(p.left+o))):C=(n=="center"?e.left+(e.right-e.left)/2-(p.right-p.left)/2:n=="start"==r?e.left-o:e.right-(p.right-p.left)+o)-p.left,C||y)if(m)d.scrollBy(C,y);else{let A=0,V=0;if(y){let k=h.scrollTop;h.scrollTop+=y/w,V=(h.scrollTop-k)*w}if(C){let k=h.scrollLeft;h.scrollLeft+=C/b,A=(h.scrollLeft-k)*b}e={left:e.left-A,top:e.top-V,right:e.right-A,bottom:e.bottom-V},A&&Math.abs(A-C)<1&&(n="nearest"),V&&Math.abs(V-y)<1&&(l="nearest")}if(m)break;(e.top<p.top||e.bottom>p.bottom||e.left<p.left||e.right>p.right)&&(e={left:Math.max(e.left,p.left),right:Math.min(e.right,p.right),top:Math.max(e.top,p.top),bottom:Math.min(e.bottom,p.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function pf(a){let e=a.ownerDocument,i,n;for(let l=a.parentNode;l&&!(l==e.body||i&&n);)if(l.nodeType==1)!n&&l.scrollHeight>l.clientHeight&&(n=l),!i&&l.scrollWidth>l.clientWidth&&(i=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:i,y:n}}class mf{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:i,focusNode:n}=e;this.set(i,Math.min(e.anchorOffset,i?Ge(i):0),n,Math.min(e.focusOffset,n?Ge(n):0))}set(e,i,n,l){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=l}}let Ut=null;function zo(a){if(a.setActive)return a.setActive();if(Ut)return a.focus(Ut);let e=[];for(let i=a;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(a.focus(Ut==null?{get preventScroll(){return Ut={preventScroll:!0},!0}}:void 0),!Ut){Ut=!1;for(let i=0;i<e.length;){let n=e[i++],l=e[i++],o=e[i++];n.scrollTop!=l&&(n.scrollTop=l),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let qo;function Rt(a,e,i=e){let n=qo||(qo=document.createRange());return n.setEnd(a,i),n.setStart(a,e),n}function jt(a,e,i,n){let l={key:e,code:e,keyCode:i,which:i,cancelable:!0};n&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=n);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,a.dispatchEvent(o);let s=new KeyboardEvent("keyup",l);return s.synthetic=!0,a.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function gf(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Qo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function kf(a,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Ge(i));;)if(n){if(i.nodeType!=1)return!1;let l=i.childNodes[n-1];l.contentEditable=="false"?n--:(i=l,n=Ge(i))}else{if(i==a)return!0;n=Vt(i),i=i.parentNode}}function Ko(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Wo(a,e){for(let i=a,n=e;;){if(i.nodeType==3&&n>0)return{node:i,offset:n};if(i.nodeType==1&&n>0){if(i.contentEditable=="false")return null;i=i.childNodes[n-1],n=Ge(i)}else if(i.parentNode&&!zi(i))n=Vt(i),i=i.parentNode;else return null}}function Yo(a,e){for(let i=a,n=e;;){if(i.nodeType==3&&n<i.nodeValue.length)return{node:i,offset:n};if(i.nodeType==1&&n<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[n],n=0}else if(i.parentNode&&!zi(i))n=Vt(i)+1,i=i.parentNode;else return null}}class Ne{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new Ne(e.parentNode,Vt(e),i)}static after(e,i){return new Ne(e.parentNode,Vt(e)+1,i)}}const Wn=[];class re{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let i=this.posAtStart;for(let n of this.children){if(n==e)return i;i+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,i){if(this.flags&2){let n=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:n.firstChild)){let r=re.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,i),s.flags&=-8}if(o=l?l.nextSibling:n.firstChild,i&&!i.written&&i.node==n&&o!=s.dom&&(i.written=!0),s.dom.parentNode==n)for(;o&&o!=s.dom;)o=Ho(o);else n.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:n.firstChild,o&&i&&i.node==n&&(i.written=!0);o;)o=Ho(o)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,i),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,i){let n;if(e==this.dom)n=this.dom.childNodes[i];else{let l=Ge(e)==0?0:i==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;l==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?l=-1:l=1),e=o}l<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!re.get(n);)n=n.nextSibling;if(!n)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==n)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,i,n=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,d=n,h=n;c<this.children.length;c++){let f=this.children[c],p=d+f.length;if(d<e&&p>i)return f.domBoundsAround(e,i,d);if(p>=e&&l==-1&&(l=c,o=d),d>i&&f.dom.parentNode==this.dom){s=c,r=h;break}h=p,d=p+f.breakAfter}return{from:o,to:r<0?n+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let i=this.parent;i;i=i.parent){if(e&&(i.flags|=2),i.flags&1)return;i.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let i=e.parent;if(!i)return e;e=i}}replaceChildren(e,i,n=Wn){this.markDirty();for(let l=e;l<i;l++){let o=this.children[l];o.parent==this&&n.indexOf(o)<0&&o.destroy()}n.length<250?this.children.splice(e,i-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(i));for(let l=0;l<n.length;l++)n[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Go(this.children,e,this.children.length)}childPos(e,i=1){return this.childCursor().findPos(e,i)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,i,n,l,o,s){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}re.prototype.breakAfter=0;function Ho(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Go{constructor(e,i,n){this.children=e,this.pos=i,this.i=n,this.off=0}findPos(e,i=1){for(;;){if(e>this.pos||e==this.pos&&(i>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Jo(a,e,i,n,l,o,s,r,c){let{children:d}=a,h=d.length?d[e]:null,f=o.length?o[o.length-1]:null,p=f?f.breakAfter:s;if(!(e==n&&h&&!s&&!p&&o.length<2&&h.merge(i,l,o.length?f:null,i==0,r,c))){if(n<d.length){let m=d[n];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==n&&(m=m.split(l),l=0),!p&&f&&m.merge(0,l,f,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(f?f.breakAfter=1:s=1),n++}for(h&&(h.breakAfter=s,i>0&&(!s&&o.length&&h.merge(i,h.length,o[0],!1,r,0)?h.breakAfter=o.shift().breakAfter:(i<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(i,h.length,null,!1,r,0),e++));e<n&&o.length;)if(d[n-1].become(o[o.length-1]))n--,o.pop(),c=o.length?0:r;else if(d[e].become(o[0]))e++,o.shift(),r=o.length?0:c;else break;!o.length&&e&&n<d.length&&!d[e-1].breakAfter&&d[n].merge(0,0,d[e-1],!1,r,c)&&e--,(e<n||o.length)&&a.replaceChildren(e,n,o)}}function Xo(a,e,i,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(i,1),{i:d,off:h}=s.findPos(e,-1),f=e-i;for(let p of n)f+=p.length;a.length+=f,Jo(a,d,h,r,c,n,0,l,o)}let Oe=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Yn=typeof document<"u"?document:{documentElement:{style:{}}};const Hn=/Edge\/(\d+)/.exec(Oe.userAgent),Zo=/MSIE \d/.test(Oe.userAgent),Gn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Oe.userAgent),Qi=!!(Zo||Gn||Hn),es=!Qi&&/gecko\/(\d+)/i.test(Oe.userAgent),Jn=!Qi&&/Chrome\/(\d+)/.exec(Oe.userAgent),ts="webkitFontSmoothing"in Yn.documentElement.style,is=!Qi&&/Apple Computer/.test(Oe.vendor),ns=is&&(/Mobile\/\w+/.test(Oe.userAgent)||Oe.maxTouchPoints>2);var W={mac:ns||/Mac/.test(Oe.platform),windows:/Win/.test(Oe.platform),linux:/Linux|X11/.test(Oe.platform),ie:Qi,ie_version:Zo?Yn.documentMode||6:Gn?+Gn[1]:Hn?+Hn[1]:0,gecko:es,gecko_version:es?+(/Firefox\/(\d+)/.exec(Oe.userAgent)||[0,0])[1]:0,chrome:!!Jn,chrome_version:Jn?+Jn[1]:0,ios:ns,android:/Android\b/.test(Oe.userAgent),webkit:ts,safari:is,webkit_version:ts?+(/\bAppleWebKit\/(\d+)/.exec(Oe.userAgent)||[0,0])[1]:0,tabSize:Yn.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const bf=256;class je extends re{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,i,n){return this.flags&8||n&&(!(n instanceof je)||this.length-(i-e)+n.length>bf||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(i),this.markDirty(),!0)}split(e){let i=new je(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),i.flags|=this.flags&8,i}localPosFromDOM(e,i){return e==this.dom?i:i?this.text.length:0}domAtPos(e){return new Ne(this.dom,e)}domBoundsAround(e,i,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,i){return yf(this.dom,e,i)}}class at extends re{constructor(e,i=[],n=0){super(),this.mark=e,this.children=i,this.length=n;for(let l of i)l.setParent(this)}setAttrs(e){if(Qo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let i in this.mark.attrs)e.setAttribute(i,this.mark.attrs[i]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,i){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,i)}merge(e,i,n,l,o,s){return n&&(!(n instanceof at&&n.mark.eq(this.mark))||e&&o<=0||i<this.length&&s<=0)?!1:(Xo(this,e,i,n?n.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let i=[],n=0,l=-1,o=0;for(let r of this.children){let c=n+r.length;c>e&&i.push(n<e?r.split(e-n):r),l<0&&n>=e&&(l=o),n=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new at(this.mark,i,s)}domAtPos(e){return ls(this,e)}coordsAt(e,i){return ss(this,e,i)}}function yf(a,e,i){let n=a.nodeValue.length;e>n&&(e=n);let l=e,o=e,s=0;e==0&&i<0||e==n&&i>=0?W.chrome||W.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):i<0?l--:o<n&&o++;let r=Rt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:i>=0)?0:r.length-1];return W.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,d=>d.width)||c),s?qi(c,s<0):c||null}class Et extends re{static create(e,i,n){return new Et(e,i,n)}constructor(e,i,n){super(),this.widget=e,this.length=i,this.side=n,this.prevWidget=null}split(e){let i=Et.create(this.widget,this.length-e,this.side);return this.length-=e,i}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,i,n,l,o,s){return n&&(!(n instanceof Et)||!this.widget.compare(n.widget)||e>0&&o<=0||i<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-i),!0)}become(e){return e instanceof Et&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return le.empty;let e=this;for(;e.parent;)e=e.parent;let{view:i}=e,n=i&&i.state.doc,l=this.posAtStart;return n?n.slice(l,l+this.length):le.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ne.before(this.dom):Ne.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,i){let n=this.widget.coordsAt(this.dom,e,i);if(n)return n;let l=this.dom.getClientRects(),o=null;if(!l.length)return null;let s=this.side?this.side<0:e>0;for(let r=s?l.length-1:0;o=l[r],!(e>0?r==0:r==l.length-1||o.top<o.bottom);r+=s?-1:1);return qi(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class zt extends re{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof zt&&e.side==this.side}split(){return new zt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ne.before(this.dom):Ne.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return le.empty}get isHidden(){return!0}}je.prototype.children=Et.prototype.children=zt.prototype.children=Wn;function ls(a,e){let i=a.dom,{children:n}=a,l=0;for(let o=0;l<n.length;l++){let s=n[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==i)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=n[o-1];if(s.dom.parentNode==i)return s.domAtPos(s.length)}for(let o=l;o<n.length;o++){let s=n[o];if(s.dom.parentNode==i)return s.domAtPos(0)}return new Ne(i,0)}function os(a,e,i){let n,{children:l}=a;i>0&&e instanceof at&&l.length&&(n=l[l.length-1])instanceof at&&n.mark.eq(e.mark)?os(n,e.children[0],i-1):(l.push(e),e.setParent(a)),a.length+=e.length}function ss(a,e,i){let n=null,l=-1,o=null,s=-1;function r(d,h){for(let f=0,p=0;f<d.children.length&&p<=h;f++){let m=d.children[f],b=p+m.length;b>=h&&(m.children.length?r(m,h-p):(!o||o.isHidden&&(i>0||Af(o,m)))&&(b>h||p==b&&m.getSide()>0)?(o=m,s=h-p):(p<h||p==b&&m.getSide()<0&&!m.isHidden)&&(n=m,l=h-p)),p=b}}r(a,e);let c=(i<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),i):wf(a)}function wf(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let i=di(e);return i[i.length-1]||null}function Af(a,e){let i=a.coordsAt(0,1),n=e.coordsAt(0,1);return i&&n&&n.top<i.bottom}function Xn(a,e){for(let i in a)i=="class"&&e.class?e.class+=" "+a.class:i=="style"&&e.style?e.style+=";"+a.style:e[i]=a[i];return e}const as=Object.create(null);function Ki(a,e,i){if(a==e)return!0;a||(a=as),e||(e=as);let n=Object.keys(a),l=Object.keys(e);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=l.length-(i&&l.indexOf(i)>-1?1:0))return!1;for(let o of n)if(o!=i&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Zn(a,e,i){let n=!1;if(e)for(let l in e)i&&l in i||(n=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(i)for(let l in i)e&&e[l]==i[l]||(n=!0,l=="style"?a.style.cssText=i[l]:a.setAttribute(l,i[l]));return n}function xf(a){let e=Object.create(null);for(let i=0;i<a.attributes.length;i++){let n=a.attributes[i];e[n.name]=n.value}return e}class el{eq(e){return!1}updateDOM(e,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,i,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Je=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Je||(Je={}));class Ve extends Pt{constructor(e,i,n,l){super(),this.startSide=e,this.endSide=i,this.widget=n,this.spec=l}get heightRelevant(){return!1}static mark(e){return new fi(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return i+=n&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new yt(e,i,i,n,e.widget||null,!1)}static replace(e){let i=!!e.block,n,l;if(e.isBlockGap)n=-5e8,l=4e8;else{let{start:o,end:s}=rs(e,i);n=(o?i?-3e8:-1:5e8)-1,l=(s?i?2e8:1:-6e8)+1}return new yt(e,n,l,i,e.widget||null,!0)}static line(e){return new ui(e)}static set(e,i=!1){return fe.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ve.none=fe.empty;class fi extends Ve{constructor(e){let{start:i,end:n}=rs(e);super(i?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var i,n;return this==e||e instanceof fi&&this.tagName==e.tagName&&(this.class||((i=this.attrs)===null||i===void 0?void 0:i.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Ki(this.attrs,e.attrs,"class")}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}fi.prototype.point=!1;class ui extends Ve{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ui&&this.spec.class==e.spec.class&&Ki(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}ui.prototype.mapMode=Te.TrackBefore,ui.prototype.point=!0;class yt extends Ve{constructor(e,i,n,l,o,s){super(i,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?i<=0?Te.TrackBefore:Te.TrackAfter:Te.TrackDel}get type(){return this.startSide!=this.endSide?Je.WidgetRange:this.startSide<=0?Je.WidgetBefore:Je.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof yt&&Cf(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}yt.prototype.point=!0;function rs(a,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=a;return i==null&&(i=a.inclusive),n==null&&(n=a.inclusive),{start:i??e,end:n??e}}function Cf(a,e){return a==e||!!(a&&e&&a.compare(e))}function Wi(a,e,i,n=0){let l=i.length-1;l>=0&&i[l]+n>=a?i[l]=Math.max(i[l],e):i.push(a,e)}class be extends re{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,i,n,l,o,s){if(n){if(!(n instanceof be))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),Xo(this,e,i,n?n.children.slice():[],o,s),!0}split(e){let i=new be;if(i.breakAfter=this.breakAfter,this.length==0)return i;let{i:n,off:l}=this.childPos(e);l&&(i.append(this.children[n].split(l),0),this.children[n].merge(l,this.children[n].length,null,!1,0,0),n++);for(let o=n;o<this.children.length;o++)i.append(this.children[o],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,i}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Ki(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,i){os(this,e,i)}addLineDeco(e){let i=e.spec.attributes,n=e.spec.class;i&&(this.attrs=Xn(i,this.attrs||{})),n&&(this.attrs=Xn({class:n},this.attrs||{}))}domAtPos(e){return ls(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,i){var n;this.dom?this.flags&4&&(Qo(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Zn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,i);let l=this.dom.lastChild;for(;l&&re.get(l)instanceof at;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=re.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!W.ios||!this.children.some(o=>o instanceof je))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,i;for(let n of this.children){if(!(n instanceof je)||/[^ -~]/.test(n.text))return null;let l=di(n.dom);if(l.length!=1)return null;e+=l[0].width,i=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:i}:null}coordsAt(e,i){let n=ss(this,e,i);if(!this.children.length&&n&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:n.top+s,bottom:n.bottom-s,left:n.left,right:n.left}}}return n}become(e){return e instanceof be&&this.children.length==0&&e.children.length==0&&Ki(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,i){for(let n=0,l=0;n<e.children.length;n++){let o=e.children[n],s=l+o.length;if(s>=i){if(o instanceof be)return o;if(s>i)break}l=s+o.breakAfter}return null}}class rt extends re{constructor(e,i,n){super(),this.widget=e,this.length=i,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,i,n,l,o,s){return n&&(!(n instanceof rt)||!this.widget.compare(n.widget)||e>0&&o<=0||i<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-i),!0)}domAtPos(e){return e==0?Ne.before(this.dom):Ne.after(this.dom,e==this.length)}split(e){let i=this.length-e;this.length=e;let n=new rt(this.widget,i,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Wn}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):le.empty}domBoundsAround(){return null}become(e){return e instanceof rt&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,i){let n=this.widget.coordsAt(this.dom,e,i);return n||(this.widget instanceof tl?null:qi(this.dom.getBoundingClientRect(),this.length?e==0:i<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:i,endSide:n}=this.deco;return i==n?!1:e<0?i<0:n>0}}class tl extends el{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class pi{constructor(e,i,n,l){this.doc=e,this.pos=i,this.end=n,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=i}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof rt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new be),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Yi(new zt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof rt)&&this.getLine()}buildText(e,i,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(i.slice(i.length-n)),this.getLine().append(Yi(new je(this.text.slice(this.textOff,this.textOff+l)),i),n),this.atCursorPos=!0,this.textOff+=l,e-=l,n=0}}span(e,i,n,l){this.buildText(i-e,n,l),this.pos=i,this.openStart<0&&(this.openStart=l)}point(e,i,n,l,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof yt){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=i-e;if(n instanceof yt)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new rt(n.widget||qt.block,r,n));else{let c=Et.create(n.widget||qt.inline,r,r?0:n.startSide),d=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<i||n.startSide>0),h=!c.isEditable&&(e<i||o>l.length||n.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),d&&(f.append(Yi(new zt(1),l),o),o=l.length+Math.max(0,o-l.length)),f.append(Yi(c,l),o),this.atCursorPos=h,this.pendingBuffer=h?e<i||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}static build(e,i,n,l,o){let s=new pi(e,i,n,o);return s.openEnd=fe.spans(l,i,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Yi(a,e){for(let i of e)a=new at(i,[a],a.length);return a}class qt extends el{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qt.inline=new qt("span"),qt.block=new qt("div");var Ce=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(Ce||(Ce={}));const Ot=Ce.LTR,il=Ce.RTL;function cs(a){let e=[];for(let i=0;i<a.length;i++)e.push(1<<+a[i]);return e}const vf=cs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Sf=cs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),nl=Object.create(null),Xe=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),i=a.charCodeAt(1);nl[e]=i,nl[i]=-e}function ds(a){return a<=247?vf[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Sf[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Bf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class wt{get dir(){return this.level%2?il:Ot}constructor(e,i,n){this.from=e,this.to=i,this.level=n}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,n,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=i&&r.to>=i){if(r.level==n)return s;(o<0||(l!=0?l<0?r.from<i:r.to>i:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function hs(a,e){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++){let n=a[i],l=e[i];if(n.from!=l.from||n.to!=l.to||n.direction!=l.direction||!hs(n.inner,l.inner))return!1}return!0}const ce=[];function Nf(a,e,i,n,l){for(let o=0;o<=n.length;o++){let s=o?n[o-1].to:e,r=o<n.length?n[o].from:i,c=o?256:l;for(let d=s,h=c,f=c;d<r;d++){let p=ds(a.charCodeAt(d));p==512?p=h:p==8&&f==4&&(p=16),ce[d]=p==4?2:p,p&7&&(f=p),h=p}for(let d=s,h=c,f=c;d<r;d++){let p=ce[d];if(p==128)d<r-1&&h==ce[d+1]&&h&24?p=ce[d]=h:ce[d]=256;else if(p==64){let m=d+1;for(;m<r&&ce[m]==64;)m++;let b=d&&h==8||m<i&&ce[m]==8?f==1?1:8:256;for(let w=d;w<m;w++)ce[w]=b;d=m-1}else p==8&&f==1&&(ce[d]=1);h=p,p&7&&(f=p)}}}function Vf(a,e,i,n,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=n.length;s++){let d=s?n[s-1].to:e,h=s<n.length?n[s].from:i;for(let f=d,p,m,b;f<h;f++)if(m=nl[p=a.charCodeAt(f)])if(m<0){for(let w=r-3;w>=0;w-=3)if(Xe[w+1]==-m){let C=Xe[w+2],y=C&2?l:C&4?C&1?o:l:0;y&&(ce[f]=ce[Xe[w]]=y),r=w;break}}else{if(Xe.length==189)break;Xe[r++]=f,Xe[r++]=p,Xe[r++]=c}else if((b=ce[f])==2||b==1){let w=b==l;c=w?0:1;for(let C=r-3;C>=0;C-=3){let y=Xe[C+2];if(y&2)break;if(w)Xe[C+2]|=2;else{if(y&4)break;Xe[C+2]|=4}}}}}function Rf(a,e,i,n){for(let l=0,o=n;l<=i.length;l++){let s=l?i[l-1].to:a,r=l<i.length?i[l].from:e;for(let c=s;c<r;){let d=ce[c];if(d==256){let h=c+1;for(;;)if(h==r){if(l==i.length)break;h=i[l++].to,r=l<i.length?i[l].from:e}else if(ce[h]==256)h++;else break;let f=o==1,p=(h<e?ce[h]:n)==1,m=f==p?f?1:2:n;for(let b=h,w=l,C=w?i[w-1].to:a;b>c;)b==C&&(b=i[--w].from,C=w?i[w-1].to:a),ce[--b]=m;c=h}else o=d,c++}}}function ll(a,e,i,n,l,o,s){let r=n%2?2:1;if(n%2==l%2)for(let c=e,d=0;c<i;){let h=!0,f=!1;if(d==o.length||c<o[d].from){let w=ce[c];w!=r&&(h=!1,f=w==16)}let p=!h&&r==1?[]:null,m=h?n:n+1,b=c;e:for(;;)if(d<o.length&&b==o[d].from){if(f)break e;let w=o[d];if(!h)for(let C=w.to,y=d+1;;){if(C==i)break e;if(y<o.length&&o[y].from==C)C=o[y++].to;else{if(ce[C]==r)break e;break}}if(d++,p)p.push(w);else{w.from>c&&s.push(new wt(c,w.from,m));let C=w.direction==Ot!=!(m%2);ol(a,C?n+1:n,l,w.inner,w.from,w.to,s),c=w.to}b=w.to}else{if(b==i||(h?ce[b]!=r:ce[b]==r))break;b++}p?ll(a,c,b,n+1,l,p,s):c<b&&s.push(new wt(c,b,m)),c=b}else for(let c=i,d=o.length;c>e;){let h=!0,f=!1;if(!d||c>o[d-1].to){let w=ce[c-1];w!=r&&(h=!1,f=w==16)}let p=!h&&r==1?[]:null,m=h?n:n+1,b=c;e:for(;;)if(d&&b==o[d-1].to){if(f)break e;let w=o[--d];if(!h)for(let C=w.from,y=d;;){if(C==e)break e;if(y&&o[y-1].to==C)C=o[--y].from;else{if(ce[C-1]==r)break e;break}}if(p)p.push(w);else{w.to<c&&s.push(new wt(w.to,c,m));let C=w.direction==Ot!=!(m%2);ol(a,C?n+1:n,l,w.inner,w.from,w.to,s),c=w.from}b=w.from}else{if(b==e||(h?ce[b-1]!=r:ce[b-1]==r))break;b--}p?ll(a,b,c,n+1,l,p,s):b<c&&s.push(new wt(b,c,m)),c=b}}function ol(a,e,i,n,l,o,s){let r=e%2?2:1;Nf(a,l,o,n,r),Vf(a,l,o,n,r),Rf(l,o,n,r),ll(a,l,o,e,i,n,s)}function Ef(a,e,i){if(!a)return[new wt(0,0,e==il?1:0)];if(e==Ot&&!i.length&&!Bf.test(a))return fs(a.length);if(i.length)for(;a.length>ce.length;)ce[ce.length]=256;let n=[],l=e==Ot?0:1;return ol(a,l,l,i,0,a.length,n),n}function fs(a){return[new wt(0,a,0)]}let us="";function Of(a,e,i,n,l){var o;let s=n.head-a.from,r=wt.find(e,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),c=e[r],d=c.side(l,i);if(s==d){let p=r+=l?1:-1;if(p<0||p>=e.length)return null;c=e[r=p],s=c.side(!l,i),d=c.side(l,i)}let h=lt(a.text,s,c.forward(l,i));(h<c.from||h>c.to)&&(h=d),us=a.text.slice(Math.min(s,h),Math.max(s,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==d&&f.level+(l?0:1)<c.level?Y.cursor(f.side(!l,i)+a.from,f.forward(l,i)?1:-1,f.level):Y.cursor(h+a.from,c.forward(l,i)?-1:1,c.level)}function Mf(a,e,i){for(let n=e;n<i;n++){let l=ds(a.charCodeAt(n));if(l==1)return Ot;if(l==2||l==4)return il}return Ot}const ps=Z.define(),ms=Z.define(),gs=Z.define(),ks=Z.define(),sl=Z.define(),bs=Z.define(),ys=Z.define(),al=Z.define(),rl=Z.define(),ws=Z.define({combine:a=>a.some(e=>e)}),_f=Z.define({combine:a=>a.some(e=>e)}),As=Z.define();class Qt{constructor(e,i="nearest",n="nearest",l=5,o=5,s=!1){this.range=e,this.y=i,this.x=n,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Qt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Qt(Y.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Hi=ye.define({map:(a,e)=>a.map(e)}),xs=ye.define();function Ze(a,e,i){let n=a.facet(ks);n.length?n[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const ct=Z.define({combine:a=>a.length?a[0]:!0});let Tf=0;const Kt=Z.define({combine(a){return a.filter((e,i)=>{for(let n=0;n<i;n++)if(a[n].plugin==e.plugin)return!1;return!0})}});class Wt{constructor(e,i,n,l,o){this.id=e,this.create=i,this.domEventHandlers=n,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Kt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Kt.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=i||{};return new Wt(Tf++,e,n,l,r=>{let c=[];return s&&c.push(mi.of(d=>{let h=d.plugin(r);return h?s(h):Ve.none})),o&&c.push(o(r)),c})}static fromClass(e,i){return Wt.define((n,l)=>new e(n,l),i)}}class cl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(n){if(Ze(i.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(i){Ze(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(n){Ze(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Cs=Z.define(),dl=Z.define(),mi=Z.define(),vs=Z.define(),hl=Z.define(),Ss=Z.define();function Bs(a,e){let i=a.state.facet(Ss);if(!i.length)return i;let n=i.map(o=>o instanceof Function?o(a):o),l=[];return fe.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let d=o-e.from,h=s-e.from,f=l;for(let p=r.length-1;p>=0;p--,c--){let m=r[p].spec.bidiIsolate,b;if(m==null&&(m=Mf(e.text,d,h)),c>0&&f.length&&(b=f[f.length-1]).to==d&&b.direction==m)b.to=h,f=b.inner;else{let w={from:d,to:h,direction:m,inner:[]};f.push(w),f=w.inner}}}}),l}const Ns=Z.define();function Vs(a){let e=0,i=0,n=0,l=0;for(let o of a.state.facet(Ns)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(i=Math.max(i,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:i,top:n,bottom:l}}const gi=Z.define();class $e{constructor(e,i,n,l){this.fromA=e,this.toA=i,this.fromB=n,this.toB=l}join(e){return new $e(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,n=this;for(;i>0;i--){let l=e[i-1];if(!(l.fromA>n.toA)){if(l.toA<n.fromA)break;n=n.join(l),e.splice(i-1,1)}}return e.splice(i,0,n),e}static extendWithRanges(e,i){if(i.length==0)return e;let n=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],d=s-r,h=c?c.fromB:1e9;for(;o<i.length&&i[o]<h;){let f=i[o],p=i[o+1],m=Math.max(r,f),b=Math.min(h,p);if(m<=b&&new $e(m+d,b+d,m,b).addToSet(n),p>h)break;o+=2}if(!c)return n;new $e(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class Gi{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Ae.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new $e(o,s,r,c))),this.changedRanges=l}static create(e,i,n){return new Gi(e,i,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Rs extends re{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Ve.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new be],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new $e(0,0,0,e.state.doc.length)],0,null)}update(e){var i;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?l=this.domChanged.newSel.head:!Uf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Ff(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;n=new $e(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(W.ie||W.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=Pf(s,r,e.changes);return n=$e.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,i,n);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||l.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof rt&&s.widget instanceof tl&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,i,n){let l=n?n.range.addToSet(e.slice()):e,o=this.childCursor(i);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:d,fromB:h,toB:f}=r,p,m,b,w;if(n&&n.range.fromB<f&&n.range.toB>h){let k=pi.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),u=pi.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,b=k.openStart,w=u.openEnd;let S=this.compositionView(n);u.breakAtStart?S.breakAfter=1:u.content.length&&S.merge(S.length,S.length,u.content[0],!1,u.openStart,0)&&(S.breakAfter=u.content[0].breakAfter,u.content.shift()),k.content.length&&S.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),p=k.content.concat(S).concat(u.content)}else({content:p,breakAtStart:m,openStart:b,openEnd:w}=pi.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:C,off:y}=o.findPos(d,1),{i:A,off:V}=o.findPos(c,-1);Jo(this,A,V,C,y,p,m,b,w)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let n of i.effects)n.is(xs)&&(this.editContextFormatting=n.value)}compositionView(e){let i=new je(e.text.nodeValue);i.flags|=8;for(let{deco:l}of e.marks)i=new at(l,[i],i.length);let n=new be;return n.append(i,0),n}fixCompositionDOM(e){let i=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=re.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},n=this.childPos(e.range.fromB,1),l=this.children[n.i];i(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)n=l.childPos(n.off,1),l=l.children[n.i],i(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,l=n==this.dom,o=!l&&!(this.view.state.facet(ct)||this.dom.tabIndex>-1)&&ji(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(l||i||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(r.anchor)),d=r.empty?c:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&If(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Ne(f,0),s=!0}let h=this.view.observer.selectionRange;(s||!h.focusNode||(!hi(c.node,c.offset,h.anchorNode,h.anchorOffset)||!hi(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(h.focusNode)&&Lf(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=ci(this.view.root);if(f)if(r.empty){if(W.gecko){let p=Df(c.node,c.offset);if(p&&p!=3){let m=(p==1?Wo:Yo)(c.node,c.offset);m&&(c=new Ne(m.node,m.offset))}}f.collapse(c.node,c.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();r.anchor>r.head&&([c,d]=[d,c]),p.setEnd(d.node,d.offset),p.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(p)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Ne(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Ne(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&hi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,n=ci(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let s=be.find(this,i.head);if(!s)return;let r=s.posAtStart;if(i.head==r||i.head==r+s.length)return;let c=this.coordsAt(i.head,-1),d=this.coordsAt(i.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(i.head+i.assoc);n.collapse(h.node,h.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=i.from&&n.collapse(l,o)}moveToLine(e){let i=this.dom,n;if(e.node!=i)return e;for(let l=e.offset;!n&&l<i.childNodes.length;l++){let o=re.get(i.childNodes[l]);o instanceof be&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=re.get(i.childNodes[l]);o instanceof be&&(n=o.domAtPos(o.length))}return n?new Ne(n.node,n.offset,!0):e}nearest(e){for(let i=e;i;){let n=re.get(i);if(n&&n.rootView==this)return n;i=i.parentNode}return null}posFromDOM(e,i){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,i)+n.posAtStart}domAtPos(e){let{i,off:n}=this.childCursor().findPos(e,-1);for(;i<this.children.length-1;){let l=this.children[i];if(n<l.length||l instanceof be)break;i++,n=0}return this.children[i].domAtPos(n)}coordsAt(e,i){let n=null,l=0;for(let o=this.length,s=this.children.length-1;s>=0;s--){let r=this.children[s],c=o-r.breakAfter,d=c-r.length;if(c<e)break;if(d<=e&&(d<e||r.covers(-1))&&(c>e||r.covers(1))&&(!n||r instanceof be&&!(n instanceof be&&i>=0)))n=r,l=d;else if(n&&d==e&&c==e&&r instanceof rt&&Math.abs(i)<2){if(r.deco.startSide<0)break;s&&(n=null)}o=d}return n?n.coordsAt(e-l,i):null}coordsForChar(e){let{i,off:n}=this.childPos(e,1),l=this.children[i];if(!(l instanceof be))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(n,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}n=c}if(!(l instanceof je))return null;let o=lt(l.text,n);if(o==n)return null;let s=Rt(l.dom,n,o).getClientRects();for(let r=0;r<s.length;r++){let c=s[r];if(r==s.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let i=[],{from:n,to:l}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,c=this.view.textDirection==Ce.LTR;for(let d=0,h=0;h<this.children.length;h++){let f=this.children[h],p=d+f.length;if(p>l)break;if(d>=n){let m=f.dom.getBoundingClientRect();if(i.push(m.height),s){let b=f.dom.lastChild,w=b?di(b):[];if(w.length){let C=w[w.length-1],y=c?C.right-m.left:m.right-C.left;y>r&&(r=y,this.minWidth=o,this.minWidthFrom=d,this.minWidthTo=p)}}}d=p+f.breakAfter}return i}textDirectionAt(e){let{i}=this.childPos(e,1);return getComputedStyle(this.children[i].dom).direction=="rtl"?Ce.RTL:Ce.LTR}measureTextSize(){for(let o of this.children)if(o instanceof be){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),i,n,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=di(e.firstChild)[0];i=e.getBoundingClientRect().height,n=o?o.width/27:7,l=o?o.height:i,e.remove()}),{lineHeight:i,charWidth:n,textHeight:l}}childCursor(e=this.length){let i=this.children.length;return i&&(e-=this.children[--i].length),new Go(this.children,e,i)}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let n=0,l=0;;l++){let o=l==i.viewports.length?null:i.viewports[l],s=o?o.from-1:this.length;if(s>n){let r=(i.lineBlockAt(s).bottom-i.lineBlockAt(n).top)/this.view.scaleY;e.push(Ve.replace({widget:new tl(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return Ve.set(e)}updateDeco(){let e=1,i=this.view.state.facet(mi).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(vs).map((o,s)=>{let r=typeof o=="function";return r&&(n=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=n,i.push(fe.join(l))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(As))try{if(d(this.view,e.range,e))return!0}catch(h){Ze(this.view.state,h,"scroll handler")}let{range:i}=e,n=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1),l;if(!n)return;!i.empty&&(l=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,l.left),top:Math.min(n.top,l.top),right:Math.max(n.right,l.right),bottom:Math.max(n.bottom,l.bottom)});let o=Vs(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;uf(this.view.scrollDOM,s,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==Ce.LTR)}}function If(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function Es(a,e){let i=a.observer.selectionRange;if(!i.focusNode)return null;let n=Wo(i.focusNode,i.focusOffset),l=Yo(i.focusNode,i.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=re.get(l.node);if(!r||r instanceof je&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=re.get(n.node);!c||c instanceof je&&c.text!=n.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=n,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Ff(a,e,i){let n=Es(a,i);if(!n)return null;let{node:l,from:o,to:s}=n,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(n.from,n.to)!=r)return null;let c=e.invertedDesc,d=new $e(c.mapPos(o),c.mapPos(s),o,s),h=[];for(let f=l.parentNode;;f=f.parentNode){let p=re.get(f);if(p instanceof at)h.push({node:f,deco:p.mark});else{if(p instanceof be||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:d,text:l,marks:h,line:f};if(f!=a.contentDOM)h.push({node:f,deco:new fi({inclusive:!0,attributes:xf(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Df(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let $f=class{constructor(){this.changes=[]}compareRange(e,i){Wi(e,i,this.changes)}comparePoint(e,i){Wi(e,i,this.changes)}boundChange(e){Wi(e,e,this.changes)}};function Pf(a,e,i){let n=new $f;return fe.compare(a,e,i,n),n.changes}function Lf(a,e){for(let i=a;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function Uf(a,e){let i=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(i=!0)}),i}function jf(a,e,i=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return Y.cursor(e);o==0?i=1:o==l.length&&(i=-1);let s=o,r=o;i<0?s=lt(l.text,o,!1):r=lt(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let d=lt(l.text,s,!1);if(n(l.text.slice(d,s))!=c)break;s=d}for(;r<l.length;){let d=lt(l.text,r);if(n(l.text.slice(r,d))!=c)break;r=d}return Y.range(s+l.from,r+l.from)}function zf(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function qf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function fl(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function Os(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function Ms(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ul(a,e,i){let n,l,o,s,r=!1,c,d,h,f;for(let b=a.firstChild;b;b=b.nextSibling){let w=di(b);for(let C=0;C<w.length;C++){let y=w[C];l&&fl(l,y)&&(y=Os(Ms(y,l.bottom),l.top));let A=zf(e,y),V=qf(i,y);if(A==0&&V==0)return b.nodeType==3?_s(b,e,i):ul(b,e,i);(!n||s>V||s==V&&o>A)&&(n=b,l=y,o=A,s=V,r=A?e<y.left?C>0:C<w.length-1:!0),A==0?i>y.bottom&&(!h||h.bottom<y.bottom)?(c=b,h=y):i<y.top&&(!f||f.top>y.top)&&(d=b,f=y):h&&fl(h,y)?h=Ms(h,y.bottom):f&&fl(f,y)&&(f=Os(f,y.top))}}if(h&&h.bottom>=i?(n=c,l=h):f&&f.top<=i&&(n=d,l=f),!n)return{node:a,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return _s(n,p,i);if(r&&n.contentEditable!="false")return ul(n,p,i);let m=Array.prototype.indexOf.call(a.childNodes,n)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function _s(a,e,i){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=Rt(a,r,r+1).getClientRects();for(let d=0;d<c.length;d++){let h=c[d];if(h.top==h.bottom)continue;s||(s=e-h.left);let f=(h.top>i?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<o){let p=e>=(h.left+h.right)/2,m=p;if((W.chrome||W.gecko)&&Rt(a,r).getBoundingClientRect().left==h.right&&(m=!p),f<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=f}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function Ts(a,e,i,n=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:d}=a.viewState,{x:h,y:f}=e,p=f-r;if(p<0)return 0;if(p>d)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,u=!1;c=a.elementAtHeight(p),c.type!=Je.Text;)for(;p=n>0?c.bottom+k:c.top-k,!(p>=0&&p<=d);){if(u)return i?null:0;u=!0,n=-n}f=r+p;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:i?null:Is(a,s,c,h,f);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:i?null:Is(a,s,c,h,f);let b=a.dom.ownerDocument,w=a.root.elementFromPoint?a.root:b,C=w.elementFromPoint(h,f);C&&!a.contentDOM.contains(C)&&(C=null),C||(h=Math.max(s.left+1,Math.min(s.right-1,h)),C=w.elementFromPoint(h,f),C&&!a.contentDOM.contains(C)&&(C=null));let y,A=-1;if(C&&((l=a.docView.nearest(C))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(h,f);k&&({offsetNode:y,offset:A}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(h,f);k&&({startContainer:y,startOffset:A}=k,(!a.contentDOM.contains(y)||W.safari&&Qf(y,A,h)||W.chrome&&Kf(y,A,h))&&(y=void 0))}y&&(A=Math.min(Ge(y),A))}if(!y||!a.docView.dom.contains(y)){let k=be.find(a.docView,m);if(!k)return p>c.top+c.height/2?c.to:c.from;({node:y,offset:A}=ul(k.dom,h,f))}let V=a.docView.nearest(y);if(!V)return null;if(V.isWidget&&((o=V.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=V.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(y,A)+V.posAtStart}function Is(a,e,i,n,l){let o=Math.round((n-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&i.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-i.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(i.from,i.to);return i.from+df(s,o,a.state.tabSize)}function Qf(a,e,i){let n,l=a;if(a.nodeType!=3||e!=(n=a.nodeValue.length))return!1;for(;;){let o=l.nextSibling;if(o){if(o.nodeName=="BR")break;return!1}else{let s=l.parentNode;if(!s||s.nodeName=="DIV")break;l=s}}return Rt(a,n-1,n).getBoundingClientRect().right>i}function Kf(a,e,i){if(e!=0)return!1;for(let l=a;;){let o=l.parentNode;if(!o||o.nodeType!=1||o.firstChild!=l)return!1;if(o.classList.contains("cm-line"))break;l=o}let n=a.nodeType==1?a.getBoundingClientRect():Rt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return i-n.left>5}function Wf(a,e,i){let n=a.lineBlockAt(e);if(Array.isArray(n.type)){let l;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Je.Text&&(l.type!=o.type||(i<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function Yf(a,e,i,n){let l=Wf(a,e.head,e.assoc||-1),o=!n||l.type!=Je.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let s=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),c=a.posAtCoords({x:i==(r==Ce.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return Y.cursor(c,i?-1:1)}return Y.cursor(i?l.to:l.from,i?-1:1)}function Fs(a,e,i,n){let l=a.state.doc.lineAt(e.head),o=a.bidiSpans(l),s=a.textDirectionAt(l.from);for(let r=e,c=null;;){let d=Of(l,o,s,r,i),h=us;if(!d){if(l.number==(i?a.state.doc.lines:1))return r;h=`
21
+ `,l=a.state.doc.line(l.number+(i?1:-1)),o=a.bidiSpans(l),d=a.visualLineSide(l,!i)}if(c){if(!c(h))return r}else{if(!n)return d;c=n(h)}r=d}}function Hf(a,e,i){let n=a.state.charCategorizer(e),l=n(i);return o=>{let s=n(o);return l==st.Space&&(l=s),l==s}}function Gf(a,e,i,n){let l=e.head,o=i?1:-1;if(l==(i?a.state.doc.length:0))return Y.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),d=a.coordsAtPos(l,e.assoc||-1),h=a.documentTop;if(d)s==null&&(s=d.left-c.left),r=o<0?d.top:d.bottom;else{let m=a.viewState.lineBlockAt(l);s==null&&(s=Math.min(c.right-c.left,a.defaultCharacterWidth*(l-m.from))),r=(o<0?m.top:m.bottom)+h}let f=c.left+s,p=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(p+m)*o,w=Ts(a,{x:f,y:b},!1,o);if(b<c.top||b>c.bottom||(o<0?w<l:w>l)){let C=a.docView.coordsForChar(w),y=!C||b<C.top?-1:1;return Y.cursor(w,y,void 0,s)}}}function Ji(a,e,i){for(;;){let n=0;for(let l of a)l.between(e-1,e+1,(o,s,r)=>{if(e>o&&e<s){let c=n||i||(e-o<s-e?-1:1);e=c<0?o:s,n=c}});if(!n)return e}}function pl(a,e,i){let n=Ji(a.state.facet(hl).map(l=>l(a)),i.from,e.head>i.from?-1:1);return n==i.from?i:Y.cursor(n,n<i.from?1:-1)}const ki="￿";class Jf{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(ae.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ki}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let l=e;;){this.findPointBefore(n,l);let o=this.text.length;this.readNode(l);let s=l.nextSibling;if(s==i)break;let r=re.get(l),c=re.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:zi(l))||zi(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=i.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=l.exec(i))&&(o=r.index,s=r[0].length),this.append(i.slice(n,o<0?i.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let i=re.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let l=n.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Xf(e,n.node,n.offset)?i:0))}}function Xf(a,e,i){for(;;){if(!e||i<Ge(e))return!1;if(e==a)return!0;i=Vt(e)+1,e=e.parentNode}}class Ds{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class Zf{constructor(e,i,n,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let r=o||s?[]:iu(e),c=new Jf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=nu(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Kn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),d=s&&s.node==r.anchorNode&&s.offset==r.anchorOffset||!Kn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(c,d),p=Math.max(c,d),m=h.from-f,b=h.to-p;(m==0||m==1||f==0)&&(b==0||b==-1||p==e.state.doc.length)&&(c=0,d=e.state.doc.length)}this.newSel=Y.single(d,c)}}}function $s(a,e){let i,{newSel:n}=e,l=a.state.selection.main,o=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:r}=e.bounds,c=l.from,d=null;(o===8||W.android&&e.text.length<r-s)&&(c=l.to,d="end");let h=tu(a.state.doc.sliceString(s,r,ki),e.text,c-s,d);h&&(W.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==ki+ki&&h.toB--,i={from:s+h.from,to:s+h.toA,insert:le.of(e.text.slice(h.from,h.toB).split(ki))})}else n&&(!a.hasFocus&&a.state.facet(ct)||n.main.eq(l))&&(n=null);if(!i&&!n)return!1;if(!i&&e.typeOver&&!l.empty&&n&&n.main.empty?i={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(W.mac||W.android)&&i&&i.from==i.to&&i.from==l.head-1&&/^\. ?$/.test(i.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(n&&i.insert.length==2&&(n=Y.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:le.of([i.insert.toString().replace("."," ")])}):i&&i.from>=l.from&&i.to<=l.to&&(i.from!=l.from||i.to!=l.to)&&l.to-l.from-(i.to-i.from)<=4?i={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,i.from).append(i.insert).append(a.state.doc.slice(i.to,l.to))}:W.chrome&&i&&i.from==i.to&&i.from==l.head&&i.insert.toString()==`
22
+ `&&a.lineWrapping&&(n&&(n=Y.single(n.main.anchor-1,n.main.head-1)),i={from:l.from,to:l.to,insert:le.of([" "])}),i)return ml(a,i,n,o);if(n&&!n.main.eq(l)){let s=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(s=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:n,scrollIntoView:s,userEvent:r}),!0}else return!1}function ml(a,e,i,n=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&jt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&jt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&jt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=eu(a,e,i));return a.state.facet(bs).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function eu(a,e,i){let n,l=a.state,o=l.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=o.from<e.from?l.sliceDoc(o.from,e.from):"",c=o.to>e.to?l.sliceDoc(e.to,o.to):"";n=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=i&&i.main.to<=r.newLength?i.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let d=a.state.sliceDoc(e.from,e.to),h,f=i&&Es(a,i.main.head);if(f){let b=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-b}}else h=a.state.doc.lineAt(o.head);let p=o.to-e.to,m=o.to-o.from;n=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:r,range:c||b.map(r)};let w=b.to-p,C=w-d.length;if(b.to-b.from!=m||a.state.sliceDoc(C,w)!=d||b.to>=h.from&&b.from<=h.to)return{range:b};let y=l.changes({from:C,to:w,insert:e.insert}),A=b.to-o.to;return{changes:y,range:c?Y.range(Math.max(0,c.anchor+A),Math.max(0,c.head+A)):b.map(y)}})}else n={changes:r,selection:c&&l.selection.replaceRange(c)}}let s="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,s+=".compose",a.inputState.compositionFirstChange&&(s+=".start",a.inputState.compositionFirstChange=!1)),l.update(n,{userEvent:s,scrollIntoView:!0})}function tu(a,e,i,n){let l=Math.min(a.length,e.length),o=0;for(;o<l&&a.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==l&&a.length==e.length)return null;let s=a.length,r=e.length;for(;s>0&&r>0&&a.charCodeAt(s-1)==e.charCodeAt(r-1);)s--,r--;if(n=="end"){let c=Math.max(0,o-Math.min(s,r));i-=s+c-o}if(s<o&&a.length<e.length){let c=i<=o&&i>=s?o-i:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=i<=o&&i>=r?o-i:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function iu(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:l,focusOffset:o}=a.observer.selectionRange;return i&&(e.push(new Ds(i,n)),(l!=i||o!=n)&&e.push(new Ds(l,o))),e}function nu(a,e){if(a.length==0)return null;let i=a[0].pos,n=a.length==2?a[1].pos:i;return i>-1&&n>-1?Y.single(i+e,n+e):null}class lu{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&Au(e.contentDOM.ownerDocument)}handleEvent(e){!uu(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let l of n.observers)l(this.view,i);for(let l of n.handlers){if(i.defaultPrevented)break;if(l(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=ou(e),n=this.handlers,l=this.view.contentDOM;for(let o in i)if(o!="scroll"){let s=!i[o].handlers.length,r=n[o];r&&s!=!r.handlers.length&&(l.removeEventListener(o,this.handleEvent),r=null),r||l.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!i[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&au.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=Ls.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||su.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,jt(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ps(a,e){return(i,n)=>{try{return e.call(a,n,i)}catch(l){Ze(i.state,l)}}}function ou(a){let e=Object.create(null);function i(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of a){let l=n.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&i(r).handlers.push(Ps(n.value,c))}if(s)for(let r in s){let c=s[r];c&&i(r).observers.push(Ps(n.value,c))}}for(let n in ze)i(n).handlers.push(ze[n]);for(let n in Pe)i(n).observers.push(Pe[n]);return e}const Ls=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],su="dthko",au=[16,17,18,20,91,92,224,225],Xi=6;function Zi(a){return Math.max(0,a)*.7+8}function ru(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class cu{constructor(e,i,n,l){this.view=e,this.startEvent=i,this.style=n,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=pf(e.contentDOM),this.atoms=e.state.facet(hl).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(ae.allowMultipleSelections)&&du(e,i),this.dragging=fu(e,i)&&Hs(i)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&ru(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,l=0,o=0,s=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:r}=this.scrollParents.y.getBoundingClientRect());let c=Vs(this.view);e.clientX-c.left<=l+Xi?i=-Zi(l-e.clientX):e.clientX+c.right>=s-Xi&&(i=Zi(e.clientX-s)),e.clientY-c.top<=o+Xi?n=-Zi(o-e.clientY):e.clientY+c.bottom>=r-Xi&&(n=Zi(e.clientY-r)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let i=null;for(let n=0;n<e.ranges.length;n++){let l=e.ranges[n],o=null;if(l.empty){let s=Ji(this.atoms,l.from,0);s!=l.from&&(o=Y.cursor(s,-1))}else{let s=Ji(this.atoms,l.from,-1),r=Ji(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=Y.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(i||(i=e.ranges.slice()),i[n]=o)}return i?Y.create(i,e.mainIndex):e}select(e){let{view:i}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function du(a,e){let i=a.state.facet(ps);return i.length?i[0](e):W.mac?e.metaKey:e.ctrlKey}function hu(a,e){let i=a.state.facet(ms);return i.length?i[0](e):W.mac?!e.altKey:!e.ctrlKey}function fu(a,e){let{main:i}=a.state.selection;if(i.empty)return!1;let n=ci(a.root);if(!n||n.rangeCount==0)return!0;let l=n.getRangeAt(0).getClientRects();for(let o=0;o<l.length;o++){let s=l[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function uu(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,n;i!=a.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(n=re.get(i))&&n.ignoreEvent(e))return!1;return!0}const ze=Object.create(null),Pe=Object.create(null),Us=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function pu(a){let e=a.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{a.focus(),i.remove(),js(a,i.value)},50)}function en(a,e,i){for(let n of a.facet(e))i=n(i,a);return i}function js(a,e){e=en(a.state,al,e);let{state:i}=a,n,l=1,o=i.toText(e),s=o.lines==i.selection.ranges.length;if(gl!=null&&i.selection.ranges.every(c=>c.empty)&&gl==o.toString()){let c=-1;n=i.changeByRange(d=>{let h=i.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let f=i.toText((s?o.line(l++).text:e)+i.lineBreak);return{changes:{from:h.from,insert:f},range:Y.cursor(d.from+f.length)}})}else s?n=i.changeByRange(c=>{let d=o.line(l++);return{changes:{from:c.from,to:c.to,insert:d.text},range:Y.cursor(c.from+d.length)}}):n=i.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Pe.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},ze.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Pe.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Pe.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},ze.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of a.state.facet(gs))if(i=n(a,e),i)break;if(!i&&e.button==0&&(i=ku(a,e)),i){let n=!a.hasFocus;a.inputState.startMouseSelection(new cu(a,e,i,n)),n&&a.observer.ignore(()=>{zo(a.contentDOM);let o=a.root.activeElement;o&&!o.contains(a.contentDOM)&&o.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function zs(a,e,i,n){if(n==1)return Y.cursor(e,i);if(n==2)return jf(a.state,e,i);{let l=be.find(a.docView,e),o=a.state.doc.lineAt(l?l.posAtEnd:e),s=l?l.posAtStart:o.from,r=l?l.posAtEnd:o.to;return r<a.state.doc.length&&r==o.to&&r++,Y.range(s,r)}}let qs=(a,e,i)=>e>=i.top&&e<=i.bottom&&a>=i.left&&a<=i.right;function mu(a,e,i,n){let l=be.find(a.docView,e);if(!l)return 1;let o=e-l.posAtStart;if(o==0)return 1;if(o==l.length)return-1;let s=l.coordsAt(o,-1);if(s&&qs(i,n,s))return-1;let r=l.coordsAt(o,1);return r&&qs(i,n,r)?1:s&&s.bottom>=n?-1:1}function Qs(a,e){let i=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:mu(a,i,e.clientX,e.clientY)}}const gu=W.ie&&W.ie_version<=11;let Ks=null,Ws=0,Ys=0;function Hs(a){if(!gu)return a.detail;let e=Ks,i=Ys;return Ks=a,Ys=Date.now(),Ws=!e||i>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Ws+1)%3:1}function ku(a,e){let i=Qs(a,e),n=Hs(e),l=a.state.selection;return{update(o){o.docChanged&&(i.pos=o.changes.mapPos(i.pos),l=l.map(o.changes))},get(o,s,r){let c=Qs(a,o),d,h=zs(a,c.pos,c.bias,n);if(i.pos!=c.pos&&!s){let f=zs(a,i.pos,i.bias,n),p=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=p<h.from?Y.range(p,m):Y.range(m,p)}return s?l.replaceRange(l.main.extend(h.from,h.to)):r&&n==1&&l.ranges.length>1&&(d=bu(l,c.pos))?d:r?l.addRange(h):Y.create([h])}}}function bu(a,e){for(let i=0;i<a.ranges.length;i++){let{from:n,to:l}=a.ranges[i];if(n<=e&&l>=e)return Y.create(a.ranges.slice(0,i).concat(a.ranges.slice(i+1)),a.mainIndex==i?0:a.mainIndex-(a.mainIndex>i?1:0))}return null}ze.dragstart=(a,e)=>{let{selection:{main:i}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let o=l.posAtStart,s=o+l.length;(o>=i.to||s<=i.from)&&(i=Y.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",en(a.state,rl,a.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},ze.dragend=a=>(a.inputState.draggedContent=null,!1);function Gs(a,e,i,n){if(i=en(a.state,al,i),!i)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&hu(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:i},c=a.state.changes(s?[s,r]:r);a.focus(),a.dispatch({changes:c,selection:{anchor:c.mapPos(l,-1),head:c.mapPos(l,1)},userEvent:s?"move.drop":"input.drop"}),a.inputState.draggedContent=null}ze.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let n=Array(i.length),l=0,o=()=>{++l==i.length&&Gs(a,e,n.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<i.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(n[s]=r.result),o()},r.readAsText(i[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Gs(a,e,n,!0),!0}return!1},ze.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let i=Us?null:e.clipboardData;return i?(js(a,i.getData("text/plain")||i.getData("text/uri-list")),!0):(pu(a),!1)};function yu(a,e){let i=a.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),a.focus()},50)}function wu(a){let e=[],i=[],n=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),i.push(l));if(!e.length){let l=-1;for(let{from:o}of a.selection.ranges){let s=a.doc.lineAt(o);s.number>l&&(e.push(s.text),i.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}n=!0}return{text:en(a,rl,e.join(a.lineBreak)),ranges:i,linewise:n}}let gl=null;ze.copy=ze.cut=(a,e)=>{let{text:i,ranges:n,linewise:l}=wu(a.state);if(!i&&!l)return!1;gl=l?i:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Us?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(yu(a,i),!1)};const Js=Dt.define();function Xs(a,e){let i=[];for(let n of a.facet(ys)){let l=n(a,e);l&&i.push(l)}return i.length?a.update({effects:i,annotations:Js.of(!0)}):null}function Zs(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let i=Xs(a.state,e);i?a.dispatch(i):a.update([])}},10)}Pe.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),Zs(a)},Pe.blur=a=>{a.observer.clearSelectionRange(),Zs(a)},Pe.compositionstart=Pe.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Pe.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Pe.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},ze.beforeinput=(a,e)=>{var i,n;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),d=a.posAtDOM(r.endContainer,r.endOffset);return ml(a,{from:c,to:d,insert:a.state.toText(o)},null),!0}}let l;if(W.chrome&&W.android&&(l=Ls.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Pe.compositionend(a,e),20),!1};const ea=new Set;function Au(a){ea.has(a)||(ea.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const ta=["pre-wrap","normal","pre-line","break-spaces"];let Yt=!1;function ia(){Yt=!1}class xu{constructor(e){this.lineWrapping=e,this.doc=le.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let n=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((i-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ta.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let n=0;n<e.length;n++){let l=e[n];l<0?n++:this.heightSamples[Math.floor(l*10)]||(i=!0,this.heightSamples[Math.floor(l*10)]=!0)}return i}refresh(e,i,n,l,o,s){let r=ta.indexOf(e)>-1,c=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=i,this.charWidth=n,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let d=0;d<s.length;d++){let h=s[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Cu{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class et{constructor(e,i,n,l,o){this.from=e,this.length=i,this.top=n,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Je.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof yt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new et(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var ue=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(ue||(ue={}));const tn=.001;class Re{constructor(e,i,n=2){this.length=e,this.height=i,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>tn&&(Yt=!0),this.height=e)}replace(e,i,n){return Re.of(n)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,n,l){let o=this,s=n.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:d,fromB:h,toB:f}=l[r],p=o.lineAt(c,ue.ByPosNoHeight,n.setDoc(i),0,0),m=p.to>=d?p:o.lineAt(d,ue.ByPosNoHeight,n,0,0);for(f+=m.to-d,d=m.to;r>0&&p.from<=l[r-1].toA;)c=l[r-1].fromA,h=l[r-1].fromB,r--,c<p.from&&(p=o.lineAt(c,ue.ByPosNoHeight,n,0,0));h+=p.from-c,c=p.from;let b=kl.build(n.setDoc(s),e,h,f);o=nn(o,o.replace(c,d,b))}return o.updateHeight(n,0)}static empty(){return new Ie(0,0)}static of(e){if(e.length==1)return e[0];let i=0,n=e.length,l=0,o=0;for(;;)if(i==n)if(l>o*2){let r=e[i-1];r.break?e.splice(--i,1,r.left,null,r.right):e.splice(--i,1,r.left,r.right),n+=1+r.break,l-=r.size}else if(o>l*2){let r=e[n];r.break?e.splice(n,1,r.left,null,r.right):e.splice(n,1,r.left,r.right),n+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[i++];r&&(l+=r.size)}else{let r=e[--n];r&&(o+=r.size)}let s=0;return e[i-1]==null?(s=1,i--):e[i]==null&&(s=1,n++),new vu(Re.of(e.slice(0,i)),s,Re.of(e.slice(n)))}}function nn(a,e){return a==e?a:(a.constructor!=e.constructor&&(Yt=!0),e)}Re.prototype.size=1;class na extends Re{constructor(e,i,n){super(e,i),this.deco=n}blockAt(e,i,n,l){return new et(l,this.length,n,this.height,this.deco||0)}lineAt(e,i,n,l,o){return this.blockAt(0,n,l,o)}forEachLine(e,i,n,l,o,s){e<=o+this.length&&i>=o&&s(this.blockAt(0,n,l,o))}updateHeight(e,i=0,n=!1,l){return l&&l.from<=i&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ie extends na{constructor(e,i){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,i,n,l){return new et(l,this.length,n,this.height,this.breaks)}replace(e,i,n){let l=n[0];return n.length==1&&(l instanceof Ie||l instanceof ve&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ve?l=new Ie(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Re.of(n)}updateHeight(e,i=0,n=!1,l){return l&&l.from<=i&&l.more?this.setHeight(l.heights[l.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ve extends Re{constructor(e){super(e,0)}heightMetrics(e,i){let n=e.doc.lineAt(i).number,l=e.doc.lineAt(i+this.length).number,o=l-n+1,s,r=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*o);s=c/o,this.length>o+1&&(r=(this.height-c)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:l,perLine:s,perChar:r}}blockAt(e,i,n,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(i,l);if(i.lineWrapping){let d=l+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),h=i.doc.lineAt(d),f=r+h.length*c,p=Math.max(n,e-f/2);return new et(h.from,h.length,p,f,0)}else{let d=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:h,length:f}=i.doc.line(o+d);return new et(h,f,n+r*d,r,0)}}lineAt(e,i,n,l,o){if(i==ue.ByHeight)return this.blockAt(e,n,l,o);if(i==ue.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new et(m,b-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),d=n.doc.lineAt(e),h=r+d.length*c,f=d.number-s,p=l+r*f+c*(d.from-o-f);return new et(d.from,d.length,Math.max(l,Math.min(p,l+this.height-h)),h,0)}forEachLine(e,i,n,l,o,s){e=Math.max(e,o),i=Math.min(i,o+this.length);let{firstLine:r,perLine:c,perChar:d}=this.heightMetrics(n,o);for(let h=e,f=l;h<=i;){let p=n.doc.lineAt(h);if(h==e){let b=p.number-r;f+=c*b+d*(e-o-b)}let m=c+d*p.length;s(new et(p.from,p.length,f,m,0)),f+=m,h=p.to+1}}replace(e,i,n){let l=this.length-i;if(l>0){let o=n[n.length-1];o instanceof ve?n[n.length-1]=new ve(o.length+l):n.push(null,new ve(l-1))}if(e>0){let o=n[0];o instanceof ve?n[0]=new ve(e+o.length):n.unshift(new ve(e-1),null)}return Re.of(n)}decomposeLeft(e,i){i.push(new ve(e-1),null)}decomposeRight(e,i){i.push(null,new ve(this.length-e-1))}updateHeight(e,i=0,n=!1,l){let o=i+this.length;if(l&&l.from<=i+this.length&&l.more){let s=[],r=Math.max(i,l.from),c=-1;for(l.from>i&&s.push(new ve(l.from-i-1).updateHeight(e,i));r<=o&&l.more;){let h=e.doc.lineAt(r).length;s.length&&s.push(null);let f=l.heights[l.index++];c==-1?c=f:Math.abs(f-c)>=tn&&(c=-2);let p=new Ie(h,f);p.outdated=!1,s.push(p),r+=h+1}r<=o&&s.push(null,new ve(o-r).updateHeight(e,r));let d=Re.of(s);return(c<0||Math.abs(d.height-this.height)>=tn||Math.abs(c-this.heightMetrics(e,i).perLine)>=tn)&&(Yt=!0),nn(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class vu extends Re{constructor(e,i,n){super(e.length+i+n.length,e.height+n.height,i|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,i,n,l){let o=n+this.left.height;return e<o?this.left.blockAt(e,i,n,l):this.right.blockAt(e,i,o,l+this.left.length+this.break)}lineAt(e,i,n,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=i==ue.ByHeight?e<s:e<r,d=c?this.left.lineAt(e,i,n,l,o):this.right.lineAt(e,i,n,s,r);if(this.break||(c?d.to<r:d.from>r))return d;let h=i==ue.ByPosNoHeight?ue.ByPosNoHeight:ue.ByPos;return c?d.join(this.right.lineAt(r,h,n,s,r)):this.left.lineAt(r,h,n,l,o).join(d)}forEachLine(e,i,n,l,o,s){let r=l+this.left.height,c=o+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,i,n,l,o,s),i>=c&&this.right.forEachLine(e,i,n,r,c,s);else{let d=this.lineAt(c,ue.ByPos,n,l,o);e<d.from&&this.left.forEachLine(e,d.from-1,n,l,o,s),d.to>=e&&d.from<=i&&s(d),i>d.to&&this.right.forEachLine(d.to+1,i,n,r,c,s)}}replace(e,i,n){let l=this.left.length+this.break;if(i<l)return this.balanced(this.left.replace(e,i,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,i-l,n));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of n)o.push(r);if(e>0&&la(o,s-1),i<this.length){let r=o.length;this.decomposeRight(i,o),la(o,r)}return Re.of(o)}decomposeLeft(e,i){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(n++,e>=n&&i.push(null)),e>n&&this.right.decomposeLeft(e-n,i)}decomposeRight(e,i){let n=this.left.length,l=n+this.break;if(e>=l)return this.right.decomposeRight(e-l,i);e<n&&this.left.decomposeRight(e,i),this.break&&e<l&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?Re.of(this.break?[e,null,i]:[e,i]):(this.left=nn(this.left,e),this.right=nn(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,n=!1,l){let{left:o,right:s}=this,r=i+o.length+this.break,c=null;return l&&l.from<=i+o.length&&l.more?c=o=o.updateHeight(e,i,n,l):o.updateHeight(e,i,n),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,n,l):s.updateHeight(e,r,n),c?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function la(a,e){let i,n;a[e]==null&&(i=a[e-1])instanceof ve&&(n=a[e+1])instanceof ve&&a.splice(e-1,3,new ve(i.length+1+n.length))}const Su=5;class kl{constructor(e,i){this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,i){if(this.lineStart>-1){let n=Math.min(i,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ie?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ie(n-this.pos,-1)),this.writtenTo=n,i>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,n){if(e<i||n.heightRelevant){let l=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=i-e;n.block?this.addBlock(new na(s,l,n)):(s||o||l>=Su)&&this.addLineDeco(l,o,s)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ie(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,i){let n=new ve(i-e);return this.oracle.doc.lineAt(e).to==i&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ie)return e;let i=new Ie(0,-1);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,n){let l=this.ensureLine();l.length+=n,l.collapsed+=n,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=i,this.writtenTo=this.pos=this.pos+n}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof Ie)&&!this.isCovered?this.nodes.push(new Ie(0,-1)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let l of this.nodes)l instanceof Ie&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,i,n,l){let o=new kl(n,e);return fe.spans(i,n,l,o,0),o.finish(n)}}function Bu(a,e,i){let n=new Nu;return fe.compare(a,e,i,n,0),n.changes}class Nu{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,l){(e<i||n&&n.heightRelevant||l&&l.heightRelevant)&&Wi(e,i,this.changes,5)}}function Vu(a,e){let i=a.getBoundingClientRect(),n=a.ownerDocument,l=n.defaultView||window,o=Math.max(0,i.left),s=Math.min(l.innerWidth,i.right),r=Math.max(0,i.top),c=Math.min(l.innerHeight,i.bottom);for(let d=a.parentNode;d&&d!=n.body;)if(d.nodeType==1){let h=d,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let p=h.getBoundingClientRect();o=Math.max(o,p.left),s=Math.min(s,p.right),r=Math.max(r,p.top),c=Math.min(d==a.parentNode?l.innerHeight:c,p.bottom)}d=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-i.left,right:Math.max(o,s)-i.left,top:r-(i.top+e),bottom:Math.max(r,c)-(i.top+e)}}function Ru(a){let e=a.getBoundingClientRect(),i=a.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function Eu(a,e){let i=a.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class bl{constructor(e,i,n,l){this.from=e,this.to=i,this.size=n,this.displaySize=l}static same(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++){let l=e[n],o=i[n];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,i){return Ve.replace({widget:new Ou(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class Ou extends el{constructor(e,i){super(),this.size=e,this.vertical=i}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class oa{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=sa,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ce.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(dl).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new xu(i),this.stateDeco=e.facet(mi).filter(n=>typeof n!="function"),this.heightMap=Re.empty().applyChanges(this.stateDeco,le.empty,this.heightOracle.setDoc(e.doc),[new $e(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ve.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let n=0;n<=1;n++){let l=n?i.head:i.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new ln(o,s))}}return this.viewports=e.sort((n,l)=>n.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?sa:new yl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(bi(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(mi).filter(h=>typeof h!="function");let l=e.changedRanges,o=$e.extendWithRanges(l,Bu(n,this.stateDeco,e?e.changes:Ae.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);ia(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Yt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let c=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<c.from||i.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,i));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_f)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Ce.RTL:Ce.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=i.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let d=0,h=0;if(r.width&&r.height){let{scaleX:k,scaleY:u}=jo(i,r);(k>.005&&Math.abs(this.scaleX-k)>.005||u>.005&&Math.abs(this.scaleY-u)>.005)&&(this.scaleX=k,this.scaleY=u,d|=16,s=c=!0)}let f=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Ko(e.scrollDOM);let b=(this.printing?Eu:Vu)(i,this.paddingTop),w=b.top-this.pixelViewport.top,C=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ru(e.dom))return 0;let A=r.width;if((this.contentDOMWidth!=A||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(A-this.contentDOMWidth)>l.charWidth){let{lineHeight:u,charWidth:S,textHeight:M}=e.docView.measureTextSize();s=u>0&&l.refresh(o,u,S,M,Math.max(5,A/S),k),s&&(e.docView.minWidth=0,d|=16)}w>0&&C>0?h=Math.max(w,C):w<0&&C<0&&(h=Math.min(w,C)),ia();for(let u of this.viewports){let S=u.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(u);this.heightMap=(s?Re.empty().applyChanges(this.stateDeco,le.empty,this.heightOracle,[new $e(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new Cu(u.from,S))}Yt&&(d|=2)}let V=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new ln(l.lineAt(s-n*1e3,ue.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,ue.ByHeight,o,0,0).to);if(i){let{head:d}=i.range;if(d<c.from||d>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(d,ue.ByPos,o,0,0),p;i.y=="center"?p=(f.top+f.bottom)/2-h/2:i.y=="start"||i.y=="nearest"&&d<c.from?p=f.top:p=f.bottom-h,c=new ln(l.lineAt(p-1e3/2,ue.ByHeight,o,0,0).from,l.lineAt(p+h+1e3/2,ue.ByHeight,o,0,0).to)}}return c}mapViewport(e,i){let n=i.mapPos(e.from,-1),l=i.mapPos(e.to,1);return new ln(this.heightMap.lineAt(n,ue.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,ue.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},n=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,ue.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(i,ue.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||o>=r+Math.max(10,Math.min(n,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let n=[];for(let l of e)i.touchesRange(l.from,l.to)||n.push(new bl(i.mapPos(l.from),i.mapPos(l.to),l.size,l.displaySize));return n}ensureLineGaps(e,i){let n=this.heightOracle.lineWrapping,l=n?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=Ce.LTR&&!n)return[];let r=[],c=(h,f,p,m)=>{if(f-h<o)return;let b=this.state.selection.main,w=[b.from];b.empty||w.push(b.to);for(let y of w)if(y>h&&y<f){c(h,y-10,p,m),c(y+10,f,p,m);return}let C=_u(e,y=>y.from>=p.from&&y.to<=p.to&&Math.abs(y.from-h)<o&&Math.abs(y.to-f)<o&&!w.some(A=>y.from<A&&y.to>A));if(!C){if(f<p.to&&i&&n&&i.visibleRanges.some(V=>V.from<=f&&V.to>=f)){let V=i.moveToLineBoundary(Y.cursor(f),!1,!0).head;V>h&&(f=V)}let y=this.gapSize(p,h,f,m),A=n||y<2e6?y:2e6;C=new bl(h,f,y,A)}r.push(C)},d=h=>{if(h.length<s||h.type!=Je.Text)return;let f=Mu(h.from,h.to,this.stateDeco);if(f.total<s)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let w=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,C,y;if(p!=null){let A=sn(f,p),V=((this.visibleBottom-this.visibleTop)/2+w)/h.height;C=A-V,y=A+V}else C=(this.visibleTop-h.top-w)/h.height,y=(this.visibleBottom-h.top+w)/h.height;m=on(f,C),b=on(f,y)}else{let w=f.total*this.heightOracle.charWidth,C=l*this.heightOracle.charWidth,y=0;if(w>2e6)for(let S of e)S.from>=h.from&&S.from<h.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=S.size-S.displaySize);let A=this.pixelViewport.left+y,V=this.pixelViewport.right+y,k,u;if(p!=null){let S=sn(f,p),M=((V-A)/2+C)/w;k=S-M,u=S+M}else k=(A-C)/w,u=(V+C)/w;m=on(f,k),b=on(f,u)}m>h.from&&c(h.from,m,h,f),b<h.to&&c(b,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return r}gapSize(e,i,n,l){let o=sn(l,n)-sn(l,i);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){bl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ve.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let n=[];fe.spans(i,this.viewport.from,this.viewport.to,{span(o,s){n.push({from:o,to:s})},point(){}},20);let l=0;if(n.length!=this.visibleRanges.length)l=12;else for(let o=0;o<n.length&&!(l&8);o++){let s=this.visibleRanges[o],r=n[o];(s.from!=r.from||s.to!=r.to)&&(l|=4,e&&e.mapPos(s.from,-1)==r.from&&e.mapPos(s.to,1)==r.to||(l|=8))}return this.visibleRanges=n,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||bi(this.heightMap.lineAt(e,ue.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(i=>i.top<=e&&i.bottom>=e)||bi(this.heightMap.lineAt(this.scaler.fromDOM(e),ue.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return bi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class ln{constructor(e,i){this.from=e,this.to=i}}function Mu(a,e,i){let n=[],l=a,o=0;return fe.spans(i,a,e,{span(){},point(s,r){s>l&&(n.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(n.push({from:l,to:e}),o+=e-l),{total:o,ranges:n}}function on({total:a,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let n=Math.floor(a*i);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(n<=r)return o+n;n-=r}}function sn(a,e){let i=0;for(let{from:n,to:l}of a.ranges){if(e<=l){i+=e-n;break}i+=l-n}return i/a.total}function _u(a,e){for(let i of a)if(e(i))return i}const sa={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class yl{constructor(e,i,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let d=i.lineAt(r,ue.ByPos,e,0,0).top,h=i.lineAt(c,ue.ByPos,e,0,0).bottom;return l+=h-d,{from:r,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(i.height-l);for(let r of this.viewports)r.domTop=s+(r.top-o)*this.scale,s=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(e){for(let i=0,n=0,l=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.top)return l+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,l=o.domBottom}}fromDOM(e){for(let i=0,n=0,l=0;;i++){let o=i<this.viewports.length?this.viewports[i]:null;if(!o||e<o.domTop)return n+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,l=o.domBottom}}eq(e){return e instanceof yl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,n)=>i.from==e.viewports[n].from&&i.to==e.viewports[n].to):!1}}function bi(a,e){if(e.scale==1)return a;let i=e.toDOM(a.top),n=e.toDOM(a.bottom);return new et(a.from,a.length,i,n-i,Array.isArray(a._content)?a._content.map(l=>bi(l,e)):a._content)}const an=Z.define({combine:a=>a.join(" ")}),wl=Z.define({combine:a=>a.indexOf(!0)>-1}),Al=bt.newName(),aa=bt.newName(),ra=bt.newName(),ca={"&light":"."+aa,"&dark":"."+ra};function xl(a,e,i){return new bt(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,l=>{if(l=="&")return a;if(!i||!i[l])throw new RangeError(`Unsupported selector: ${l}`);return i[l]}):a+" "+n}})}const Tu=xl("."+Al,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ca),Iu={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Cl=W.ie&&W.ie_version<=11;class Fu{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new mf,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let n of i)this.queue.push(n);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&i.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new $u(e),e.state.facet(ct)&&(e.contentDOM.editContext=this.editContext.editContext)),Cl&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,n)=>i!=e[n]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,l=this.selectionRange;if(n.state.facet(ct)?n.root.activeElement!=this.dom:!ji(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!n.state.selection.main.empty&&l.focusNode&&hi(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=ci(e.root);if(!i)return!1;let n=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Du(this.view,i)||i;if(!n||this.selectionRange.eq(n))return!1;let l=ji(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&kf(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let n=this.dom;n;)if(n.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=i)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Iu),Cl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Cl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var n;if(!this.delayedAndroidKey){let l=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&jt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,n=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),i==-1?{from:i,to:n}=s:(i=Math.min(s.from,i),n=Math.max(s.to,n)))}return{from:i,to:n,typeOver:l}}readChange(){let{from:e,to:i,typeOver:n}=this.processRecords(),l=this.selectionChanged&&ji(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Zf(this.view,e,i,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let n=this.view.state,l=$s(this.view,i);return this.view.state==n&&(i.domChanged||i.newSel&&!i.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let i=this.view.docView.nearest(e.target);if(!i||i.ignoreMutation(e))return null;if(i.markDirty(e.type=="attributes"),e.type=="attributes"&&(i.flags|=4),e.type=="childList"){let n=da(i,e.previousSibling||e.target.previousSibling,-1),l=da(i,e.nextSibling||e.target.nextSibling,1);return{from:n?i.posAfter(n):i.posAtStart,to:l?i.posBefore(l):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ct)!=e.state.facet(ct)&&(e.view.contentDOM.editContext=e.state.facet(ct)?this.editContext.editContext:null))}destroy(){var e,i,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function da(a,e,i){for(;e;){let n=re.get(e);if(n&&n.parent==a)return n;let l=e.parentNode;e=l!=a.dom?l:i>0?e.nextSibling:e.previousSibling}return null}function ha(a,e){let i=e.startContainer,n=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return hi(s.node,s.offset,l,o)&&([i,n,l,o]=[l,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:l,focusOffset:o}}function Du(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ha(a,l)}let i=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),i=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",n,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",n,!0),i?ha(a,i):null}class $u{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:r,drifted:!1});let d={from:r,to:c,insert:le.of(n.text.split(`
23
+ `))};if(d.from==this.from&&o<this.from?d.from=o:d.to==this.to&&o>this.to&&(d.to=o),d.from==d.to&&!d.insert.length){let h=Y.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));h.main.eq(l)||e.dispatch({selection:h,userEvent:"select"});return}if((W.mac||W.android)&&d.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:r,to:c,insert:le.of([n.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);ml(e,d,Y.single(this.toEditorPos(n.selectionStart,h),this.toEditorPos(n.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let l=[],o=null;for(let s=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);s<r;s++){let c=e.coordsForChar(s);o=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||o||new DOMRect,l.push(o)}i.updateCharacterBounds(n.rangeStart,l)},this.handlers.textformatupdate=n=>{let l=[];for(let o of n.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(c<d){let h=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(Ve.mark({attributes:{style:h}}).range(c,d))}}}e.dispatch({effects:xs.of(Ve.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let l=ci(n.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,d)=>{if(n)return;let h=d.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(d)){l=this.pendingContextChange=null,i+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(o+=i,s+=i,s<=this.from)this.from+=h,this.to+=h;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),d.toString()),this.to+=h}i+=h}),l&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),l=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(n,l)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class se{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(l=>l.forEach(o=>n(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||gf(e.parent)||document,this.viewState=new oa(e.state||ae.create(e)),e.scrollTo&&e.scrollTo.is(Hi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(l=>new cl(l));for(let l of this.plugins)l.update(this);this.observer=new Fu(this),this.inputState=new lu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Rs(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let i=e.length==1&&e[0]instanceof Be?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,n=!1,l,o=this.state;for(let p of e){if(p.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=p.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(p=>p.annotation(Js))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=Xs(o,s),c||(r=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(ae.phrases)!=this.state.facet(ae.phrases))return this.setState(o);l=Gi.create(this,o,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(f&&(f=f.map(p.changes)),p.scrollIntoView){let{main:m}=p.state.selection;f=new Qt(m.empty?m:Y.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of p.effects)m.is(Hi)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=rn.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),i=this.docView.update(l),this.state.facet(gi)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(p=>p.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(an)!=l.state.facet(an)&&(this.viewState.mustMeasureContent=!0),(i||n||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(sl))try{p(l)}catch(m){Ze(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!$s(this,h)&&d.force&&jt(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let i=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new oa(e),this.plugins=e.facet(Kt).map(n=>new cl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Rs(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(Kt),n=e.state.facet(Kt);if(i!=n){let l=[];for(let o of n){let s=i.indexOf(o);if(s<0)l.push(new cl(o));else{let r=this.plugins[s];r.mustUpdate=e,l.push(r)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);i!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(n){Ze(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,n=this.scrollDOM,l=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(s<0)if(Ko(n))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(m=>{try{return m.read(this)}catch(b){return Ze(this.state,b),fa}}),f=Gi.create(this,this.state,[]),p=!1;f.flags|=c,i?i.flags|=c:i=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),p=this.docView.update(f),p&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(h[m]!=fa)try{let b=d[m];b.write&&b.write(h[m],this)}catch(b){Ze(this.state,b)}if(p&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let b=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(b>1||b<-1){l=l+b,n.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let r of this.state.facet(sl))r(i)}get themeClasses(){return Al+" "+(this.state.facet(wl)?ra:aa)+" "+this.state.facet(an)}updateAttrs(){let e=ua(this,Cs,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ct)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),ua(this,dl,i);let n=this.observer.ignore(()=>{let l=Zn(this.contentDOM,this.contentAttrs,i),o=Zn(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=i,n}showAnnouncements(e){let i=!0;for(let n of e)for(let l of n.effects)if(l.is(se.announce)){i&&(this.announceDOM.textContent=""),i=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(gi);let e=this.state.facet(se.cspNonce);bt.mount(this.root,this.styleModules.concat(Tu).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(n=>n.plugin==e)||null),i&&i.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,i,n){return pl(this,e,Fs(this,e,i,n))}moveByGroup(e,i){return pl(this,e,Fs(this,e,i,n=>Hf(this,e.head,n)))}visualLineSide(e,i){let n=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=n[i?n.length-1:0];return Y.cursor(o.side(i,l)+e.from,o.forward(!i,l)?1:-1)}moveToLineBoundary(e,i,n=!0){return Yf(this,e,i,n)}moveVertically(e,i,n){return pl(this,e,Gf(this,e,i,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){return this.readMeasured(),Ts(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let n=this.docView.coordsAt(e,i);if(!n||n.left==n.right)return n;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[wt.find(o,e-l.from,-1,i)];return qi(n,s.dir==Ce.LTR==i>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ws)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Pu)return fs(e.length);let i=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||hs(o.isolates,n=Bs(this,e))))return o.order;n||(n=Bs(this,e));let l=Ef(e.text,i,n);return this.bidiCache.push(new rn(e.from,e.to,i,n,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{zo(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,i={}){return Hi.of(new Qt(typeof e=="number"?Y.cursor(e):e,i.y,i.x,i.yMargin,i.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Hi.of(new Qt(Y.cursor(n.from),"start","start",n.top-e,i,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Wt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Wt.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=bt.newName(),l=[an.of(n),gi.of(xl(`.${n}`,e))];return i&&i.dark&&l.push(wl.of(!0)),l}static baseTheme(e){return Jh.lowest(gi.of(xl("."+Al,e,ca)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),l=n&&re.get(n)||re.get(e);return((i=l?.rootView)===null||i===void 0?void 0:i.view)||null}}se.styleModule=gi,se.inputHandler=bs,se.clipboardInputFilter=al,se.clipboardOutputFilter=rl,se.scrollHandler=As,se.focusChangeEffect=ys,se.perLineTextDirection=ws,se.exceptionSink=ks,se.updateListener=sl,se.editable=ct,se.mouseSelectionStyle=gs,se.dragMovesSelection=ms,se.clickAddsSelectionRange=ps,se.decorations=mi,se.outerDecorations=vs,se.atomicRanges=hl,se.bidiIsolatedRanges=Ss,se.scrollMargins=Ns,se.darkTheme=wl,se.cspNonce=Z.define({combine:a=>a.length?a[0]:""}),se.contentAttributes=dl,se.editorAttributes=Cs,se.lineWrapping=se.contentAttributes.of({class:"cm-lineWrapping"}),se.announce=ye.define();const Pu=4096,fa={};class rn{constructor(e,i,n,l,o,s){this.from=e,this.to=i,this.dir=n,this.isolates=l,this.fresh=o,this.order=s}static update(e,i){if(i.empty&&!e.some(o=>o.fresh))return e;let n=[],l=e.length?e[e.length-1].dir:Ce.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!i.touchesRange(s.from,s.to)&&n.push(new rn(i.mapPos(s.from,1),i.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function ua(a,e,i){for(let n=a.state.facet(e),l=n.length-1;l>=0;l--){let o=n[l],s=typeof o=="function"?o(a):o;s&&Xn(s,i)}return i}class Ht extends Pt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ht.prototype.elementClass="",Ht.prototype.toDOM=void 0,Ht.prototype.mapMode=Te.TrackBefore,Ht.prototype.startSide=Ht.prototype.endSide=-1,Ht.prototype.point=!0;var vl;const Gt=new oe;function Lu(a){return Z.define({combine:a?e=>e.concat(a):void 0})}const Uu=new oe;class qe{constructor(e,i,n=[],l=""){this.data=e,this.name=l,ae.prototype.hasOwnProperty("tree")||Object.defineProperty(ae.prototype,"tree",{get(){return Sl(this)}}),this.parser=i,this.extension=[Xt.of(this),ae.languageData.of((o,s,r)=>{let c=pa(o,s,r),d=c.type.prop(Gt);if(!d)return[];let h=o.facet(d),f=c.type.prop(Uu);if(f){let p=c.resolve(s-c.from,r);for(let m of f)if(m.test(p,o)){let b=o.facet(m.facet);return m.type=="replace"?b:b.concat(h)}}return h})].concat(n)}isActiveAt(e,i,n=-1){return pa(e,i,n).type.prop(Gt)==this.data}findRegions(e){let i=e.facet(Xt);if(i?.data==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let n=[],l=(o,s)=>{if(o.prop(Gt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(oe.mounted);if(r){if(r.tree.prop(Gt)==this.data){if(r.overlay)for(let c of r.overlay)n.push({from:c.from+s,to:c.to+s});else n.push({from:s,to:s+o.length});return}else if(r.overlay){let c=n.length;if(l(r.tree,r.overlay[0].from+s),n.length>c)return}}for(let c=0;c<o.children.length;c++){let d=o.children[c];d instanceof ke&&l(d,o.positions[c]+s)}};return l(Sl(e),0),n}get allowsNesting(){return!0}}qe.setState=ye.define();function pa(a,e,i){let n=a.facet(Xt),l=Sl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,i,we.ExcludeBuffers))o.type.isTop&&(l=o);return l}class cn extends qe{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=Lu(e.languageData);return new cn(i,e.parser.configure({props:[Gt.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new cn(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Sl(a){let e=a.field(qe.state,!1);return e?e.tree:ke.empty}class ju{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,i){let n=this.cursorPos-this.string.length;return e<n||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-n,i-n)}}let yi=null;class dn{constructor(e,i,n=[],l,o,s,r,c){this.parser=e,this.state=i,this.fragments=n,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,i,n){return new dn(e,i,[],ke.empty,0,n,[],null)}startParse(){return this.parser.startParse(new ju(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=ke.empty&&this.isDone(i??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(Ct.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(Ct.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=yi;yi=this;try{return e()}finally{yi=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=ma(e,i.from,i.to);return e}changes(e,i){let{fragments:n,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,f,p)=>c.push({fromA:d,toA:h,fromB:f,toB:p})),n=Ct.applyChanges(n,c),l=ke.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),f=e.mapPos(d.to,-1);h<f&&r.push({from:h,to:f})}}}return new dn(this.parser,i,n,l,o,s,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:l,to:o}=this.skipped[n];l<e.to&&o>e.from&&(this.fragments=ma(this.fragments,l,o),this.skipped.splice(n--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends eo{createParse(i,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=yi;if(c){for(let d of l)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=s,new ke(Ee.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return yi}}function ma(a,e,i){return Ct.applyChanges(a,[{fromA:e,toA:i,fromB:e,toB:i}])}class Jt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new Jt(i)}static init(e){let i=Math.min(3e3,e.doc.length),n=dn.create(e.facet(Xt).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new Jt(n)}}qe.state=Bt.define({create:Jt.init,update(a,e){for(let i of e.effects)if(i.is(qe.setState))return i.value;return e.startState.facet(Xt)!=e.state.facet(Xt)?Jt.init(e.state):a.apply(e)}});let ga=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ga=a=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Bl=typeof navigator<"u"&&(!((vl=navigator.scheduling)===null||vl===void 0)&&vl.isInputPending)?()=>navigator.scheduling.isInputPending():null,zu=Wt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let i=this.view.state.field(qe.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(qe.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=ga(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:l}}=this.view,o=n.field(qe.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!Bl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&n.doc.length>l+1e3,c=o.context.work(()=>Bl&&Bl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-i,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:qe.setState.of(new Jt(o.context))})),this.chunkBudget>0&&!(c&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>Ze(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Xt=Z.define({combine(a){return a.length?a[0]:null},enables:a=>[qe.state,zu,se.contentAttributes.compute([a],e=>{let i=e.facet(a);return i&&i.name?{"data-language":i.name}:{}})]});class qu{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const Qu=new oe;function ka({except:a,units:e=1}={}){return i=>{let n=a&&a.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const Ku=new oe;function Wu(a){let e=a.firstChild,i=a.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?a.to:i.from}:null}class Nl{constructor(e,i){this.specs=e;let n;function l(r){let c=bt.newName();return(n||(n=Object.create(null)))["."+c]=r,c}const o=typeof i.all=="string"?i.all:i.all?l(i.all):void 0,s=i.scope;this.scope=s instanceof qe?r=>r.prop(Gt)==s.data:s?r=>r==s:void 0,this.style=ro(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new bt(n):null,this.themeType=i.themeType}static define(e,i){return new Nl(e,i||{})}}U.meta,U.link,U.heading,U.emphasis,U.strong,U.strikethrough,U.keyword,U.atom,U.bool,U.url,U.contentSeparator,U.labelName,U.literal,U.inserted,U.string,U.deleted,U.regexp,U.escape,U.string,U.variableName,U.variableName,U.typeName,U.namespace,U.className,U.variableName,U.macroName,U.propertyName,U.comment,U.invalid;const Yu=Object.create(null),ba=[Ee.none],ya=[],wa=Object.create(null),Hu=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Hu[a]=Gu(Yu,e);function Vl(a,e){ya.indexOf(a)>-1||(ya.push(a),console.warn(e))}function Gu(a,e){let i=[];for(let r of e.split(" ")){let c=[];for(let d of r.split(".")){let h=a[d]||U[d];h?typeof h=="function"?c.length?c=c.map(h):Vl(d,`Modifier ${d} used at start of tag`):c.length?Vl(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Vl(d,`Unknown highlighting tag ${d}`)}for(let d of c)i.push(d)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),l=n+" "+i.map(r=>r.id),o=wa[l];if(o)return o.id;let s=wa[l]=Ee.define({id:ba.length,name:n,props:[ao({[n]:i})]});return ba.push(s),s.id}Ce.RTL,Ce.LTR;const Ju=cn.define({name:"json",parser:qh.configure({props:[Qu.add({Object:ka({except:/^\s*\}/}),Array:ka({except:/^\s*\]/})}),Ku.add({"Object Array":Wu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Xu(){return new qu(Ju)}const Rl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function Zu(){const a=Le();if(a.formRules?.length){const e={};Rl.forEach(n=>{e[n.name]=n});const i=[...Rl];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):i.push(l)}),i}return Rl}const ep={loadAdvances:Zu},tp={class:"unione-props-setting data-field-setting"},ip={key:0},np=["onClick"],lp={class:"field-txt"},op=["onClick"],sp={key:1,class:"field-txt"},ap=["onClick"],rp={key:0,class:"field-txt"},cp={key:3,class:"edit-field"},dp=["onClick"],hp=ie(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([Xu()]),i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=t.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let u in k){const S=n.value.filter(M=>M.name==u);if(S&&S[0]){let M=o.value[u];Object.keys(M).forEach(v=>{v=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=M[v]):S[0][v]=M[v]})}}o.value={}}function r(k,u){s();const S={};u=="convertName"?(k.convert||(k.convert={}),S[u]=k.convert?.type):S[u]=k[u]||"",o.value[k.name]=S}function c(k,u){{o.value={};return}}function d(k,u){switch(u){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function h(k,u){switch(u){case"query":k.configs=K.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=K.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=K.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=K.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=K.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const f=t.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function p(k,u){switch(f.value.prop=u,f.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),u){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),f.value.show=k.configs.query,f.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),f.value.show=k.configs.show.form,f.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),f.value.show=k.configs.show.view,f.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),f.value.show=k.configs.show.list,f.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),f.value.show=k.configs.sort,f.value.title=`排序设置/${k.title}(${k.name})`;break}f.value.visible=!0}const m=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const u=m.value.options.filter(S=>S.value==k);return u[0]?u[0].label:k}}),b=t.ref({visible:!1,field:{},props:{},advances:ep.loadAdvances(),showInfo:k=>{let u=0;if(k.configs?.rule){const S=k.configs.rule;S.advance&&u++,typeof S.rangeMin<"u"&&u++,typeof S.rangeMax<"u"&&u++,typeof S.regExpress<"u"&&u++}if(u>0)return"("+u+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=K.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function w(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const C=t.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const u=k.configs?.widget?.name,S=C.value.widgets.filter(M=>M.value==u);return S[0]?S[0].label:u},toSetting:(k,u)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=u},toclose:()=>{C.value.visible=!1}});function y(k){C.value.field=k,k.configs=K.utils.obj.ext(k.configs,{widget:{props:{}}}),C.value.widget=k.configs.widget,C.value.visible=!0}const A=t.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,u="--")=>A.value.types.filter(S=>S.value==k)[0]?.label||u,toAddOption:()=>{A.value.convert.options||(A.value.convert.options=[]),A.value.convert.options.push({label:"",value:""})},toDelOption:(k,u)=>{A.value.convert.options.splice(k,1)},toSetting:()=>{A.value.visible=!1}});function V(k){A.value.visible=!0,A.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),A.value.convert=k.configs.convert}return(k,u)=>{const S=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-button"),v=t.resolveComponent("a-select"),x=t.resolveComponent("a-checkbox"),N=t.resolveComponent("a-table"),R=t.resolveComponent("a-switch"),g=t.resolveComponent("a-form-item"),B=t.resolveComponent("a-select-option"),T=t.resolveComponent("a-input-number"),O=t.resolveComponent("a-form"),_=t.resolveComponent("a-modal"),$=t.resolveComponent("a-input"),I=t.resolveComponent("unione-select-box"),j=t.resolveComponent("a-checkbox-group"),P=t.resolveComponent("unione-section");return t.openBlock(),t.createElementBlock("div",tp,[t.createVNode(N,{columns:i.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:E})=>[["widget","queryType","rules","convertName"].includes(E.key)?(t.openBlock(),t.createElementBlock("span",ip,[t.createVNode(S),t.createTextVNode(" "+t.toDisplayString(E.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:E,text:J,record:F})=>[["rules"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!b.value.showInfo(F)&&"empty"]),onClick:z=>w(F)},[t.createElementVNode("span",lp,t.toDisplayString(b.value.showInfo(F)),1),b.value.showInfo(F)?(t.openBlock(),t.createBlock(M,{key:0,type:"link"},{default:t.withCtx(()=>u[50]||(u[50]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,np)):["widget"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[F.name]||!Object.keys(o.value[F.name]).includes(E.dataIndex))&&!J&&"empty"]),onClick:z=>r(F,E.dataIndex)},[o.value[F.name]&&Object.keys(o.value[F.name]).includes(E.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:F.configs?.widget?.name,allowClear:!0,options:C.value.widgets,onChange:z=>C.value.toSetting(F,z),onBlur:u[0]||(u[0]=z=>c())},null,8,["value","options","onChange"])),[[l]]):(t.openBlock(),t.createElementBlock("span",sp,t.toDisplayString(C.value.widgetName(F)),1)),t.createVNode(M,{type:"link",onClick:t.withModifiers(z=>y(F),["stop"])},{default:t.withCtx(()=>u[51]||(u[51]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])],10,op)):["convertName"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[F.name]||!Object.keys(o.value[F.name]).includes(E.dataIndex))&&!F.convert?.type&&"empty"]),onClick:z=>V(F)},[F.configs?.convert?.types?(t.openBlock(),t.createElementBlock("span",rp,t.toDisplayString(A.value.getTypes(F.configs.convert.types)),1)):t.createCommentVNode("",!0)],10,ap)):["query","form","view","list","sort"].includes(E.dataIndex)?(t.openBlock(),t.createElementBlock("div",cp,[t.createVNode(x,{checked:d(F,E.dataIndex),onClick:z=>h(F,E.dataIndex)},null,8,["checked","onClick"]),t.createVNode(M,{type:"link",onClick:z=>p(F,E.dataIndex)},{default:t.withCtx(()=>u[52]||(u[52]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(_,{visible:f.value.visible,"onUpdate:visible":u[14]||(u[14]=E=>f.value.visible=E),width:600,title:f.value.title,onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:t.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:t.withCtx(()=>[t.createVNode(g,{label:"启用状态"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.enable,"onUpdate:checked":u[1]||(u[1]=E=>f.value.show.enable=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(t.openBlock(),t.createBlock(g,{key:0,label:"默认排序"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":u[2]||(u[2]=E=>f.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="sort"?(t.openBlock(),t.createBlock(g,{key:1,label:"排序方式"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.asc,"onUpdate:checked":u[3]||(u[3]=E=>f.value.show.asc=E),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(t.openBlock(),t.createBlock(g,{key:2,label:"高级查询"})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":u[4]||(u[4]=E=>f.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.visible,"onUpdate:checked":u[5]||(u[5]=E=>f.value.show.visible=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:5,label:"查询方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.types,"onUpdate:value":u[6]||(u[6]=E=>f.value.show.types=E)},{default:t.withCtx(()=>[t.createVNode(B,{key:"EQ",value:"EQ"},{default:t.withCtx(()=>u[53]||(u[53]=[t.createTextVNode("精确查询")])),_:1}),t.createVNode(B,{key:"LIKE",value:"LIKE"},{default:t.withCtx(()=>u[54]||(u[54]=[t.createTextVNode("模糊查询")])),_:1}),t.createVNode(B,{key:"LLIKE",value:"LLIKE"},{default:t.withCtx(()=>u[55]||(u[55]=[t.createTextVNode("左模糊")])),_:1}),t.createVNode(B,{key:"RLIKE",value:"RLIKE"},{default:t.withCtx(()=>u[56]||(u[56]=[t.createTextVNode("右模糊")])),_:1}),t.createVNode(B,{key:"RANGE",value:"RANGE"},{default:t.withCtx(()=>u[57]||(u[57]=[t.createTextVNode("范围查询")])),_:1}),t.createVNode(B,{key:"ADVANCE",value:"ADVANCE"},{default:t.withCtx(()=>u[58]||(u[58]=[t.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:t.withCtx(()=>[t.createVNode(T,{value:f.value.show.index,"onUpdate:value":u[7]||(u[7]=E=>f.value.show.index=E)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.width,"onUpdate:value":u[8]||(u[8]=E=>f.value.show.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,value:f.value.show.width,"onUpdate:value":u[9]||(u[9]=E=>f.value.show.width=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":u[10]||(u[10]=E=>f.value.show.labelWidth=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":u[11]||(u[11]=E=>f.value.show.valueWidth=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:11,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.fixed,"onUpdate:value":u[12]||(u[12]=E=>f.value.show.fixed=E),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(g,{key:12,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(v,{value:f.value.show.align,"onUpdate:value":u[13]||(u[13]=E=>f.value.show.align=E),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),t.createVNode(_,{visible:A.value.visible,"onUpdate:visible":u[33]||(u[33]=E=>A.value.visible=E),width:600,title:A.value.getTypes(A.value.convert.types,"转换")+"设置",onOk:A.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:A.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(g,{label:"转换类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:A.value.convert.types,"onUpdate:value":u[15]||(u[15]=E=>A.value.convert.types=E),allowClear:!0,options:A.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(g,{key:0,label:"是否搜索"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.convert.search,"onUpdate:checked":u[16]||(u[16]=E=>f.value.convert.search=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="option"?(t.openBlock(),t.createBlock(g,{key:1,label:"选项设置"},{default:t.withCtx(()=>[t.createVNode(M,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:A.value.toAddOption},{default:t.withCtx(()=>u[59]||(u[59]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(N,{columns:A.value.optionColumn,"data-source":A.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:E,record:J,index:F})=>[E.dataIndex==="label"?(t.openBlock(),t.createBlock($,{key:0,value:J.label,"onUpdate:value":z=>J.label=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),E.dataIndex==="value"?(t.openBlock(),t.createBlock($,{key:1,value:J.value,"onUpdate:value":z=>J.value=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),E.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:z=>A.value.toDelOption(F,J)},"删除",8,dp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):t.createCommentVNode("",!0),["dbtable","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:2,label:"数据源"},{default:t.withCtx(()=>[t.createVNode(I,{value:A.value.convert.dsId,"onUpdate:value":u[17]||(u[17]=E=>A.value.convert.dsId=E),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:3,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableName,"onUpdate:value":u[18]||(u[18]=E=>A.value.convert.tableName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:4,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableName,"onUpdate:value":u[19]||(u[19]=E=>A.value.convert.tableName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(g,{key:5,label:"主键字段"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.idField,"onUpdate:value":u[20]||(u[20]=E=>A.value.convert.idField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(g,{key:6,label:"父级字段"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.pidField,"onUpdate:value":u[21]||(u[21]=E=>A.value.convert.pidField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:7,label:"value字段"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.valueField,"onUpdate:value":u[22]||(u[22]=E=>A.value.convert.valueField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:8,label:"label字段"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.labelField,"onUpdate:value":u[23]||(u[23]=E=>A.value.convert.labelField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableField,"onUpdate:value":u[24]||(u[24]=E=>A.value.convert.tableField=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableWhere,"onUpdate:value":u[25]||(u[25]=E=>A.value.convert.tableWhere=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableOrder,"onUpdate:value":u[26]||(u[26]=E=>A.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.tableOrder,"onUpdate:value":u[27]||(u[27]=E=>A.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:13,label:"异步加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isAsync,"onUpdate:checked":u[28]||(u[28]=E=>A.value.convert.isAsync=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:14,label:"分页加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isPaging,"onUpdate:checked":u[29]||(u[29]=E=>A.value.convert.isPaging=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dict"?(t.openBlock(),t.createBlock(g,{key:15,label:"字典名称"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.dictName,"onUpdate:value":u[30]||(u[30]=E=>A.value.convert.dictName=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:t.withCtx(()=>[t.createVNode($,{value:A.value.convert.url,"onUpdate:value":u[31]||(u[31]=E=>A.value.convert.url=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.convert.params,"onUpdate:modelValue":u[32]||(u[32]=E=>A.value.convert.params=E),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(_,{visible:C.value.visible,"onUpdate:visible":u[40]||(u[40]=E=>C.value.visible=E),width:600,title:"控件设置",onOk:C.value.toclose},{default:t.withCtx(()=>[t.createVNode(O,{model:C.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(g,{label:"组件类型"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(v,{value:C.value.widget.name,"onUpdate:value":u[34]||(u[34]=E=>C.value.widget.name=E),allowClear:!0,options:C.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),t.createVNode(g,{label:"输入提示"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.placeholder,"onUpdate:value":u[35]||(u[35]=E=>C.value.widget.placeholder=E)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"帮助说明"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.help,"onUpdate:value":u[36]||(u[36]=E=>C.value.widget.help=E)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"提示文本"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.widget.tooltip,"onUpdate:value":u[37]||(u[37]=E=>C.value.widget.tooltip=E)},null,8,["value"])]),_:1}),["a-date-picker"].includes(C.value.widget.name)?(t.openBlock(),t.createBlock(g,{key:0,label:"显示格式"},{default:t.withCtx(()=>[t.createVNode($,{value:C.value.field.dataFormat,"onUpdate:value":u[38]||(u[38]=E=>C.value.field.dataFormat=E)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),C.value.widget.name=="unione-select-box"?(t.openBlock(),t.createBlock(g,{key:1,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(v,{value:C.value.widget.props.mode,"onUpdate:value":u[39]||(u[39]=E=>C.value.widget.props.mode=E),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(B,{value:"multiple"},{default:t.withCtx(()=>u[60]||(u[60]=[t.createTextVNode("多选")])),_:1}),t.createVNode(B,{value:"tags"},{default:t.withCtx(()=>u[61]||(u[61]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(_,{visible:b.value.visible,"onUpdate:visible":u[49]||(u[49]=E=>b.value.visible=E),width:600,title:"规则设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[t.createVNode(O,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(P,{title:"基本设置",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(j,{value:b.value.props.trigger,"onUpdate:value":u[41]||(u[41]=E=>b.value.props.trigger=E),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(x,{checked:b.value.props.whitespace,"onUpdate:checked":u[42]||(u[42]=E=>b.value.props.whitespace=E)},{default:t.withCtx(()=>u[62]||(u[62]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),t.createVNode(g,{label:"预设类型"},{default:t.withCtx(()=>[t.createVNode(v,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":u[43]||(u[43]=E=>b.value.props.advance=E)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(t.openBlock(),t.createBlock(P,{key:0,title:"数值验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(T,{value:b.value.props.rangeMin,"onUpdate:value":u[44]||(u[44]=E=>b.value.props.rangeMin=E)},null,8,["value"]),u[63]||(u[63]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(T,{value:b.value.props.rangeMax,"onUpdate:value":u[45]||(u[45]=E=>b.value.props.rangeMax=E)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":u[46]||(u[46]=E=>b.value.props.rangeMessage=E)},null,8,["value"])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(P,{title:"正则验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":u[47]||(u[47]=E=>b.value.props.regExpress=E)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":u[48]||(u[48]=E=>b.value.props.regMessage=E)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),fp={class:"unione-props-setting data-field-fkey"},up={key:0},pp=["onClick"],mp=["onClick"],gp=["onClick"],kp=["onClick"],bp=["onClick"],yp=["onClick"],wp=["onClick"],Ap=["onClick"],xp=ie(t.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),n=t.useModel(a,"modelValue"),l=t.computed(()=>n.value.filter(p=>p.configs?.fkey?.enable)||[]),o=t.ref({});function s(){o.value={}}function r(p,m){s();const b={};b[m]=p.configs.fkey[m]||"",o.value[p.name]=b}function c(p,m,b){p.configs.fkey.dsn=m,p.configs.fkey.dsnName=b.name,p.configs.fkey.dsnTitle=b.title,p.configs.fkey.dsnId=b.id}function d(p,m,b,w){p.configs.fkey[m]=b,m=="fieldName"&&(p.configs.fkey.fieldTitle=w.title),m=="labelName"&&(p.configs.fkey.labelTitle=w.title)}function h(p){f.value.record=p,f.value.visible=!0,f.value.fields=p.configs?.fkey?.fields||[]}const f=t.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(p,m)=>{f.value.editField[p]=m},onShowFieldChange:(p,m,b)=>{p.name=b.name,p.title=b.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(p,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=K.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(p,m)=>{const b=t.resolveComponent("FormOutlined"),w=t.resolveComponent("unione-select-box"),C=t.resolveComponent("a-button"),y=t.resolveComponent("a-table"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",fp,[t.createVNode(y,{columns:i.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:t.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(t.openBlock(),t.createElementBlock("span",up,[t.createVNode(b),t.createTextVNode(" "+t.toDisplayString(k.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:k,record:u})=>[["dsnName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":S=>o.value[u.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(S,M)=>c(u,S,M)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u.configs?.fkey?.dsnName),1)],64))],10,pp)):["dsnTitle"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":S=>o.value[u.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(S,M)=>c(u,S,M)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u.configs?.fkey?.dsnTitle),1)],64))],10,mp)):t.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":S=>o.value[u.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,M)=>d(u,"fieldName",S,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u.configs?.fkey?.fieldTitle),1)],64))],10,gp)):["labelName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":S=>o.value[u.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,M)=>d(u,"labelName",S,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u.configs?.fkey?.labelTitle)+" ",1),u.configs?.fkey?.labelName?(t.openBlock(),t.createBlock(C,{key:0,type:"link",onClick:t.withModifiers(S=>h(u),["stop"])},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,kp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(V,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>f.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(C,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(y,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:t.withCtx(({column:k,record:u,index:S,text:M})=>[k.dataIndex==="title"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",f.value.editField!="title"&&!M&&"empty"]),onClick:v=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="title"?(t.openBlock(),t.createBlock(w,{key:0,value:u[u.dataIndex],"onUpdate:value":v=>u[u.dataIndex]=v,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=v=>f.value.editField={}),onSelect:(v,x)=>f.value.onShowFieldChange(u,v,x)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,bp)):t.createCommentVNode("",!0),k.dataIndex==="width"?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",f.value.editField!="width"&&!M&&"empty"]),onClick:v=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="width"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[1]||(m[1]=v=>f.value.editField={}),value:u.width,"onUpdate:value":v=>u.width=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,yp)):t.createCommentVNode("",!0),k.dataIndex==="index"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:v=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="index"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[2]||(m[2]=v=>f.value.editField={}),value:u.index,"onUpdate:value":v=>u.index=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,wp)):t.createCommentVNode("",!0),k.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:3,onClick:v=>f.value.toDelField(S)},"删除",8,Ap)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),Cp={class:"unione-props-setting data-filter"},vp={class:"title"},Sp={class:"name"},Bp={class:"action"},Np=ie(t.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=K.useDialog(),i=t.useModel(a,"modelValue");function n(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(d){r.value.visible=!0,r.value.filter={...d},r.value.name=d.name}function o(d){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{i.value.splice(d,1)}})}const s=t.ref(),r=t.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(d=>{if(r.value.name){const h=i.value.filter(f=>f.name==r.value.name)[0];if(!h){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&i.value.filter(p=>p.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(d).forEach(f=>{h[f]=d[f]})}else{if(i.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}i.value.push(d)}r.value.visible=!1})}});function c(){const d=[];r.value.filter.filter||(r.value.filter.filter=""),d.push("-- @if(isNotEmpty(params."),d.push(r.value.filter.name||"xxx"),d.push(") && !isBlank(params."),d.push(r.value.filter.name||"xxx"),d.push(`)
24
24
  `),d.push(" AND XXX=#{params."),d.push(r.value.filter.name||"xxx"),d.push(`}
25
25
  `),d.push(`-- @}
26
- `),r.value.filter.filter=r.value.filter.filter+d.join("")}return(d,h)=>{const f=t.resolveComponent("a-button"),u=t.resolveComponent("a-card"),m=t.resolveComponent("PlusOutlined"),b=t.resolveComponent("a-empty"),A=t.resolveComponent("a-input"),C=t.resolveComponent("a-form-item"),w=t.resolveComponent("a-textarea"),y=t.resolveComponent("a-tag"),R=t.resolveComponent("a-form"),g=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",Cp,[(i.value.length,t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,(p,N)=>(t.openBlock(),t.createBlock(u,{class:"filter-box",size:"small",key:N},{default:t.withCtx(()=>[t.createElementVNode("div",vp,"过滤标题:"+t.toDisplayString(p.title),1),t.createElementVNode("div",Sp,"过滤名称:"+t.toDisplayString(p.name),1),t.createElementVNode("div",Bp,[t.createVNode(f,{size:"small",onClick:M=>l(p)},{default:t.withCtx(()=>h[4]||(h[4]=[t.createTextVNode("编辑")])),_:2},1032,["onClick"]),t.createVNode(f,{danger:"",size:"small",onClick:M=>o(N)},{default:t.withCtx(()=>h[5]||(h[5]=[t.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),t.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:n},{default:t.withCtx(()=>[t.createVNode(m,{class:"btn"})]),_:1})],64)),t.createVNode(g,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(C,{label:"过滤标题",name:"title"},{default:t.withCtx(()=>[t.createVNode(A,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),t.createVNode(C,{label:"过滤名称",name:"name"},{default:t.withCtx(()=>[t.createVNode(A,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),t.createVNode(C,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),t.createVNode(y,{class:"btn-tmpl",color:"blue",onClick:c},{default:t.withCtx(()=>h[6]||(h[6]=[t.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),Vp={class:"unione-page form-page data-define-edit"},Rp={class:"actions"},Ep=ie(t.defineComponent({__name:"edit",setup(a){const e=K.useDialog(),i=t.inject("route"),n=t.inject("router"),l=t.ref(),o=t.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=t.ref(),r=t.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=t.ref({configs:{fields:[],filters:[]}}),d=t.ref(!1);function h(){n.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{xt.release([c.value.id]).then(A=>{A.success?(e.success({title:"发布成功",content:A.body}),b(c.value.id)):e.error({title:"发布失败",content:A.body})})}})}async function u(){const A=await l.value.validate(),C={...c.value,...A};C.configs.show=await s.value.getValue(),console.log("formData",C),te.message.loading({content:"提交中..."}),d.value=!0,xt.save(C).then(w=>{te.message.destroy(),w.success?(c.value=w.body,l.value.setValue(w.body),s.value.setValue(w.body.configs?.show||{}),te.message.success("保存成功!")):te.message.error(w.message)}).finally(()=>{d.value=!1})}const m=t.ref(!1);t.onMounted(()=>{i.query.id&&b(i.query.id)});function b(A){te.message.loading({content:"加载中..."}),xt.detail(A).then(C=>{C.success?(c.value=C.body,l.value.setValue(C.body),s.value.setValue(C.body.configs?.show||{}),te.message.destroy()):te.message.error(C.message)})}return(A,C)=>{const w=t.resolveComponent("unione-form"),y=t.resolveComponent("unione-section"),R=t.resolveComponent("OrderedListOutlined"),g=t.resolveComponent("a-tab-pane"),p=t.resolveComponent("ToolOutlined"),N=t.resolveComponent("ApiOutlined"),M=t.resolveComponent("FunnelPlotOutlined"),v=t.resolveComponent("a-tabs"),x=t.resolveComponent("a-button");return t.openBlock(),t.createElementBlock("div",Vp,[t.createVNode(y,{title:"基础信息",type:"line"},{default:t.withCtx(()=>[t.createVNode(w,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),t.createVNode(y,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":C[0]||(C[0]=B=>m.value=B)},{default:t.withCtx(()=>[t.createVNode(w,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),t.createVNode(v,null,{default:t.withCtx(()=>[t.createVNode(g,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(R),C[5]||(C[5]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(Ah,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[1]||(C[1]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),t.createVNode(g,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(p),C[6]||(C[6]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(hp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[2]||(C[2]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),t.createVNode(g,{key:"field-fkeys"},{tab:t.withCtx(()=>[t.createVNode(N),C[7]||(C[7]=t.createTextVNode("外键设置 "))]),default:t.withCtx(()=>[t.createVNode(xp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[3]||(C[3]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),t.createVNode(g,{key:"data-filter"},{tab:t.withCtx(()=>[t.createVNode(M),C[8]||(C[8]=t.createTextVNode("数据过滤 "))]),default:t.withCtx(()=>[t.createVNode(Np,{modelValue:c.value.configs.filters,"onUpdate:modelValue":C[4]||(C[4]=B=>c.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),t.createElementVNode("div",Rp,[t.createVNode(x,{type:"primary",onClick:u,loading:d.value},{default:t.withCtx(()=>C[9]||(C[9]=[t.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(t.openBlock(),t.createBlock(x,{key:0,danger:"",onClick:f,loading:d.value},{default:t.withCtx(()=>C[10]||(C[10]=[t.createTextVNode("发布")])),_:1},8,["loading"])):t.createCommentVNode("",!0),t.createVNode(x,{onClick:h},{default:t.withCtx(()=>C[11]||(C[11]=[t.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Op={UnioneEditor:dt,locales:fn,loadConfig:Le,DataStorage:un,Convertor:Qe,install(a,e){K.loadConfig(e);const i=Le(e);i.axios&&K.axios.create(i.axios),a.component("UnioneBtn",$a),a.component("UnioneTabs",La),a.component("UnioneSection",Ka),a.component("UnioneQuery",Dl),a.component("UnioneTable",$l),a.component("UnioneRichText",id),a.component("UnioneFormItem",ur),a.component("UnioneForm",cr),a.component("UnioneSelectBox",pr),a.component("UnioneSwitchBox",mr),a.component("UnioneRadioBox",gr),a.component("UnioneCheckBox",kr),a.component("UnionePwdBox",br),a.component("UnioneRandomInput",wr),a.component("UnioneUploadBox",Ar),a.component("UnionePageEditor",jl),a.component("UnionePageForm",zl),a.component("UnionePageTree",ql),a.component("UnionePageList",Ql),a.component("UnioneFlowTodo",Kl),a.component("UnioneFlowAudit",Wd),a.component("UnioneFlowOpinion",hh)}};ee.Convertor=Qe,ee.DataStorage=un,ee.UnioneDataDefineEdit=Ep,ee.UnioneDataDefineList=uh,ee.UnioneEditor=dt,ee.UnioneFlowTodo=Kl,ee.UnionePage=_t,ee.UnionePageEditor=jl,ee.UnionePageForm=zl,ee.UnionePageList=Ql,ee.UnionePageSetting=Tt,ee.UnionePageTree=ql,ee.UnioneQueryForm=Dl,ee.UnioneTableList=$l,ee.default=Op,ee.loadConfig=Le,ee.locales=fn,ee.useDebounce=At,ee.utils=yr,Object.defineProperties(ee,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
26
+ `),r.value.filter.filter=r.value.filter.filter+d.join("")}return(d,h)=>{const f=t.resolveComponent("a-button"),p=t.resolveComponent("a-card"),m=t.resolveComponent("PlusOutlined"),b=t.resolveComponent("a-empty"),w=t.resolveComponent("a-input"),C=t.resolveComponent("a-form-item"),y=t.resolveComponent("a-textarea"),A=t.resolveComponent("a-tag"),V=t.resolveComponent("a-form"),k=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",Cp,[(i.value.length,t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,(u,S)=>(t.openBlock(),t.createBlock(p,{class:"filter-box",size:"small",key:S},{default:t.withCtx(()=>[t.createElementVNode("div",vp,"过滤标题:"+t.toDisplayString(u.title),1),t.createElementVNode("div",Sp,"过滤名称:"+t.toDisplayString(u.name),1),t.createElementVNode("div",Bp,[t.createVNode(f,{size:"small",onClick:M=>l(u)},{default:t.withCtx(()=>h[4]||(h[4]=[t.createTextVNode("编辑")])),_:2},1032,["onClick"]),t.createVNode(f,{danger:"",size:"small",onClick:M=>o(S)},{default:t.withCtx(()=>h[5]||(h[5]=[t.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),t.createVNode(p,{class:"filter-box btn-add",size:"small",onClick:n},{default:t.withCtx(()=>[t.createVNode(m,{class:"btn"})]),_:1})],64)),t.createVNode(k,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=u=>r.value.visible=u),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(C,{label:"过滤标题",name:"title"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=u=>r.value.filter.title=u)},null,8,["value"])]),_:1}),t.createVNode(C,{label:"过滤名称",name:"name"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=u=>r.value.filter.name=u)},null,8,["value"])]),_:1}),t.createVNode(C,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:t.withCtx(()=>[t.createVNode(y,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=u=>r.value.filter.filter=u),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),t.createVNode(A,{class:"btn-tmpl",color:"blue",onClick:c},{default:t.withCtx(()=>h[6]||(h[6]=[t.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),Vp={class:"unione-page form-page data-define-edit"},Rp={class:"actions"},Ep=ie(t.defineComponent({__name:"edit",setup(a){const e=K.useDialog(),i=t.inject("route"),n=t.inject("router"),l=t.ref(),o=t.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=t.ref(),r=t.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=t.ref({configs:{fields:[],filters:[]}}),d=t.ref(!1);function h(){n.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{xt.release([c.value.id]).then(w=>{w.success?(e.success({title:"发布成功",content:w.body}),b(c.value.id)):e.error({title:"发布失败",content:w.body})})}})}async function p(){const w=await l.value.validate(),C={...c.value,...w};C.configs.show=await s.value.getValue(),console.log("formData",C),te.message.loading({content:"提交中..."}),d.value=!0,xt.save(C).then(y=>{te.message.destroy(),y.success?(c.value=y.body,l.value.setValue(y.body),s.value.setValue(y.body.configs?.show||{}),te.message.success("保存成功!")):te.message.error(y.message)}).finally(()=>{d.value=!1})}const m=t.ref(!1);t.onMounted(()=>{i.query.id&&b(i.query.id)});function b(w){te.message.loading({content:"加载中..."}),xt.detail(w).then(C=>{C.success?(c.value=C.body,l.value.setValue(C.body),s.value.setValue(C.body.configs?.show||{}),te.message.destroy()):te.message.error(C.message)})}return(w,C)=>{const y=t.resolveComponent("unione-form"),A=t.resolveComponent("unione-section"),V=t.resolveComponent("OrderedListOutlined"),k=t.resolveComponent("a-tab-pane"),u=t.resolveComponent("ToolOutlined"),S=t.resolveComponent("ApiOutlined"),M=t.resolveComponent("FunnelPlotOutlined"),v=t.resolveComponent("a-tabs"),x=t.resolveComponent("a-button");return t.openBlock(),t.createElementBlock("div",Vp,[t.createVNode(A,{title:"基础信息",type:"line"},{default:t.withCtx(()=>[t.createVNode(y,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),t.createVNode(A,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":C[0]||(C[0]=N=>m.value=N)},{default:t.withCtx(()=>[t.createVNode(y,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),t.createVNode(v,null,{default:t.withCtx(()=>[t.createVNode(k,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(V),C[5]||(C[5]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(Ah,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[1]||(C[1]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(u),C[6]||(C[6]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(hp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[2]||(C[2]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-fkeys"},{tab:t.withCtx(()=>[t.createVNode(S),C[7]||(C[7]=t.createTextVNode("外键设置 "))]),default:t.withCtx(()=>[t.createVNode(xp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":C[3]||(C[3]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"data-filter"},{tab:t.withCtx(()=>[t.createVNode(M),C[8]||(C[8]=t.createTextVNode("数据过滤 "))]),default:t.withCtx(()=>[t.createVNode(Np,{modelValue:c.value.configs.filters,"onUpdate:modelValue":C[4]||(C[4]=N=>c.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),t.createElementVNode("div",Rp,[t.createVNode(x,{type:"primary",onClick:p,loading:d.value},{default:t.withCtx(()=>C[9]||(C[9]=[t.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(t.openBlock(),t.createBlock(x,{key:0,danger:"",onClick:f,loading:d.value},{default:t.withCtx(()=>C[10]||(C[10]=[t.createTextVNode("发布")])),_:1},8,["loading"])):t.createCommentVNode("",!0),t.createVNode(x,{onClick:h},{default:t.withCtx(()=>C[11]||(C[11]=[t.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Op={UnioneEditor:ht,locales:fn,loadConfig:Le,DataStorage:un,Convertor:Qe,install(a,e){K.loadConfig(e);const i=Le(e);i.axios&&K.axios.create(i.axios),a.component("UnioneBtn",$a),a.component("UnioneTabs",La),a.component("UnioneSection",Ka),a.component("UnioneQuery",Dl),a.component("UnioneTable",$l),a.component("UnioneRichText",id),a.component("UnioneFormItem",ur),a.component("UnioneForm",cr),a.component("UnioneSelectBox",pr),a.component("UnioneSwitchBox",mr),a.component("UnioneRadioBox",gr),a.component("UnioneCheckBox",kr),a.component("UnionePwdBox",br),a.component("UnioneRandomInput",wr),a.component("UnioneUploadBox",Ar),a.component("UnionePageEditor",jl),a.component("UnionePageForm",zl),a.component("UnionePageTree",ql),a.component("UnionePageList",Ql),a.component("UnioneFlowTodo",Kl),a.component("UnioneFlowAudit",Wd),a.component("UnioneFlowOpinion",hh)}};ee.Convertor=Qe,ee.DataStorage=un,ee.UnioneDataDefineEdit=Ep,ee.UnioneDataDefineList=uh,ee.UnioneEditor=ht,ee.UnioneFlowTodo=Kl,ee.UnionePage=_t,ee.UnionePageEditor=jl,ee.UnionePageForm=zl,ee.UnionePageList=Ql,ee.UnionePageSetting=Tt,ee.UnionePageTree=ql,ee.UnioneQueryForm=Dl,ee.UnioneTableList=$l,ee.default=Op,ee.loadConfig=Le,ee.locales=fn,ee.useDebounce=At,ee.utils=yr,Object.defineProperties(ee,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});