unione-form-vue 0.0.21 → 0.0.22

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(Z,Y){typeof exports=="object"&&typeof module<"u"?Y(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"],Y):(Z=typeof globalThis<"u"?globalThis:Z||self,Y(Z.index={},Z.UnioneBaseVue,Z.Vue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.canvasEditor,Z.dayjs,Z.prism,Z.iconsVue,Z.uuid))})(this,function(Z,Y,i,X,ha,jt,fa,ae,ua,xl,Ke,pa){"use strict";const ma={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},nn=i.ref(ma);function Fe(a){return a&&(nn.value=Y.utils.obj.ext(nn.value,a)),nn.value}const ga={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ka={...{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"}},ba=i.ref([ga,ka]);function ya(a,e){return Y.locales.loadLanguage(a,()=>new Promise((t,n)=>{const l=ba.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};t(s)}else{const s={...l[0],...o};t(s)}});else if(l.length==0){const o={...e,localeName:a};t(o)}else{const o={...l[0],...e};t(o)}else l.length>0?t(l[0]):n("local language not defined ,lang:"+a)}))}const ln={...Y.locales};ln.loadLanguage=ya;class wa{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=i.ref(e),this.$pid=i.ref(""),this.$store=i.ref({}),this.$forms=i.ref({}),this.$params=i.ref({}),this.$refObj=i.ref({}),this.$refData=i.ref({}),this.$model=t}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 t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,n){}use(e,t,n){let l=this.$store.value[e];return l||(l=new on(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),n&&(l.$form=n,this.$forms.value[e]=n),l}useForm(e,t,n){const l=this.use(e,"form",t);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 on{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,n){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=i.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=Y.useDialog(),this.$model=n||i.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)}$processParams(e,t){if(t)t.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((t,n)=>{const l=X.message.loading("数据请求中..."),o=this.$store.controller+e.url;Y.axios.form({method:"post",...e,url:o}).then(s=>{s.success?t(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 t=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=X.message.loading("数据加载中...");Y.axios.form({url:t,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:t,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:s})}).finally(()=>{o()})})}save(e){const t=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=X.message.loading("数据提交中...");Y.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||X.message.success(s.message),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(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((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/detail";Y.axios.form({url:o,method:"post",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),t(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((t,n)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=X.message.loading("数据处理中..."),o=this.$store.controller+"/delete";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(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 Aa{$event;$onces;$delayEmit;constructor(){this.$event=i.ref({}),this.$onces=i.ref({}),this.$delayEmit=i.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const n=this.$delayEmit.value[e];t(n)}}$emit(e,t){if(this.$onces.value[e]){const n=this.$onces.value[e];delete this.$onces.value[e],n(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class ut{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=i.ref("run"),this.type=i.ref(e.types||"setting"),this.define=i.ref(e),this.ebus=new Aa,this.$widgetList=i.ref([]),this.$widgetMap=i.ref({}),this.$dataManager=new wa(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=i.ref({}),this.$dialog=Y.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.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}Y.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)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();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),Y.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(X.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}),t())}).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,t){if(t){const n={...t,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(t=>{t.wid||(t.wid="w:"+ha.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const xa={class:"widget-setting-dialog"},Ca=i.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:t}){const n=t,l=i.ref(),o=i.ref(),s=i.ref(!1);function r(){o.value&&(s.value=!0),n("setting")}function c(){n("saving"),s.value=!1}function h(){return l.value?.clientHeight}function f(){return l.value?.clientWidth}return e({getHeight:h,getWidth:f}),(d,p)=>{const m=i.resolveComponent("SettingOutlined"),b=i.resolveComponent("a-tooltip"),y=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[i.createVNode(b,{title:a.settingTitle},{default:i.withCtx(()=>[a.model=="edit"&&(d.$slots["widget-setting"]||a.custome)?(i.openBlock(),i.createBlock(m,{key:0,class:"widget-setting",onClick:r})):i.createCommentVNode("",!0)]),_:1},8,["title"]),i.renderSlot(d.$slots,"default",{},void 0,!0),a.model=="edit"&&d.$slots["widget-setting"]?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":p[0]||(p[0]=A=>s.value=A),centered:"",width:"80%",onOk:c},{default:i.withCtx(()=>[i.createElementVNode("div",xa,[i.renderSlot(d.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),ee=(a,e)=>{const t=a.__vccOpts||a;for(const[n,l]of e)t[n]=l;return t},lt=ee(Ca,[["__scopeId","data-v-17b517f5"]]),va={key:0},Sa=["onClick"],fi=ee(i.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const t=a,n=i.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=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=i.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let u in k){const N=y.value.form.action.params[u];N&&s.value[u]&&Object.keys(s.value[u]).forEach(M=>{N[M]=s.value[u][M]})}s.value={}}function c(k,u,N){r();const M={};M[N]=u[N]||"",N=="showIndex"&&(M[N]=u.show?.query?.index),s.value[k]=M}function h(k,u,N){if(!u||!N){s.value={};return}const M=s.value[k][N];u[N]=M,s.value={}}function f(){y.value.form.action.params.push({title:"新建",name:"",value:""})}function d(){}const p=i.ref(""),m=i.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,u)=>p.value!=u&&t.preset.includes(u)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=i.ref([fa.javascript()]),y=i.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),A=i.ref();function x(k,u,N={}){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,y.value.form=k,y.value.helps=N,y.value.visible=!0,A.value=u}const w=i.ref(null);function R(){w.value&&w.value.validate().then(()=>{y.value.visible=!1,A.value(y.value.form)})}return e({open:x,close}),(k,u)=>{const N=i.resolveComponent("a-input"),M=i.resolveComponent("a-form-item"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-input-number"),B=i.resolveComponent("a-checkbox"),E=i.resolveComponent("a-tab-pane"),g=i.resolveComponent("a-switch"),S=i.resolveComponent("a-button"),I=i.resolveComponent("a-divider"),V=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-tooltip"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-tabs"),Q=i.resolveComponent("a-form"),L=i.resolveComponent("a-modal");return i.openBlock(),i.createBlock(L,{visible:y.value.visible,"onUpdate:visible":u[23]||(u[23]=O=>y.value.visible=O),title:y.value.title,centered:"",width:"50%",onOk:R},{default:i.withCtx(()=>[i.createVNode(Q,{name:"basic",ref_key:"form",ref:w,rules:m.value,model:y.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:i.withCtx(()=>[i.createVNode(D,null,{default:i.withCtx(()=>[i.createVNode(E,{key:"base",tab:"基本设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"操作标题",required:"",name:"title"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.title,"onUpdate:value":u[0]||(u[0]=O=>y.value.form.title=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"操作名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.name,"onUpdate:value":u[1]||(u[1]=O=>y.value.form.name=O),disabled:t.preset.includes(y.value.form.name)},null,8,["value","disabled"])]),_:1}),i.createVNode(M,{label:"操作图标"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.icon,"onUpdate:value":u[2]||(u[2]=O=>y.value.form.icon=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.type,"onUpdate:value":u[3]||(u[3]=O=>y.value.form.type=O),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.index,"onUpdate:value":u[4]||(u[4]=O=>y.value.form.index=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮大小"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.size,"onUpdate:value":u[5]||(u[5]=O=>y.value.form.size=O),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮特性"},{default:i.withCtx(()=>[i.createVNode(B,{checked:y.value.form.props.block,"onUpdate:checked":u[6]||(u[6]=O=>y.value.form.props.block=O)},{default:i.withCtx(()=>u[24]||(u[24]=[i.createTextVNode("自适应 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.danger,"onUpdate:checked":u[7]||(u[7]=O=>y.value.form.props.danger=O)},{default:i.withCtx(()=>u[25]||(u[25]=[i.createTextVNode("危险 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.ghost,"onUpdate:checked":u[8]||(u[8]=O=>y.value.form.props.ghost=O)},{default:i.withCtx(()=>u[26]||(u[26]=[i.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),i.createVNode(E,{key:"action",tab:"响应设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"响应方式",required:""},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.type,"onUpdate:value":u[9]||(u[9]=O=>y.value.form.action.type=O),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.psn,"onUpdate:value":u[10]||(u[10]=O=>y.value.form.action.psn=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.component,"onUpdate:value":u[11]||(u[11]=O=>y.value.form.action.component=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(M,{label:"连接地址"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.href,"onUpdate:value":u[12]||(u[12]=O=>y.value.form.action.href=O)},null,8,["value"])]),_:1}),["link","route"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:2,label:"连接方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.target,"onUpdate:value":u[13]||(u[13]=O=>y.value.form.action.target=O),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:3,label:"抽屉位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.position,"onUpdate:value":u[14]||(u[14]=O=>y.value.form.action.position=O),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:4,label:"显示标题",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.title,"onUpdate:value":u[15]||(u[15]=O=>y.value.form.action.title=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:5,label:"蒙层关闭"},{default:i.withCtx(()=>[i.createVNode(g,{checked:y.value.form.action.maskClosable,"onUpdate:checked":u[16]||(u[16]=O=>y.value.form.action.maskClosable=O),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:6,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.width,"onUpdate:value":u[17]||(u[17]=O=>y.value.form.action.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:7,label:"显示高度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.height,"onUpdate:value":u[18]||(u[18]=O=>y.value.form.action.height=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(I,{orientation:"left"},{default:i.withCtx(()=>[u[29]||(u[29]=i.createTextVNode("参数列表 ")),i.createVNode(S,{size:"small",class:"param-btn",onClick:f},{default:i.withCtx(()=>u[27]||(u[27]=[i.createTextVNode("添加")])),_:1}),i.createVNode(S,{size:"small",class:"param-btn",danger:"",onClick:d},{default:i.withCtx(()=>u[28]||(u[28]=[i.createTextVNode("删除")])),_:1})]),_:1}),i.createVNode($,{columns:n.value,"data-source":y.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:O})=>[["name","title"].includes(O.key)?(i.openBlock(),i.createElementBlock("span",va,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(O.title),1)])):i.createCommentVNode("",!0),["value"].includes(O.key)?(i.openBlock(),i.createBlock(F,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:i.withCtx(()=>[i.createElementVNode("span",null,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(O.title),1)])]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:O,text:G,record:T,index:_})=>[["name","title","value"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!s.value[_]||!Object.keys(s.value[_]).includes(O.dataIndex))&&!G&&"empty"]),onClick:q=>c(_,T,O.dataIndex)},[s.value[_]&&Object.keys(s.value[_]).includes(O.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(N,{key:0,value:s.value[_][O.dataIndex],"onUpdate:value":q=>s.value[_][O.dataIndex]=q,onBlur:q=>h(_,T,O.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(G),1)],64))],10,Sa)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),i.createVNode(E,{key:"event",tab:"事件设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"点击事件",help:y.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.clickScript,"onUpdate:modelValue":u[19]||(u[19]=O=>y.value.form.event.clickScript=O),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"禁用逻辑",help:y.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.disableScript,"onUpdate:modelValue":u[20]||(u[20]=O=>y.value.form.event.disableScript=O),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"显示逻辑",help:y.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.visibleScript,"onUpdate:modelValue":u[21]||(u[21]=O=>y.value.form.event.visibleScript=O),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"动态标题",help:y.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.titleScript,"onUpdate:modelValue":u[22]||(u[22]=O=>y.value.form.event.titleScript=O),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"]]),Ba=["src"],Na=["src"],Va=ee(i.defineComponent({__name:"btn",props:{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 t=Fe(),n=a,l=Y.useSession();i.watch(()=>n.widget?.event,()=>{s()}),i.onMounted(()=>{s()});const o=i.ref({});function s(){n.widget?.event&&(n.widget.event.clickScript?o.value.click=new Function("ctx","btn","event",n.widget.event.clickScript):n.widget.event.click&&(o.value.click=n.widget.event.click),n.widget.event.disableScript?o.value.disable=new Function("ctx","btn",n.widget.event.disableScript):n.widget.event.disable&&(o.value.disable=n.widget.event.disable),n.widget.event.visibleScript?o.value.visible=new Function("ctx","btn",n.widget.event.visibleScript):n.widget.event.visible&&(o.value.visible=n.widget.event.visible),n.widget.event.titleScript?o.value.title=new Function("ctx","btn",n.widget.event.titleScript):n.widget.event.title&&(o.value.title=n.widget.event.title)),typeof n.widget.click=="function"&&(o.value.click=n.widget.click),typeof n.widget.title=="function"&&(o.value.title=n.widget.title),typeof n.widget.visible=="function"&&(o.value.visible=n.widget.visible),typeof n.widget.disabled=="function"&&(o.value.disable=n.widget.disabled)}const r=i.computed(()=>o.value.title?o.value.title(p.value,n.widget):n.widget.title),c=i.computed(()=>o.value.visible?o.value.visible(p.value,n.widget)!=!1:n.widget.visible!=!1),h=i.computed(()=>n.disabled==!0?!0:o.value.disable?o.value.disable(p.value,n.widget):n.widget.disable==!0),f=i.ref(null);function d(){f.value?.open(n.widget,k=>{console.log("btn props",k),Object.keys(k).forEach(u=>{n.widget[u]=k[u]}),console.log("props btn",n.widget)})}const p=i.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),m=i.ref({open:!1}),b=i.computed(()=>{if(n.widget.action?.href){let k=n.widget.action.href;const u=k.matchAll("{[a-zA-Z.]*}"),N=[];let M=null;for(;M=u.next();){if(M&&M.value&&M.value[0]){let v=M.value[0].substring(1,M.value[0].length-1);N.includes(v)||N.push(v)}if(M.done)break}if(N.length>0)for(let v=0;v<N.length;v++){let C=N[v],B=Y.utils.obj.getValue(p.value,C);B?B instanceof Object?k=k.replaceAll("{"+C+"}",JSON.stringify(B)):Array.isArray(B)?k=k.replaceAll("{"+C+"}",B.join(",")):k=k.replaceAll("{"+C+"}",B):k=k.replaceAll("{"+C+"}","")}return k}return""}),y=i.computed(()=>{const k={};let u=n.widget.action?.href||n.widget.action?.link;if(u){const N=u.matchAll("{[a-zA-Z0-9.]*}"),M=[];let v=null;for(;v=N.next();){if(v&&v.value&&v.value[0]){let B=v.value[0].substring(1,v.value[0].length-1);M.includes(B)||M.push(B)}if(v.done)break}if(M.length>0)for(let B=0;B<M.length;B++){let E=M[B],g=Y.utils.obj.getValue(p.value,E);g?g instanceof Object?u=u.replaceAll("{"+E+"}",JSON.stringify(g)):Array.isArray(g)?u=u.replaceAll("{"+E+"}",g.join(",")):u=u.replaceAll("{"+E+"}",g):u=u.replaceAll("{"+E+"}","")}const C=u.split("?")[1];C&&C.split("&").forEach(B=>{const E=B.split("=");E[0]&&E[1]&&(k[E[0]]=E[1])})}return n.widget.action?.params&&n.widget.action.params.filter(N=>N.value+"").forEach(N=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(N.value)){let v=Y.utils.obj.getValue(p.value,N.value);k[N.name]=v}else k[N.name]=N.value}),k}),A=e,x=i.inject("router");function w(k){if(t.isDebug&&console.log("unione btn click",n.widget,k),!(o.value.click&&o.value.click(p.value,n.widget,k)==!1)){if(n.widget.action?.type=="drawer"||n.widget.action?.type=="dialog")m.value.open=!0;else if(n.widget.action?.type=="route"&&(n.widget.action?.href||n.widget.action?.link)){if(n.widget.action.link&&n.editor?.type.value=="code")return;x.push({path:n.widget.action.href||n.widget.action?.link,query:y.value})}A("click",{btn:n.widget,event:k})}}function R(k){A("click",k)}return(k,u)=>{const N=i.resolveComponent("a-button"),M=i.resolveComponent("unione-btn"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-drawer"),B=i.resolveComponent("a-modal");return c.value?(i.openBlock(),i.createBlock(lt,{key:0,class:i.normalizeClass(["unione-btn",a.widget.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:d,custome:!0,"setting-title":"按钮设置"},{default:i.withCtx(()=>[!a.widget.widget||a.widget.widget=="button"?(i.openBlock(),i.createBlock(N,i.mergeProps({key:0,disabled:h.value,size:a.widget.size||"small",type:a.type||a.widget.type,shape:a.widget.shape,class:"unione-btn-"+a.widget.name,loading:a.widget.loading,target:a.widget.action?.target,title:a.widget.tooltip,onClick:w},a.widget.props),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value)+" ",1)]),_:2},[a.widget.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):i.createCommentVNode("",!0),a.widget.widget=="dropdown"?(i.openBlock(),i.createBlock(v,{key:1,trigger:[a.widget.trigger||"hover"],class:i.normalizeClass([a.widget.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["dropdown-overlay",a.widget.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.widget.items,E=>(i.openBlock(),i.createBlock(M,{key:E.name,class:"item",widget:E,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:R},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode(N,{size:a.widget.size||"small"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):i.createCommentVNode("",!0),a.widget.action?.type=="drawer"?(i.openBlock(),i.createBlock(C,{key:2,open:m.value.open,"onUpdate:open":u[0]||(u[0]=E=>m.value.open=E),title:a.widget.action?.title,placement:a.widget.action?.position,maskClosable:a.widget.action?.maskClosable,width:a.widget.action?.width,bodyStyle:{padding:0,overflow:!a.widget.action.component||a.widget.action.component=="iframe"?"hidden":"auto"}},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,Ba)):i.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):i.createCommentVNode("",!0),a.widget.action?.type=="dialog"?(i.openBlock(),i.createBlock(B,{key:3,open:m.value.open,"onUpdate:open":u[1]||(u[1]=E=>m.value.open=E),title:a.widget.action?.title,width:a.widget.action?.width,maskClosable:a.widget.action?.maskClosable,centered:"",footer:null},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:i.normalizeStyle({height:a.widget.action?.height?a.widget.action?.height+"px":""})},null,12,Na)):i.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):i.createCommentVNode("",!0),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):i.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b868da76"]]),Ra={key:0,class:"unione-widget-empty-tip"},Ea=ee(i.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,t=i.ref(),n=i.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=i.resolveComponent("a-tab-pane"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:i.withCtx(()=>[n.value?(i.openBlock(),i.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":o[0]||(o[0]=c=>t.value=c)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.chidlren,(c,h)=>(i.openBlock(),i.createBlock(s,{key:h,class:"unione-layout-tab-pane"},{tab:i.withCtx(()=>[i.createElementVNode("span",null,[c.icon?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.icon),{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(c.title),1)])]),default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.chidlren,(f,d)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(f.widget),{key:d,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(i.openBlock(),i.createElementBlock("div",Ra,i.toDisplayString(c.emptyTips),1)):i.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):i.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Oa={class:"title"},Ma={class:"text"},Ta={key:0,class:"reactive"},Ia={key:1,class:"opts"},Fa={class:"warp"},Da=ee(i.defineComponent({__name:"section",props:i.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,t=i.computed(()=>e.editor?.widget(e.wid)||e.widget),n=i.computed(()=>t.value?.title||e.title),l=i.computed(()=>t.value?.icon||e.icon),o=i.computed(()=>t.value?.type||e.type),s=i.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,h)=>(i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[i.createElementVNode("div",Oa,[o.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["type",o.value])},null,2)):i.createCommentVNode("",!0),l.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value),{key:1,class:"icon"})):i.createCommentVNode("",!0),i.createElementVNode("span",Ma,i.toDisplayString(n.value),1)]),a.reactive?(i.openBlock(),i.createElementBlock("div",Ta,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):i.createCommentVNode("",!0),a.location=="left"?(i.openBlock(),i.createElementBlock("div",Ia,[i.renderSlot(c.$slots,"opts",{},void 0,!0)])):i.createCommentVNode("",!0)],2),i.withDirectives(i.createElementVNode("div",Fa,[i.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[i.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),_a={class:"unione-props-setting unione-form-setting"},Pa={class:"unione-form-btns"},$a={key:0},La=["onClick"],Ua={class:"field-txt"},za=["onClick"],ja={key:1,class:"field-txt"},qa=["onClick"],Qa={key:0,class:"field-txt"},Wa={key:3,class:"edit-field"},Ya={key:0},Ha=["onClick"],Ka=ee(i.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.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=i.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=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{const v=n.value.configs.settings.btns,C=v.map(B=>B.name);if(!C.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};v.splice(B.index,0,B)}if(!C.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let E=B.index||1;v.splice(E,0,B)}if(!C.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};v.splice(B.index,0,B)}if(!C.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};v.splice(B.index,0,B)}return v}),s=i.ref(null);function r(v){s.value&&s.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.settings.btns.sort((B,E)=>{const g=B.index||1,S=E.index||1;return g-S}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const v=n.value.configs.settings.btns.length+1;let C={title:"新增",name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C.name="new_"+n.value.configs.settings.btns.length;const B=n.value.configs.settings.btns.filter(E=>E.name==C.name).length;B>0&&(C.name=C.name+B),n.value.configs.settings.btns.push(C),e.editor.widget(e.wid,n.value),s.value.open(C,E=>{Object.keys(E).forEach(g=>{C[g]=E[g]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(v){const C=()=>{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(E=>{E.name!=v.name&&B.push(E)}),n.value.configs.settings.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{C()}})}const f=i.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 C=f.value.widgets.filter(B=>B.value==v);return C[0]?C[0].label:v},toSetting:()=>{}}),d=i.ref({visible:!1,field:{},props:{},showInfo:v=>{let C="";return v.rules&&(C=v.rules.filter(B=>B.enable).length||""),C&&(C="("+C+")"),C},toSetting:()=>{const v=d.value.props,C={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(C.min=v.rangeMin,C.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(C.max=v.rangeMax,C.enable=!0);const B={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(B.pattern=v.regExpress,B.enable=!0),d.value.field.rules=[C,B],d.value.visible=!1,d.value.props={},console.log("rule",d.value.field.rules)}});function p(v){d.value.visible=!0,d.value.field=v;const C=v.rules||[],B={trigger:"change",whitespace:!0};C.forEach(E=>{E.name=="reg"&&(B.trigger=E.trigger,B.whitespace=E.whitespace,B.regExpress=E.pattern,B.regMessage=E.message),E.name=="range"&&(B.rangeMin=E.min,B.rangeMax=E.max,B.rangeMessage=E.message)}),d.value.props=B}const m=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(v,C){const B=w.value.filter(g=>g.name==v.name);B.forEach(g=>{C!="isSort"?g[C]=!0:g[C]=!g[C]});const E=B[0];if(!(!E||C=="isSort")){switch(m.value.prop=C,m.value.field=v,E.show||(E.show={}),C){case"isQuery":E.show.query||(E.show.query={}),m.value.show=E.show.query,m.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":E.show.form||(E.show.form={}),m.value.show=E.show.form,m.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":E.show.view||(E.show.view={}),m.value.show=E.show.view,m.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":E.show.list||(E.show.list={}),m.value.show=E.show.list,m.value.title=`列头设置/${v.title}(${v.name})`;break}m.value.visible=!0}}const y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(v,C)=>{y.value.convert.options.splice(v,1)},toSetting:()=>{y.value.visible=!1}});function A(v){y.value.visible=!0,y.value.field=v,y.value.convert=v.convert||{}}const x=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),w=i.computed(()=>x.value.fields?.length?x.value.fields:[]),R={mounted:v=>v.focus()},k=i.ref({});function u(v,C){const B={};C=="convertName"?B[C]=v.convert?.type:B[C]=v[C]||"",k.value={},k.value[v.name]=B}function N(v,C){{k.value={};return}}function M(v,C){w.value.filter(E=>E.name==v.name).forEach(E=>{E[C]=!E[C]})}return(v,C)=>{const B=i.resolveComponent("a-divider"),E=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),I=i.resolveComponent("a-select"),V=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-checkbox"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-select-option"),Q=i.resolveComponent("a-form-item"),L=i.resolveComponent("a-form"),O=i.resolveComponent("a-modal"),G=i.resolveComponent("a-checkbox-group"),T=i.resolveComponent("a-input-number"),_=i.resolveComponent("a-input"),q=i.resolveComponent("a-col"),U=i.resolveComponent("a-row");return i.openBlock(),i.createElementBlock("div",_a,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[23]||(C[23]=[i.createTextVNode("按钮设置")])),_:1}),i.createElementVNode("div",Pa,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,P=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:P.name,class:["btn",P.name,!P.visible&&"deleted"],type:P.visible?P.type:"default",size:P.size,ref_for:!0},P.props||{},{onClick:re=>r(P)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(P.title)+" ",1),P.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"btn-del",onClick:i.withModifiers(re=>h(P),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[P.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(P.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),size:"small",onClick:C[0]||(C[0]=P=>c())},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[24]||(C[24]=[i.createTextVNode("表单设置")])),_:1}),C[36]||(C[36]=i.createTextVNode(" 数据模型:")),i.createVNode(I,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[1]||(C[1]=P=>n.value.dataModel=P)},null,8,["options","value"]),i.createVNode($,{columns:t.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:P})=>[["widget","rules","convertName"].includes(P.key)?(i.openBlock(),i.createElementBlock("span",$a,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(P.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:P,text:re,record:H})=>[["rules"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!d.value.showInfo(H)&&"empty"]),onClick:pe=>p(H)},[i.createElementVNode("span",Ua,i.toDisplayString(d.value.showInfo(H)),1),d.value.showInfo(H)?(i.openBlock(),i.createBlock(g,{key:0,type:"link"},{default:i.withCtx(()=>C[25]||(C[25]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,La)):["widget"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!k.value[H.name]||!Object.keys(k.value[H.name]).includes(P.dataIndex))&&!re&&"empty"]),onClick:pe=>u(H,P.dataIndex)},[k.value[H.name]&&Object.keys(k.value[H.name]).includes(P.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(I,{key:0,value:H[P.dataIndex],"onUpdate:value":pe=>H[P.dataIndex]=pe,options:f.value.widgets,onBlur:C[2]||(C[2]=pe=>N())},null,8,["value","onUpdate:value","options"])),[[R]]):(i.openBlock(),i.createElementBlock("span",ja,i.toDisplayString(f.value.widgetName(re)),1))],10,za)):["convertName"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!k.value[H.name]||!Object.keys(k.value[H.name]).includes(P.dataIndex))&&!H.convert?.type&&"empty"]),onClick:pe=>u(H,P.dataIndex)},[k.value[H.name]&&Object.keys(k.value[H.name]).includes(P.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(I,{key:0,value:H[P.dataIndex],"onUpdate:value":pe=>H[P.dataIndex]=pe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:C[3]||(C[3]=pe=>N())},null,8,["value","onUpdate:value"])),[[R]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[H.convert?.type?(i.openBlock(),i.createElementBlock("span",Qa,i.toDisplayString(H.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),H.convert?.type?(i.openBlock(),i.createBlock(g,{key:1,type:"link",onClick:i.withModifiers(pe=>A(H),["stop"])},{default:i.withCtx(()=>C[26]||(C[26]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,qa)):["isForm","isView"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",Wa,[i.createVNode(F,{checked:H[P.dataIndex],onClick:pe=>M(H,P.dataIndex)},null,8,["checked","onClick"]),i.createVNode(g,{type:"link",onClick:pe=>b(H,P.dataIndex)},{default:i.withCtx(()=>C[27]||(C[27]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(O,{visible:f.value.visible,"onUpdate:visible":C[5]||(C[5]=P=>f.value.visible=P),title:"控件设置",onOk:f.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[f.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(Q,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(I,{value:f.value.props.mode,"onUpdate:value":C[4]||(C[4]=P=>f.value.props.mode=P),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(D,{value:"multiple"},{default:i.withCtx(()=>C[28]||(C[28]=[i.createTextVNode("多选")])),_:1}),i.createVNode(D,{value:"tags"},{default:i.withCtx(()=>C[29]||(C[29]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(O,{visible:d.value.visible,"onUpdate:visible":C[13]||(C[13]=P=>d.value.visible=P),title:"规则设置",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:d.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[30]||(C[30]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(Q,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(G,{value:d.value.props.trigger,"onUpdate:value":C[6]||(C[6]=P=>d.value.props.trigger=P),options:["change","blur"]},null,8,["value"])]),_:1}),d.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(F,{value:d.value.props.whitespace,"onUpdate:value":C[7]||(C[7]=P=>d.value.props.whitespace=P),checked:d.value.props.whitespace},{default:i.withCtx(()=>C[31]||(C[31]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[32]||(C[32]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(Q,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(T,{value:d.value.props.rangeMin,"onUpdate:value":C[8]||(C[8]=P=>d.value.props.rangeMin=P)},null,8,["value"]),C[33]||(C[33]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(T,{value:d.value.props.rangeMax,"onUpdate:value":C[9]||(C[9]=P=>d.value.props.rangeMax=P)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.rangeMessage,"onUpdate:value":C[10]||(C[10]=P=>d.value.props.rangeMessage=P)},null,8,["value"])]),_:1}),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[34]||(C[34]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(Q,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regExpress,"onUpdate:value":C[11]||(C[11]=P=>d.value.props.regExpress=P)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regMessage,"onUpdate:value":C[12]||(C[12]=P=>d.value.props.regMessage=P)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(O,{visible:m.value.visible,"onUpdate:visible":C[20]||(C[20]=P=>m.value.visible=P),title:m.value.title,onOk:m.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(Q,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(T,{value:m.value.show.index,"onUpdate:value":C[14]||(C[14]=P=>m.value.show.index=P)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.width,"onUpdate:value":C[15]||(C[15]=P=>m.value.show.width=P)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.labelWidth,"onUpdate:value":C[16]||(C[16]=P=>m.value.show.labelWidth=P)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.valueWidth,"onUpdate:value":C[17]||(C[17]=P=>m.value.show.valueWidth=P)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(I,{value:m.value.show.fixed,"onUpdate:value":C[18]||(C[18]=P=>m.value.show.fixed=P),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(I,{value:m.value.show.align,"onUpdate:value":C[19]||(C[19]=P=>m.value.show.align=P),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(O,{visible:y.value.visible,"onUpdate:visible":C[22]||(C[22]=P=>y.value.visible=P),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",Ya,[i.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>C[35]||(C[35]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode($,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:P,record:re,index:H})=>[P.dataIndex==="label"?(i.openBlock(),i.createBlock(_,{key:0,value:re.label,"onUpdate:value":pe=>re.label=pe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),P.dataIndex==="value"?(i.openBlock(),i.createBlock(_,{key:1,value:re.value,"onUpdate:value":pe=>re.value=pe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),P.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:pe=>y.value.toDelOption(H,re)},"删除",8,Ha)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(L,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(U,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(q,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(Q,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(_,{value:y.value.convert.dict,"onUpdate:value":C[21]||(C[21]=P=>y.value.convert.dict=P)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Ga=ee(i.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const t=a,n=i.ref(!1),l=i.ref(),o=i.ref({}),s=i.ref(null);i.onMounted(()=>{if(c.value.dsn){const w=r.value.dataManager();c.value.primary&&w.psn(c.value.dsn),s.value.setDisabled=x,s.value.getValue=p,s.value.setValue=m,s.value.reset=b,l.value=w.useForm(c.value.dsn,s.value,R=>{o.value=R.body||{}})}t.editor||r.value.loadConfig({widgets:h.value}),t.form?.model&&r.value.setModel(t.form.model),y()});const r=i.computed(()=>t.editor||new ut),c=i.computed(()=>t.widget||t.form||{}),h=i.computed(()=>{let w=c.value.widgets||[];return!w.length&&t.form?.fields&&(w=t.form.fields),w.forEach(R=>{R.widget||(R.widget="unione-form-item"),R.control||(R.control="a-input")}),w}),f=i.inject("pageSetting",{}),d=i.computed(()=>c.value.setting||f?.form||{});i.provide("formSetting",d.value);function p(){return o.value}function m(w){o.value=w,y()}function b(){o.value={},y()}function y(){const w=R=>{R.widget=="unione-form-item"&&R.name&&(R.value!=null&&R.value!=null&&R.value!=""||R.value==0)&&(o.value[R.name]==null||o.value[R.name]==null||o.value[R.name]=="")&&(o.value[R.name]=R.value),R.widgets?.forEach(k=>{w(k)})};h.value.forEach(R=>{w(R)})}function A(){return s.value.validate()}function x(w=!0){n.value=w}return e({validate:A,getValue:p,setValue:m,reset:b,setDisabled:x}),(w,R)=>{const k=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},i.createSlots({default:i.withCtx(()=>[i.createVNode(k,{ref_key:"formObj",ref:s,model:o.value,class:i.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(d.value.showColumn||3)])},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(u,N)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(u.widget),{key:N,widget:u,editor:r.value,value:o.value[u.name],"onUpdate:value":M=>o.value[u.name]=M,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[a.editor&&c.value.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Ka,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-cecc4588"]]);function Cl(a,e=!1){const t=Fe();if(!a)return Promise.reject("字典名称不能为空");const n=localStorage.getItem("UNIONE-DICT-"+a);return n&&e==!1?Promise.resolve(JSON.parse(n)):(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{Y.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 t.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function vl(a,e){const t=Fe();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Cl(a),l=n.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",n),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function Ja(a,e){const t=await vl(a,e);return Promise.resolve(t.dictValue)}const Sl={load:Cl,getLabel:Ja,getOption:vl};class Ge{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=Fe()}load(e,t=!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}Sl.load(this.convertObj.dictName,t).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;Y.axios.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(h=>h.value==e).length?n(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,Y.axios.admin({url:s,data:o,method:"POST"}).then(h=>{if(h.success){const f={};this.options.forEach(d=>{f[e]=!0}),h.body.forEach(d=>{f[d.value]||this.options.push(d)}),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?Sl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(n=>n.value==e);return t.length?Promise.resolve(t[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 t=this.options.filter(n=>n.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,n)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return t(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;Y.axios.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 t={...this.convertObj.params||{}};return new Promise(n=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:l,data:{body:{...t,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),n(o.body)):n([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField||"id"],t.label=t[this.convertObj.labelField||"title"]}),e}}function pt(a,e=350){let t=null;return n=>{clearTimeout(t),t=setTimeout(()=>{a(n)},e)}}const Xa=["innerHTML"],Za={key:2,class:"text-view"},er=ee(i.defineComponent({__name:"formItem",props:i.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,t=i.useModel(a,"value"),n=i.computed(()=>o.value.showFormat?o.value.showFormat.call(this,t.value,{label:A.value,form:e.formValue}):A.value||t.value),l=i.inject("formSetting");i.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")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const o=i.ref({}),s=i.computed(()=>{const x=e.editor?.widget(e.wid)||e.widget||{};return x.event&&Object.keys(x.event).forEach(w=>{const R=x.event[w];R&&(o.value[w]=null,typeof R=="function"?o.value[w]=R:R.enable&&R.scriptText&&(o.value[w]=new Function("value","ctx",R.scriptText)))}),x}),r=i.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=i.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),h=pt(()=>{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)}),f=i.ref({}),d=i.computed(()=>{const x=[],w=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&&x.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||l.ruleTrigger||"change",validator:(k,u)=>(w?.whitespace&&u&&typeof u=="string"&&(u=u.trim()),u!=null&&u!=null&&(u+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),w.advance&&f.value[w.advance]){const k=f.value[w.advance];x.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"})}return w.regExpress&&x.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&x.push({validator:(k,u)=>u&&(u+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(u+"").length+"]"):Promise.resolve(),trigger:w?.trigger||l.ruleTrigger||"change"}),x}),p=i.computed(()=>{const x=s.value.props||{};if(s.value.control=="a-input-number"){const w=s.value.rule||{};w.rangeMin!=null&&w.rangeMin!=null&&(x.min=w.rangeMin),w.rangeMax!=null&&w.rangeMax!=null&&(x.max=w.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(x.format=s.value.view.dataFormat,x.valueFormat=s.value.view.dataFormat),s.value.required&&(x.required=s.value.required),x}),m=i.computed(()=>{const x=s.value.css||{},w=["form-item-"+s.value.name];return x.cssName&&w.push(x.cssName),l.platform=="app"?x.cssName?typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0&&w.push("all-line"):w.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!x.cssName||typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0)&&w.push("all-line"):s.value.view.width==2&&w.push("2in-line")),w}),b=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&x>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(w/x)}:s.value.view?.width>=3&&x>1?{span:Math.round(w/x)}:{span:w}}),y=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&x>1&&m.value.includes("all-line")?{}:{span:w}}),A=i.ref();return i.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ge(s.value.convert).convert(t.value.toString()).then(x=>{A.value=x})}),(x,w)=>{const R=i.resolveComponent("a-form-item");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-form-item",m.value]),style:i.normalizeStyle(s.value.css?.cssText)},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createBlock(R,{key:0,label:c.value,name:s.value.name,labelCol:b.value,wrapperCol:y.value,required:s.value.props?.required,rules:d.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:i.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value.control||"a-input"),i.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:i.unref(h),value:t.value,"onUpdate:value":w[0]||(w[0]=k=>t.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"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:n.value},null,8,Xa)):(i.openBlock(),i.createElementBlock("div",Za,i.toDisplayString(n.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):i.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),tr=ee(i.defineComponent({__name:"selectBox",props:i.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){Fe();const e=a,t=i.ref(),n=i.useModel(a,"value"),l=i.ref([]),o=i.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=i.computed(()=>{const b=p.value.convert||e.convert||{};if(b.refValue){const y={};return b.refValue.split(",").forEach(x=>{const w=x.split("=");w.length==1?y[w[0]]=Y.utils.obj.getValue(e.formValue,w[0]):y[w[0]]=Y.utils.obj.getValue(e.formValue,w[1])}),y}return{}}),r=i.computed(()=>(p.value.convert||e.convert||{}).search||!1),c=pt(b=>{const y=p.value.convert||e.convert||{};y.params={...f.value,...s.value},m.value.search(b).then(A=>{l.value=A})},500);function h(b,y){d.value.select&&d.value.select(b,{option:y,formValue:e.formValue})}const f=i.ref();i.onMounted(()=>{const b=p.value.convert||e.convert||{};f.value=b.params||{},b.params={...f.value,...s.value},e.mode=="multiple"&&typeof n.value=="string"&&(t.value=n.value.split(",")),m.value.load(n.value).then(y=>{l.value=y})});const d=i.ref({}),p=i.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(y=>{const A=b.event[y];A&&(d.value[y]=null,typeof A=="function"?d.value[y]=A:A.enable&&A.scriptText&&(d.value[y]=new Function("value","ctx",A.scriptText)))}),b}),m=i.computed(()=>{const b=p.value.convert||e.convert||{};return new Ge(b)});return i.watch(n,pt(()=>{n.value&&(e.mode=="multiple"&&typeof n.value=="string"&&(t.value=n.value.split(",")),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(n.value).then(b=>{l.value=b}))},200)),i.watch(()=>p.value.convert||e.convert||{},pt(()=>{m.value.load().then(b=>{l.value=b})})),i.watch(()=>s.value,pt(()=>{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={...f.value,...s.value},m.value.load(n.value,!0).then(y=>{l.value=y})}},200),{deep:!0}),i.watch(t,()=>{Array.isArray(t.value)&&e.valueType=="string"?n.value=t.value.join(","):n.value=t.value}),(b,y)=>{const A=i.resolveComponent("a-select");return i.openBlock(),i.createBlock(A,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:t.value,"onUpdate:value":y[0]||(y[0]=x=>t.value=x),onSearch:i.unref(c),onSelect:h},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-f4706b5f"]]),ir=ee(i.defineComponent({__name:"switchBox",props:i.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,t=i.useModel(a,"value"),n=i.ref({});i.onMounted(()=>{s.value?.load(t.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=i.ref({}),o=i.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(c=>{const h=r.event[c];h&&(l.value[c]=null,typeof h=="function"?l.value[c]=h:h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText)))}),r}),s=i.computed(()=>{const r=o.value.convert||e.convert;return r?new Ge(r):null});return(r,c)=>{const h=i.resolveComponent("a-switch");return i.openBlock(),i.createBlock(h,i.mergeProps({class:"unione-form-switch"},n.value,{checked:t.value,"onUpdate:checked":c[0]||(c[0]=f=>t.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),nr=ee(i.defineComponent({__name:"radioBox",props:i.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,t=i.useModel(a,"value"),n=i.ref([]),l=i.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=i.computed(()=>{const f=c.value.convert||e.convert||{};if(f.refValue){const d={};return f.refValue.split(",").forEach(m=>{const b=m.split("=");b.length==1?d[b[0]]=Y.utils.obj.getValue(e.formValue,b[0]):d[b[0]]=Y.utils.obj.getValue(e.formValue,b[1])}),console.log(c.value.name+" ref field:"+f.refValue+",ref value",d),d}return{}}),s=i.ref();i.onMounted(()=>{const f=c.value.convert||e.convert||{};s.value=f.params||{},f.params={...s.value,...o.value},h.value.load(t.value||c.value.value).then(d=>{n.value=d})});const r=i.ref({}),c=i.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(d=>{const p=f.event[d];p&&(r.value[d]=null,typeof p=="function"?r.value[d]=p:p.enable&&p.scriptText&&(r.value[d]=new Function("value","ctx",p.scriptText)))}),f}),h=i.computed(()=>{const f=c.value.convert||e.convert||{};return new Ge(f)});return i.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const f=c.value.convert||e.convert||{};f.params={...s.value,...o.value},h.value.load(void 0,!0).then(d=>{n.value=d})}},{deep:!0}),(f,d)=>{const p=i.resolveComponent("a-radio-group");return i.openBlock(),i.createBlock(p,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":d[0]||(d[0]=m=>t.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),lr=ee(i.defineComponent({__name:"checkBox",props:i.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:i.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const t=a,n=i.useModel(a,"value"),l=i.ref(),o=i.ref([]),s=i.computed(()=>o.value?.length?o.value:t.options?.length?t.options:[]),r=i.computed(()=>{const b=f.value.convert||t.convert||{};if(b.refValue){const y={};return b.refValue.split(",").forEach(x=>{const w=x.split("=");w.length==1?y[w[0]]=Y.utils.obj.getValue(t.formValue,w[0]):y[w[0]]=Y.utils.obj.getValue(t.formValue,w[1])}),console.log(f.value.name+" ref field:"+b.refValue+",ref value",y),y}return{}}),c=i.ref();i.onMounted(()=>{const b=n.value||f.value.value;t.returnType==="string"?l.value=b.split(","):l.value=b;const y=f.value.convert||t.convert||{};c.value=y.params||{},y.params={...c.value,...r.value},m.value.load().then(A=>{o.value=A})});const h=i.ref({}),f=i.computed(()=>{const b=t.editor?.widget(t.wid)||t.widget||{};return b.event&&Object.keys(b.event).forEach(y=>{const A=b.event[y];h.value[y]=null,A.enable&&A.scriptText&&(h.value[y]=new Function("value","ctx",A.scriptText))}),b}),d=e;function p(b){t.returnType==="string"?n.value=b.join(","):n.value=b,console.log("checkbox changed",n.value),d("change",n.value)}const m=i.computed(()=>{const b=f.value.convert||t.convert||{};return new Ge(b)});return i.watch(()=>n.value,()=>{l.value=Array.isArray(n.value)?n.value:[],n.value&&!Array.isArray(n.value)&&(l.value=n.value.split(","))}),i.watch(()=>r.value,()=>{if(console.log(f.value.name+" ref value changed",r.value),r.value){l.value=[],t.returnType==="string"?n.value="":n.value=[];const b=f.value.convert||t.convert||{};b.params={...c.value,...r.value},m.value.load(void 0,!0).then(y=>{o.value=y})}},{deep:!0}),(b,y)=>{const A=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createBlock(A,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":y[0]||(y[0]=x=>l.value=x),onChange:p},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),or=ee(i.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=i.ref(),t=i.useModel(a,"value");return i.watch(()=>e.value,()=>{e.value?t.value=Y.utils.sm2Encrypt(e.value):t.value=""}),(n,l)=>{const o=i.resolveComponent("a-input-password");return i.openBlock(),i.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 sn(a){const e=a.toLowerCase().split("_"),t=[];t.push(e[0]);for(let n=1;n<e.length;n++){const l=e[n];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const Bl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Nl(a=10){const e=Date.now().toString(),t=new Uint32Array(a);crypto.getRandomValues(t);let n="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+t[l])%Bl.length;n+=Bl[o]}return n}const sr={toHump:sn,randomStr:Nl},ar=ee(i.defineComponent({__name:"randomInput",props:i.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,t=i.useModel(a,"value");function n(){t.value=Nl(e.len)}return(l,o)=>{const s=i.resolveComponent("SyncOutlined"),r=i.resolveComponent("a-input");return i.openBlock(),i.createBlock(r,{class:"unione-form-random-input",value:t.value,"onUpdate:value":o[0]||(o[0]=c=>t.value=c)},{suffix:i.withCtx(()=>[i.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:n})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),rr={class:"unione-props-setting unione-query-setting"},cr={class:"unione-query-opts"},dr={key:0},hr=["onClick"],fr={key:1},ur={key:1,class:"edit-field"},pr=["onClick"],mr=ee(i.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.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=i.computed(()=>{const R=e.editor.widget(e.wid)||{};return R.configs||(R.configs={}),R.configs.btns||(R.configs.btns=[]),R}),l=i.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=i.computed(()=>{const R=[],k=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(u=>{R.push(u),k.push(u.name)}),k.includes("query")||R.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||R.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||R.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),R.sort((u,N)=>{const M=u.index||1,v=N.index||1;return M-v}),R}),s=i.ref(null);function r(R){s.value&&s.value.open(R,k=>{k.visible=!0,Object.keys(k).forEach(u=>{R[u]=k[u]}),n.value.configs.btns.sort((u,N)=>{const M=u.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 k={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(k),e.editor.widget(e.wid,n.value),s.value.open(k,u=>{Object.keys(u).forEach(N=>{k[N]=u[N]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(R){const k=()=>{if(["query","reset","advanced"].includes(R.name))R.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const u=[];n.value.configs.btns.forEach(N=>{N.name!=R.name&&u.push(N)}),n.value.configs.btns=u}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const f=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),d=i.computed(()=>f.value.fields?.length?f.value.fields:[]),p={mounted:R=>R.focus()},m=i.ref({});function b(){const R=Object.keys(m.value);if(R.length)for(let k in R){const u=d.value.filter(N=>N.name==k);if(u&&u[0]){let N=m.value[k];Object.keys(N).forEach(M=>{if(M=="showIndex"){const v=u[0].show?.query||{};u[0].show||(u[0].show={}),u[0].show.query={...v,index:N[M]}}else u[0][M]=N[M]})}}m.value={}}function y(R,k){b();const u={};u[k]=R[k]||"",k=="showIndex"&&(u[k]=R.show?.query?.index),m.value[R.name]=u}function A(R,k){if(!R||!k){m.value={};return}const u=m.value[R.name][k];if(k=="showIndex"){const N=R.show?.query||{};R.show||(R.show={}),R.show.query={...N,index:u}}else R[k]=u;m.value={}}function x(R,k){d.value.filter(N=>N.name==R.name).forEach(N=>{N[k]=!N[k]})}const w=i.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 k=w.value.options.filter(u=>u.value==R);return k[0]?k[0].label:R}});return(R,k)=>{const u=i.resolveComponent("a-divider"),N=i.resolveComponent("CloseOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("PlusOutlined"),C=i.resolveComponent("a-select"),B=i.resolveComponent("ToolOutlined"),E=i.resolveComponent("a-checkbox"),g=i.resolveComponent("a-input-number"),S=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",rr,[i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[3]||(k[3]=[i.createTextVNode("查询按钮")])),_:1}),i.createElementVNode("div",cr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,I=>(i.openBlock(),i.createBlock(M,i.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"default",ref_for:!0},I.props||{},{onClick:V=>r(I)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(I.title)+" ",1),I.visible?(i.openBlock(),i.createBlock(N,{key:0,class:"btn-del",onClick:i.withModifiers(V=>h(I),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(M,{class:i.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=I=>c()),size:"small"},{default:i.withCtx(()=>[i.createVNode(v)]),_:1})]),i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[4]||(k[4]=[i.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=i.createTextVNode(" 数据模型:")),i.createVNode(C,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":k[1]||(k[1]=I=>n.value.dataModel=I)},null,8,["options","value"]),i.createVNode(S,{columns:t.value,"data-source":d.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:I})=>[["showIndex","queryType"].includes(I.key)?(i.openBlock(),i.createElementBlock("span",dr,[i.createVNode(B),i.createTextVNode(" "+i.toDisplayString(I.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:I,text:V,record:F})=>[["queryType"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!V&&"empty"]),onClick:$=>y(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(C,{key:0,value:F[I.dataIndex],"onUpdate:value":$=>F[I.dataIndex]=$,allowClear:!0,options:w.value.options,onBlur:k[2]||(k[2]=$=>A())},null,8,["value","onUpdate:value","options"])),[[p]]):(i.openBlock(),i.createElementBlock("span",fr,i.toDisplayString(w.value.showLabel(V)),1))],10,hr)):["isQuery"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",ur,[i.createVNode(E,{checked:F[I.dataIndex],onClick:$=>x(F,I.dataIndex)},null,8,["checked","onClick"])])):I.dataIndex=="showIndex"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!V&&"empty"]),onClick:$=>y(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(g,{key:0,value:m.value[F.name][I.dataIndex],"onUpdate:value":$=>m.value[F.name][I.dataIndex]=$,onBlur:$=>A(F,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(F.show?.query?.index||" "),1)],64))],10,pr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),gr={class:"query-btn"},kr={class:"btn-advanced-overlay"},Vl=ee(i.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 t=a,n=i.computed(()=>{const A=t.editor?.widget(t.wid)||t.widget||{};return A.btns||(A.btns=[]),A}),l=i.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=i.computed(()=>{let A=[];return n.value.fields?.length&&(A=n.value.fields),A.length==0&&t.fields?.length&&(A=t.fields),A.sort((x,w)=>{const R=x.show?.query?.index||1,k=w.show?.query?.index||1;return R-k}),A.forEach(x=>{!x.widget&&!x.control&&x.convert&&(x.widget="unione-select-box"),x.widget=x.widget||x.control||"a-input",x.defaultValue!=null&&x.defaultValue!="undefined"&&typeof x.defaultValue<"u"&&(f.value[x.name]=x.defaultValue,x.value=x.defaultValue)}),A}),s=i.computed(()=>n.value.labelWidth||7),r=i.computed(()=>{const A=n.value.btns.filter(x=>x.name=="advanced")[0]||{};return A.event?.clickScript&&(A.event.click=new Function("ctx","btn","event",A.event.clickScript)),A.event?.disableScript&&(A.event.disable=new Function("ctx","btn",A.event.disableScript)),A.event?.visibleScript&&(A.event.visible=new Function("ctx","btn",A.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...A}}),c=["query","reset","advanced"],h=i.computed(()=>{const A=n.value.btns.filter(w=>w.name!="advanced"),x=[];return A.forEach(w=>{w.size||(w.size="default"),x.push(w.name)}),x.includes("query")||A.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||A.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),A.sort((w,R)=>{const k=w.index||1,u=R.index||1;return k-u}),A}),f=i.ref({}),d=i.computed(()=>{const A={};return n.value.params?Object.keys(n.value.params).forEach(x=>{A[x]=n.value.params[x]}):t.params&&Object.keys(t.params).forEach(x=>{A[x]=t.params[x]}),A});i.onMounted(()=>{t.editor?.ebus.$on("query-form-params",A=>{n.value.params=A}),b()});const p=e;function m({btn:A,event:x}){console.log("unione query form btn click",A,x),A.name=="query"&&b(),A.name=="reset"&&y(),p("btnClick",{btn:A,event:x})}function b(){const A=[];o.value.forEach(w=>{w.visible&&A.push(w.name)});const x={params:{...d.value},keywords:""};Object.keys(f.value).forEach(w=>{A.includes(w)&&(x.params[w]=f.value[w])}),l.value.visible&&f.value[l.value.name]&&(x.keywords=f.value[l.value.name]),p("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){f.value={},o.value.forEach(x=>{x.visible=!1});const A={params:{...d.value},keywords:""};p("reset",A),t.editor?.ebus.$emit("table-list-reset",A)}return(A,x)=>{const w=i.resolveComponent("a-input"),R=i.resolveComponent("a-form-item"),k=i.resolveComponent("unione-btn"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("DownOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},i.createSlots({default:i.withCtx(()=>[i.createVNode(C,{model:f.value,layout:"horizontal","label-col":{span:s.value}},{default:i.withCtx(()=>[l.value.visible?(i.openBlock(),i.createBlock(R,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:i.normalizeStyle({width:s.value})},{default:i.withCtx(()=>[i.createVNode(w,{placeholder:l.value.placeholder,value:f.value[l.value.name],"onUpdate:value":x[0]||(x[0]=B=>f.value[l.value.name]=B),allowClear:"",onKeyup:i.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible?(i.openBlock(),i.createBlock(R,{key:0,label:B.title,class:i.normalizeClass(["query-field",B.name]),style:i.normalizeStyle({width:s.value}),name:B.name},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(B.widget),i.mergeProps({placeholder:B.placeholder,value:f.value[B.name],"onUpdate:value":E=>f.value[B.name]=E,ref_for:!0},B.props||{},{allowClear:"",widget:B}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):i.createCommentVNode("",!0)],64))),128)),i.createElementVNode("div",gr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible!=!1?(i.openBlock(),i.createBlock(k,{key:0,widget:B,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(i.openBlock(),i.createBlock(v,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:i.withCtx(()=>[i.createElementVNode("div",kr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createBlock(u,{key:B.name,class:"item",checked:B.visible,onClick:E=>B.visible=!B.visible},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(B.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:i.withCtx(()=>[i.createVNode(M,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value.title)+" ",1),i.createVNode(N)]),_:1})]),_:1},8,["trigger"])):i.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(mr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),br={class:"unione-props-setting unione-table-setting"},yr={class:"unione-table-tools"},wr={key:1,class:"unione-table-opts"},Ar={key:0},xr=["onClick"],Cr={key:1,class:"edit-field"},vr=["onClick"],Sr={key:1},Br=ee(i.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.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,C){let B=v.filter(E=>E.value==C);return B&&B[0]&&B[0].label||C}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(v,C){let B=v.filter(E=>E.value==C);return B&&B[0]&&B[0].label||C}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=i.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=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.leftBtns;if(C.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"};C.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"};C.splice(1,0,B)}return C}),s=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.rightBtns;if(C.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"};C.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"};C.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"};C.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"};C.splice(3,0,B)}return C});function r(v,C){v=="left"?f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.leftBtns.sort((E,g)=>{const S=E.index||1,I=g.index||1;return S-I}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.rightBtns.sort((E,g)=>{const S=E.index||1,I=g.index||1;return S-I}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(v){const C=v=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let B={title:"新增"+C,name:"new_"+C,index:C,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 h(v,C){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(C.name))C.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 E=[];n.value.configs.leftBtns.forEach(g=>{g.name!=C.name&&E.push(g)}),n.value.configs.leftBtns=E}else{const E=[];n.value.configs.rightBtns.forEach(g=>{g.name!=C.name&&E.push(g)}),n.value.configs.rightBtns=E}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const f=i.ref(null);function d(v){f.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.operation.btns.sort((B,E)=>{const g=B.index||1,S=E.index||1;return g-S}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function p(){const v=n.value.configs.operation.btns.length+1;let C={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(C),e.editor.widget(e.wid,n.value),f.value.open(C,B=>{Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(v){const C=()=>{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(E=>{E.name!=v.name&&B.push(E)}),n.value.configs.operation.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{C()}})}const b=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),y=i.computed(()=>b.value.fields?.length?(b.value.fields.forEach(v=>{v.show||(v.show={}),v.show.list||(v.show.list={})}),b.value.fields):[]),A={mounted:v=>v.focus()},x=i.ref({});function w(){const v=Object.keys(x.value);if(v.length)for(let C in v){const B=y.value.filter(E=>E.name==C);if(B&&B[0]){let E=x.value[C];Object.keys(E).forEach(g=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),g=="showIndex"?B[0].show.list.index=E[g]:g=="showWidth"?B[0].show.list.width=E[g]:g=="fixed"?B[0].show.list.fixed=E[g]:g=="align"?B[0].show.list.align=E[g]:B[0][g]=E[g]})}}x.value={}}function R(v,C){w();const B={};C=="showIndex"?B[C]=v.show?.list?.index:C=="showWidth"?B[C]=v.show?.list?.width:C=="fixed"?B[C]=v.show?.list?.fixed:C=="align"?B[C]=v.show?.list?.align:B[C]=v[C]||"",x.value[v.name]=B}function k(v,C){if(!v||!C){x.value={};return}const B=x.value[v.name][C];v.show||(v.show={}),v.show.list||(v.show.list={}),C=="showIndex"?v.show.list.index=B:C=="showWidth"?v.show.list.width=B:C=="fixed"?v.show.list.fixed=B:C=="align"?v.show.list.align=B:v[C]=B,x.value={}}function u(v,C){return C=="showIndex"?v.show?.list?.index:C=="showWidth"?v.show?.list?.width:C=="fixed"?v.show?.list?.fixed:C=="align"?v.show?.list?.align:v[C]}function N(v,C){y.value.filter(E=>E.name==v.name).forEach(E=>{E[C]=!E[C]})}const M=i.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:v=>{const C=M.value.options.filter(B=>B.value==v);return C[0]?C[0].label:v}});return(v,C)=>{const B=i.resolveComponent("a-divider"),E=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),I=i.resolveComponent("a-input"),V=i.resolveComponent("a-form-item"),F=i.resolveComponent("a-col"),$=i.resolveComponent("a-input-number"),D=i.resolveComponent("a-checkbox"),Q=i.resolveComponent("a-row"),L=i.resolveComponent("a-select"),O=i.resolveComponent("ToolOutlined"),G=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",br,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[8]||(C[8]=[i.createTextVNode("工具设置")])),_:1}),i.createElementVNode("div",yr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:_=>r("left",T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("left",T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add"]),size:"small",onClick:C[0]||(C[0]=T=>c("left"))},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add","right"]),onClick:C[1]||(C[1]=T=>c("right")),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn","right",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:_=>r("right",T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("right",T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[9]||(C[9]=[i.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createBlock(Q,{key:0},{default:i.withCtx(()=>[i.createVNode(F,{span:7},{default:i.withCtx(()=>[i.createVNode(V,{label:"操作标题"},{default:i.withCtx(()=>[i.createVNode(I,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(V,{label:"显示宽度",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":C[2]||(C[2]=T=>n.value.configs.operation.width=T)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:6},{default:i.withCtx(()=>[i.createVNode(V,{label:"显示按钮数量",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":C[3]||(C[3]=T=>n.value.configs.operation.count=T)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(V,{label:"是否显示"},{default:i.withCtx(()=>[i.createVNode(D,{checked:n.value.configs.operation.visible,"onUpdate:checked":C[4]||(C[4]=T=>n.value.configs.operation.visible=T)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[10]||(C[10]=[i.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createElementBlock("div",wr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.configs.operation.btns,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"small",ref_for:!0},T.props||{},{onClick:_=>d(T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"btn-del",onClick:i.withModifiers(_=>m(T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),onClick:C[5]||(C[5]=T=>p()),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})])):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[11]||(C[11]=[i.createTextVNode("表头设置")])),_:1}),C[12]||(C[12]=i.createTextVNode(" 数据模型:")),i.createVNode(L,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[6]||(C[6]=T=>n.value.dataModel=T)},null,8,["options","value"]),i.createVNode(G,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:T})=>[["showIndex","showWidth","align","fixed"].includes(T.key)?(i.openBlock(),i.createElementBlock("span",Ar,[i.createVNode(O),i.createTextVNode(" "+i.toDisplayString(T.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:T,record:_})=>[["showIndex","showWidth"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(T.dataIndex))&&!u(_,T.dataIndex)&&"empty"]),onClick:q=>R(_,T.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock($,{key:0,value:x.value[_.name][T.dataIndex],"onUpdate:value":q=>x.value[_.name][T.dataIndex]=q,onBlur:q=>k(_,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[A]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u(_,T.dataIndex)),1)],64))],10,xr)):["isList","isQuery","isSort"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",Cr,[i.createVNode(D,{checked:_[T.dataIndex],onClick:q=>N(_,T.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(T.dataIndex))&&!u(_,T.dataIndex)&&"empty"]),onClick:q=>R(_,T.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(L,{key:0,value:_.show.list[T.dataIndex],"onUpdate:value":q=>_.show.list[T.dataIndex]=q,allowClear:!0,options:T.options,onBlur:C[7]||(C[7]=q=>k())},null,8,["value","onUpdate:value","options"])),[[A]]):(i.openBlock(),i.createElementBlock("span",Sr,i.toDisplayString(T.showLabel(T.options,u(_,T.dataIndex))),1))],10,vr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Nr={class:"unione-table-tools"},Vr={class:"unione-table-data"},Rr={key:0,class:"unione-table-opts"},Rl=ee(i.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:t}){const n=Fe(),l=a,o=i.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=i.computed(()=>o.value.props||{}),r=i.computed(()=>o.value.rowKey||l.rowKey||"id"),c=i.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),h=i.computed(()=>{const S=l.dataList||[];return!S.length&&c.value?c.value.data().body||[]:S}),f=i.computed(()=>{if(o.value.operation==!1)return{visible:!1};const S=Y.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),I=[];let V=(o.value.operation?.btns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F));if(V.forEach(F=>{I.push(F.name)}),I.includes("edit")||V.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),I.includes("view")||V.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),I.includes("delete")||V.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const F=V.filter(D=>D.name=="edit")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",Q=l.editor.model.value;F.action.link=n.editPageUrl+"?psn="+D+"&model="+Q+"&id={row."+l.rowKey+"}"}const $=V.filter(D=>D.name=="view")[0];if($.visible&&($.action||($.action={}),$.action.type||($.action.type="route"),!$.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";$.action.link=n.viewPageUrl+"?psn="+D+"&model=view&id={row."+l.rowKey+"}"}}return V=V.filter(F=>F.visible!=!1).sort((F,$)=>{const D=F.index||1,Q=$.index||1;return D-Q}),S.count&&(V.length>S.count+1?(S.btns=V.slice(0,S.count),S.more.items=V.slice(S.count,V.length),S.more.visible=!0):(S.btns=V,S.more.visible=!1)),S}),d=i.computed(()=>{let S=[];o.value.columns?.length&&(S=[...o.value.columns]);const I=[];S.forEach((F,$)=>{F.dataIndex=F.name,F.convert&&(F.dataIndex=F.name+"Label",F.convertObj=new Ge(F.convert),F.customCell=(D,Q,L)=>{const O=D[L.name];F.convertObj&&(D[L.dataIndex]==null||D[L.dataIndex]==null)&&O!=null&&O!=null&&(O+"").length>0&&(D[L.dataIndex]=O,F.convertObj.convert(O).then(G=>{G&&(D[L.dataIndex]=G)}))}),F.sort?.enable&&(F.sorter=!0,F.sort.multiple&&(F.sorter={},F.sorter.multiple=F.sort.multiple),F.sort.defoult&&(F.defaultSortOrder=F.sort.asc?"ascend":"descend")),F.customRender=({text:D})=>D||"--",F.fkey?.enable&&(F.fkey.labelName&&(F.dataIndex=sn(F.fkey.labelName)),F.fkey.labelTitle&&(F.title=F.fkey.labelTitle),F.customRender=({record:D,column:Q})=>D&&D[Q.name+"FEntry"]&&D[Q.name+"FEntry"][Q.dataIndex]||"--",F.fkey.fields?.forEach((D,Q)=>{if(!D.name)return;const L=sn(D.name),O={fkName:F.name,title:D.title,name:L,dataIndex:D.name,width:D.width,index:D.index||$+Q+1,customRender:({record:G,column:T})=>{if(G&&G[T.fkName+"FEntry"]){const _=G[T.fkName+"FEntry"][T.name];if(_)return D.convertObj&&D.convertObj.convert(_)||_}return"--"}};D.convert&&(D.convertObj=new Ge(D.convert)),I.push(O)}))}),I.forEach(F=>{S.splice(F.index,0,F)});const V=Y.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return V&&V.visible!=!1&&(V.customRender=F=>R.value?(R.value.current-1)*R.value.pageSize+F.index+1:F.index,S=[V,...S]),f.value&&f.value.visible!=!1&&S.push({fixed:"right",align:"center",...f.value,name:"operation"}),S}),p=i.computed(()=>{if(o.value.leftBtns===!1)return[];const S=[],I=[];if((o.value.leftBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name),F.name=="delBatch"&&!k.value&&(F.visible=!1)}),!I.includes("add")){const F={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};S.splice(0,0,F)}if(!I.includes("delBatch")&&k.value){const F={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};S.splice(1,0,F)}if(l.editor&&l.editor.type.value!="code"){const F=S.filter($=>$.name=="add")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",D=l.editor.model.value;F.action.link=n.addPageUrl+"?psn="+$+"&model="+D}}return S});function m({btn:S,event:I}){if(n.isDebug&&console.log("unione table left btn click",S,I),S.name=="delBatch"){if(!u.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(u.value.selectedRowKeys).then(()=>{E(),B(!0)});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+u.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const b=i.computed(()=>{if(o.value.rightBtns===!1)return[];const S=[],I=[];if((o.value.rightBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name)}),!I.includes("impData")){const F={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};S.splice(1,0,F)}if(!I.includes("expData")){const F={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};S.splice(2,0,F)}if(!I.includes("downTmpl")){const F={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};S.splice(3,0,F)}return S});function y({btn:S,event:I}){n.isDebug&&console.log("unione table right btn click",S,I),M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("rightBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const A=i.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),x=i.ref({}),w=i.ref(null),R=i.computed(()=>Y.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"]})),k=i.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),u=i.ref({selectedRowKeys:[],selectedRowList:[],onChange:(S,I)=>{u.value.selectedRowKeys=S,u.value.selectedRowList=I},getCheckboxProps:S=>({disabled:S.checkable})}),N=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=t;function v({btn:S,event:I},V){if(n.isDebug&&console.log("unione table opt btn click",S,I),S.name=="delete"){if(c.value){c.value.deleteByIds([V[r.value]]).then(()=>{E(),u.value.selectedRowKeys=u.value.selectedRowKeys.filter(F=>F!=V[r.value]),u.value.selectedRowList=u.value.selectedRowList.filter(F=>F[r.value]!=V[r.value])});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(S.name,{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}function C(S,I,V,F){console.log("tableChanged",S,I,V,F),w.value={page:S.current,pageSize:S.pageSize},V&&(Array.isArray(V)?(w.value.sorts=[],V.forEach($=>{w.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):V.column&&(w.value.sorts=[{name:V.column.name,asc:V.order=="ascend"}])),E(),M("change",{pagination:S,filters:I,sorter:V,event:F})}function B(S=!1){S?(u.value.selectedRowKeys=[],u.value.selectedRowList=[]):X.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${u.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{u.value.selectedRowKeys=[],u.value.selectedRowList=[]}})}function E(){if(c.value){const S={page:R.value.current,pageSize:R.value.pageSize,keywords:x.value.keywords,body:x.value.params||{}};w.value?.page&&(S.page=w.value.page),w.value?.pageSize&&(S.pageSize=w.value.pageSize),w.value?.sorts&&(S.sorts=w.value.sorts),console.log("dataStorage find params",S),c.value.find(S)}}i.onMounted(()=>{d.value?.forEach(S=>{S.sort?.enable&&S.sort.defoult&&(w.value||(w.value={},w.value.sorts||(w.value.sorts=[]),w.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),x.value=S||{},E()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),x.value={},E(),B(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),E()})});function g(){return{keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}}return e({getSelected:g,clearSelected:B}),(S,I)=>{const V=i.resolveComponent("unione-btn"),F=i.resolveComponent("DownOutlined"),$=i.resolveComponent("a-button"),D=i.resolveComponent("a-dropdown"),Q=i.resolveComponent("a-table");return i.openBlock(),i.createBlock(lt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",Nr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,L=>(i.openBlock(),i.createBlock(V,{key:L.name,class:"btn",widget:L,editor:a.editor,onClick:m,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),u.value.selectedRowKeys.length?(i.openBlock(),i.createElementBlock("span",{key:0,class:"selected-info",onClick:I[0]||(I[0]=L=>B())},"当前选中记录("+i.toDisplayString(u.value.selectedRowKeys.length)+")",1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.value,L=>(i.openBlock(),i.createBlock(V,{key:L.name,class:"btn right",widget:L,editor:a.editor,onClick:y,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),i.createElementVNode("div",Vr,[d.value&&d.value.length?(i.openBlock(),i.createBlock(Q,i.mergeProps({key:0,columns:d.value,rowKey:r.value,"data-source":h.value,"row-selection":k.value?u.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:R.value,onChange:C},A.value),{bodyCell:i.withCtx(({column:L,record:O})=>[L.name==="operation"?(i.openBlock(),i.createElementBlock("div",Rr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.btns,G=>(i.openBlock(),i.createBlock(V,{key:G.name,class:"opt",widget:G,editor:a.editor,onClick:T=>v(T,O),preset:N,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(i.openBlock(),i.createBlock(D,{key:0,trigger:[f.value.more.trigger||"hover"],class:i.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.more.items,G=>(i.openBlock(),i.createBlock(V,{key:G.name,class:"item",widget:G,editor:a.editor,onClick:T=>v(T,O),type:"text",preset:N,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode($,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.value.more.title)+" ",1),i.createVNode(F)]),_:1})]),_:2},1032,["trigger","class"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):i.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Br,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a168b83b"]]);class De{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:t,onClose:n,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(ae.EDITOR_COMPONENT,ae.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(ae.EDITOR_COMPONENT,ae.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const h=document.createElement("div");h.classList.add("dialog-title");const f=document.createElement("span");f.append(document.createTextNode(e));const d=document.createElement("i");d.onclick=()=>{n&&n(),this._dispose()},h.append(f),h.append(d),c.append(h);const p=document.createElement("div");p.classList.add("dialog-option");for(let A=0;A<t.length;A++){const x=t[A],w=document.createElement("div");if(w.classList.add("dialog-option__item"),x.label){const k=document.createElement("span");k.append(document.createTextNode(x.label)),w.append(k),x.required&&k.classList.add("dialog-option__item--require")}let R;x.type==="select"?(R=document.createElement("select"),x.options?.forEach(k=>{const u=document.createElement("option");u.value=k.value,u.label=k.label,R.append(u)})):x.type==="textarea"?R=document.createElement("textarea"):(R=document.createElement("input"),R.type=x.type),x.width&&(R.style.width=`${x.width}px`),x.height&&(R.style.height=`${x.height}px`),R.name=x.name,R.value=x.value||"",R instanceof HTMLSelectElement||(R.placeholder=x.placeholder||""),w.append(R),p.append(w),this.inputList.push(R)}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 y=document.createElement("button");y.append(document.createTextNode("确定")),y.type="submit",y.onclick=()=>{if(o){const A=this.inputList.map(x=>({name:x.name,value:x.value}));o(A)}this._dispose()},m.append(y),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Er(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 Or(a){const e=[];function t(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))t(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...Er(s)})}}}return t(a),e}const Mr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Tr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Ir="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Fr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Dr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",_r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",Pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",$r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",Ur="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==",zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",Wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",rc="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",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",El="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Ml="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",xc=["title"],Cc=["title"],vc={class:"options"},Sc=["title"],Bc={class:"options"},Nc={class:"options"},Vc=["title"],Rc=["title"],Ec=["title"],Oc=["title"],Mc=["title"],Tc={class:"options"},Ic={class:"options"},Fc={class:"options"},Dc={class:"options"},_c={class:"options"},Pc={class:"menu-item__search__collapse__search"},$c={class:"arrow-left"},Lc={class:"arrow-right"},Uc=ee(i.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const t=a,n=i.ref(),l=i.computed(()=>{let E=["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 t.items&&(t.items.length>1?E=t.items:t.items[0]=="simple"&&(E=["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"])),E});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(E,g){console.log("exec cmd "+E+",params:",g),E!="Separator"&&Array.isArray(g)?t.editor?.command["execute"+E](g[0],g[1]):t.editor?.command["execute"+E](g)}function h(E,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+E+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px"}let f=!0,d;function p(){f?(f=!1,d=window.setTimeout(()=>{f=!0,t.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(d)}function m(){f=!0,window.clearTimeout(d),t.editor?.command.executePainter({isDblclick:!0})}function b(){new De({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:E=>{const g=E.find(S=>S.name==="value")?.value;g&&t.editor?.command.executeInsertElementList([{type:ae.ElementType.LATEX,value:g}])}})}function y(E){t.editor?.command.executeInsertElementList([{type:E,checkbox:{value:!1},value:""}])}function A(E,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+E+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px";const V=ua();I.firstChild.childNodes.forEach(F=>{const $=F.attributes.getNamedItem("label-format").value;F.innerText=V.format($),F.onclick=()=>{t.editor?.command.executeInsertElementList([{type:ae.ElementType.DATE,dateFormat:F.attributes.getNamedItem("data-format").value,valueList:[{value:F.innerText.trim()}]}])}})}function x(){new De({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:E=>{const g=E.find(Q=>Q.name==="type")?.value;if(!g)return;const S=E.find(Q=>Q.name==="width")?.value,I=E.find(Q=>Q.name==="height")?.value;if(!I)return;const V=E.find(Q=>Q.name==="src")?.value,F=E.find(Q=>Q.name==="srcdoc")?.value,$={type:g};if($.type===ae.BlockType.IFRAME){if(!V&&!F)return;$.iframeBlock={src:V,srcdoc:F}}else if($.type===ae.BlockType.VIDEO){if(!V)return;$.videoBlock={src:V}}const D={type:ae.ElementType.BLOCK,value:"",height:Number(I),block:$};S&&(D.width=Number(S)),t.editor?.command.executeInsertElementList([D])}})}function w(E){const g=E.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__table__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-270/2+"px";const I=n.value.querySelector(".menu-item__table__collapse .table-close"),V=n.value.querySelector(".menu-item__table__collapse .table-select"),F=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(L=>{$.push(L.childNodes)});let D=0,Q=0;F.onmousemove=L=>{const{offsetX:_,offsetY:q}=L;$.forEach(U=>{U.forEach(P=>{P.classList.remove("active")})}),D=Math.ceil(_/22)||1,Q=Math.ceil(q/26)||1,$.forEach((U,P)=>{U.forEach((re,H)=>{H<D&&P<Q&&re.classList.add("active")})}),V.innerText=`${Q}×${D}`},F.onclick=()=>{S.style.display="none",t.editor?.command.executeInsertTable(Q,D)},I.onclick=L=>{L.stopPropagation(),S.style.display="none"}}function R(){const E=n.value.querySelector(".menu-item__image .image");E.click(),E.onchange=function(){const g=E.files[0],S=new FileReader;S.readAsDataURL(g),S.onload=function(){const I=new Image,V=S.result;I.src=V,I.onload=function(){t.editor?.command.executeImage({value:V,width:I.width,height:I.height}),E.value=""}}}}function k(){new De({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:t.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:E=>{const g=E.find(I=>I.name==="name")?.value;if(!g)return;const S=E.find(I=>I.name==="url")?.value;S&&t.editor?.command.executeHyperlink({type:ae.ElementType.HYPERLINK,value:"",url:S,valueList:ae.splitText(g).map(I=>({value:I,size:16}))})}})}function u(E){E==="add"?new De({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(F=>!F.value))return;const I=g.reduce((F,$)=>(F[$.name]=$.value,F),{}),V=I.repeat==="1";t.editor?.command.executeAddWatermark({data:I.data,color:I.color,size:Number(I.size),opacity:Number(I.opacity),repeat:V,gap:V&&I.horizontalGap&&I.verticalGap?[Number(I.horizontalGap),Number(I.verticalGap)]:void 0})}}):t.editor?.command.executeDeleteWatermark()}function N(){new De({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:E=>{const g=E.find(F=>F.name==="codeblock")?.value;if(!g)return;const S=xl.tokenize(g,xl.languages.javascript),I=Or(S),V=[];for(let F=0;F<I.length;F++){const $=I[F],D=ae.splitText($.content);for(let Q=0;Q<D.length;Q++){const O={value:D[Q]};$.color&&(O.color=$.color),$.bold&&(O.bold=!0),$.italic&&(O.italic=!0),V.push(O)}}V.unshift({value:`
2
- `}),t.editor?.command.executeInsertElementList(V)}})}function M(E){const g=E.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__search__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-260/2+"px";const I=n.value.querySelector(".menu-item__search__collapse__search input"),V=n.value.querySelector(".menu-item__search__collapse__replace input"),F=S.querySelector(".search-result");I.focus();const $=()=>{const D=t.editor?.command.getSearchNavigateInfo();if(D){const{index:Q,count:L}=D;F.innerText=`${Q}/${L}`}else F.innerText=""};S.querySelector("span").onclick=()=>{S.style.display="none",I.value="",V.value="",t.editor?.command.executeSearch(null),$()},I.oninput=()=>{t.editor?.command.executeSearch(I.value||null),$()},I.onkeydown=D=>{D.key==="Enter"&&(t.editor?.command.executeSearch(I.value||null),$())},S.querySelector("button").onclick=()=>{const D=I.value,Q=V.value;D&&Q&&D!==Q&&t.editor?.command.executeReplace(Q)},S.querySelector(".arrow-left").onclick=()=>{t.editor?.command.executeSearchNavigatePre(),$()},S.querySelector(".arrow-right").onclick=()=>{t.editor?.command.executeSearchNavigateNext(),$()}}function v(){const E=n.value.querySelector(".menu-item__color .input-color");E.oninput=function(){t.editor?.command.executeColor(E.value)},E.click()}function C(){const E=n.value.querySelector(".menu-item__highlight .input-highlight");E.oninput=function(){t.editor?.command.executeHighlight(E.value)},E.click()}function B(E){switch(E){case ae.ControlType.TEXT:new De({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(V=>V.name==="placeholder")?.value;if(!S)return;const I=g.find(V=>V.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,value:I?[{value:I}]:null,placeholder:S}})}});break;case ae.ControlType.SELECT:new De({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(Z,W){typeof exports=="object"&&typeof module<"u"?W(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"],W):(Z=typeof globalThis<"u"?globalThis:Z||self,W(Z.index={},Z.UnioneBaseVue,Z.Vue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.canvasEditor,Z.dayjs,Z.prism,Z.iconsVue,Z.uuid))})(this,function(Z,W,t,ee,ua,Qt,pa,ce,ma,vl,Ge,ga){"use strict";const ka={isDebug:!0,axios:{form:"/portal",flow:"/flow"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},nn=t.ref(ka);function Fe(a){return a&&(nn.value=W.utils.obj.ext(a,nn.value)),nn.value}const ba={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ya={...{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"}},wa=t.ref([ba,ya]);function Aa(a,e){return W.locales.loadLanguage(a,()=>new Promise((i,n)=>{const l=wa.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 ln={...W.locales};ln.loadLanguage=Aa;class xa{$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 on(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 on{$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=W.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)}$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=ee.message.loading("数据请求中..."),o=this.$store.controller+e.url;W.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=ee.message.loading("数据加载中...");W.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=ee.message.loading("数据提交中...");W.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||ee.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=ee.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";W.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=ee.message.loading("数据加载中..."),o=this.$store.controller+"/detail";W.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=ee.message.loading("数据处理中..."),o=this.$store.controller+"/delete";W.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 va{$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 lt{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 va,this.$widgetList=t.ref([]),this.$widgetMap=t.ref({}),this.$dataManager=new xa(i.dsnList?i.dsnList[0]:"",this.model),this.$axiosProccess=t.ref({}),this.$dialog=W.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}W.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),W.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(ee.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:"+ua.uniqueId()),this.$widgetMap.value[i.wid]=i,i.configs?.widgets&&this.$processWidget(i.configs.widgets)})}dataManager(){return this.$dataManager}}const Ca={class:"widget-setting-dialog"},Sa=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 f(){return l.value?.clientWidth}return e({getHeight:d,getWidth:f}),(h,p)=>{const m=t.resolveComponent("SettingOutlined"),k=t.resolveComponent("a-tooltip"),b=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[t.createVNode(k,{title:a.settingTitle},{default:t.withCtx(()=>[a.model=="edit"&&(h.$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(h.$slots,"default",{},void 0,!0),a.model=="edit"&&h.$slots["widget-setting"]?(t.openBlock(),t.createBlock(b,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":p[0]||(p[0]=x=>s.value=x),centered:"",width:"80%",onOk:c},{default:t.withCtx(()=>[t.createElementVNode("div",Ca,[t.renderSlot(h.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),te=(a,e)=>{const i=a.__vccOpts||a;for(const[n,l]of e)i[n]=l;return i},ot=te(Sa,[["__scopeId","data-v-17b517f5"]]),Ba={key:0},Na=["onClick"],fi=te(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:w})=>w+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:w=>{l.value.selectedRowKeys=w}}),o={mounted:w=>w.focus()},s=t.ref({});function r(){const w=Object.keys(s.value);if(w.length)for(let u in w){const B=b.value.form.action.params[u];B&&s.value[u]&&Object.keys(s.value[u]).forEach(M=>{B[M]=s.value[u][M]})}s.value={}}function c(w,u,B){r();const M={};M[B]=u[B]||"",B=="showIndex"&&(M[B]=u.show?.query?.index),s.value[w]=M}function d(w,u,B){if(!u||!B){s.value={};return}const M=s.value[w][B];u[B]=M,s.value={}}function f(){b.value.form.action.params.push({title:"新建",name:"",value:""})}function h(){}const p=t.ref(""),m=t.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(w,u)=>p.value!=u&&i.preset.includes(u)?Promise.reject("预设按钮名称,请使用其他名称,["+i.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),k=t.ref([pa.javascript()]),b=t.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),x=t.ref();function v(w,u,B={}){w=JSON.parse(JSON.stringify(w)),w.event||(w.event={}),w.props||(w.props={}),w.action||(w.action={}),Object.keys(w.action).includes("maskClosable")||(w.action.maskClosable=!0),w.action.params||(w.action.params=[]),p.value=w.name,b.value.form=w,b.value.helps=B,b.value.visible=!0,x.value=u}const y=t.ref(null);function E(){y.value&&y.value.validate().then(()=>{b.value.visible=!1,x.value(b.value.form)})}return e({open:v,close}),(w,u)=>{const B=t.resolveComponent("a-input"),M=t.resolveComponent("a-form-item"),C=t.resolveComponent("a-select"),A=t.resolveComponent("a-input-number"),N=t.resolveComponent("a-checkbox"),V=t.resolveComponent("a-tab-pane"),g=t.resolveComponent("a-switch"),S=t.resolveComponent("a-button"),I=t.resolveComponent("a-divider"),R=t.resolveComponent("ToolOutlined"),F=t.resolveComponent("a-tooltip"),$=t.resolveComponent("a-table"),_=t.resolveComponent("a-tabs"),q=t.resolveComponent("a-form"),L=t.resolveComponent("a-modal");return t.openBlock(),t.createBlock(L,{visible:b.value.visible,"onUpdate:visible":u[23]||(u[23]=O=>b.value.visible=O),title:b.value.title,centered:"",width:"50%",onOk:E},{default:t.withCtx(()=>[t.createVNode(q,{name:"basic",ref_key:"form",ref:y,rules:m.value,model:b.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:t.withCtx(()=>[t.createVNode(_,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(B,{value:b.value.form.title,"onUpdate:value":u[0]||(u[0]=O=>b.value.form.title=O)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"操作名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.name,"onUpdate:value":u[1]||(u[1]=O=>b.value.form.name=O),disabled:i.preset.includes(b.value.form.name)},null,8,["value","disabled"])]),_:1}),t.createVNode(M,{label:"操作图标"},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.icon,"onUpdate:value":u[2]||(u[2]=O=>b.value.form.icon=O)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:b.value.form.type,"onUpdate:value":u[3]||(u[3]=O=>b.value.form.type=O),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(A,{value:b.value.form.index,"onUpdate:value":u[4]||(u[4]=O=>b.value.form.index=O)},null,8,["value"])]),_:1}),t.createVNode(M,{label:"按钮大小"},{default:t.withCtx(()=>[t.createVNode(C,{value:b.value.form.size,"onUpdate:value":u[5]||(u[5]=O=>b.value.form.size=O),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:b.value.form.props.block,"onUpdate:checked":u[6]||(u[6]=O=>b.value.form.props.block=O)},{default:t.withCtx(()=>u[24]||(u[24]=[t.createTextVNode("自适应 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:b.value.form.props.danger,"onUpdate:checked":u[7]||(u[7]=O=>b.value.form.props.danger=O)},{default:t.withCtx(()=>u[25]||(u[25]=[t.createTextVNode("危险 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:b.value.form.props.ghost,"onUpdate:checked":u[8]||(u[8]=O=>b.value.form.props.ghost=O)},{default:t.withCtx(()=>u[26]||(u[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(C,{value:b.value.form.action.type,"onUpdate:value":u[9]||(u[9]=O=>b.value.form.action.type=O),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.action.psn,"onUpdate:value":u[10]||(u[10]=O=>b.value.form.action.psn=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.action.component,"onUpdate:value":u[11]||(u[11]=O=>b.value.form.action.component=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(M,{label:"连接地址"},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.action.href,"onUpdate:value":u[12]||(u[12]=O=>b.value.form.action.href=O)},null,8,["value"])]),_:1}),["link","route"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:2,label:"连接方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:b.value.form.action.target,"onUpdate:value":u[13]||(u[13]=O=>b.value.form.action.target=O),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:3,label:"抽屉位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:b.value.form.action.position,"onUpdate:value":u[14]||(u[14]=O=>b.value.form.action.position=O),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:4,label:"显示标题",required:""},{default:t.withCtx(()=>[t.createVNode(B,{value:b.value.form.action.title,"onUpdate:value":u[15]||(u[15]=O=>b.value.form.action.title=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:5,label:"蒙层关闭"},{default:t.withCtx(()=>[t.createVNode(g,{checked:b.value.form.action.maskClosable,"onUpdate:checked":u[16]||(u[16]=O=>b.value.form.action.maskClosable=O),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:6,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(A,{value:b.value.form.action.width,"onUpdate:value":u[17]||(u[17]=O=>b.value.form.action.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["dialog"].includes(b.value.form.action.type)?(t.openBlock(),t.createBlock(M,{key:7,label:"显示高度"},{default:t.withCtx(()=>[t.createVNode(A,{value:b.value.form.action.height,"onUpdate:value":u[18]||(u[18]=O=>b.value.form.action.height=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(I,{orientation:"left"},{default:t.withCtx(()=>[u[29]||(u[29]=t.createTextVNode("参数列表 ")),t.createVNode(S,{size:"small",class:"param-btn",onClick:f},{default:t.withCtx(()=>u[27]||(u[27]=[t.createTextVNode("添加")])),_:1}),t.createVNode(S,{size:"small",class:"param-btn",danger:"",onClick:h},{default:t.withCtx(()=>u[28]||(u[28]=[t.createTextVNode("删除")])),_:1})]),_:1}),t.createVNode($,{columns:n.value,"data-source":b.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:O})=>[["name","title"].includes(O.key)?(t.openBlock(),t.createElementBlock("span",Ba,[t.createVNode(R),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0),["value"].includes(O.key)?(t.openBlock(),t.createBlock(F,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:t.withCtx(()=>[t.createElementVNode("span",null,[t.createVNode(R),t.createTextVNode(" "+t.toDisplayString(O.title),1)])]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:G,record:T,index:D})=>[["name","title","value"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!s.value[D]||!Object.keys(s.value[D]).includes(O.dataIndex))&&!G&&"empty"]),onClick:Q=>c(D,T,O.dataIndex)},[s.value[D]&&Object.keys(s.value[D]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(B,{key:0,value:s.value[D][O.dataIndex],"onUpdate:value":Q=>s.value[D][O.dataIndex]=Q,onBlur:Q=>d(D,T,O.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(G),1)],64))],10,Na)):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:b.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:t.withCtx(()=>[t.createVNode(t.unref(Qt.Codemirror),{modelValue:b.value.form.event.clickScript,"onUpdate:modelValue":u[19]||(u[19]=O=>b.value.form.event.clickScript=O),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"禁用逻辑",help:b.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:t.withCtx(()=>[t.createVNode(t.unref(Qt.Codemirror),{modelValue:b.value.form.event.disableScript,"onUpdate:modelValue":u[20]||(u[20]=O=>b.value.form.event.disableScript=O),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"显示逻辑",help:b.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:t.withCtx(()=>[t.createVNode(t.unref(Qt.Codemirror),{modelValue:b.value.form.event.visibleScript,"onUpdate:modelValue":u[21]||(u[21]=O=>b.value.form.event.visibleScript=O),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(M,{label:"动态标题",help:b.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:t.withCtx(()=>[t.createVNode(t.unref(Qt.Codemirror),{modelValue:b.value.form.event.titleScript,"onUpdate:modelValue":u[22]||(u[22]=O=>b.value.form.event.titleScript=O),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:k.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Va=["src"],Ra=["src"],Ea=te(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=Fe(),n=a,l=W.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),f=t.computed(()=>n.disabled==!0?!0:s.value.disable?s.value.disable(m.value,o.value):o.value.disable==!0),h=t.ref(null);function p(){h.value?.open(o.value,u=>{console.log("btn props",u),Object.keys(u).forEach(B=>{o.value[B]=u[B]}),console.log("props btn",o.value)})}const m=t.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),k=t.ref({open:!1}),b=t.computed(()=>{if(o.value.action?.href){let u=o.value.action.href;const B=u.matchAll("{[a-zA-Z.]*}"),M=[];let C=null;for(;C=B.next();){if(C&&C.value&&C.value[0]){let A=C.value[0].substring(1,C.value[0].length-1);M.includes(A)||M.push(A)}if(C.done)break}if(M.length>0)for(let A=0;A<M.length;A++){let N=M[A],V=W.utils.obj.getValue(m.value,N);V?V instanceof Object?u=u.replaceAll("{"+N+"}",JSON.stringify(V)):Array.isArray(V)?u=u.replaceAll("{"+N+"}",V.join(",")):u=u.replaceAll("{"+N+"}",V):u=u.replaceAll("{"+N+"}","")}return u}return""}),x=t.computed(()=>{const u={};let B=o.value.action?.href||o.value.action?.link;if(B){const M=B.matchAll("{[a-zA-Z0-9.]*}"),C=[];let A=null;for(;A=M.next();){if(A&&A.value&&A.value[0]){let V=A.value[0].substring(1,A.value[0].length-1);C.includes(V)||C.push(V)}if(A.done)break}if(C.length>0)for(let V=0;V<C.length;V++){let g=C[V],S=W.utils.obj.getValue(m.value,g);S?S instanceof Object?B=B.replaceAll("{"+g+"}",JSON.stringify(S)):Array.isArray(S)?B=B.replaceAll("{"+g+"}",S.join(",")):B=B.replaceAll("{"+g+"}",S):B=B.replaceAll("{"+g+"}","")}const N=B.split("?")[1];N&&N.split("&").forEach(V=>{const g=V.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 A=W.utils.obj.getValue(m.value,M.value);u[M.name]=A}else u[M.name]=M.value}),u}),v=e,y=t.inject("router");function E(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")k.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:x.value})}v("click",{btn:o.value,event:u})}}function w(u){v("click",u)}return(u,B)=>{const M=t.resolveComponent("a-button"),C=t.resolveComponent("unione-btn"),A=t.resolveComponent("a-dropdown"),N=t.resolveComponent("a-drawer"),V=t.resolveComponent("a-modal");return d.value?(t.openBlock(),t.createBlock(ot,{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:f.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:E},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(A,{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(C,{key:g.name,class:"item",widget:g,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:w},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:k.value.open,"onUpdate:open":B[0]||(B[0]=g=>k.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:b.value},null,8,Va)):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:k.value.open,"onUpdate:open":B[1]||(B[1]=g=>k.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:b.value,style:t.normalizeStyle({height:o.value.action?.height?o.value.action?.height+"px":""})},null,12,Ra)):t.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):t.createCommentVNode("",!0),t.createVNode(fi,{ref_key:"btnSetting",ref:h,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-02b17517"]]),Oa={key:0,class:"unione-widget-empty-tip"},Ma=te(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(ot,{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,(f,h)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(f.widget),{key:h,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(t.openBlock(),t.createElementBlock("div",Oa,t.toDisplayString(c.emptyTips),1)):t.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):t.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Ta={class:"title"},Ia={class:"text"},Fa={key:0,class:"reactive"},_a={key:1,class:"opts"},Da={class:"warp"},Pa=te(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(ot,{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",Ta,[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",Ia,t.toDisplayString(n.value),1)]),a.reactive?(t.openBlock(),t.createElementBlock("div",Fa,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):t.createCommentVNode("",!0),a.location=="left"?(t.openBlock(),t.createElementBlock("div",_a,[t.renderSlot(c.$slots,"opts",{},void 0,!0)])):t.createCommentVNode("",!0)],2),t.withDirectives(t.createElementVNode("div",Da,[t.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),$a={class:"unione-props-setting unione-form-setting"},La={class:"unione-form-btns"},Ua={key:0},za=["onClick"],ja={class:"field-txt"},qa=["onClick"],Qa={key:1,class:"field-txt"},Wa=["onClick"],Ya={key:0,class:"field-txt"},Ka={key:3,class:"edit-field"},Ha={key:0},Ga=["onClick"],Ja=te(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:C})=>C+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 C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=t.computed(()=>(e.editor.dataModels()||[]).map(A=>({value:A.sn,label:A.title+"("+A.name+")"}))),o=t.computed(()=>{const C=n.value.configs.settings.btns,A=C.map(N=>N.name);if(!A.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!A.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let V=N.index||1;C.splice(V,0,N)}if(!A.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!A.includes("back")){const N={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(N.index,0,N)}return C}),s=t.ref(null);function r(C){s.value&&s.value.open(C,A=>{A.visible=!0,Object.keys(A).forEach(N=>{C[N]=A[N]}),n.value.configs.settings.btns.sort((N,V)=>{const g=N.index||1,S=V.index||1;return g-S}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const C=n.value.configs.settings.btns.length+1;let A={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};A.name="new_"+n.value.configs.settings.btns.length;const N=n.value.configs.settings.btns.filter(V=>V.name==A.name).length;N>0&&(A.name=A.name+N),n.value.configs.settings.btns.push(A),e.editor.widget(e.wid,n.value),s.value.open(A,V=>{Object.keys(V).forEach(g=>{A[g]=V[g]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(C){const A=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,n.value.configs.settings.btns=[...n.value.configs.settings.btns];else{const N=[];n.value.configs.settings.btns.forEach(V=>{V.name!=C.name&&N.push(V)}),n.value.configs.settings.btns=N}};ee.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{A()}})}const f=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:C=>{const A=f.value.widgets.filter(N=>N.value==C);return A[0]?A[0].label:C},toSetting:()=>{}}),h=t.ref({visible:!1,field:{},props:{},showInfo:C=>{let A="";return C.rules&&(A=C.rules.filter(N=>N.enable).length||""),A&&(A="("+A+")"),A},toSetting:()=>{const C=h.value.props,A={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(A.min=C.rangeMin,A.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(A.max=C.rangeMax,A.enable=!0);const N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),h.value.field.rules=[A,N],h.value.visible=!1,h.value.props={},console.log("rule",h.value.field.rules)}});function p(C){h.value.visible=!0,h.value.field=C;const A=C.rules||[],N={trigger:"change",whitespace:!0};A.forEach(V=>{V.name=="reg"&&(N.trigger=V.trigger,N.whitespace=V.whitespace,N.regExpress=V.pattern,N.regMessage=V.message),V.name=="range"&&(N.rangeMin=V.min,N.rangeMax=V.max,N.rangeMessage=V.message)}),h.value.props=N}const m=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function k(C,A){const N=y.value.filter(g=>g.name==C.name);N.forEach(g=>{A!="isSort"?g[A]=!0:g[A]=!g[A]});const V=N[0];if(!(!V||A=="isSort")){switch(m.value.prop=A,m.value.field=C,V.show||(V.show={}),A){case"isQuery":V.show.query||(V.show.query={}),m.value.show=V.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":V.show.form||(V.show.form={}),m.value.show=V.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":V.show.view||(V.show.view={}),m.value.show=V.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":V.show.list||(V.show.list={}),m.value.show=V.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const b=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{b.value.convert.options||(b.value.convert.options=[]),b.value.convert.options.push({label:"",value:""})},toDelOption:(C,A)=>{b.value.convert.options.splice(C,1)},toSetting:()=>{b.value.visible=!1}});function x(C){b.value.visible=!0,b.value.field=C,b.value.convert=C.convert||{}}const v=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),y=t.computed(()=>v.value.fields?.length?v.value.fields:[]),E={mounted:C=>C.focus()},w=t.ref({});function u(C,A){const N={};A=="convertName"?N[A]=C.convert?.type:N[A]=C[A]||"",w.value={},w.value[C.name]=N}function B(C,A){{w.value={};return}}function M(C,A){y.value.filter(V=>V.name==C.name).forEach(V=>{V[A]=!V[A]})}return(C,A)=>{const N=t.resolveComponent("a-divider"),V=t.resolveComponent("CloseOutlined"),g=t.resolveComponent("a-button"),S=t.resolveComponent("PlusOutlined"),I=t.resolveComponent("a-select"),R=t.resolveComponent("ToolOutlined"),F=t.resolveComponent("a-checkbox"),$=t.resolveComponent("a-table"),_=t.resolveComponent("a-select-option"),q=t.resolveComponent("a-form-item"),L=t.resolveComponent("a-form"),O=t.resolveComponent("a-modal"),G=t.resolveComponent("a-checkbox-group"),T=t.resolveComponent("a-input-number"),D=t.resolveComponent("a-input"),Q=t.resolveComponent("a-col"),U=t.resolveComponent("a-row");return t.openBlock(),t.createElementBlock("div",$a,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[23]||(A[23]=[t.createTextVNode("按钮设置")])),_:1}),t.createElementVNode("div",La,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,P=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:P.name,class:["btn",P.name,!P.visible&&"deleted"],type:P.visible?P.type:"default",size:P.size,ref_for:!0},P.props||{},{onClick:se=>r(P)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(P.title)+" ",1),P.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"btn-del",onClick:t.withModifiers(se=>d(P),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[P.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(P.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(g,{class:t.normalizeClass(["btn","btn-add"]),size:"small",onClick:A[0]||(A[0]=P=>c())},{default:t.withCtx(()=>[t.createVNode(S)]),_:1})]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[24]||(A[24]=[t.createTextVNode("表单设置")])),_:1}),A[36]||(A[36]=t.createTextVNode(" 数据模型:")),t.createVNode(I,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":A[1]||(A[1]=P=>n.value.dataModel=P)},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:P})=>[["widget","rules","convertName"].includes(P.key)?(t.openBlock(),t.createElementBlock("span",Ua,[t.createVNode(R),t.createTextVNode(" "+t.toDisplayString(P.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:P,text:se,record:X})=>[["rules"].includes(P.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!h.value.showInfo(X)&&"empty"]),onClick:H=>p(X)},[t.createElementVNode("span",ja,t.toDisplayString(h.value.showInfo(X)),1),h.value.showInfo(X)?(t.openBlock(),t.createBlock(g,{key:0,type:"link"},{default:t.withCtx(()=>A[25]||(A[25]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,za)):["widget"].includes(P.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!w.value[X.name]||!Object.keys(w.value[X.name]).includes(P.dataIndex))&&!se&&"empty"]),onClick:H=>u(X,P.dataIndex)},[w.value[X.name]&&Object.keys(w.value[X.name]).includes(P.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(I,{key:0,value:X[P.dataIndex],"onUpdate:value":H=>X[P.dataIndex]=H,options:f.value.widgets,onBlur:A[2]||(A[2]=H=>B())},null,8,["value","onUpdate:value","options"])),[[E]]):(t.openBlock(),t.createElementBlock("span",Qa,t.toDisplayString(f.value.widgetName(se)),1))],10,qa)):["convertName"].includes(P.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!w.value[X.name]||!Object.keys(w.value[X.name]).includes(P.dataIndex))&&!X.convert?.type&&"empty"]),onClick:H=>u(X,P.dataIndex)},[w.value[X.name]&&Object.keys(w.value[X.name]).includes(P.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(I,{key:0,value:X[P.dataIndex],"onUpdate:value":H=>X[P.dataIndex]=H,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:A[3]||(A[3]=H=>B())},null,8,["value","onUpdate:value"])),[[E]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[X.convert?.type?(t.openBlock(),t.createElementBlock("span",Ya,t.toDisplayString(X.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),X.convert?.type?(t.openBlock(),t.createBlock(g,{key:1,type:"link",onClick:t.withModifiers(H=>x(X),["stop"])},{default:t.withCtx(()=>A[26]||(A[26]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Wa)):["isForm","isView"].includes(P.dataIndex)?(t.openBlock(),t.createElementBlock("div",Ka,[t.createVNode(F,{checked:X[P.dataIndex],onClick:H=>M(X,P.dataIndex)},null,8,["checked","onClick"]),t.createVNode(g,{type:"link",onClick:H=>k(X,P.dataIndex)},{default:t.withCtx(()=>A[27]||(A[27]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(O,{visible:f.value.visible,"onUpdate:visible":A[5]||(A[5]=P=>f.value.visible=P),title:"控件设置",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(L,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[f.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(q,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(I,{value:f.value.props.mode,"onUpdate:value":A[4]||(A[4]=P=>f.value.props.mode=P),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(_,{value:"multiple"},{default:t.withCtx(()=>A[28]||(A[28]=[t.createTextVNode("多选")])),_:1}),t.createVNode(_,{value:"tags"},{default:t.withCtx(()=>A[29]||(A[29]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:h.value.visible,"onUpdate:visible":A[13]||(A[13]=P=>h.value.visible=P),title:"规则设置",onOk:h.value.toSetting},{default:t.withCtx(()=>[t.createVNode(L,{model:h.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(()=>A[30]||(A[30]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(q,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(G,{value:h.value.props.trigger,"onUpdate:value":A[6]||(A[6]=P=>h.value.props.trigger=P),options:["change","blur"]},null,8,["value"])]),_:1}),h.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(F,{value:h.value.props.whitespace,"onUpdate:value":A[7]||(A[7]=P=>h.value.props.whitespace=P),checked:h.value.props.whitespace},{default:t.withCtx(()=>A[31]||(A[31]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[32]||(A[32]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(q,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(T,{value:h.value.props.rangeMin,"onUpdate:value":A[8]||(A[8]=P=>h.value.props.rangeMin=P)},null,8,["value"]),A[33]||(A[33]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(T,{value:h.value.props.rangeMax,"onUpdate:value":A[9]||(A[9]=P=>h.value.props.rangeMax=P)},null,8,["value"])]),_:1}),t.createVNode(q,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(D,{value:h.value.props.rangeMessage,"onUpdate:value":A[10]||(A[10]=P=>h.value.props.rangeMessage=P)},null,8,["value"])]),_:1}),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[34]||(A[34]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(q,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(D,{value:h.value.props.regExpress,"onUpdate:value":A[11]||(A[11]=P=>h.value.props.regExpress=P)},null,8,["value"])]),_:1}),t.createVNode(q,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(D,{value:h.value.props.regMessage,"onUpdate:value":A[12]||(A[12]=P=>h.value.props.regMessage=P)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:m.value.visible,"onUpdate:visible":A[20]||(A[20]=P=>m.value.visible=P),title:m.value.title,onOk:m.value.toSetting},{default:t.withCtx(()=>[t.createVNode(L,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(q,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(T,{value:m.value.show.index,"onUpdate:value":A[14]||(A[14]=P=>m.value.show.index=P)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(q,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(D,{value:m.value.show.width,"onUpdate:value":A[15]||(A[15]=P=>m.value.show.width=P)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(q,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(D,{value:m.value.show.labelWidth,"onUpdate:value":A[16]||(A[16]=P=>m.value.show.labelWidth=P)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(q,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(D,{value:m.value.show.valueWidth,"onUpdate:value":A[17]||(A[17]=P=>m.value.show.valueWidth=P)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(q,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(I,{value:m.value.show.fixed,"onUpdate:value":A[18]||(A[18]=P=>m.value.show.fixed=P),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(q,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(I,{value:m.value.show.align,"onUpdate:value":A[19]||(A[19]=P=>m.value.show.align=P),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(O,{visible:b.value.visible,"onUpdate:visible":A[22]||(A[22]=P=>b.value.visible=P),title:b.value.convert.type=="dict"?"字典设置":"选项设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[b.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",Ha,[t.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:b.value.toAddOption},{default:t.withCtx(()=>A[35]||(A[35]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode($,{columns:b.value.optionColumn,"data-source":b.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:P,record:se,index:X})=>[P.dataIndex==="label"?(t.openBlock(),t.createBlock(D,{key:0,value:se.label,"onUpdate:value":H=>se.label=H,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),P.dataIndex==="value"?(t.openBlock(),t.createBlock(D,{key:1,value:se.value,"onUpdate:value":H=>se.value=H,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),P.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:H=>b.value.toDelOption(X,se)},"删除",8,Ga)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),b.value.convert.type=="dict"?(t.openBlock(),t.createBlock(L,{key:1,model:b.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(U,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(Q,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(q,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(D,{value:b.value.convert.dict,"onUpdate:value":A[21]||(A[21]=P=>b.value.convert.dict=P)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Xa={key:0,class:"form-left"},Za={class:"form-warp"},er={key:1,class:"form-right"},tr=te(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=w,s.value.getValue=b,s.value.setValue=x,s.value.reset=v,l.value=u.useForm(c.value.dsn,s.value,B=>{o.value=B.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 lt),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(B=>{B.widget||(B.widget="unione-form-item"),B.control||(B.control="a-input")}),u}),f=t.computed(()=>d.value.filter(u=>u.float=="left")),h=t.computed(()=>d.value.filter(u=>!u.float)),p=t.computed(()=>d.value.filter(u=>u.float=="right")),m=t.inject("pageSetting",{}),k=t.computed(()=>c.value.setting||m?.form||{});t.provide("formSetting",k.value);function b(){return o.value}function x(u){o.value=u,y()}function v(){o.value={},y()}function y(){const u=B=>{B.widget=="unione-form-item"&&B.name&&(B.value!=null&&B.value!=null&&B.value!=""||B.value==0)&&(o.value[B.name]==null||o.value[B.name]==null||o.value[B.name]=="")&&(o.value[B.name]=B.value),B.widgets?.forEach(M=>{u(M)})};d.value.forEach(B=>{u(B)})}function E(){return s.value.validate()}function w(u=!0){n.value=u}return e({validate:E,getValue:b,setValue:x,reset:v,setDisabled:w}),(u,B)=>{const M=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ot,{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-"+(k.value.showColumn||3)])},{default:t.withCtx(()=>[f.value?.length?(t.openBlock(),t.createElementBlock("div",Xa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,C=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(C.widget),{key:C.name,widget:C,editor:r.value,value:o.value[C.name],"onUpdate:value":A=>o.value[C.name]=A,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0),t.createElementVNode("div",Za,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,C=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(C.widget),{key:C.name,widget:C,editor:r.value,value:o.value[C.name],"onUpdate:value":A=>o.value[C.name]=A,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),p.value?.length?(t.openBlock(),t.createElementBlock("div",er,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,C=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(C.widget),{key:C.name,widget:C,editor:r.value,value:o.value[C.name],"onUpdate:value":A=>o.value[C.name]=A,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(Ja,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-12b27d37"]]);function Cl(a,e=!1){const i=Fe();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)=>{W.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 Sl(a,e){const i=Fe();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Cl(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 ir(a,e){const i=await Sl(a,e);return Promise.resolve(i.dictValue)}const Bl={load:Cl,getLabel:ir,getOption:Sl};class Le{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=Fe()}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}Bl.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;W.axios.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,W.axios.admin({url:s,data:o,method:"POST"}).then(d=>{if(d.success){const f={};this.options.forEach(h=>{f[e]=!0}),d.body.forEach(h=>{f[h.value]||this.options.push(h)}),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?Bl.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;W.axios.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;W.axios.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"&&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"]}),e}}function pt(a,e=350){let i=null;return n=>{clearTimeout(i),i=setTimeout(()=>{a(n)},e)}}const nr=["innerHTML"],lr={key:2,class:"text-view"},or=te(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:x.value,form:e.formValue}):x.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 v=e.editor?.widget(e.wid)||e.widget||{};return v.event&&Object.keys(v.event).forEach(y=>{const E=v.event[y];E&&(o.value[y]=null,typeof E=="function"?o.value[y]=E:E.enable&&E.scriptText&&(o.value[y]=new Function("value","ctx",E.scriptText)))}),v}),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=pt(()=>{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)}),f=t.ref({}),h=t.computed(()=>{const v=[],y=s.value.rule||{};let E=s.value.props?.required||s.value.required;if(o.value.required&&(E=o.value.required(e.formValue[s.value.name],e.formValue)),E&&v.push({required:!0,whitespace:y?.whitespace||!1,trigger:y?.trigger||l.ruleTrigger||"change",validator:(w,u)=>(y?.whitespace&&u&&typeof u=="string"&&(u=u.trim()),u!=null&&u!=null&&(u+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),y.advance&&f.value[y.advance]){const w=f.value[y.advance];v.push({pattern:w.pattern,message:w.message||"表单验证不通过!",trigger:y.trigger||l.ruleTrigger||"change"})}return y.regExpress&&v.push({pattern:y.regExpress,message:y.regMessage||"表单验证不通过!",trigger:y.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&v.push({validator:(w,u)=>u&&(u+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(u+"").length+"]"):Promise.resolve(),trigger:y?.trigger||l.ruleTrigger||"change"}),v}),p=t.computed(()=>{const v=s.value.props||{};if(s.value.control=="a-input-number"){const y=s.value.rule||{};y.rangeMin!=null&&y.rangeMin!=null&&(v.min=y.rangeMin),y.rangeMax!=null&&y.rangeMax!=null&&(v.max=y.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(v.format=s.value.view.dataFormat,v.valueFormat=s.value.view.dataFormat),s.value.required&&(v.required=s.value.required),v}),m=t.computed(()=>{const v=s.value.css||{},y=["form-item-"+s.value.name];return v.cssName&&y.push(v.cssName),l.platform=="app"?v.cssName?typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0&&y.push("all-line"):y.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!v.cssName||typeof v.cssName=="string"&&v.cssName.indexOf("all-line")<0)&&y.push("all-line"):s.value.view.width==2&&y.push("2in-line")),y}),k=t.computed(()=>{const v=l.showColumn||3;let y=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&v>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(y/v)}:s.value.view?.width>=3&&v>1?{span:Math.round(y/v)}:{span:y}}),b=t.computed(()=>{const v=l.showColumn||3;let y=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&v>1&&m.value.includes("all-line")?{}:{span:y}}),x=t.ref();return t.watch(i,()=>{i.value&&e.editor?.model.value=="view"&&s.value.convert&&new Le(s.value.convert).convert(i.value.toString()).then(v=>{x.value=v})}),(v,y)=>{const E=t.resolveComponent("a-form-item");return t.openBlock(),t.createBlock(ot,{class:t.normalizeClass(["unione-form-item",m.value]),style:t.normalizeStyle(s.value.css?.cssText)},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(E,{key:0,label:c.value,name:s.value.name,labelCol:k.value,wrapperCol:b.value,required:s.value.props?.required,rules:h.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]=w=>i.value=w),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,nr)):(t.openBlock(),t.createElementBlock("div",lr,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"]]),sr=te(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){Fe();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 k=p.value.convert||e.convert||{};if(k.refValue){const b={};return k.refValue.split(",").forEach(v=>{const y=v.split("=");y.length==1?b[y[0]]=W.utils.obj.getValue(e.formValue,y[0]):b[y[0]]=W.utils.obj.getValue(e.formValue,y[1])}),b}return{}}),r=t.computed(()=>(p.value.convert||e.convert||{}).search||!1),c=pt(k=>{const b=p.value.convert||e.convert||{};b.params={...f.value,...s.value},m.value.search(k).then(x=>{l.value=x})},500);function d(k,b){h.value.select&&h.value.select(k,{option:b,formValue:e.formValue})}const f=t.ref();t.onMounted(()=>{const k=p.value.convert||e.convert||{};f.value=k.params||{},k.params={...f.value,...s.value},e.mode=="multiple"&&typeof n.value=="string"&&(i.value=n.value.split(",")),m.value.load(n.value).then(b=>{l.value=b})});const h=t.ref({}),p=t.computed(()=>{const k=e.editor?.widget(e.wid)||e.widget||{};return k.event&&Object.keys(k.event).forEach(b=>{const x=k.event[b];x&&(h.value[b]=null,typeof x=="function"?h.value[b]=x:x.enable&&x.scriptText&&(h.value[b]=new Function("value","ctx",x.scriptText)))}),k}),m=t.computed(()=>{const k=p.value.convert||e.convert||{};return new Le(k)});return t.watch(n,pt(()=>{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(k=>{l.value=k}))},200)),t.watch(()=>p.value.convert||e.convert||{},pt(()=>{m.value.load().then(k=>{l.value=k})})),t.watch(()=>s.value,pt(()=>{if(console.log(p.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const k=p.value.convert||e.convert||{};k.params={...f.value,...s.value},m.value.load(n.value,!0).then(b=>{l.value=b})}},200),{deep:!0}),t.watch(i,()=>{Array.isArray(i.value)&&e.valueType=="string"?n.value=i.value.join(","):n.value=i.value}),(k,b)=>{const x=t.resolveComponent("a-select");return t.openBlock(),t.createBlock(x,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:i.value,"onUpdate:value":b[0]||(b[0]=v=>i.value=v),onSearch:t.unref(c),onSelect:d},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-f4706b5f"]]),ar=te(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 Le(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]=f=>i.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),rr=te(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 f=c.value.convert||e.convert||{};if(f.refValue){const h={};return f.refValue.split(",").forEach(m=>{const k=m.split("=");k.length==1?h[k[0]]=W.utils.obj.getValue(e.formValue,k[0]):h[k[0]]=W.utils.obj.getValue(e.formValue,k[1])}),console.log(c.value.name+" ref field:"+f.refValue+",ref value",h),h}return{}}),s=t.ref();t.onMounted(()=>{const f=c.value.convert||e.convert||{};s.value=f.params||{},f.params={...s.value,...o.value},d.value.load(i.value||c.value.value).then(h=>{n.value=h})});const r=t.ref({}),c=t.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(h=>{const p=f.event[h];p&&(r.value[h]=null,typeof p=="function"?r.value[h]=p:p.enable&&p.scriptText&&(r.value[h]=new Function("value","ctx",p.scriptText)))}),f}),d=t.computed(()=>{const f=c.value.convert||e.convert||{};return new Le(f)});return t.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const f=c.value.convert||e.convert||{};f.params={...s.value,...o.value},d.value.load(void 0,!0).then(h=>{n.value=h})}},{deep:!0}),(f,h)=>{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":h[0]||(h[0]=m=>i.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),cr=te(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 k=f.value.convert||i.convert||{};if(k.refValue){const b={};return k.refValue.split(",").forEach(v=>{const y=v.split("=");y.length==1?b[y[0]]=W.utils.obj.getValue(i.formValue,y[0]):b[y[0]]=W.utils.obj.getValue(i.formValue,y[1])}),console.log(f.value.name+" ref field:"+k.refValue+",ref value",b),b}return{}}),c=t.ref();t.onMounted(()=>{const k=n.value||f.value.value;i.returnType==="string"?l.value=k.split(","):l.value=k;const b=f.value.convert||i.convert||{};c.value=b.params||{},b.params={...c.value,...r.value},m.value.load().then(x=>{o.value=x})});const d=t.ref({}),f=t.computed(()=>{const k=i.editor?.widget(i.wid)||i.widget||{};return k.event&&Object.keys(k.event).forEach(b=>{const x=k.event[b];d.value[b]=null,x.enable&&x.scriptText&&(d.value[b]=new Function("value","ctx",x.scriptText))}),k}),h=e;function p(k){i.returnType==="string"?n.value=k.join(","):n.value=k,console.log("checkbox changed",n.value),h("change",n.value)}const m=t.computed(()=>{const k=f.value.convert||i.convert||{};return new Le(k)});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(f.value.name+" ref value changed",r.value),r.value){l.value=[],i.returnType==="string"?n.value="":n.value=[];const k=f.value.convert||i.convert||{};k.params={...c.value,...r.value},m.value.load(void 0,!0).then(b=>{o.value=b})}},{deep:!0}),(k,b)=>{const x=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createBlock(x,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":b[0]||(b[0]=v=>l.value=v),onChange:p},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),dr=te(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=W.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 sn(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 Nl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Vl(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])%Nl.length;n+=Nl[o]}return n}const hr={toHump:sn,randomStr:Vl},fr=te(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=Vl(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"]]),ur={class:"unione-props-setting unione-query-setting"},pr={class:"unione-query-opts"},mr={key:0},gr=["onClick"],kr={key:1},br={key:1,class:"edit-field"},yr=["onClick"],wr=te(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:E})=>E+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 E=e.editor.widget(e.wid)||{};return E.configs||(E.configs={}),E.configs.btns||(E.configs.btns=[]),E}),l=t.computed(()=>(e.editor.dataModels()||[]).map(w=>({value:w.sn,label:w.title+"("+w.name+")"}))),o=t.computed(()=>{const E=[],w=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(u=>{E.push(u),w.push(u.name)}),w.includes("query")||E.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),w.includes("reset")||E.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),w.includes("reset")||E.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),E.sort((u,B)=>{const M=u.index||1,C=B.index||1;return M-C}),E}),s=t.ref(null);function r(E){s.value&&s.value.open(E,w=>{w.visible=!0,Object.keys(w).forEach(u=>{E[u]=w[u]}),n.value.configs.btns.sort((u,B)=>{const M=u.index||1,C=B.index||1;return M-C}),n.value.configs.btns=[...n.value.configs.btns]})}function c(){const E=n.value.configs.btns.length+1;let w={title:"新增",name:"new_"+E,size:"default",index:E,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.btns.push(w),e.editor.widget(e.wid,n.value),s.value.open(w,u=>{Object.keys(u).forEach(B=>{w[B]=u[B]}),n.value.configs.btns=[...n.value.configs.btns]})}function d(E){const w=()=>{if(["query","reset","advanced"].includes(E.name))E.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const u=[];n.value.configs.btns.forEach(B=>{B.name!=E.name&&u.push(B)}),n.value.configs.btns=u}};ee.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{w()}})}const f=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),h=t.computed(()=>f.value.fields?.length?f.value.fields:[]),p={mounted:E=>E.focus()},m=t.ref({});function k(){const E=Object.keys(m.value);if(E.length)for(let w in E){const u=h.value.filter(B=>B.name==w);if(u&&u[0]){let B=m.value[w];Object.keys(B).forEach(M=>{if(M=="showIndex"){const C=u[0].show?.query||{};u[0].show||(u[0].show={}),u[0].show.query={...C,index:B[M]}}else u[0][M]=B[M]})}}m.value={}}function b(E,w){k();const u={};u[w]=E[w]||"",w=="showIndex"&&(u[w]=E.show?.query?.index),m.value[E.name]=u}function x(E,w){if(!E||!w){m.value={};return}const u=m.value[E.name][w];if(w=="showIndex"){const B=E.show?.query||{};E.show||(E.show={}),E.show.query={...B,index:u}}else E[w]=u;m.value={}}function v(E,w){h.value.filter(B=>B.name==E.name).forEach(B=>{B[w]=!B[w]})}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:E=>{const w=y.value.options.filter(u=>u.value==E);return w[0]?w[0].label:E}});return(E,w)=>{const u=t.resolveComponent("a-divider"),B=t.resolveComponent("CloseOutlined"),M=t.resolveComponent("a-button"),C=t.resolveComponent("PlusOutlined"),A=t.resolveComponent("a-select"),N=t.resolveComponent("ToolOutlined"),V=t.resolveComponent("a-checkbox"),g=t.resolveComponent("a-input-number"),S=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ur,[t.createVNode(u,{orientation:"left"},{default:t.withCtx(()=>w[3]||(w[3]=[t.createTextVNode("查询按钮")])),_:1}),t.createElementVNode("div",pr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,I=>(t.openBlock(),t.createBlock(M,t.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"default",ref_for:!0},I.props||{},{onClick:R=>r(I)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(I.title)+" ",1),I.visible?(t.openBlock(),t.createBlock(B,{key:0,class:"btn-del",onClick:t.withModifiers(R=>d(I),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(M,{class:t.normalizeClass(["btn","btn-add"]),onClick:w[0]||(w[0]=I=>c()),size:"small"},{default:t.withCtx(()=>[t.createVNode(C)]),_:1})]),t.createVNode(u,{orientation:"left"},{default:t.withCtx(()=>w[4]||(w[4]=[t.createTextVNode("查询字段")])),_:1}),w[5]||(w[5]=t.createTextVNode(" 数据模型:")),t.createVNode(A,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":w[1]||(w[1]=I=>n.value.dataModel=I)},null,8,["options","value"]),t.createVNode(S,{columns:i.value,"data-source":h.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:I})=>[["showIndex","queryType"].includes(I.key)?(t.openBlock(),t.createElementBlock("span",mr,[t.createVNode(N),t.createTextVNode(" "+t.toDisplayString(I.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:I,text:R,record:F})=>[["queryType"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!R&&"empty"]),onClick:$=>b(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(A,{key:0,value:F[I.dataIndex],"onUpdate:value":$=>F[I.dataIndex]=$,allowClear:!0,options:y.value.options,onBlur:w[2]||(w[2]=$=>x())},null,8,["value","onUpdate:value","options"])),[[p]]):(t.openBlock(),t.createElementBlock("span",kr,t.toDisplayString(y.value.showLabel(R)),1))],10,gr)):["isQuery"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",br,[t.createVNode(V,{checked:F[I.dataIndex],onClick:$=>v(F,I.dataIndex)},null,8,["checked","onClick"])])):I.dataIndex=="showIndex"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!R&&"empty"]),onClick:$=>b(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(g,{key:0,value:m.value[F.name][I.dataIndex],"onUpdate:value":$=>m.value[F.name][I.dataIndex]=$,onBlur:$=>x(F,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(F.show?.query?.index||" "),1)],64))],10,yr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),Ar={class:"query-btn"},xr={class:"btn-advanced-overlay"},Rl=te(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 x=i.editor?.widget(i.wid)||i.widget||{};return x.btns||(x.btns=[]),x}),l=t.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=t.computed(()=>{let x=[];return n.value.fields?.length&&(x=n.value.fields),x.length==0&&i.fields?.length&&(x=i.fields),x.sort((v,y)=>{const E=v.show?.query?.index||1,w=y.show?.query?.index||1;return E-w}),x.forEach(v=>{!v.widget&&!v.control&&v.convert&&(v.widget="unione-select-box"),v.widget=v.widget||v.control||"a-input",v.defaultValue!=null&&v.defaultValue!="undefined"&&typeof v.defaultValue<"u"&&(f.value[v.name]=v.defaultValue,v.value=v.defaultValue)}),x}),s=t.computed(()=>n.value.labelWidth||7),r=t.computed(()=>{const x=n.value.btns.filter(v=>v.name=="advanced")[0]||{};return x.event?.clickScript&&(x.event.click=new Function("ctx","btn","event",x.event.clickScript)),x.event?.disableScript&&(x.event.disable=new Function("ctx","btn",x.event.disableScript)),x.event?.visibleScript&&(x.event.visible=new Function("ctx","btn",x.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...x}}),c=["query","reset","advanced"],d=t.computed(()=>{const x=n.value.btns.filter(y=>y.name!="advanced"),v=[];return x.forEach(y=>{y.size||(y.size="default"),v.push(y.name)}),v.includes("query")||x.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),v.includes("reset")||x.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),x.sort((y,E)=>{const w=y.index||1,u=E.index||1;return w-u}),x}),f=t.ref({}),h=t.computed(()=>{const x={};return n.value.params?Object.keys(n.value.params).forEach(v=>{x[v]=n.value.params[v]}):i.params&&Object.keys(i.params).forEach(v=>{x[v]=i.params[v]}),x});t.onMounted(()=>{i.editor?.ebus.$on("query-form-params",x=>{n.value.params=x}),k()});const p=e;function m({btn:x,event:v}){console.log("unione query form btn click",x,v),x.name=="query"&&k(),x.name=="reset"&&b(),p("btnClick",{btn:x,event:v})}function k(){const x=[];o.value.forEach(y=>{y.visible&&x.push(y.name)});const v={params:{...h.value},keywords:""};Object.keys(f.value).forEach(y=>{x.includes(y)&&(v.params[y]=f.value[y])}),l.value.visible&&f.value[l.value.name]&&(v.keywords=f.value[l.value.name]),p("query",v),i.editor?.ebus.$emit("table-list-search",v)}function b(){f.value={},o.value.forEach(v=>{v.visible=!1});const x={params:{...h.value},keywords:""};p("reset",x),i.editor?.ebus.$emit("table-list-reset",x)}return(x,v)=>{const y=t.resolveComponent("a-input"),E=t.resolveComponent("a-form-item"),w=t.resolveComponent("unione-btn"),u=t.resolveComponent("a-checkbox"),B=t.resolveComponent("DownOutlined"),M=t.resolveComponent("a-button"),C=t.resolveComponent("a-dropdown"),A=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ot,{class:"unione-query-form",model:i.editor?.model.value,"setting-title":"查询设置"},t.createSlots({default:t.withCtx(()=>[t.createVNode(A,{model:f.value,layout:"horizontal","label-col":{span:s.value}},{default:t.withCtx(()=>[l.value.visible?(t.openBlock(),t.createBlock(E,{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:f.value[l.value.name],"onUpdate:value":v[0]||(v[0]=N=>f.value[l.value.name]=N),allowClear:"",onKeyup:t.withKeys(k,["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(E,{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:f.value[N.name],"onUpdate:value":V=>f.value[N.name]=V,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",Ar,[(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(w,{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(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:t.withCtx(()=>[t.createElementVNode("div",xr,[(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:V=>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(B)]),_: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(wr,{editor:i.editor,wid:i.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),vr={class:"unione-props-setting unione-table-setting"},Cr={class:"unione-table-tools"},Sr={key:1,class:"unione-table-opts"},Br={key:0},Nr=["onClick"],Vr={key:1,class:"edit-field"},Rr=["onClick"],Er={key:1},Or=te(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:C})=>C+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(C,A){let N=C.filter(V=>V.value==A);return N&&N[0]&&N[0].label||A}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,A){let N=C.filter(V=>V.value==A);return N&&N[0]&&N[0].label||A}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=t.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=t.computed(()=>(e.editor.dataModels()||[]).map(A=>({value:A.sn,label:A.title+"("+A.name+")"}))),o=t.computed(()=>{if(!n.value)return[];const C=[],A=n.value.configs.leftBtns;if(A.forEach(N=>{C.push(N.name)}),!C.includes("add")){const N={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};A.splice(0,0,N)}if(!C.includes("delBatch")){const N={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};A.splice(1,0,N)}return A}),s=t.computed(()=>{if(!n.value)return[];const C=[],A=n.value.configs.rightBtns;if(A.forEach(N=>{C.push(N.name)}),!C.includes("downData")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};A.splice(0,0,N)}if(!C.includes("impData")){const N={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};A.splice(1,0,N)}if(!C.includes("expData")){const N={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};A.splice(2,0,N)}if(!C.includes("downTmpl")){const N={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};A.splice(3,0,N)}return A});function r(C,A){C=="left"?f.value.open(A,N=>{N.visible=!0,Object.keys(N).forEach(V=>{A[V]=N[V]}),n.value.configs.leftBtns.sort((V,g)=>{const S=V.index||1,I=g.index||1;return S-I}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):f.value.open(A,N=>{N.visible=!0,Object.keys(N).forEach(V=>{A[V]=N[V]}),n.value.configs.rightBtns.sort((V,g)=>{const S=V.index||1,I=g.index||1;return S-I}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(C){const A=C=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let N={title:"新增"+A,name:"new_"+A,index:A,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?n.value.configs.leftBtns.push(N):n.value.configs.rightBtns.push(N),e.editor.widget(e.wid,n.value),r(C,N)}function d(C,A){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(A.name))A.visible=!1,C=="left"?n.value.configs.leftBtns=[...n.value.configs.leftBtns]:n.value.configs.rightBtns=[...n.value.configs.rightBtns];else if(C=="left"){const V=[];n.value.configs.leftBtns.forEach(g=>{g.name!=A.name&&V.push(g)}),n.value.configs.leftBtns=V}else{const V=[];n.value.configs.rightBtns.forEach(g=>{g.name!=A.name&&V.push(g)}),n.value.configs.rightBtns=V}};ee.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const f=t.ref(null);function h(C){f.value.open(C,A=>{A.visible=!0,Object.keys(A).forEach(N=>{C[N]=A[N]}),n.value.configs.operation.btns.sort((N,V)=>{const g=N.index||1,S=V.index||1;return g-S}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function p(){const C=n.value.configs.operation.btns.length+1;let A={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.operation.btns.push(A),e.editor.widget(e.wid,n.value),f.value.open(A,N=>{Object.keys(N).forEach(V=>{A[V]=N[V]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(C){const A=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,n.value.configs.operation.btns=[...n.value.configs.operation.btns];else{const N=[];n.value.configs.operation.btns.forEach(V=>{V.name!=C.name&&N.push(V)}),n.value.configs.operation.btns=N}};ee.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{A()}})}const k=t.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),b=t.computed(()=>k.value.fields?.length?(k.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),k.value.fields):[]),x={mounted:C=>C.focus()},v=t.ref({});function y(){const C=Object.keys(v.value);if(C.length)for(let A in C){const N=b.value.filter(V=>V.name==A);if(N&&N[0]){let V=v.value[A];Object.keys(V).forEach(g=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),g=="showIndex"?N[0].show.list.index=V[g]:g=="showWidth"?N[0].show.list.width=V[g]:g=="fixed"?N[0].show.list.fixed=V[g]:g=="align"?N[0].show.list.align=V[g]:N[0][g]=V[g]})}}v.value={}}function E(C,A){y();const N={};A=="showIndex"?N[A]=C.show?.list?.index:A=="showWidth"?N[A]=C.show?.list?.width:A=="fixed"?N[A]=C.show?.list?.fixed:A=="align"?N[A]=C.show?.list?.align:N[A]=C[A]||"",v.value[C.name]=N}function w(C,A){if(!C||!A){v.value={};return}const N=v.value[C.name][A];C.show||(C.show={}),C.show.list||(C.show.list={}),A=="showIndex"?C.show.list.index=N:A=="showWidth"?C.show.list.width=N:A=="fixed"?C.show.list.fixed=N:A=="align"?C.show.list.align=N:C[A]=N,v.value={}}function u(C,A){return A=="showIndex"?C.show?.list?.index:A=="showWidth"?C.show?.list?.width:A=="fixed"?C.show?.list?.fixed:A=="align"?C.show?.list?.align:C[A]}function B(C,A){b.value.filter(V=>V.name==C.name).forEach(V=>{V[A]=!V[A]})}const M=t.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const A=M.value.options.filter(N=>N.value==C);return A[0]?A[0].label:C}});return(C,A)=>{const N=t.resolveComponent("a-divider"),V=t.resolveComponent("CloseOutlined"),g=t.resolveComponent("a-button"),S=t.resolveComponent("PlusOutlined"),I=t.resolveComponent("a-input"),R=t.resolveComponent("a-form-item"),F=t.resolveComponent("a-col"),$=t.resolveComponent("a-input-number"),_=t.resolveComponent("a-checkbox"),q=t.resolveComponent("a-row"),L=t.resolveComponent("a-select"),O=t.resolveComponent("ToolOutlined"),G=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",vr,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[8]||(A[8]=[t.createTextVNode("工具设置")])),_:1}),t.createElementVNode("div",Cr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,T=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:D=>r("left",T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"bool-del",onClick:t.withModifiers(D=>d("left",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(g,{class:t.normalizeClass(["btn","tool-add"]),size:"small",onClick:A[0]||(A[0]=T=>c("left"))},{default:t.withCtx(()=>[t.createVNode(S)]),_:1}),t.createVNode(g,{class:t.normalizeClass(["btn","tool-add","right"]),onClick:A[1]||(A[1]=T=>c("right")),size:"small"},{default:t.withCtx(()=>[t.createVNode(S)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,T=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:T.name,class:["btn","right",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:D=>r("right",T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"bool-del",onClick:t.withModifiers(D=>d("right",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(N,{orientation:"left"},{default:t.withCtx(()=>A[9]||(A[9]=[t.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createBlock(q,{key:0},{default:t.withCtx(()=>[t.createVNode(F,{span:7},{default:t.withCtx(()=>[t.createVNode(R,{label:"操作标题"},{default:t.withCtx(()=>[t.createVNode(I,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),t.createVNode(F,{span:5},{default:t.withCtx(()=>[t.createVNode(R,{label:"显示宽度",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":A[2]||(A[2]=T=>n.value.configs.operation.width=T)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(F,{span:6},{default:t.withCtx(()=>[t.createVNode(R,{label:"显示按钮数量",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":A[3]||(A[3]=T=>n.value.configs.operation.count=T)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(F,{span:5},{default:t.withCtx(()=>[t.createVNode(R,{label:"是否显示"},{default:t.withCtx(()=>[t.createVNode(_,{checked:n.value.configs.operation.visible,"onUpdate:checked":A[4]||(A[4]=T=>n.value.configs.operation.visible=T)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[10]||(A[10]=[t.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(t.openBlock(),t.createElementBlock("div",Sr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value.configs.operation.btns,T=>(t.openBlock(),t.createBlock(g,t.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"small",ref_for:!0},T.props||{},{onClick:D=>h(T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(V,{key:0,class:"btn-del",onClick:t.withModifiers(D=>m(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(g,{class:t.normalizeClass(["btn","btn-add"]),onClick:A[5]||(A[5]=T=>p()),size:"small"},{default:t.withCtx(()=>[t.createVNode(S)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>A[11]||(A[11]=[t.createTextVNode("表头设置")])),_:1}),A[12]||(A[12]=t.createTextVNode(" 数据模型:")),t.createVNode(L,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":A[6]||(A[6]=T=>n.value.dataModel=T)},null,8,["options","value"]),t.createVNode(G,{columns:i.value,"data-source":b.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:T})=>[["showIndex","showWidth","align","fixed"].includes(T.key)?(t.openBlock(),t.createElementBlock("span",Br,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(T.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:T,record:D})=>[["showIndex","showWidth"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!v.value[D.name]||!Object.keys(v.value[D.name]).includes(T.dataIndex))&&!u(D,T.dataIndex)&&"empty"]),onClick:Q=>E(D,T.dataIndex)},[v.value[D.name]&&Object.keys(v.value[D.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock($,{key:0,value:v.value[D.name][T.dataIndex],"onUpdate:value":Q=>v.value[D.name][T.dataIndex]=Q,onBlur:Q=>w(D,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[x]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(u(D,T.dataIndex)),1)],64))],10,Nr)):["isList","isQuery","isSort"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",Vr,[t.createVNode(_,{checked:D[T.dataIndex],onClick:Q=>B(D,T.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!v.value[D.name]||!Object.keys(v.value[D.name]).includes(T.dataIndex))&&!u(D,T.dataIndex)&&"empty"]),onClick:Q=>E(D,T.dataIndex)},[v.value[D.name]&&Object.keys(v.value[D.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(L,{key:0,value:D.show.list[T.dataIndex],"onUpdate:value":Q=>D.show.list[T.dataIndex]=Q,allowClear:!0,options:T.options,onBlur:A[7]||(A[7]=Q=>w())},null,8,["value","onUpdate:value","options"])),[[x]]):(t.openBlock(),t.createElementBlock("span",Er,t.toDisplayString(T.showLabel(T.options,u(D,T.dataIndex))),1))],10,Rr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Mr={class:"unione-table-tools"},Tr={class:"unione-table-data"},Ir={key:0,class:"unione-table-opts"},El=te(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=Fe(),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}),f=t.computed(()=>{if(o.value.operation==!1||!Array.isArray(o.value.operation.btns))return{visible:!1};const S=W.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),I=[];let R=(o.value.operation?.btns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F));if(R.forEach(F=>{I.push(F.name)}),I.includes("edit")||R.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),I.includes("view")||R.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),I.includes("delete")||R.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const F=R.filter(_=>_.name=="edit")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const _=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",q=l.editor.model.value;F.action.link=n.editPageUrl+"?psn="+_+"&model="+q+"&id={row."+l.rowKey+"}"}const $=R.filter(_=>_.name=="view")[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";$.action.link=n.viewPageUrl+"?psn="+_+"&model=view&id={row."+l.rowKey+"}"}}return R=R.filter(F=>F.visible!=!1).sort((F,$)=>{const _=F.index||1,q=$.index||1;return _-q}),S.count&&(R.length>S.count+1?(S.btns=R.slice(0,S.count),S.more.items=R.slice(S.count,R.length),S.more.visible=!0):(S.btns=R,S.more.visible=!1)),S}),h=t.computed(()=>{let S=[];o.value.columns?.length&&(S=[...o.value.columns]);const I=[];S.forEach((F,$)=>{F.dataIndex=F.name,F.convert&&(F.dataIndex=F.name+"Label",F.convertObj=new Le(F.convert),F.customCell=(_,q,L)=>{const O=W.utils.obj.getValue(_,L.name);F.convertObj&&(_[L.dataIndex]==null||_[L.dataIndex]==null)&&O!=null&&O!=null&&(O+"").length>0&&(_[L.dataIndex]=O,F.convertObj.convert(O).then(G=>{G&&W.utils.obj.setValue(_,L.dataIndex,G)}))}),F.sort?.enable&&(F.sorter=!0,F.sort.multiple&&(F.sorter={},F.sorter.multiple=F.sort.multiple),F.sort.defoult&&(F.defaultSortOrder=F.sort.asc?"ascend":"descend")),F.customRender=({record:_,column:q})=>W.utils.obj.getValue(_,q.dataIndex)||"--",F.fkey?.enable&&(F.fkey.labelName&&(F.dataIndex=sn(F.fkey.labelName)),F.fkey.labelTitle&&(F.title=F.fkey.labelTitle),F.customRender=({record:_,column:q})=>_&&_[q.name+"FEntry"]&&_[q.name+"FEntry"][q.dataIndex]||"--",F.fkey.fields?.forEach((_,q)=>{if(!_.name)return;const L=sn(_.name),O={fkName:F.name,title:_.title,name:L,dataIndex:_.name,width:_.width,index:_.index||$+q+1,customRender:({record:G,column:T})=>{if(G&&G[T.fkName+"FEntry"]){const D=G[T.fkName+"FEntry"][T.name];if(D)return _.convertObj&&_.convertObj.convert(D)||D}return"--"}};_.convert&&(_.convertObj=new Le(_.convert)),I.push(O)}))}),I.forEach(F=>{S.splice(F.index,0,F)});const R=W.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return R&&R.visible!=!1&&(R.customRender=F=>E.value?(E.value.current-1)*E.value.pageSize+F.index+1:F.index,S=[R,...S]),f.value&&f.value.visible!=!1&&S.push({fixed:"right",align:"center",...f.value,name:"operation"}),S}),p=t.computed(()=>{if(o.value.leftBtns===!1||!Array.isArray(o.value.leftBtns))return[];const S=[],I=[];if((o.value.leftBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name),F.name=="delBatch"&&!w.value&&(F.visible=!1)}),!I.includes("add")){const F={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};S.splice(0,0,F)}if(!I.includes("delBatch")&&w.value){const F={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};S.splice(1,0,F)}if(l.editor&&l.editor.type.value!="code"){const F=S.filter($=>$.name=="add")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",_=l.editor.model.value;F.action.link=n.addPageUrl+"?psn="+$+"&model="+_}}return S});function m({btn:S,event:I}){if(n.isDebug&&console.log("unione table left btn click",S,I),S.name=="delBatch"){if(!u.value.selectedRowKeys.length){ee.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(u.value.selectedRowKeys).then(()=>{V(),N(!0)});return}ee.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+u.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const k=t.computed(()=>{if(o.value.rightBtns===!1||!Array.isArray(o.value.rightBtns))return[];const S=[],I=[];if((o.value.rightBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name)}),!I.includes("impData")){const F={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};S.splice(1,0,F)}if(!I.includes("expData")){const F={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};S.splice(2,0,F)}if(!I.includes("downTmpl")){const F={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};S.splice(3,0,F)}return S});function b({btn:S,event:I}){n.isDebug&&console.log("unione table right btn click",S,I),M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("rightBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const x=t.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),v=t.ref({}),y=t.ref(null),E=t.computed(()=>W.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"]})),w=t.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),u=t.ref({selectedRowKeys:[],selectedRowList:[],onChange:(S,I)=>{u.value.selectedRowKeys=S,u.value.selectedRowList=I},getCheckboxProps:S=>({disabled:S.checkable})}),B=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=i;function C({btn:S,event:I},R){if(n.isDebug&&console.log("unione table opt btn click",S,I),S.name=="delete"){if(c.value){c.value.deleteByIds([R[r.value]]).then(()=>{V(),u.value.selectedRowKeys=u.value.selectedRowKeys.filter(F=>F!=R[r.value]),u.value.selectedRowList=u.value.selectedRowList.filter(F=>F[r.value]!=R[r.value])});return}ee.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(S.name,{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:R,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}function A(S,I,R,F){console.log("tableChanged",S,I,R,F),y.value={page:S.current,pageSize:S.pageSize},R&&(Array.isArray(R)?(y.value.sorts=[],R.forEach($=>{y.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):R.column&&(y.value.sorts=[{name:R.column.name,asc:R.order=="ascend"}])),V(),M("change",{pagination:S,filters:I,sorter:R,event:F})}function N(S=!1){S?(u.value.selectedRowKeys=[],u.value.selectedRowList=[]):ee.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${u.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{u.value.selectedRowKeys=[],u.value.selectedRowList=[]}})}function V(){if(c.value){const S={page:E.value.current,pageSize:E.value.pageSize,keywords:v.value.keywords,body:v.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(()=>{h.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),v.value=S||{},V()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),v.value={},V(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),V()})});function g(){return{keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}}return e({getSelected:g,clearSelected:N}),(S,I)=>{const R=t.resolveComponent("unione-btn"),F=t.resolveComponent("DownOutlined"),$=t.resolveComponent("a-button"),_=t.resolveComponent("a-dropdown"),q=t.resolveComponent("a-table");return t.openBlock(),t.createBlock(ot,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",Mr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,L=>(t.openBlock(),t.createBlock(R,{key:L.name,class:"btn",widget:L,editor:a.editor,onClick:m,preset:B,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:I[0]||(I[0]=L=>N())},"当前选中记录("+t.toDisplayString(u.value.selectedRowKeys.length)+")",1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,L=>(t.openBlock(),t.createBlock(R,{key:L.name,class:"btn right",widget:L,editor:a.editor,onClick:b,preset:B,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),t.createElementVNode("div",Tr,[h.value&&h.value.length?(t.openBlock(),t.createBlock(q,t.mergeProps({key:0,columns:h.value,rowKey:r.value,"data-source":d.value,"row-selection":w.value?u.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:E.value,onChange:A},x.value),{bodyCell:t.withCtx(({column:L,record:O})=>[L.name==="operation"?(t.openBlock(),t.createElementBlock("div",Ir,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value.btns,G=>(t.openBlock(),t.createBlock(R,{key:G.name,class:"opt",widget:G,editor:a.editor,onClick:T=>C(T,O),preset:B,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(t.openBlock(),t.createBlock(_,{key:0,trigger:[f.value.more.trigger||"hover"],class:t.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value.more.items,G=>(t.openBlock(),t.createBlock(R,{key:G.name,class:"item",widget:G,editor:a.editor,onClick:T=>C(T,O),type:"text",preset:B,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode($,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value.more.title)+" ",1),t.createVNode(F)]),_: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(Or,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-7e2010e6"]]);class _e{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(ce.EDITOR_COMPONENT,ce.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(ce.EDITOR_COMPONENT,ce.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 f=document.createElement("span");f.append(document.createTextNode(e));const h=document.createElement("i");h.onclick=()=>{n&&n(),this._dispose()},d.append(f),d.append(h),c.append(d);const p=document.createElement("div");p.classList.add("dialog-option");for(let x=0;x<i.length;x++){const v=i[x],y=document.createElement("div");if(y.classList.add("dialog-option__item"),v.label){const w=document.createElement("span");w.append(document.createTextNode(v.label)),y.append(w),v.required&&w.classList.add("dialog-option__item--require")}let E;v.type==="select"?(E=document.createElement("select"),v.options?.forEach(w=>{const u=document.createElement("option");u.value=w.value,u.label=w.label,E.append(u)})):v.type==="textarea"?E=document.createElement("textarea"):(E=document.createElement("input"),E.type=v.type),v.width&&(E.style.width=`${v.width}px`),v.height&&(E.style.height=`${v.height}px`),E.name=v.name,E.value=v.value||"",E instanceof HTMLSelectElement||(E.placeholder=v.placeholder||""),y.append(E),p.append(y),this.inputList.push(E)}c.append(p);const m=document.createElement("div");m.classList.add("dialog-menu");const k=document.createElement("button");k.classList.add("dialog-menu__cancel"),k.append(document.createTextNode("取消")),k.type="button",k.onclick=()=>{l&&l(),this._dispose()},m.append(k);const b=document.createElement("button");b.append(document.createTextNode("确定")),b.type="submit",b.onclick=()=>{if(o){const x=this.inputList.map(v=>({name:v.name,value:v.value}));o(x)}this._dispose()},m.append(b),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Fr(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 _r(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,...Fr(s)})}}}return i(a),e}const Dr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",$r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",Wr="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==",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",pc="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",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",Ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ml="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Tl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",xc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",Cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",Sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",Nc=["title"],Vc=["title"],Rc={class:"options"},Ec=["title"],Oc={class:"options"},Mc={class:"options"},Tc=["title"],Ic=["title"],Fc=["title"],_c=["title"],Dc=["title"],Pc={class:"options"},$c={class:"options"},Lc={class:"options"},Uc={class:"options"},zc={class:"options"},jc={class:"menu-item__search__collapse__search"},qc={class:"arrow-left"},Qc={class:"arrow-right"},Wc=te(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,g){console.log("exec cmd "+V+",params:",g),V!="Separator"&&Array.isArray(g)?i.editor?.command["execute"+V](g[0],g[1]):i.editor?.command["execute"+V](g)}function d(V,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+V+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px"}let f=!0,h;function p(){f?(f=!1,h=window.setTimeout(()=>{f=!0,i.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(h)}function m(){f=!0,window.clearTimeout(h),i.editor?.command.executePainter({isDblclick:!0})}function k(){new _e({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:V=>{const g=V.find(S=>S.name==="value")?.value;g&&i.editor?.command.executeInsertElementList([{type:ce.ElementType.LATEX,value:g}])}})}function b(V){i.editor?.command.executeInsertElementList([{type:V,checkbox:{value:!1},value:""}])}function x(V,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+V+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px";const R=ma();I.firstChild.childNodes.forEach(F=>{const $=F.attributes.getNamedItem("label-format").value;F.innerText=R.format($),F.onclick=()=>{i.editor?.command.executeInsertElementList([{type:ce.ElementType.DATE,dateFormat:F.attributes.getNamedItem("data-format").value,valueList:[{value:F.innerText.trim()}]}])}})}function v(){new _e({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 g=V.find(q=>q.name==="type")?.value;if(!g)return;const S=V.find(q=>q.name==="width")?.value,I=V.find(q=>q.name==="height")?.value;if(!I)return;const R=V.find(q=>q.name==="src")?.value,F=V.find(q=>q.name==="srcdoc")?.value,$={type:g};if($.type===ce.BlockType.IFRAME){if(!R&&!F)return;$.iframeBlock={src:R,srcdoc:F}}else if($.type===ce.BlockType.VIDEO){if(!R)return;$.videoBlock={src:R}}const _={type:ce.ElementType.BLOCK,value:"",height:Number(I),block:$};S&&(_.width=Number(S)),i.editor?.command.executeInsertElementList([_])}})}function y(V){const g=V.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__table__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-270/2+"px";const I=n.value.querySelector(".menu-item__table__collapse .table-close"),R=n.value.querySelector(".menu-item__table__collapse .table-select"),F=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(L=>{$.push(L.childNodes)});let _=0,q=0;F.onmousemove=L=>{const{offsetX:D,offsetY:Q}=L;$.forEach(U=>{U.forEach(P=>{P.classList.remove("active")})}),_=Math.ceil(D/22)||1,q=Math.ceil(Q/26)||1,$.forEach((U,P)=>{U.forEach((se,X)=>{X<_&&P<q&&se.classList.add("active")})}),R.innerText=`${q}×${_}`},F.onclick=()=>{S.style.display="none",i.editor?.command.executeInsertTable(q,_)},I.onclick=L=>{L.stopPropagation(),S.style.display="none"}}function E(){const V=n.value.querySelector(".menu-item__image .image");V.click(),V.onchange=function(){const g=V.files[0],S=new FileReader;S.readAsDataURL(g),S.onload=function(){const I=new Image,R=S.result;I.src=R,I.onload=function(){i.editor?.command.executeImage({value:R,width:I.width,height:I.height}),V.value=""}}}}function w(){new _e({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 g=V.find(I=>I.name==="name")?.value;if(!g)return;const S=V.find(I=>I.name==="url")?.value;S&&i.editor?.command.executeHyperlink({type:ce.ElementType.HYPERLINK,value:"",url:S,valueList:ce.splitText(g).map(I=>({value:I,size:16}))})}})}function u(V){V==="add"?new _e({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(F=>!F.value))return;const I=g.reduce((F,$)=>(F[$.name]=$.value,F),{}),R=I.repeat==="1";i.editor?.command.executeAddWatermark({data:I.data,color:I.color,size:Number(I.size),opacity:Number(I.opacity),repeat:R,gap:R&&I.horizontalGap&&I.verticalGap?[Number(I.horizontalGap),Number(I.verticalGap)]:void 0})}}):i.editor?.command.executeDeleteWatermark()}function B(){new _e({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:V=>{const g=V.find(F=>F.name==="codeblock")?.value;if(!g)return;const S=vl.tokenize(g,vl.languages.javascript),I=_r(S),R=[];for(let F=0;F<I.length;F++){const $=I[F],_=ce.splitText($.content);for(let q=0;q<_.length;q++){const O={value:_[q]};$.color&&(O.color=$.color),$.bold&&(O.bold=!0),$.italic&&(O.italic=!0),R.push(O)}}R.unshift({value:`
2
+ `}),i.editor?.command.executeInsertElementList(R)}})}function M(V){const g=V.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__search__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-260/2+"px";const I=n.value.querySelector(".menu-item__search__collapse__search input"),R=n.value.querySelector(".menu-item__search__collapse__replace input"),F=S.querySelector(".search-result");I.focus();const $=()=>{const _=i.editor?.command.getSearchNavigateInfo();if(_){const{index:q,count:L}=_;F.innerText=`${q}/${L}`}else F.innerText=""};S.querySelector("span").onclick=()=>{S.style.display="none",I.value="",R.value="",i.editor?.command.executeSearch(null),$()},I.oninput=()=>{i.editor?.command.executeSearch(I.value||null),$()},I.onkeydown=_=>{_.key==="Enter"&&(i.editor?.command.executeSearch(I.value||null),$())},S.querySelector("button").onclick=()=>{const _=I.value,q=R.value;_&&q&&_!==q&&i.editor?.command.executeReplace(q)},S.querySelector(".arrow-left").onclick=()=>{i.editor?.command.executeSearchNavigatePre(),$()},S.querySelector(".arrow-right").onclick=()=>{i.editor?.command.executeSearchNavigateNext(),$()}}function C(){const V=n.value.querySelector(".menu-item__color .input-color");V.oninput=function(){i.editor?.command.executeColor(V.value)},V.click()}function A(){const V=n.value.querySelector(".menu-item__highlight .input-highlight");V.oninput=function(){i.editor?.command.executeHighlight(V.value)},V.click()}function N(V){switch(V){case ce.ControlType.TEXT:new _e({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(R=>R.name==="placeholder")?.value;if(!S)return;const I=g.find(R=>R.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,value:I?[{value:I}]:null,placeholder:S}})}});break;case ce.ControlType.SELECT:new _e({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:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="valueSets")?.value;if(!I)return;const V=g.find(F=>F.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:V,value:null,placeholder:S,valueSets:JSON.parse(I)}})}});break;case ae.ControlType.CHECKBOX:new De({title:"复选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值,多个值以英文逗号分割"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
6
+ }]`}],onConfirm:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="valueSets")?.value;if(!I)return;const R=g.find(F=>F.name==="code")?.value;i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,code:R,value:null,placeholder:S,valueSets:JSON.parse(I)}})}});break;case ce.ControlType.CHECKBOX:new _e({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:g=>{const S=g.find(V=>V.name==="valueSets")?.value;if(!S)return;const I=g.find(V=>V.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ae.ControlType.RADIO:new De({title:"单选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
10
+ }]`}],onConfirm:g=>{const S=g.find(R=>R.name==="valueSets")?.value;if(!S)return;const I=g.find(R=>R.name==="code")?.value;i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ce.ControlType.RADIO:new _e({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:g=>{const S=g.find(V=>V.name==="valueSets")?.value;if(!S)return;const I=g.find(V=>V.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ae.ControlType.DATE:new De({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 S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="value")?.value||"",V=g.find(F=>F.name==="dateFormat")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,dateFormat:V,value:I?[{value:I}]:null,placeholder:S}})}});break;case ae.ControlType.NUMBER:new De({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(V=>V.name==="placeholder")?.value;if(!S)return;const I=g.find(V=>V.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,value:I?[{value:I}]:null,placeholder:S}})}});break}}return i.onMounted(()=>{window.addEventListener("click",E=>{const g=n.value?.querySelector(".visible");!g||g.contains(E.target)||g.classList.remove("visible")},{capture:!0}),t.editor&&(t.editor.listener.rangeStyleChange=E=>{i.nextTick(()=>{if(E.type===ae.ElementType.TEXT){const g=n.value,S=g.querySelector(".menu-item__font .select");S&&(S.textContent=E.font);const I=g.querySelector(".menu-item__size .select");if(I){const T={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};I.textContent=T[E.size]||"小四"}const V=g.querySelector(".menu-item__bold");V&&V.classList.toggle("active",E.bold);const F=g.querySelector(".menu-item__italic");F&&F.classList.toggle("active",E.italic);const $=g.querySelector(".menu-item__underline");$&&$.classList.toggle("active",E.underline);const D=g.querySelector(".menu-item__strikeout");D&&D.classList.toggle("active",E.strikeout);const Q=g.querySelector(".menu-item__color span");Q&&(Q.style.backgroundColor=E.color||"#000000");const L=g.querySelector(".menu-item__highlight span");L&&(L.style.backgroundColor=E.highlight);const O=g.querySelector(".menu-item__title .select");if(O){const T={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};O.textContent=T[E.level]||"正文"}["left","center","right","alignment","justify"].forEach(T=>{const _=g.querySelector(`.menu-item__${T}`);_&&_.classList.toggle("active",E.rowFlex===T)})}})})}),e({getHeight:o,getWidth:s}),(E,g)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"dom",ref:n,class:"unione-rich-toolbar menu","editor-component":"menu"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(S,I)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[S=="Undo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__undo",key:S,title:`撤销(${i.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:g[0]||(g[0]=V=>c("Undo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Mr)})`})},null,4)],8,xc)):i.createCommentVNode("",!0),S=="Redo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__redo",key:S,title:`重做(${i.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:g[1]||(g[1]=V=>c("Redo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Tr)})`})},null,4)],8,Cc)):i.createCommentVNode("",!0),S=="Painter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__painter",key:S,title:"格式刷(双击可连续使用)",onClick:p,onDblclick:m},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ir)})`})},null,4)],32)):i.createCommentVNode("",!0),S=="Format"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__format",key:S,title:"清除格式",onClick:g[2]||(g[2]=V=>c("Format")),"data-item":"Format"},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Fr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Divider"?(i.openBlock(),i.createElementBlock("div",{class:"menu-divider",key:S+I,"data-item":"Divider"})):i.createCommentVNode("",!0),S=="Font"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__font",onClick:g[19]||(g[19]=V=>h("menu-item__font",V)),style:{display:"none"},key:S},[g[99]||(g[99]=i.createElementVNode("span",{class:"select",title:"字体"},"微软雅黑",-1)),i.createElementVNode("div",{class:"options",ref_for:!0,ref:"fontOptions"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[3]||(g[3]=V=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),i.createElementVNode("li",{onClick:g[4]||(g[4]=V=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),i.createElementVNode("li",{onClick:g[5]||(g[5]=V=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),i.createElementVNode("li",{onClick:g[6]||(g[6]=V=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),i.createElementVNode("li",{onClick:g[7]||(g[7]=V=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[8]||(g[8]=V=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),i.createElementVNode("li",{onClick:g[9]||(g[9]=V=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[10]||(g[10]=V=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),i.createElementVNode("li",{onClick:g[11]||(g[11]=V=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),i.createElementVNode("li",{onClick:g[12]||(g[12]=V=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),i.createElementVNode("li",{onClick:g[13]||(g[13]=V=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),i.createElementVNode("li",{onClick:g[14]||(g[14]=V=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),i.createElementVNode("li",{onClick:g[15]||(g[15]=V=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),i.createElementVNode("li",{onClick:g[16]||(g[16]=V=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),i.createElementVNode("li",{onClick:g[17]||(g[17]=V=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),i.createElementVNode("li",{onClick:g[18]||(g[18]=V=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):i.createCommentVNode("",!0),S=="Size"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size",onClick:g[36]||(g[36]=V=>h("menu-item__size",V)),key:S},[g[100]||(g[100]=i.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),i.createElementVNode("div",vc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[20]||(g[20]=V=>c("Size",56))},"初号"),i.createElementVNode("li",{onClick:g[21]||(g[21]=V=>c("Size",48))},"小初"),i.createElementVNode("li",{onClick:g[22]||(g[22]=V=>c("Size",34))},"一号"),i.createElementVNode("li",{onClick:g[23]||(g[23]=V=>c("Size",32))},"小一"),i.createElementVNode("li",{onClick:g[24]||(g[24]=V=>c("Size",29))},"二号"),i.createElementVNode("li",{onClick:g[25]||(g[25]=V=>c("Size",24))},"小二"),i.createElementVNode("li",{onClick:g[26]||(g[26]=V=>c("Size",21))},"三号"),i.createElementVNode("li",{onClick:g[27]||(g[27]=V=>c("Size",20))},"小三"),i.createElementVNode("li",{onClick:g[28]||(g[28]=V=>c("Size",18))},"四号"),i.createElementVNode("li",{onClick:g[29]||(g[29]=V=>c("Size",16))},"小四"),i.createElementVNode("li",{onClick:g[30]||(g[30]=V=>c("Size",14))},"五号"),i.createElementVNode("li",{onClick:g[31]||(g[31]=V=>c("Size",12))},"小五"),i.createElementVNode("li",{onClick:g[32]||(g[32]=V=>c("Size",10))},"六号"),i.createElementVNode("li",{onClick:g[33]||(g[33]=V=>c("Size",8))},"小六"),i.createElementVNode("li",{onClick:g[34]||(g[34]=V=>c("Size",7))},"七号"),i.createElementVNode("li",{onClick:g[35]||(g[35]=V=>c("Size",6))},"八号")])])])):i.createCommentVNode("",!0),S=="SizeAdd"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:g[37]||(g[37]=V=>c("SizeAdd")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Dr)})`})},null,4)])):i.createCommentVNode("",!0),S=="SizeMinus"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:g[38]||(g[38]=V=>c("SizeMinus")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(_r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Bold"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:g[39]||(g[39]=V=>c("Bold")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Pr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Italic"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:g[40]||(g[40]=V=>c("Italic")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref($r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Underline"?(i.openBlock(),i.createElementBlock("div",{title:`下划线(${i.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:g[46]||(g[46]=V=>h("menu-item__underline",V)),"data-item":"Underline",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Lr)})`})},null,4),g[101]||(g[101]=i.createElementVNode("span",{class:"select"},null,-1)),i.createElementVNode("div",Bc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-decoration-style":"solid",onClick:g[41]||(g[41]=V=>c("Underline",{style:"solid"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"double",onClick:g[42]||(g[42]=V=>c("Underline",{style:"double"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(mc)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dashed",onClick:g[43]||(g[43]=V=>c("Underline",{style:"dashed"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dotted",onClick:g[44]||(g[44]=V=>c("Underline",{style:"dotted"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"wavy",onClick:g[45]||(g[45]=V=>c("Underline",{style:"wavy"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(gc)})`})},null,4)])])])],8,Sc)):i.createCommentVNode("",!0),S=="Strikeout"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:g[47]||(g[47]=V=>c("Strikeout")),"data-item":"Strikeout",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ur)})`})},null,4)])):i.createCommentVNode("",!0),S=="Superscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:g[48]||(g[48]=V=>c("Superscript")),"data-item":"Superscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(zr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Subscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:g[49]||(g[49]=V=>c("Subscript")),"data-item":"Subscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(jr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Color"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:v,"data-item":"Color",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(qr)})`})},null,4),g[102]||(g[102]=i.createElementVNode("span",null,null,-1)),g[103]||(g[103]=i.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):i.createCommentVNode("",!0),S=="Highlight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:C,"data-item":"Highlight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Qr)})`})},null,4),g[104]||(g[104]=i.createElementVNode("span",null,null,-1)),g[105]||(g[105]=i.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):i.createCommentVNode("",!0),S=="Title"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__title",onClick:g[57]||(g[57]=V=>h("menu-item__title",V)),"data-item":"Title",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Wr)})`})},null,4),g[106]||(g[106]=i.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),i.createElementVNode("div",Nc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{style:{"font-size":"16px"},onClick:g[50]||(g[50]=V=>c("Title",null))},"正文"),i.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:g[51]||(g[51]=V=>c("Title","first"))},"标题1"),i.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:g[52]||(g[52]=V=>c("Title","second"))},"标题2"),i.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:g[53]||(g[53]=V=>c("Title","third"))},"标题3"),i.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:g[54]||(g[54]=V=>c("Title","fourth"))},"标题4"),i.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:g[55]||(g[55]=V=>c("Title","fifth"))},"标题5"),i.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:g[56]||(g[56]=V=>c("Title","sixth"))},"标题6")])])])):i.createCommentVNode("",!0),S=="RowFlexLeft"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__left",onClick:g[58]||(g[58]=V=>c("RowFlex","left")),title:`左对齐(${i.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Yr)})`})},null,4)],8,Vc)):i.createCommentVNode("",!0),S=="RowFlexCenter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__center",onClick:g[59]||(g[59]=V=>c("RowFlex","center")),title:`居中对齐(${i.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Hr)})`})},null,4)],8,Rc)):i.createCommentVNode("",!0),S=="RowFlexRight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__right",onClick:g[60]||(g[60]=V=>c("RowFlex","right")),title:`右对齐(${i.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Kr)})`})},null,4)],8,Ec)):i.createCommentVNode("",!0),S=="RowFlexAlignment"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:g[61]||(g[61]=V=>c("RowFlex","alignment")),title:`两端对齐(${i.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Gr)})`})},null,4)],8,Oc)):i.createCommentVNode("",!0),S=="RowFlexJustify"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:g[62]||(g[62]=V=>c("RowFlex","justify")),title:`分散对齐(${i.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Jr)})`})},null,4)],8,Mc)):i.createCommentVNode("",!0),S=="RowMargin"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:g[71]||(g[71]=V=>h("menu-item__row-margin",V)),"data-item":"RowMargin",key:S},[i.createElementVNode("i",{title:"行间距",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Xr)})`})},null,4),i.createElementVNode("div",Tc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-rowmargin":"1",onClick:g[63]||(g[63]=V=>c("RowMargin",1))},"1"),i.createElementVNode("li",{"data-rowmargin":"1.25",onClick:g[64]||(g[64]=V=>c("RowMargin",1.25))},"1.25"),i.createElementVNode("li",{"data-rowmargin":"1.5",onClick:g[65]||(g[65]=V=>c("RowMargin",1.5))},"1.5"),i.createElementVNode("li",{"data-rowmargin":"1.75",onClick:g[66]||(g[66]=V=>c("RowMargin",1.75))},"1.75"),i.createElementVNode("li",{"data-rowmargin":"2",onClick:g[67]||(g[67]=V=>c("RowMargin",2))},"2"),i.createElementVNode("li",{"data-rowmargin":"2.5",onClick:g[68]||(g[68]=V=>c("RowMargin",2.5))},"2.5"),i.createElementVNode("li",{"data-rowmargin":"3",onClick:g[69]||(g[69]=V=>c("RowMargin",3))},"3"),i.createElementVNode("li",{"data-rowmargin":"5",onClick:g[70]||(g[70]=V=>c("RowMargin",5))},"5")])])])):i.createCommentVNode("",!0),S=="List"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__list",onClick:g[77]||(g[77]=V=>h("menu-item__list",V)),key:S},[i.createElementVNode("i",{title:"列表",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Zr)})`})},null,4),i.createElementVNode("div",Ic,[i.createElementVNode("ul",null,[g[112]||(g[112]=i.createElementVNode("li",null,[i.createElementVNode("label",null,"取消列表")],-1)),i.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:g[72]||(g[72]=V=>c("List",["ol","decimal"]))},g[107]||(g[107]=[i.createElementVNode("label",null,"有序列表:",-1),i.createElementVNode("ol",null,[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"checkbox",onClick:g[73]||(g[73]=V=>c("List",["ul","checkbox"]))},g[108]||(g[108]=[i.createElementVNode("label",null,"复选框列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☑️ '"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"disc",onClick:g[74]||(g[74]=V=>c("List",["ul","disc"]))},g[109]||(g[109]=[i.createElementVNode("label",null,"实心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"disc"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"circle",onClick:g[75]||(g[75]=V=>c("List",["ul","circle"]))},g[110]||(g[110]=[i.createElementVNode("label",null,"空心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"circle"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"square",onClick:g[76]||(g[76]=V=>c("List",["ul","square"]))},g[111]||(g[111]=[i.createElementVNode("label",null,"空心方块列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[i.createElementVNode("li",null,"________")],-1)]))])])])):i.createCommentVNode("",!0),S=="Table"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__table",onClick:w,key:S},[i.createElementVNode("i",{title:"表格",style:i.normalizeStyle({backgroundImage:`url(${i.unref(tc)})`})},null,4),g[113]||(g[113]=i.createStaticVNode('<div class="menu-item__table__collapse" data-v-b97ae666><div class="table-close" data-v-b97ae666>×</div><div class="table-title" data-v-b97ae666><span class="table-select" data-v-b97ae666>插入</span><span data-v-b97ae666>表格</span></div><div class="table-panel" data-v-b97ae666><table data-v-b97ae666><tbody data-v-b97ae666><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr></tbody></table></div></div>',1))])):i.createCommentVNode("",!0),S=="Image"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__image",onClick:R,key:S},[i.createElementVNode("i",{title:"图片",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ec)})`})},null,4),g[114]||(g[114]=i.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):i.createCommentVNode("",!0),S=="Hyperlink"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:S},[i.createElementVNode("i",{title:"超链接",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ic)})`})},null,4)])):i.createCommentVNode("",!0),S=="Separator"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:g[84]||(g[84]=V=>h("menu-item__separator",V)),key:S},[i.createElementVNode("i",{title:"分割线",style:i.normalizeStyle({backgroundImage:`url(${i.unref(nc)})`})},null,4),i.createElementVNode("div",Fc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-separator":"0,0",onClick:g[78]||(g[78]=V=>c("Separator",[0,0]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"1,1",onClick:g[79]||(g[79]=V=>c("Separator",[1,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"3,1",onClick:g[80]||(g[80]=V=>c("Separator",[3,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"4,4",onClick:g[81]||(g[81]=V=>c("Separator",[4,4]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(kc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:g[82]||(g[82]=V=>c("Separator",[7,3,3,3]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(bc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:g[83]||(g[83]=V=>c("Separator",[6,2,2,2,2,2]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(yc)})`})},null,4)])])])])):i.createCommentVNode("",!0),S=="Watermark"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:g[87]||(g[87]=V=>h("menu-item__watermark",V)),key:S},[i.createElementVNode("i",{title:"水印(添加、删除)",style:i.normalizeStyle({backgroundImage:`url(${i.unref(lc)})`})},null,4),i.createElementVNode("div",Dc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-menu":"add",onClick:g[85]||(g[85]=V=>u("add"))},"添加水印"),i.createElementVNode("li",{"data-menu":"delete",onClick:g[86]||(g[86]=V=>u("delete"))},"删除水印")])])])):i.createCommentVNode("",!0),S=="Codeblock"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:N,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(oc)})`})},null,4)])):i.createCommentVNode("",!0),S=="PageBreak"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(sc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Control"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__control",onClick:g[94]||(g[94]=V=>h("menu-item__control",V)),key:S},[i.createElementVNode("i",{title:"控件",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ac)})`})},null,4),i.createElementVNode("div",_c,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-control":"text",onClick:g[88]||(g[88]=V=>B("text"))},"文本"),i.createElementVNode("li",{"data-control":"number",onClick:g[89]||(g[89]=V=>B("number"))},"数值"),i.createElementVNode("li",{"data-control":"select",onClick:g[90]||(g[90]=V=>B("select"))},"列举"),i.createElementVNode("li",{"data-control":"date",onClick:g[91]||(g[91]=V=>B("date"))},"日期"),i.createElementVNode("li",{"data-control":"checkbox",onClick:g[92]||(g[92]=V=>B("checkbox"))},"复选框"),i.createElementVNode("li",{"data-control":"radio",onClick:g[93]||(g[93]=V=>B("radio"))},"单选框")])])])):i.createCommentVNode("",!0),S=="Checkbox"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:g[95]||(g[95]=V=>y("checkbox")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(rc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Radio"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:g[96]||(g[96]=V=>y("radio")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(cc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Latex"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:b,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(dc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Date"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__date",onClick:g[97]||(g[97]=V=>A("menu-item__date",V)),key:S},[i.createElementVNode("i",{title:"日期",style:i.normalizeStyle({backgroundImage:`url(${i.unref(hc)})`})},null,4),g[115]||(g[115]=i.createElementVNode("div",{class:"options"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),i.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):i.createCommentVNode("",!0),S=="Block"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:x,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(fc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Search"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:M,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(uc)})`})},null,4)])):i.createCommentVNode("",!0),S=="SearchCollapse"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:S},[i.createElementVNode("div",Pc,[g[116]||(g[116]=i.createElementVNode("input",{type:"text"},null,-1)),g[117]||(g[117]=i.createElementVNode("label",{class:"search-result"},null,-1)),i.createElementVNode("div",$c,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(wc)})`})},null,4)]),i.createElementVNode("div",Lc,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ac)})`})},null,4)]),g[118]||(g[118]=i.createElementVNode("span",null,"×",-1))]),g[119]||(g[119]=i.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[i.createElementVNode("input",{type:"text"}),i.createElementVNode("button",null,"替换")],-1))])):i.createCommentVNode("",!0),S=="Print"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:g[98]||(g[98]=V=>c("Print")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(pc)})`})},null,4)])):i.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-b97ae666"]]),zc=ee(i.defineComponent({__name:"richText",props:i.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 t=a,n=i.useModel(a,"value"),l=i.ref(!1),o=i.computed(()=>t.editor?.widget(t.wid)||t.widget||{}),s=i.computed(()=>t.editor?.model.value||t.model);i.computed(()=>o.value.props||{});const r=i.ref(),c=i.ref(),h=i.ref(),f=i.ref();i.onMounted(()=>{i.nextTick(()=>{d()}),window.addEventListener("click",()=>{l.value=!1})});function d(){const p=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;console.log("width:"+p+",height:"+m);const b=JSON.parse(JSON.stringify(t.options));f.value=new ae.Editor(h.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}),f.value.listener.contentChange=()=>{f.value.command.getValueAsync().then(({data:y})=>{n.value=JSON.stringify(y)})},n.value&&(typeof n.value=="string"?n.value=JSON.parse(n.value):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}return i.watch(n,()=>{l.value==!1&&n.value&&f.value&&(typeof n.value=="string"?n.value=JSON.parse(n.value):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}),i.watch(s,()=>{f.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(p,m)=>(i.openBlock(),i.createBlock(lt,{class:"unione-rich-text",model:t.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=i.withModifiers(b=>l.value=!0,["stop"]))},{default:i.withCtx(()=>[(s.value=="edit"||s.value=="run")&&f.value?(i.openBlock(),i.createBlock(Uc,{key:0,ref_key:"canvasMenuDom",ref:c,editor:f.value,items:a.toolbar},null,8,["editor","items"])):i.createCommentVNode("",!0),i.createElementVNode("div",{ref_key:"canvasEditorDom",ref:h,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-108483bc"]]),jc={class:"page-setting-dialog"},qt=i.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=a,n=i.computed(()=>t.editor?.model?.value),l=Y.useSession(),o=i.computed(()=>l.getPrincipal()),s=i.ref(!1);i.provide("closeSetting",()=>{t.editor?.save().then(p=>{s.value=!1})});function r(){s.value=!0}function c(){t.editor?.save().then(p=>{console.log("res",p)})}function h(){t.editor?.save().then(p=>{console.log("res",p)})}const f=i.ref("");function d(p){f.value||(f.value=n.value),p?t.editor?.setModel("edit"):t.editor?.setModel(f.value)}return(p,m)=>{const b=i.resolveComponent("SettingOutlined"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("SaveOutlined"),x=i.resolveComponent("FormOutlined"),w=i.resolveComponent("StopOutlined"),R=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-page",n.value])},[n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle},{default:i.withCtx(()=>[i.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:1,title:"保存页面"},{default:i.withCtx(()=>[i.createVNode(A,{class:"btn-save",onClick:c})]),_:1})):i.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:2,title:"编辑页面"},{default:i.withCtx(()=>[i.createVNode(x,{class:"btn-edit",onClick:m[0]||(m[0]=k=>d(!0))})]),_:1})):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:3,title:"退出编辑"},{default:i.withCtx(()=>[i.createVNode(w,{class:"btn-edit",onClick:m[1]||(m[1]=k=>d(!1))})]),_:1})):i.createCommentVNode("",!0),i.renderSlot(p.$slots,"default"),n.value=="edit"?(i.openBlock(),i.createBlock(R,{key:4,title:t.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:h},{default:i.withCtx(()=>[i.createElementVNode("div",jc,[i.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),qc={class:"unione-props-setting data-field-manage"},Qc={key:0},Wc={key:1},Yc={key:2},Hc={key:3},Kc={key:4},Gc={key:5},Jc={key:6},Xc=["onClick"],Zc=["onClick"],ed=["onClick"],td={key:1},id=ee(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.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"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(m=>{n.value.selectedRowKeys.includes(m)||n.value.selectedRowKeys.push(m);const b=[];t.value.forEach(y=>{!p.includes(y.name)&&n.value.selectedRowKeys.includes(y.name)&&b.push(y.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(y=>!b.includes(y)))})}}),l={mounted:p=>p.focus()},o=i.ref({});function s(){const p=Object.keys(o.value);if(p.length)for(let m in p){const b=t.value.filter(y=>y.name==m);if(b&&b[0]){let y=o.value[m];Object.keys(y).forEach(A=>{b[0][A]=y[A]})}}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"&&t.value.filter(A=>A[m]==b&&A.name!=p.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}p[m]=b,o.value={}}function h(p,m){t.value.filter(y=>y.name==p.name).forEach(y=>{y[m]=!y[m]})}function f(){if(s(),t.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),o.value[m.name]={name:"new_"}}function d(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(p=>!n.value.selectedRowKeys.includes(p.name)),n.value.selectedRowKeys=[]}})}return(p,m)=>{const b=i.resolveComponent("a-button"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("a-input"),x=i.resolveComponent("a-input-number"),w=i.resolveComponent("a-select-option"),R=i.resolveComponent("a-select"),k=i.resolveComponent("a-checkbox"),u=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",qc,[i.createVNode(b,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:i.withCtx(()=>m[1]||(m[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:d,size:"small"},{default:i.withCtx(()=>m[2]||(m[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(u,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:i.withCtx(({column:N})=>[N.key==="name"?(i.openBlock(),i.createElementBlock("span",Qc,[m[3]||(m[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="title"?(i.openBlock(),i.createElementBlock("span",Wc,[m[4]||(m[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="descs"?(i.openBlock(),i.createElementBlock("span",Yc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataLen"?(i.openBlock(),i.createElementBlock("span",Hc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataPrec"?(i.openBlock(),i.createElementBlock("span",Kc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="defaultValue"?(i.openBlock(),i.createElementBlock("span",Gc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataType"?(i.openBlock(),i.createElementBlock("span",Jc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="isPk"?(i.openBlock(),i.createBlock(y,{key:7,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[m[5]||(m[5]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isFk"?(i.openBlock(),i.createBlock(y,{key:8,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isNull"?(i.openBlock(),i.createBlock(y,{key:9,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="syncDbEnable"?(i.openBlock(),i.createBlock(y,{key:10,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:N,text:M,record:v})=>[["name","title","descs","defaultValue"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(A,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Xc)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Zc)):["dataType"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(R,{key:0,value:v[N.dataIndex],"onUpdate:value":C=>v[N.dataIndex]=C,onBlur:m[0]||(m[0]=C=>c())},{default:i.withCtx(()=>[i.createVNode(w,{key:"String",value:"String"}),i.createVNode(w,{key:"Long",value:"Long"}),i.createVNode(w,{key:"Short",value:"Short"}),i.createVNode(w,{key:"Integer",value:"Integer"}),i.createVNode(w,{key:"Float",value:"Float"}),i.createVNode(w,{key:"Double",value:"Double"}),i.createVNode(w,{key:"Date",value:"Date"}),i.createVNode(w,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",td,i.toDisplayString(M),1))],10,ed)):["syncDbEnable","isFk","isPk"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:3,checked:v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:4,checked:!v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),nd={class:"unione-props-setting data-field-setting"},ld={key:0},od=["onClick"],sd={class:"field-txt"},ad=["onClick"],rd={key:1,class:"field-txt"},cd=["onClick"],dd={key:1},hd=["onClick"],fd={key:0,class:"field-txt"},ud={key:4,class:"edit-field"},pd={key:0},md=["onClick"],gd=ee(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:x})=>x+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"}]),t=i.useModel(a,"modelValue"),n={mounted:x=>x.focus()},l=i.ref({});function o(){const x=Object.keys(l.value);if(x.length)for(let w in x){const R=t.value.filter(k=>k.name==w);if(R&&R[0]){let k=l.value[w];Object.keys(k).forEach(u=>{u=="convertName"?(R[0].convert||(R[0].convert={}),R[0].convert.type=k[u]):R[0][u]=k[u]})}}l.value={}}function s(x,w){o();const R={};w=="convertName"?(x.convert||(x.convert={}),R[w]=x.convert?.type):R[w]=x[w]||"",l.value[x.name]=R}function r(x,w){{l.value={};return}}function c(x,w){t.value.filter(k=>k.name==x.name).forEach(k=>{k[w]=!k[w]})}const h=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function f(x,w){const R=t.value.filter(u=>u.name==x.name);R.forEach(u=>{w!="isSort"?u[w]=!0:u[w]=!u[w]});const k=R[0];if(!(!k||w=="isSort")){switch(h.value.prop=w,h.value.field=x,k.show||(k.show={}),w){case"isQuery":k.show.query||(k.show.query={}),h.value.show=k.show.query,h.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":k.show.form||(k.show.form={}),h.value.show=k.show.form,h.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":k.show.view||(k.show.view={}),h.value.show=k.show.view,h.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":k.show.list||(k.show.list={}),h.value.show=k.show.list,h.value.title=`列头设置/${x.title}(${x.name})`;break}h.value.visible=!0}}const d=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const w=d.value.options.filter(R=>R.value==x);return w[0]?w[0].label:x}}),p=i.ref({visible:!1,field:{},props:{},showInfo:x=>{let w="";return x.rules&&(w=x.rules.filter(R=>R.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const x=p.value.props,w={name:"range",trigger:x.trigger,whitespace:x.whitespace,message:x.rangeMessage};x.rangeMin!=null&&x.rangeMin!=null&&(w.min=x.rangeMin,w.enable=!0),x.rangeMax!=null&&x.rangeMax!=null&&(w.max=x.rangeMax,w.enable=!0);const R={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(R.pattern=x.regExpress,R.enable=!0),p.value.field.rules=[w,R],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function m(x){p.value.visible=!0,p.value.field=x;const w=x.rules||[],R={trigger:"change",whitespace:!0};w.forEach(k=>{k.name=="reg"&&(R.trigger=k.trigger,R.whitespace=k.whitespace,R.regExpress=k.pattern,R.regMessage=k.message),k.name=="range"&&(R.rangeMin=k.min,R.rangeMax=k.max,R.rangeMessage=k.message)}),p.value.props=R}const b=i.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:x=>{const w=b.value.widgets.filter(R=>R.value==x);return w[0]?w[0].label:x},toSetting:()=>{}}),y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(x,w)=>{y.value.convert.options.splice(x,1)},toSetting:()=>{y.value.visible=!1}});function A(x){y.value.visible=!0,y.value.field=x,y.value.convert=x.convert||{}}return(x,w)=>{const R=i.resolveComponent("ToolOutlined"),k=i.resolveComponent("a-button"),u=i.resolveComponent("a-select"),N=i.resolveComponent("a-checkbox"),M=i.resolveComponent("a-table"),v=i.resolveComponent("a-input-number"),C=i.resolveComponent("a-form-item"),B=i.resolveComponent("a-input"),E=i.resolveComponent("a-form"),g=i.resolveComponent("a-modal"),S=i.resolveComponent("a-col"),I=i.resolveComponent("a-row"),V=i.resolveComponent("a-select-option"),F=i.resolveComponent("a-divider"),$=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createElementBlock("div",nd,[i.createVNode(M,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:D})=>[["widget","queryType","rules","convertName"].includes(D.key)?(i.openBlock(),i.createElementBlock("span",ld,[i.createVNode(R),i.createTextVNode(" "+i.toDisplayString(D.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:D,text:Q,record:L})=>[["rules"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!p.value.showInfo(L)&&"empty"]),onClick:O=>m(L)},[i.createElementVNode("span",sd,i.toDisplayString(p.value.showInfo(L)),1),p.value.showInfo(L)?(i.openBlock(),i.createBlock(k,{key:0,type:"link"},{default:i.withCtx(()=>w[22]||(w[22]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,od)):["widget"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L[D.dataIndex],"onUpdate:value":O=>L[D.dataIndex]=O,allowClear:!0,options:b.value.widgets,onBlur:w[0]||(w[0]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",rd,i.toDisplayString(b.value.widgetName(Q)),1))],10,ad)):["queryType"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[L.isQuery?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L[D.dataIndex],"onUpdate:value":O=>L[D.dataIndex]=O,allowClear:!0,options:d.value.options,onBlur:w[1]||(w[1]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",dd,i.toDisplayString(d.value.showLabel(Q)),1))],10,cd)):i.createCommentVNode("",!0)],64)):["convertName"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!L.convert?.type&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L.convert.type,"onUpdate:value":O=>L.convert.type=O,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:w[2]||(w[2]=O=>r())},null,8,["value","onUpdate:value"])),[[n]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[L.convert?.type?(i.openBlock(),i.createElementBlock("span",fd,i.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),L.convert?.type?(i.openBlock(),i.createBlock(k,{key:1,type:"link",onClick:i.withModifiers(O=>A(L),["stop"])},{default:i.withCtx(()=>w[23]||(w[23]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,hd)):["isQuery","isForm","isView","isList","isSort"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",ud,[i.createVNode(N,{checked:L[D.dataIndex],onClick:O=>c(L,D.dataIndex)},null,8,["checked","onClick"]),i.createVNode(k,{type:"link",onClick:O=>f(L,D.dataIndex)},{default:i.withCtx(()=>w[24]||(w[24]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(g,{visible:h.value.visible,"onUpdate:visible":w[9]||(w[9]=D=>h.value.visible=D),title:h.value.title,onOk:h.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(C,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(v,{value:h.value.show.index,"onUpdate:value":w[3]||(w[3]=D=>h.value.show.index=D)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.width,"onUpdate:value":w[4]||(w[4]=D=>h.value.show.width=D)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.labelWidth,"onUpdate:value":w[5]||(w[5]=D=>h.value.show.labelWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.valueWidth,"onUpdate:value":w[6]||(w[6]=D=>h.value.show.valueWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.fixed,"onUpdate:value":w[7]||(w[7]=D=>h.value.show.fixed=D),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.align,"onUpdate:value":w[8]||(w[8]=D=>h.value.show.align=D),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:y.value.visible,"onUpdate:visible":w[11]||(w[11]=D=>y.value.visible=D),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",pd,[i.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>w[25]||(w[25]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(M,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:D,text:Q,record:L,index:O})=>[D.dataIndex==="label"?(i.openBlock(),i.createBlock(B,{key:0,value:L.label,"onUpdate:value":G=>L.label=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="value"?(i.openBlock(),i.createBlock(B,{key:1,value:L.value,"onUpdate:value":G=>L.value=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:G=>y.value.toDelOption(O,L)},"删除",8,md)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(E,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(I,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(S,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(C,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(B,{value:y.value.convert.dict,"onUpdate:value":w[10]||(w[10]=D=>y.value.convert.dict=D)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:b.value.visible,"onUpdate:visible":w[13]||(w[13]=D=>b.value.visible=D),title:"控件设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[b.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(C,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(u,{value:b.value.props.mode,"onUpdate:value":w[12]||(w[12]=D=>b.value.props.mode=D),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(V,{value:"multiple"},{default:i.withCtx(()=>w[26]||(w[26]=[i.createTextVNode("多选")])),_:1}),i.createVNode(V,{value:"tags"},{default:i.withCtx(()=>w[27]||(w[27]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(g,{visible:p.value.visible,"onUpdate:visible":w[21]||(w[21]=D=>p.value.visible=D),title:"规则设置",onOk:p.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[28]||(w[28]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(C,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode($,{value:p.value.props.trigger,"onUpdate:value":w[14]||(w[14]=D=>p.value.props.trigger=D),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(N,{value:p.value.props.whitespace,"onUpdate:value":w[15]||(w[15]=D=>p.value.props.whitespace=D),checked:p.value.props.whitespace},{default:i.withCtx(()=>w[29]||(w[29]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[30]||(w[30]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(C,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(v,{value:p.value.props.rangeMin,"onUpdate:value":w[16]||(w[16]=D=>p.value.props.rangeMin=D)},null,8,["value"]),w[31]||(w[31]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(v,{value:p.value.props.rangeMax,"onUpdate:value":w[17]||(w[17]=D=>p.value.props.rangeMax=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.rangeMessage,"onUpdate:value":w[18]||(w[18]=D=>p.value.props.rangeMessage=D)},null,8,["value"])]),_:1}),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[32]||(w[32]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(C,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regExpress,"onUpdate:value":w[19]||(w[19]=D=>p.value.props.regExpress=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regMessage,"onUpdate:value":w[20]||(w[20]=D=>p.value.props.regMessage=D)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),kd={class:"unione-props-setting data-field"},bd=ee(i.defineComponent({__name:"dataField",props:i.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=i.useModel(a,"modelValue");return(t,n)=>{const l=i.resolveComponent("OrderedListOutlined"),o=i.resolveComponent("a-tab-pane"),s=i.resolveComponent("ToolOutlined"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",kd,[i.createVNode(r,null,{default:i.withCtx(()=>[i.createVNode(o,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(l),n[2]||(n[2]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(id,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),i.createVNode(o,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(s),n[3]||(n[3]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(gd,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),yd={key:0,class:"data-model-list"},wd=["onClick"],Ad=ee(i.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const t=i.computed(()=>l.editor.dataModels()),n=i.ref({sn:"new_",title:"新建数据",fields:[]});i.onMounted(()=>{t.value&&t.value[0]&&(n.value=t.value[0])});const l=a;function o(d){n.value=d}function s(){if(t.value.length>=l.limit){X.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const d=pa.v4(),p={sn:d,title:"新建数据",name:"new_",fields:[]};n.value=p,console.log("data model added",p),l.editor.dataModel(d,p)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=i.ref(),h=i.inject("closeSetting");function f(){c.value.validate().then(d=>{h&&h()})}return e({toSaving:f}),(d,p)=>{const m=i.resolveComponent("a-input"),b=i.resolveComponent("a-form-item"),y=i.resolveComponent("a-textarea"),A=i.resolveComponent("a-form");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(i.openBlock(),i.createElementBlock("div",yd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,x=>(i.openBlock(),i.createElementBlock("div",{key:x.sn,class:i.normalizeClass(["title",n.value&&n.value.sn==x.sn&&"slt"]),onClick:w=>o(x)},i.toDisplayString(x.title),11,wd))),128)),i.createElementVNode("div",{class:"title btn-add",onClick:s},"+")])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[i.createVNode(A,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:i.withCtx(()=>[i.createVNode(b,{label:"数据标题",name:"title",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.title,"onUpdate:value":p[0]||(p[0]=x=>n.value.title=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.name,"onUpdate:value":p[1]||(p[1]=x=>n.value.name=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.url,"onUpdate:value":p[2]||(p[2]=x=>n.value.url=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据说明",name:"descs"},{default:i.withCtx(()=>[i.createVNode(y,{value:n.value.descs,"onUpdate:value":p[3]||(p[3]=x=>n.value.descs=x)},null,8,["value"])]),_:1})]),_:1},8,["model"]),i.createVNode(bd,{modelValue:n.value.fields,"onUpdate:modelValue":p[4]||(p[4]=x=>n.value.fields=x)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),xd={class:"unione-props-setting unione-page-setting"},Qt=ee(i.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref({});return i.onMounted(()=>{t.value=e.editor.define.value}),(n,l)=>{const o=i.resolveComponent("a-form-item"),s=i.resolveComponent("a-input"),r=i.resolveComponent("a-switch"),c=i.resolveComponent("a-textarea"),h=i.resolveComponent("a-form"),f=i.resolveComponent("a-tab-pane"),d=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",xd,[i.createVNode(d,{type:"card"},{default:i.withCtx(()=>[i.createVNode(f,{key:"pageDefine",tab:"页面设置"},{default:i.withCtx(()=>[i.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(i.openBlock(),i.createBlock(o,{key:0,label:"页面编码"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.sn)+"/V"+i.toDisplayString(t.value.vers),1)]),_:1})):i.createCommentVNode("",!0),i.createVNode(o,{label:"页面标题",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=p=>t.value.title=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"页面组件",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=p=>t.value.component=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"icon图标"},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=p=>t.value.icon=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"是否全局"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=p=>t.value.isGlobal=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"是否模版"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=p=>t.value.isTmpl=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"页面备注"},{default:i.withCtx(()=>[i.createVNode(c,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=p=>t.value.descs=p),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),i.createVNode(f,{key:"dataDefine",tab:"数据设置"},{default:i.withCtx(()=>[i.createVNode(Ad,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Tl=ee(i.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,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},n=new ut,l=i.computed(()=>n.$widgetList.value||[]);i.watch(()=>e.pageDefine,s=>{s&&n.load(o.value,s)});const o=i.ref("new_");return i.onMounted(()=>{const s=i.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||t)}),(s,r)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-view","setting-title":"页面设置",editor:i.unref(n)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,c=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.render||c.widget),{key:c.wid,wid:c.wid,widget:c,editor:i.unref(n)},null,8,["wid","widget","editor"]))),128))]),_:2},[i.unref(n)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Cd={class:"form-btns"},Il=i.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){const e=i.inject("router"),t=a,n={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new ut,o=i.computed(()=>l.$widgetList.value||[]),s=i.computed(()=>{const d=l.define.value?.configs?.btns||[],p=d.map(m=>m.name);if(!p.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};d.splice(m.index,0,m)}if(!p.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=m.index||1;d.splice(b,0,m)}if(!p.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};d.splice(m.index,0,m)}if(!p.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};d.splice(m.index,0,m)}return l.model.value=="view"&&d.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),d});function r({btn:d,event:p}){d.name=="save"&&c(),d.name=="reset",d.name=="back"&&h()}async function c(){const d=l.dataManager().form();let p={};for(let m in d){const b=await d[m].validate();if(l.dataManager().psn()==m){for(let y in p)b[y]=p[y];p=b}else p[m]=b}console.log("=======form data=====",p),l.dataManager().primary().save({data:p,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}i.watch(()=>t.pageDefine,d=>{d&&l.load(f.value,d)});const f=i.ref("new_");return i.onMounted(()=>{const d=i.inject("route");console.log("unione page view route",d),f.value=t.psn||d?.query?.psn||d?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),l.setModel(d?.query?.model||d?.meta?.model||"run"),d?.query&&l.dataManager().params(d.query),l.load(f.value,t.pageDefine||n)}),(d,p)=>{const m=i.resolveComponent("unione-btn");return i.openBlock(),i.createBlock(qt,{class:"unione-page-form","setting-title":"页面设置",editor:i.unref(l)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,b=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:i.unref(l)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Cd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b.name},[b.visible!=!1?(i.openBlock(),i.createBlock(m,{key:0,widget:b,editor:i.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128))])]),_:2},[i.unref(l)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),vd=["onMouseover"],Sd={key:0,class:"node-opts"},Bd={class:"form-warp"},Nd={class:"form-btns"},Fl=ee(i.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"],setup(a,{emit:e}){const t=Y.useDialog(),n=i.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(l.fields?.length){const T={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[T]}o.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage),o.configs.btns=l.btns||[],l.btns==!1&&(o.configs.btns=!1),o.configs.opts=l.opts||[],l.opts==!1&&(o.configs.opts=!1),o.configs.event=l.event||{},o.configs.setting=l.setting||{}}const r=new ut,c=i.ref(!1),h=i.ref([]),f=i.ref({}),d=i.ref(null),p=i.ref(null),m=i.ref([]),b=i.ref([]),y=i.ref(0),A=i.computed(()=>{const T={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",...l.setting?.tree||{}};return r.define.value?.configs?.tree||T}),x=i.computed(()=>A.value.searchEnable),w=i.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return!1;const _=(T||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:U),q=[];return _.forEach(U=>{q.push(U.name)}),console.log("opts addBtn",_),_.filter(U=>U.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),R=i.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return[];const _=(T||[]).map(P=>typeof P=="string"?{name:P,visible:!1}:P),q=[],U=[];return _.forEach(P=>{U.push(P.name),P.name!="add"&&q.push(P)}),U.includes("delete")||q.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),U.includes("child")||q.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",q),q});function k({btn:T,event:_},q){_.stopPropagation();const U=f.value[q[A.value.idField]];if(console.log("onTreeMenuClick,btn:",T),console.log("onTreeMenuClick,node:",q),console.log("onTreeMenuClick,curentNode:",U),T.name=="child"){if(V.value.preCreate&&V.value.preCreate(U)==!1)return;const P=f.value[U[A.value.idField]];P.isLeaf=!1,d.value={},d.value[A.value.pidField]=P[A.value.idField],d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,d.value.parentNode=P,y.value=y.value+1,P.children||(P.children=[],b.value.push(P[A.value.idField])),V.value.createNode&&V.value.createNode(d.value,P,r.dataManager().params()),f.value[d.value[A.value.idField]]=d.value,P.children.push(d.value),m.value=[d.value[A.value.idField]],r.dataManager().primary().setValue(d.value)}if(T.name=="delete"){if(V.value.preDelete&&V.value.preDelete(U)==!1)return;U[A.value.idField]&&(U[A.value.idField]+"").startsWith("new_")?(U.parentNode?U.parentNode.children=U.parentNode.children.filter(P=>P[A.value.idField]!=U[A.value.idField]):h.value=h.value.filter(P=>P[A.value.idField]!=U[A.value.idField]),delete f.value[U[A.value.idField]]):r.dataManager().primary().deleteByIds([U[A.value.idField]]).then(()=>{if(U.parentNode){const P=f.value[U[A.value.pidField]];P.children=P.children.filter(re=>re[A.value.idField]!=U[A.value.idField])}else h.value=h.value.filter(P=>P[A.value.idField]!=U[A.value.idField]);delete f.value[U[A.value.idField]]})}}function u(T,{expanded:_,node:q}){_&&(d.value=q.dataRef,r.dataManager().primary().setValue(d.value),S())}function N(T,_){_.selected?(d.value=_.node.dataRef,r.dataManager().primary().setValue(d.value)):d.value&&(m.value=[d.value[A.value.idField]]),D("treeClick",{keys:T,event:_})}const M=i.computed(()=>{if(l.storage?.orderBy){const T=l.storage.orderBy.split(" ");return[{name:T[0],asc:T[1].toLowerCase()=="asc"}]}return[]});i.watch(()=>l.params,()=>{c.value&&(h.value=[],f.value={},d.value=null,m.value=[],b.value=[],y.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),S())}),i.watch(()=>d.value,()=>{console.log("active node changed",d.value),C(!d.value)});const v=i.ref(null);i.watch(v,()=>{v.value&&d.value&&r.dataManager().primary().setValue(d.value)});function C(T=!0){const _=r.dataManager().form();for(let q in _)_[q].setDisabled(T)}function B(){if(!(V.value.preCreate&&V.value.preCreate()==!1)){if(d.value={},d.value[A.value.pidField]=-1,d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,y.value=y.value+1,V.value.createNode&&V.value.createNode(d.value,null,r.dataManager().params()),d.value[A.value.pidField]==-1)h.value.push(d.value);else{const T=f.value[d.value[A.value.pidField]];T?(T.children||(T.children=[]),T.children.push(d.value)):h.value.push(d.value)}m.value=[d.value[A.value.idField]],f.value[d.value[A.value.idField]]=d.value,r.dataManager().primary().setValue(d.value)}}const E=i.ref(""),g=pt(T=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:T||E.value,needCount:!1,body:A.value.async==!1?null:{},sorts:M.value}).then(_=>{if(f.value={},h.value=[],_.body?.length){const q={};_.body.forEach(U=>{q[U[A.value.idField]]=U}),_.body.forEach(U=>{const P=q[U[A.value.pidField]];P?(P.children||(P.children=[],P.isLeaf=!1),P.children.push(U)):h.value.push(U)})}})},400);function S(){const T={};if(T[A.value.pidField]=l.params[A.value.pidField]||-1,d.value){if(d.value.children?.length||A.value.async==!1)return;T[A.value.pidField]=d.value[A.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:T,sorts:M.value}).then(_=>{d.value.children=_.body||[],d.value.children.forEach(q=>{q.isLeaf=!!q[A.value.leafField],f.value[q[A.value.idField]]=q,q.parentNode=f.value[q[A.value.pidField]]})})}else{const _=A.value.async==!1?null:{page:1,pageSize:999,body:T,sorts:M.value};r.dataManager().primary().find(_).then(q=>{if(A.value.async==!1){if(h.value=[],q.body?.length){const U={};q.body.forEach(P=>{U[P[A.value.idField]]=P}),q.body.forEach(P=>{const re=U[P[A.value.pidField]];re?(re.children||(re.children=[],re.isLeaf=!1),re.children.push(P)):h.value.push(P)})}}else h.value=q.body||[],h.value.forEach(U=>{U.isLeaf=!!U[A.value.leafField],f.value[U[A.value.idField]]=U})})}}const I=i.computed(()=>r.$widgetList.value||[]),V=i.computed(()=>{const T={...r.define.value?.configs?.event||{}};for(const _ in T)T[_]&&typeof T[_]!="function"&&T[_].enable&&T[_].scriptText&&(_=="createNode"&&(T[_]=new Function("node","parent","params",T[_].scriptText)),_=="preCreate"?T[_]=new Function("parent",T[_].scriptText):T[_]=new Function("data","event",T[_].scriptText));return T}),F=i.computed(()=>r.define.value?.configs?.setting||l.setting||{});i.provide("pageSetting",F.value);const $=i.computed(()=>{const T=r.define.value?.configs?.btns;if(typeof T=="boolean"&&T==!1)return[];const _=(r.define.value?.configs?.btns||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:{size:"default",...U}),q=_.map(U=>U.name);if(!q.includes("save")){const U={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};_.splice(U.index,0,U)}if(!q.includes("reset")){const U={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};_.splice(U.index,0,U)}if(!q.includes("back")){const U={title:"返回",type:"default",index:_.length,visible:!0,size:"default",name:"back"};_.splice(U.index,0,U)}return r.model.value=="view"&&_.filter(U=>["save","submit","reset"].includes(U.name)).forEach(U=>{U.visible=!1}),_}),D=e;function Q({btn:T,event:_}){T.name=="save"&&L({btn:T,event:_}),T.name=="reset",T.name=="back"&&O(),D("btnClick",{btn:T,event:_})}async function L(T){const _=r.dataManager().form();let q={...d.value};for(let U in _){const P=await _[U].validate();if(r.dataManager().psn()==U)for(let re in P)q[re]=P[re];else q[U]=P}if(q[A.value.pidField]&&(q[A.value.pidField]+"").startsWith("new_")){t.error({content:"请先保存父节点!"});return}q[A.value.idField]&&(q[A.value.idField]+"").startsWith("new_")&&delete q[A.value.idField],delete q.parentNode,delete q.children,q[A.value.leafField]=q[A.value.leafField]?1:0,V.value.preSave&&V.value.preSave(q,T),console.log("=======form data=====",q),r.dataManager().primary().save({data:q}).then(U=>{console.log("save result:",U),d.value[A.value.idField]=U.body,m.value=[U.body],f.value[U.body]=d.value,d.value.children?.forEach(P=>{P[A.value.pidField]=U.body}),V.value.postSaved&&V.value.postSaved(q,T)})}function O(){n.back()}const G=i.ref("new_");return i.onMounted(()=>{const T=i.inject("route");console.log("unione page tree route",T),G.value=l.psn||T?.query?.psn||T?.meta?.psn||"new_",console.log("unione page tree,psn:"+G.value),r.setModel(T?.query?.model||T?.meta?.model||"run");const _={...l.params||{},...T?.query||{},...T?.params||{}};r.dataManager().params(_),s(),r.load(G.value,o),i.nextTick(()=>{C(!0)}),S(),c.value=!0}),(T,_)=>{const q=i.resolveComponent("SearchOutlined"),U=i.resolveComponent("a-input"),P=i.resolveComponent("unione-btn"),re=i.resolveComponent("a-tree");return i.openBlock(),i.createBlock(qt,{class:"unione-page-tree","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",{class:"tree-warp",onContextmenu:_[6]||(_[6]=i.withModifiers(()=>{},["prevent"]))},[i.renderSlot(T.$slots,"tree-top",{onChange:_[0]||(_[0]=(...H)=>i.unref(g)&&i.unref(g)(...H)),onPressEnter:_[1]||(_[1]=(...H)=>i.unref(g)&&i.unref(g)(...H))},()=>[x.value?(i.openBlock(),i.createBlock(U,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:E.value,"onUpdate:value":_[2]||(_[2]=H=>E.value=H),onChange:i.unref(g),onPressEnter:i.unref(g)},{suffix:i.withCtx(()=>[i.createVNode(q)]),_:1},8,["value","onChange","onPressEnter"])):i.createCommentVNode("",!0)],!0),w.value?(i.openBlock(),i.createBlock(P,{key:0,widget:w.value,onClick:B},null,8,["widget"])):i.createCommentVNode("",!0),i.createVNode(re,{"show-line":A.value.showLine,"show-icon":A.value.showIcon,disabled:A.value.disabled,blockNode:!0,draggable:A.value.draggable,multiple:A.value.multiple,selectable:A.value.selectable,checkable:A.value.checkable,fieldNames:{title:A.value.labelField,key:A.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":_[4]||(_[4]=H=>m.value=H),expandedKeys:b.value,"onUpdate:expandedKeys":_[5]||(_[5]=H=>b.value=H),"tree-data":h.value,onExpand:u,onSelect:N},i.createSlots({icon:i.withCtx(({dataRef:H})=>[H[A.value.iconField]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(H[A.value.iconField]),{key:0,class:"node-icon"})):i.createCommentVNode("",!0)]),_:2},[R.value?.length?{name:"title",fn:i.withCtx(({dataRef:H})=>[i.createElementVNode("div",{class:"node-label",onMouseover:()=>p.value=H,onMouseleave:_[3]||(_[3]=()=>p.value=null)},[i.createElementVNode("span",null,i.toDisplayString(H[A.value.labelField]),1),d.value&&d.value[A.value.idField]==H[A.value.idField]||p.value&&p.value[A.value.idField]==H[A.value.idField]?(i.openBlock(),i.createElementBlock("div",Sd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(R.value,pe=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[!V.value.btnVisible||V.value.btnVisible(pe,H)?(i.openBlock(),i.createBlock(P,{key:pe.name,widget:pe,ctx:{node:H},onClick:Hu=>k(Hu,H)},null,8,["widget","ctx","onClick"])):i.createCommentVNode("",!0)],64))),256))])):i.createCommentVNode("",!0)],40,vd)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),i.createElementVNode("div",Bd,[i.renderSlot(T.$slots,"form-warp",{},()=>[i.createElementVNode("div",{ref_key:"formWarp",ref:v},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(I.value,H=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(H.widget),{key:H.wid,wid:H.wid,widget:H,editor:i.unref(r)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Nd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList($.value,H=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:H.name},[H.visible!=!1?(i.openBlock(),i.createBlock(P,{key:0,widget:H,editor:i.unref(r),disabled:!d.value,ctx:{},onClick:Q},null,8,["widget","editor","disabled"])):i.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-969fb71b"]]),Dl=i.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:t}){const n=a,l=i.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 w=n.fields.filter(R=>R.isPk)[0];w&&w.name&&(o.configs.widgets[1].dataKey=w.name),o.configs.widgets[1].columns=n.fields.filter(R=>R.hidden!=!0),o.configs.widgets[1].operation=Y.utils.obj.ext(o.configs.widgets[1].operation,n.operation||{}),n.operation==!1&&(o.configs.widgets[1].operation=!1),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 ut,c=i.computed(()=>r.$widgetList.value||[]),h=t;function f(w){h("btnClick",w)}const d=i.ref("new_");i.onMounted(()=>{const w=i.inject("route");console.log("unione page view route",w),d.value=n.psn||w?.query?.psn||w?.meta?.psn||"new_",console.log("unione page view,psn:"+d.value),r.setModel(w?.query?.model||w?.meta?.model||"run");const R={...n.params||{},...w?.query||{},...w?.params||{}};r.dataManager().params(R),s(),r.load(d.value,o)});function p(){return r.dataManager().use("primary","list")}function m(w){w?r.ebus.$emit("table-list-search",w):r.ebus.$emit("table-list-reload")}function b(w){r.dataManager().params(w),r.ebus.$emit("query-form-params",w),r.ebus.$emit("table-list-search",{params:w})}function y(){return l.value?l.value[0]:null}function A(){return l.value?l.value[0].getSelected():null}function x(){l.value&&l.value[0].clearSelected()}return e({storage:p,editor:r,reload:m,setParams:b,getTable:y,getSelected:A,clearSelected:x}),(w,R)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-list","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,k=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:k.wid},[k.widget=="unione-table"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),mt={release(a){return Y.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return Y.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return Y.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return Y.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return Y.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return Y.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return Y.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},Vd={class:"unione-page list-page"},Rd=ee(i.defineComponent({__name:"list",setup(a){const e=Fe(),t=Y.useDialog(),n=i.inject("router"),l=i.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),o=i.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"}}});i.onMounted(()=>{r()});const s=i.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){s.value.loading=!0,mt.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 h({params:k,keywords:u}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=u,r()}function f({btn:k,event:u,row:N}){console.log("table btn click",k,u,N),(k.name=="add"||k.name=="edit")&&n.push({path:"/dev/data/define/edit",query:N?{id:N.id}:{}}),k.name=="impFromDb"&&(p.value=!0),k.name=="release"&&d(N),k.name=="view"&&n.push({path:e.listPageUrl,query:{psn:N.sn+":list",model:"preview"}})}function d(k){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([k.id]).then(u=>{u.success?(t.success({title:"发布成功",content:u.body}),r()):t.error({title:"发布失败",content:u.body})})}})}const p=i.ref(!1),m=i.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=i.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),y=i.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function A(k){!k||!Object.keys(k).length||!k.dsId||(X.message.loading("数据加载中..."),y.value.params=k,y.value.loading=!0,mt.loadFromDb(k).then(u=>{y.value.loading=!1,X.message.destroy(),u.success?(u.body.forEach(N=>{N.checkable=!!N.id}),y.value.data=u.body,y.value.pagination.total=u.body.length):X.message.error(u.message)}))}function x(k){y.value.pagination.current=k.pagination.current,y.value.pagination.pageSize=k.pagination.pageSize}const w=i.ref();function R({btn:k}){if(k.name!="imp")return;const u=w.value.getSelected();u?.keys?.length?t.confirm({content:"确定导入选中的"+u.keys.length+"条记录么?",onOk:()=>{X.message.loading("数据导入中..."),mt.impFromDb({dsId:y.value.params.dsId,tables:u.keys.join()}).then(N=>{X.message.destroy(),N.success?(t.success({content:N.message}),s.value.pagination.current=1,r()):t.error({context:N.message})})}}):t.error({content:"请选择目标记录!"})}return(k,u)=>{const N=i.resolveComponent("UnioneQuery"),M=i.resolveComponent("UnioneTable"),v=i.resolveComponent("a-drawer");return i.openBlock(),i.createElementBlock("div",Vd,[i.createVNode(N,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),i.createVNode(M,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:f},null,8,["widget","dataList","loading","pagination"]),i.createVNode(v,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":u[0]||(u[0]=C=>p.value=C),placement:"left"},{default:i.withCtx(()=>[i.createVNode(N,{widget:m.value,onQuery:A,onReset:A,onBtnClick:R,class:"load-table-form"},null,8,["widget"]),i.createVNode(M,{widget:b.value,dataList:y.value.data,loading:y.value.loading,pagination:y.value.pagination,onChange:x,rowKey:"name",ref_key:"loadTableObj",ref:w},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),Ed={class:"unione-props-setting data-field-manage"},Od={key:0},Md={key:1},Td=["onClick"],Id=["onClick"],Fd=["onClick"],Dd={key:1},_d=ee(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.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"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{n.value.selectedRowKeys.includes(b)||n.value.selectedRowKeys.push(b);const y=[];t.value.forEach(A=>{!m.includes(A.name)&&n.value.selectedRowKeys.includes(A.name)&&y.push(A.name)}),y.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(A=>!y.includes(A)))})}}),l={mounted:m=>m.focus()},o=i.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let b in m){const y=t.value.filter(A=>A.name==b);if(y&&y[0]){let A=o.value[b];Object.keys(A).forEach(x=>{y[0][x]=A[x]})}}o.value={}}function r(m,b){s();const y={};y[b]=m[b]||"",o.value[m.name]=y}function c(m,b){if(!m||!b){o.value={};return}const y=o.value[m.name][b];if(b=="name"&&t.value.filter(x=>x[b]==y&&x.name!=m.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}m[b]=y,o.value={}}function h(m,b){const y=t.value.filter(A=>A.name==m.name)[0];return b=="isFk"?y.configs?.fkey?.enable:y[b]==1}function f(m,b){const y=t.value.filter(A=>A.name==m.name)[0];b=="isFk"?(y.configs||(y.configs={}),y.configs.fkey||(y.configs.fkey={}),y.configs.fkey.enable=!y.configs.fkey.enable):y[b]!=1?y[b]=1:y[b]=0}function d(){if(s(),t.value.filter(y=>y.name=="new_").length>0){o.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),o.value[b.name]={name:"new_"}}function p(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!n.value.selectedRowKeys.includes(m.name)),n.value.selectedRowKeys=[]}})}return(m,b)=>{const y=i.resolveComponent("a-button"),A=i.resolveComponent("a-tooltip"),x=i.resolveComponent("a-input"),w=i.resolveComponent("a-input-number"),R=i.resolveComponent("a-select-option"),k=i.resolveComponent("a-select"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",Ed,[i.createVNode(y,{class:"btn btn-add",type:"primary",onClick:d,size:"small"},{default:i.withCtx(()=>b[1]||(b[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:i.withCtx(()=>b[2]||(b[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(N,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:M})=>[["name","title"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Od,[b[3]||(b[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Md,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),M.key==="isPk"?(i.openBlock(),i.createBlock(A,{key:2,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[b[4]||(b[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isFk"?(i.openBlock(),i.createBlock(A,{key:3,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isNull"?(i.openBlock(),i.createBlock(A,{key:4,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="syncEnable"?(i.openBlock(),i.createBlock(A,{key:5,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:M,text:v,record:C})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Td)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(w,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Id)):["dataType"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(k,{key:0,value:C[M.dataIndex],"onUpdate:value":B=>C[M.dataIndex]=B,onBlur:b[0]||(b[0]=B=>c())},{default:i.withCtx(()=>[i.createVNode(R,{key:"String",value:"String"}),i.createVNode(R,{key:"Long",value:"Long"}),i.createVNode(R,{key:"Short",value:"Short"}),i.createVNode(R,{key:"Integer",value:"Integer"}),i.createVNode(R,{key:"Float",value:"Float"}),i.createVNode(R,{key:"Double",value:"Double"}),i.createVNode(R,{key:"Date",value:"Date"}),i.createVNode(R,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",Dd,i.toDisplayString(v),1))],10,Fd)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:3,checked:h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:4,checked:!h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),_l=1024;let Pd=0,an=class{constructor(e,t){this.from=e,this.to=t}};class ie{constructor(e={}){this.id=Pd++,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=Be.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}ie.closedBy=new ie({deserialize:a=>a.split(" ")}),ie.openedBy=new ie({deserialize:a=>a.split(" ")}),ie.group=new ie({deserialize:a=>a.split(" ")}),ie.isolate=new ie({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),ie.contextHash=new ie({perNode:!0}),ie.lookAhead=new ie({perNode:!0}),ie.mounted=new ie({perNode:!0});class ui{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ie.mounted.id]}}const $d=Object.create(null);class Be{constructor(e,t,n,l=0){this.name=e,this.props=t,this.id=n,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):$d,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Be(e.name||"",t,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");t[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 t=this.prop(ie.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let l of n.split(" "))t[l]=e[n];return n=>{for(let l=n.prop(ie.group),o=-1;o<(l?l.length:0);o++){let s=t[o<0?n.name:l[o]];if(s)return s}}}}Be.none=new Be("",Object.create(null),0,8);class rn{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];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])}t.push(l?new Be(n.name,l,n.id,n.flags):n)}return new rn(t)}}const pi=new WeakMap,Pl=new WeakMap;var ge;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(ge||(ge={}));class fe{constructor(e,t,n,l,o){if(this.type=e,this.children=t,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=ui.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let l=n.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new hn(this.topNode,e)}cursorAt(e,t=0,n=0){let l=pi.get(this)||this.topNode,o=new hn(l);return o.moveTo(e,t),pi.set(this,o._tree),o}get topNode(){return new Oe(this,0,0,null)}resolve(e,t=0){let n=Wt(pi.get(this)||this.topNode,e,t,!1);return pi.set(this,n),n}resolveInner(e,t=0){let n=Wt(Pl.get(this)||this.topNode,e,t,!0);return Pl.set(this,n),n}resolveStack(e,t=0){return zd(this,e,t)}iterate(e){let{enter:t,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&ge.IncludeAnonymous)>0;for(let c=this.cursor(s|ge.IncludeAnonymous);;){let h=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&n&&(r||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;h=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:un(Be.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,l)=>new fe(this.type,t,n,l,this.propValues),e.makeTree||((t,n,l)=>new fe(Be.none,t,n,l)))}static build(e){return jd(e)}}fe.empty=new fe(Be.none,[],[],0);class cn{constructor(e,t){this.buffer=e,this.index=t}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 cn(this.buffer,this.index)}}class ot{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Be.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],l=this.set.types[t],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,t,n,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=t&&!($l(o,l,s[c+1],s[c+2])&&(r=c,n>0));c=s[c+3]);return r}slice(e,t,n){let l=this.buffer,o=new Uint16Array(t-e),s=0;for(let r=e,c=0;r<t;){o[c++]=l[r++],o[c++]=l[r++]-n;let h=o[c++]=l[r++]-n;o[c++]=l[r++]-e,s=Math.max(s,h)}return new ot(o,s,this.set)}}function $l(a,e,t,n){switch(a){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Wt(a,e,t,n){for(var l;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let s=!n&&a instanceof Oe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:ge.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Oe&&s.index<0&&((l=r.enter(e,t,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,t,o);if(!s)return a;a=s}}class Ll{cursor(e=0){return new hn(this,e)}getChild(e,t=null,n=null){let l=Ul(this,e,t,n);return l.length?l[0]:null}getChildren(e,t=null,n=null){return Ul(this,e,t,n)}resolve(e,t=0){return Wt(this,e,t,!1)}resolveInner(e,t=0){return Wt(this,e,t,!0)}matchContext(e){return dn(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(n=t,t=l.prevSibling):t=l}return n}get node(){return this}get next(){return this.parent}}class Oe extends Ll{constructor(e,t,n,l){super(),this._tree=e,this.from=t,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,t,n,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,h=t>0?r.length:-1;e!=h;e+=t){let f=r[e],d=c[e]+s.from;if($l(l,n,d,d+f.length)){if(f instanceof ot){if(o&ge.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,t,n-d,l);if(p>-1)return new st(new Ld(s,f,e,d),null,p)}else if(o&ge.IncludeAnonymous||!f.type.isAnonymous||fn(f)){let p;if(!(o&ge.IgnoreMounts)&&(p=ui.get(f))&&!p.overlay)return new Oe(p.tree,d,e,s);let m=new Oe(f,d,e,s);return o&ge.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?f.children.length-1:0,t,n,l)}}}if(o&ge.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<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,t,n=0){let l;if(!(n&ge.IgnoreOverlays)&&(l=ui.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((t>0?s<=o:s<o)&&(t<0?r>=o:r>o))return new Oe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,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 Ul(a,e,t,n){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let s=!1;!s;)if(s=l.type.is(t),!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 dn(a,e,t=e.length-1){for(let n=a.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Ld{constructor(e,t,n,l){this.parent=e,this.buffer=t,this.index=n,this.start=l}}class st extends Ll{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,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new st(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,t,n=0){if(n&ge.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new st(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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new st(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new st(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{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)),t.push(0)}return new fe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zl(a){if(!a.length)return null;let e=0,t=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>t.from||s.to<t.to)&&(t=s,e=o)}let n=t instanceof Oe&&t.index<0?null:t.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Ud(l,t)}class Ud{constructor(e,t){this.heads=e,this.node=t}get next(){return zl(this.heads)}}function zd(a,e,t){let n=a.resolveInner(e,t),l=null;for(let o=n instanceof Oe?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[n])).push(s.resolve(e,t)),o=s}else{let s=ui.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Oe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(Wt(r,e,t,!1))}}return l?zl(l):n}class hn{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Oe)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,t){this.index=e;let{start:n,buffer:l}=this.buffer;return this.type=t||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 Oe?(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,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-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,t,n=this.mode){return this.buffer?n&ge.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ge.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ge.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:t}=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(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(n<0?t.buffer.length:t.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 t,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:t,parent:n}=l)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let o=t+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let r=n._tree.children[o];if(this.mode&ge.IncludeAnonymous||r instanceof ot||!r.type.isAnonymous||fn(r))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=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;t=s,n=o+1;break e}l=this.stack[--o]}for(let l=n;l<this.stack.length;l++)t=new st(this.buffer,t,this.stack[l]);return this.bufferNode=new st(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){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&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,l=!0}}}matchContext(e){if(!this.buffer)return dn(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return dn(this.node,e,l);let s=n[t.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function fn(a){return a.children.some(e=>e instanceof ot||!e.type.isAnonymous||fn(e))}function jd(a){var e;let{buffer:t,nodeSet:n,maxBufferLength:l=_l,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(t)?new cn(t,t.length):t,c=n.types,h=0,f=0;function d(u,N,M,v,C,B){let{id:E,start:g,end:S,size:I}=r,V=f;for(;I<0;)if(r.next(),I==-1){let L=o[E];M.push(L),v.push(g-u);return}else if(I==-3){h=E;return}else if(I==-4){f=E;return}else throw new RangeError(`Unrecognized record size: ${I}`);let F=c[E],$,D,Q=g-u;if(S-g<=l&&(D=A(r.pos-N,C))){let L=new Uint16Array(D.size-D.skip),O=r.pos-D.size,G=L.length;for(;r.pos>O;)G=x(D.start,L,G);$=new ot(L,S-D.start,n),Q=D.start-u}else{let L=r.pos-I;r.next();let O=[],G=[],T=E>=s?E:-1,_=0,q=S;for(;r.pos>L;)T>=0&&r.id==T&&r.size>=0?(r.end<=q-l&&(b(O,G,g,_,r.end,q,T,V),_=O.length,q=r.end),r.next()):B>2500?p(g,L,O,G):d(g,L,O,G,T,B+1);if(T>=0&&_>0&&_<O.length&&b(O,G,g,_,g,q,T,V),O.reverse(),G.reverse(),T>-1&&_>0){let U=m(F);$=un(F,O,G,0,O.length,0,S-g,U,U)}else $=y(F,O,G,S-g,V-S)}M.push($),v.push(Q)}function p(u,N,M,v){let C=[],B=0,E=-1;for(;r.pos>N;){let{id:g,start:S,end:I,size:V}=r;if(V>4)r.next();else{if(E>-1&&S<E)break;E<0&&(E=I-l),C.push(g,S,I),B++,r.next()}}if(B){let g=new Uint16Array(B*4),S=C[C.length-2];for(let I=C.length-3,V=0;I>=0;I-=3)g[V++]=C[I],g[V++]=C[I+1]-S,g[V++]=C[I+2]-S,g[V++]=V;M.push(new ot(g,C[2]-S,n)),v.push(S-u)}}function m(u){return(N,M,v)=>{let C=0,B=N.length-1,E,g;if(B>=0&&(E=N[B])instanceof fe){if(!B&&E.type==u&&E.length==v)return E;(g=E.prop(ie.lookAhead))&&(C=M[B]+E.length+g)}return y(u,N,M,v,C)}}function b(u,N,M,v,C,B,E,g){let S=[],I=[];for(;u.length>v;)S.push(u.pop()),I.push(N.pop()+M-C);u.push(y(n.types[E],S,I,B-C,g-B)),N.push(C-M)}function y(u,N,M,v,C=0,B){if(h){let E=[ie.contextHash,h];B=B?[E].concat(B):[E]}if(C>25){let E=[ie.lookAhead,C];B=B?[E].concat(B):[E]}return new fe(u,N,M,v,B)}function A(u,N){let M=r.fork(),v=0,C=0,B=0,E=M.end-l,g={size:0,start:0,skip:0};e:for(let S=M.pos-u;M.pos>S;){let I=M.size;if(M.id==N&&I>=0){g.size=v,g.start=C,g.skip=B,B+=4,v+=4,M.next();continue}let V=M.pos-I;if(I<0||V<S||M.start<E)break;let F=M.id>=s?4:0,$=M.start;for(M.next();M.pos>V;){if(M.size<0)if(M.size==-3)F+=4;else break e;else M.id>=s&&(F+=4);M.next()}C=$,v+=I,B+=F}return(N<0||v==u)&&(g.size=v,g.start=C,g.skip=B),g.size>4?g:void 0}function x(u,N,M){let{id:v,start:C,end:B,size:E}=r;if(r.next(),E>=0&&v<s){let g=M;if(E>4){let S=r.pos-(E-4);for(;r.pos>S;)M=x(u,N,M)}N[--M]=g,N[--M]=B-u,N[--M]=C-u,N[--M]=v}else E==-3?h=v:E==-4&&(f=v);return M}let w=[],R=[];for(;r.pos>0;)d(a.start||0,a.bufferStart||0,w,R,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:w.length?R[0]+w[0].length:0;return new fe(c[a.topID],w.reverse(),R.reverse(),k)}const jl=new WeakMap;function mi(a,e){if(!a.isAnonymous||e instanceof ot||e.type!=a)return 1;let t=jl.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=a||!(n instanceof fe)){t=1;break}t+=mi(a,n)}jl.set(e,t)}return t}function un(a,e,t,n,l,o,s,r,c){let h=0;for(let b=n;b<l;b++)h+=mi(a,e[b]);let f=Math.ceil(h*1.5/8),d=[],p=[];function m(b,y,A,x,w){for(let R=A;R<x;){let k=R,u=y[R],N=mi(a,b[R]);for(R++;R<x;R++){let M=mi(a,b[R]);if(N+M>=f)break;N+=M}if(R==k+1){if(N>f){let M=b[k];m(M.children,M.positions,0,M.children.length,y[k]+w);continue}d.push(b[k])}else{let M=y[R-1]+b[R-1].length-u;d.push(un(a,b,y,k,R,u,M,null,c))}p.push(u+w-o)}}return m(e,t,n,l,0),(r||c)(d,p,s)}class gt{constructor(e,t,n,l,o=!1,s=!1){this.from=e,this.to=t,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,t=[],n=!1){let l=[new gt(0,e.length,e,0,!1,n)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,n=128){if(!t.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,h=0;;r++){let f=r<t.length?t[r]:null,d=f?f.fromA:1e9;if(d-c>=n)for(;s&&s.from<d;){let p=s;if(c>=p.from||d<=p.to||h){let m=Math.max(p.from,c)-h,b=Math.min(p.to,d)-h;p=m>=b?null:new gt(m,b,p.tree,p.offset+h,r>0,!!f)}if(p&&l.push(p),s.to>d)break;s=o<e.length?e[o++]:null}if(!f)break;c=f.toA,h=f.toA-f.toB}return l}}class ql{startParse(e,t,n){return typeof e=="string"&&(e=new qd(e)),n=n?n.length?n.map(l=>new an(l.from,l.to)):[new an(0,0)]:[new an(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let l=this.startParse(e,t,n);for(;;){let o=l.advance();if(o)return o}}}class qd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ie({perNode:!0});class gi{constructor(e,t,n,l,o,s,r,c,h,f=0,d){this.p=e,this.stack=t,this.state=n,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=d}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let l=e.parser.context;return new gi(e,[],t,n,n,0,[],0,l?new Ql(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;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),h=c?this.stack[c-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let d=c?this.stack[c-1]:0,p=this.bufferBase+this.buffer.length-d;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,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,h)}storeNode(e,t,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(t==n)return;if(s.buffer[r-2]>=t){s.buffer[r-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,t,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]=t,this.buffer[s+2]=n,this.buffer[s+3]=l}}shift(e,t,n,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||t<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,n),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,l,4)}}apply(e,t,n,l){e&65536?this.reduce(e):this.shift(e,t,n,l)}useNode(e,t){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(t,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,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new gi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Qd(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<t.length;o+=2)(s=t[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(t[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<t.length;o+=2){let s=t[o+1];l.some((r,c)=>c&1&&r==s)||l.push(t[o],s)}t=l}let n=[];for(let l=0;l<t.length&&n.length<4;l+=2){let o=t[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(t[l],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,l=t&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;t=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,s=>{if(!(s&393216))if(s&65536){let r=(s>>19)-o;if(r>1){let c=s&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],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 t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}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 t=new Ql(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}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 Ql{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Qd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=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],t,!0);this.state=l}}class ki{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ki(e,t,t-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 ki(this.stack,this.pos,this.index)}}function bi(a,e=Uint16Array){if(typeof a!="string")return a;let t=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}t?t[l++]=o:t=new e(o)}return t}class yi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Wl=new yi;class Wd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Wl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){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(;t<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 t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,l;if(t>=0&&t<this.chunk.length)n=this.pos+e,l=this.chunk.charCodeAt(t);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,t=0){let n=t?this.resolveOffset(t,-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,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Wl,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,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(n+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return n}}class St{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}St.prototype.contextual=St.prototype.fallback=St.prototype.extend=!1,St.prototype.fallback=St.prototype.extend=!1;function Yd(a,e,t,n,l,o){let s=0,r=1<<n,{dialect:c}=t.p.parser;e:for(;r&a[s];){let h=a[s+1];for(let m=s+3;m<h;m+=2)if((a[m+1]&r)>0){let b=a[m];if(c.allows(b)&&(e.token.value==-1||e.token.value==b||Hd(b,e.token.value,l,o))){e.acceptToken(b);break}}let f=e.next,d=0,p=a[s+2];if(e.next<0&&p>d&&a[h+p*3-3]==65535){s=a[h+p*3-1];continue e}for(;d<p;){let m=d+p>>1,b=h+m+(m<<1),y=a[b],A=a[b+1]||65536;if(f<y)p=m;else if(f>=A)d=m+1;else{s=a[b+2],e.advance();continue e}}break}}function Yl(a,e,t){for(let n=e,l;(l=a[n])!=65535;n++)if(l==t)return n-e;return-1}function Hd(a,e,t,n){let l=Yl(t,n,e);return l<0||Yl(t,n,a)<l}const Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let pn=null;function Hl(a,e,t){let n=a.cursor(ge.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(a.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:a.length}}class Kd{constructor(e,t){this.fragments=e,this.nodeSet=t,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?Hl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Hl(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 t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],l=this.index[t];if(l==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[l],s=this.start[t]+n.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof fe){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(ie.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}}class Gd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new yi)}getActions(e){let t=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 h=0;h<o.length;h++){if(!(1<<h&s))continue;let f=o[h],d=this.tokens[h];if(!(n&&!f.fallback)&&((f.contextual||d.start!=e.pos||d.mask!=s||d.context!=r)&&(this.updateCachedToken(d,f,e),d.mask=s,d.context=r),d.lookAhead>d.end+25&&(c=Math.max(d.lookAhead,c)),d.value!=0)){let p=t;if(d.extended>-1&&(t=this.addActions(e,d.extended,d.end,t)),t=this.addActions(e,d.value,d.end,t),!f.extend&&(n=d,t>p))break}}for(;this.actions.length>t;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new yi,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yi,{pos:n,p:l}=e;return t.start=n,t.end=Math.min(n+1,l.stream.end),t.value=n==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,n){let l=this.stream.clipPos(n.pos);if(t.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,t,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++]=t,this.actions[l++]=n,l}addActions(e,t,n,l){let{state:o}=e,{parser:s}=e.p,{data:r}=s;for(let c=0;c<2;c++)for(let h=s.stateSlot(o,c?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=Je(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(Je(r,h+2),t,n,l));break}r[h]==t&&(l=this.putAction(Je(r,h+1),t,n,l))}return l}}class Jd{constructor(e,t,n,l){this.parser=e,this.input=t,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 Wd(t,l),this.tokens=new Gd(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[gi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new Kd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=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>t)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&&Zd(l);if(s)return Ve&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ve&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);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 Ve&&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>t)&&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 h=n[c];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.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,t,n){let l=e.pos,{parser:o}=this,s=Ve?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let d=this.fragments.nodeAt(l);d;){let p=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(e.state,d.type.id):-1;if(p>-1&&d.length&&(!h||(d.prop(ie.contextHash)||0)==f))return e.useNode(d,p),Ve&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof fe)||d.children.length==0||d.positions[0]>0)break;let m=d.children[0];if(m instanceof fe&&d.positions[0]==0)d=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ve&&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 h=0;h<c.length;){let f=c[h++],d=c[h++],p=c[h++],m=h==c.length||!n,b=m?e:e.split(),y=this.tokens.mainToken;if(b.apply(f,d,y?y.start:b.pos,p),Ve&&console.log(s+this.stackID(b)+` (via ${f&65536?`reduce of ${o.getName(f&65535)}`:"shift"} for ${o.getName(d)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?t.push(b):n.push(b)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Kl(e,t),!0}}runRecovery(e,t,n){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=t[s<<1],h=t[(s<<1)+1],f=Ve?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Ve&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let d=r.split(),p=f;for(let m=0;d.forceReduce()&&m<10&&(Ve&&console.log(p+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));m++)Ve&&(p=this.stackID(d)+" -> ");for(let m of r.recoverByInsert(c))Ve&&console.log(f+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>r.pos?(h==r.pos&&(h++,c=0),r.recoverByDelete(c,h),Ve&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),Kl(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),fe.build({buffer:ki.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 t=(pn||(pn=new WeakMap)).get(e);return t||pn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Kl(a,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==a.pos&&n.sameState(a)){e[t].score<a.score&&(e[t]=a);return}}e.push(a)}class Xd{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class wi extends ql{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let n=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function o(r,c,h){l[r].push([c,c.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let c=r[0];typeof c=="string"&&(c=ie[c]);for(let h=1;h<r.length;){let f=r[h++];if(f>=0)o(f,c,r[h++]);else{let d=r[h+-f];for(let p=-f;p>0;p--)o(r[h++],c,d);h++}}}this.nodeSet=new rn(t.map((r,c)=>Be.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=_l;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(Gl),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 St(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,t,n){let l=new Jd(this,e,t,n);for(let o of this.wrappers)l=o(l,e,t,n);return l}getGoto(e,t,n=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&n)return c;for(let h=o+(s>>1);o<h;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,t){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=Je(n,o+2)];else{if(n[o+1]==2)return Je(n,o+2);break}if(s==t||s==0)return Je(n,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),l=n?t(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=Je(this.data,o+2);else break;l=t(Je(this.data,o+1))}return l}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Je(this.data,n+2);else break;if(!(this.data[n+2]&1)){let l=this.data[n+1];t.some((o,s)=>s&1&&o==l)||t.push(this.data[n],l)}}return t}configure(e){let t=Object.assign(Object.create(wi.prototype),this);if(e.props&&(t.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}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let l=e.tokenizers.find(o=>o.from==n);return l?l.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.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 t.specializers[l]=Gl(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let o of e.split(" ")){let s=t.indexOf(o);s>=0&&(n[s]=!0)}let l=null;for(let o=0;o<t.length;o++)if(!n[o])for(let s=this.dialects[t[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Xd(e,n,l)}static deserialize(e){return new wi(e)}}function Je(a,e){return a[e]|a[e+1]<<16}function Zd(a){let e=null;for(let t of a){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Gl(a){if(a.external){let e=a.extend?1:0;return(t,n)=>a.external(t,n)<<1|e}return a.get}let eh=0;class Me{constructor(e,t,n,l){this.name=e,this.set=t,this.base=n,this.modified=l,this.id=eh++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Me&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new Me(n,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new Ai(e);return n=>n.modified.indexOf(t)>-1?n:Ai.get(n.base||n,n.modified.concat(t).sort((l,o)=>l.id-o.id))}}let th=0;class Ai{constructor(e){this.name=e,this.instances=[],this.id=th++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(r=>r.base==e&&ih(t,r.modified));if(n)return n;let l=[],o=new Me(e.name,l,e,t);for(let r of t)r.instances.push(o);let s=nh(t);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ai.get(r,c));return o}}function ih(a,e){return a.length==e.length&&a.every((t,n)=>t==e[n])}function nh(a){let e=[[]];for(let t=0;t<a.length;t++)for(let n=0,l=e.length;n<l;n++)e.push(e[n].concat(a[t]));return e.sort((t,n)=>n.length-t.length)}function Jl(a){let e=Object.create(null);for(let t in a){let n=a[t];Array.isArray(n)||(n=[n]);for(let l of t.split(" "))if(l){let o=[],s=2,r=l;for(let d=0;;){if(r=="..."&&d>0&&d+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]),d+=p[0].length,d==l.length)break;let m=l[d++];if(d==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(d)}let c=o.length-1,h=o[c];if(!h)throw new RangeError("Invalid path: "+l);let f=new mn(n,s,c>0?o.slice(0,c):null);e[h]=f.sort(e[h])}}return lh.add(e)}const lh=new ie;class mn{constructor(e,t,n,l){this.tags=e,this.mode=t,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}}mn.empty=new mn([],2,null);function Xl(a,e){let t=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let s of o.tag)t[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 h=t[c.id];if(h){s=s?s+" "+h:h;break}}return s},scope:n}}const j=Me.define,xi=j(),at=j(),Zl=j(at),eo=j(at),rt=j(),Ci=j(rt),gn=j(rt),Le=j(),kt=j(Le),Ue=j(),ze=j(),kn=j(),Yt=j(kn),vi=j(),z={comment:xi,lineComment:j(xi),blockComment:j(xi),docComment:j(xi),name:at,variableName:j(at),typeName:Zl,tagName:j(Zl),propertyName:eo,attributeName:j(eo),className:j(at),labelName:j(at),namespace:j(at),macroName:j(at),literal:rt,string:Ci,docString:j(Ci),character:j(Ci),attributeValue:j(Ci),number:gn,integer:j(gn),float:j(gn),bool:j(rt),regexp:j(rt),escape:j(rt),color:j(rt),url:j(rt),keyword:Ue,self:j(Ue),null:j(Ue),atom:j(Ue),unit:j(Ue),modifier:j(Ue),operatorKeyword:j(Ue),controlKeyword:j(Ue),definitionKeyword:j(Ue),moduleKeyword:j(Ue),operator:ze,derefOperator:j(ze),arithmeticOperator:j(ze),logicOperator:j(ze),bitwiseOperator:j(ze),compareOperator:j(ze),updateOperator:j(ze),definitionOperator:j(ze),typeOperator:j(ze),controlOperator:j(ze),punctuation:kn,separator:j(kn),bracket:Yt,angleBracket:j(Yt),squareBracket:j(Yt),paren:j(Yt),brace:j(Yt),content:Le,heading:kt,heading1:j(kt),heading2:j(kt),heading3:j(kt),heading4:j(kt),heading5:j(kt),heading6:j(kt),contentSeparator:j(Le),list:j(Le),quote:j(Le),emphasis:j(Le),strong:j(Le),link:j(Le),monospace:j(Le),strikethrough:j(Le),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:vi,documentMeta:j(vi),annotation:j(vi),processingInstruction:j(vi),definition:Me.defineModifier("definition"),constant:Me.defineModifier("constant"),function:Me.defineModifier("function"),standard:Me.defineModifier("standard"),local:Me.defineModifier("local"),special:Me.defineModifier("special")};for(let a in z){let e=z[a];e instanceof Me&&(e.name=a)}Xl([{tag:z.link,class:"tok-link"},{tag:z.heading,class:"tok-heading"},{tag:z.emphasis,class:"tok-emphasis"},{tag:z.strong,class:"tok-strong"},{tag:z.keyword,class:"tok-keyword"},{tag:z.atom,class:"tok-atom"},{tag:z.bool,class:"tok-bool"},{tag:z.url,class:"tok-url"},{tag:z.labelName,class:"tok-labelName"},{tag:z.inserted,class:"tok-inserted"},{tag:z.deleted,class:"tok-deleted"},{tag:z.literal,class:"tok-literal"},{tag:z.string,class:"tok-string"},{tag:z.number,class:"tok-number"},{tag:[z.regexp,z.escape,z.special(z.string)],class:"tok-string2"},{tag:z.variableName,class:"tok-variableName"},{tag:z.local(z.variableName),class:"tok-variableName tok-local"},{tag:z.definition(z.variableName),class:"tok-variableName tok-definition"},{tag:z.special(z.variableName),class:"tok-variableName2"},{tag:z.definition(z.propertyName),class:"tok-propertyName tok-definition"},{tag:z.typeName,class:"tok-typeName"},{tag:z.namespace,class:"tok-namespace"},{tag:z.className,class:"tok-className"},{tag:z.macroName,class:"tok-macroName"},{tag:z.propertyName,class:"tok-propertyName"},{tag:z.operator,class:"tok-operator"},{tag:z.comment,class:"tok-comment"},{tag:z.meta,class:"tok-meta"},{tag:z.invalid,class:"tok-invalid"},{tag:z.punctuation,class:"tok-punctuation"}]);const oh=Jl({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),sh=wi.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:[oh],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=[],to=[];(()=>{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,t=0;e<a.length;e++)(e%2?to:bn).push(t=t+a[e])})();function ah(a){if(a<768)return!1;for(let e=0,t=bn.length;;){let n=e+t>>1;if(a<bn[n])t=n;else if(a>=to[n])e=n+1;else return!0;if(e==t)return!1}}function io(a){return a>=127462&&a<=127487}const no=8205;function rh(a,e,t=!0,n=!0){return(t?lo:ch)(a,e,n)}function lo(a,e,t){if(e==a.length)return e;e&&oo(a.charCodeAt(e))&&so(a.charCodeAt(e-1))&&e--;let n=yn(a,e);for(e+=ao(n);e<a.length;){let l=yn(a,e);if(n==no||l==no||t&&ah(l))e+=ao(l),n=l;else if(io(l)){let o=0,s=e-2;for(;s>=0&&io(yn(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function ch(a,e,t){for(;e>0;){let n=lo(a,e-2,t);if(n<e)return n;e--}return 0}function yn(a,e){let t=a.charCodeAt(e);if(!so(t)||e+1==a.length)return t;let n=a.charCodeAt(e+1);return oo(n)?(t-55296<<10)+(n-56320)+65536:t}function oo(a){return a>=56320&&a<57344}function so(a){return a>=55296&&a<56320}function ao(a){return a<65536?1:2}class te{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,t,n){[e,t]=Bt(this,e,t);let l=[];return this.decompose(0,e,l,2),n.length&&n.decompose(0,n.length,l,3),this.decompose(t,this.length,l,1),je.from(l,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Bt(this,e,t);let n=[];return this.decompose(e,t,n,0),je.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),l=new Ht(this),o=new Ht(e);for(let s=t,r=t;;){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 Ht(this,e)}iterRange(e,t=this.length){return new co(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;n=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ho(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]?te.empty:e.length<=32?new he(e):je.from(he.split(e,[]))}}class he extends te{constructor(e,t=dh(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((t?n:r)>=e)return new hh(l,r,n,s);l=r+1,n++}}decompose(e,t,n,l){let o=e<=0&&t>=this.length?this:new he(ro(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=Si(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new he(r,s.length+o.length));else{let c=r.length>>1;n.push(new he(r.slice(0,c)),new he(r.slice(c)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof he))return super.replace(e,t,n);[e,t]=Bt(this,e,t);let l=Si(this.text,Si(n.text,ro(this.text,0,e)),t),o=this.length+n.length-(t-e);return l.length<=32?new he(l,o):je.from(he.split(l,[]),o)}sliceString(e,t=this.length,n=`
15
- `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<=t&&s<this.text.length;s++){let r=this.text[s],c=o+r.length;o>e&&s&&(l+=n),e<c&&t>o&&(l+=r.slice(Math.max(0,e-o),t-o)),o=c+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],l=-1;for(let o of e)n.push(o),l+=o.length+1,n.length==32&&(t.push(new he(n,l)),n=[],l=-1);return l>-1&&t.push(new he(n,l)),t}}class je extends te{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.children[o],r=l+s.length,c=n+s.lines-1;if((t?c:r)>=e)return s.lineInner(e,t,n,l);l=r+1,n=c+1}}decompose(e,t,n,l){for(let o=0,s=0;s<=t&&o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e<=c&&t>=s){let h=l&((s<=e?1:0)|(c>=t?2:0));s>=e&&c<=t&&!h?n.push(r):r.decompose(e-s,t-s,n,h)}s=c+1}}replace(e,t,n){if([e,t]=Bt(this,e,t),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&&t<=r){let c=s.replace(e-o,t-o,n),h=this.lines-s.lines+c.lines;if(c.lines<h>>4&&c.lines>h>>6){let f=this.children.slice();return f[l]=c,new je(f,this.length-(t-e)+n.length)}return super.replace(o,r,c)}o=r+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
16
- `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<this.children.length&&s<=t;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=n),e<c&&t>s&&(l+=r.sliceString(e-s,t-s,n)),s=c+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof je))return 0;let n=0,[l,o,s,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==s||o==r)return n;let c=this.children[l],h=e.children[o];if(c!=h)return n+c.scanIdentical(h,t);n+=c.length+1}}static from(e,t=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 he(m,t)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,h=-1,f=[];function d(m){let b;if(m.lines>o&&m instanceof je)for(let y of m.children)d(y);else m.lines>s&&(c>s||!c)?(p(),r.push(m)):m instanceof he&&c&&(b=f[f.length-1])instanceof he&&m.lines+b.lines<=32?(c+=m.lines,h+=m.length+1,f[f.length-1]=new he(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>l&&p(),c+=m.lines,h+=m.length+1,f.push(m))}function p(){c!=0&&(r.push(f.length==1?f[0]:je.from(f,h)),h=-1,c=f.length=0)}for(let m of e)d(m);return p(),r.length==1?r[0]:new je(r,t)}}te.empty=new he([""],0);function dh(a){let e=-1;for(let t of a)e+=t.length+1;return e}function Si(a,e,t=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>=t&&(c>n&&(r=r.slice(0,n-l)),l<t&&(r=r.slice(t-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function ro(a,e,t){return Si(a,[""],e,t)}class Ht{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof he?e.text.length:e.children.length)<<1]}nextInner(e,t){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 he?l.text.length:l.children.length;if(s==(t>0?r:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
17
- `,this;e--}else if(l instanceof he){let c=l.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof he?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 co{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Ht(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<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)*t,this.value=l.length<=n?l:t<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 ho{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(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"&&(te.prototype[Symbol.iterator]=function(){return this.iter()},Ht.prototype[Symbol.iterator]=co.prototype[Symbol.iterator]=ho.prototype[Symbol.iterator]=function(){return this});class hh{constructor(e,t,n,l){this.from=e,this.to=t,this.number=n,this.text=l}get length(){return this.to-this.from}}function Bt(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}function Xe(a,e,t=!0,n=!0){return rh(a,e,t,n)}const wn=/\r\n?|\n/;var Re=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Re||(Re={}));class Ze{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,l=0;t<this.sections.length;){let o=this.sections[t++],s=this.sections[t++];s<0?(e(n,l,o),l+=o):l+=s,n+=o}}iterChangedRanges(e,t=!1){An(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];l<0?e.push(n,l):e.push(l,n)}return new Ze(e)}composeDesc(e){return this.empty?e:e.empty?this:fo(this,e)}mapDesc(e,t=!1){return e.empty?this:xn(this,e,t)}mapPos(e,t=-1,n=Re.Simple){let l=0,o=0;for(let s=0;s<this.sections.length;){let r=this.sections[s++],c=this.sections[s++],h=l+r;if(c<0){if(h>e)return o+(e-l);o+=r}else{if(n!=Re.Simple&&h>=e&&(n==Re.TrackDel&&l<e&&h>e||n==Re.TrackBefore&&l<e||n==Re.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?o:o+c;o+=c}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let n=0,l=0;n<this.sections.length&&l<=t;){let o=this.sections[n++],s=this.sections[n++],r=l+o;if(s>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+n+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ze(e)}static create(e){return new Ze(e)}}class ke extends Ze{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return An(this,(t,n,l,o,s)=>e=e.replace(l,l+(n-t),s),!1),e}mapDesc(e,t=!1){return xn(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let l=0,o=0;l<t.length;l+=2){let s=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=s;let c=l>>1;for(;n.length<c;)n.push(te.empty);n.push(s?e.slice(o,o+s):te.empty)}o+=s}return new ke(t,n)}compose(e){return this.empty?e:e.empty?this:fo(this,e,!0)}map(e,t=!1){return e.empty?this:xn(this,e,t,!0)}iterChanges(e,t=!1){An(this,e,t)}get desc(){return Ze.create(this.sections)}filter(e){let t=[],n=[],l=[],o=new Kt(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 f=Math.min(o.len,c-r);Ae(l,f,-1);let d=o.ins==-1?-1:o.off==0?o.ins:0;Ae(t,f,d),d>0&&ct(n,t,o.text),o.forward(f),r+=f}let h=e[s++];for(;r<h;){if(o.done)break e;let f=Math.min(o.len,h-r);Ae(t,f,-1),Ae(l,f,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(f),r+=f}}return{changes:new ke(t,n),filtered:Ze.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],l=this.sections[t+1];l<0?e.push(n):l==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let l=[],o=[],s=0,r=null;function c(f=!1){if(!f&&!l.length)return;s<t&&Ae(l,t-s,-1);let d=new ke(l,o);r=r?r.compose(d.map(r)):d,l=[],o=[],s=0}function h(f){if(Array.isArray(f))for(let d of f)h(d);else if(f instanceof ke){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);c(),r=r?r.compose(f.map(r)):f}else{let{from:d,to:p=d,insert:m}=f;if(d>p||d<0||p>t)throw new RangeError(`Invalid change range ${d} to ${p} (in doc of length ${t})`);let b=m?typeof m=="string"?te.of(m.split(n||wn)):m:te.empty,y=b.length;if(d==p&&y==0)return;d<s&&c(),d>s&&Ae(l,d-s,-1),Ae(l,p-d,y),ct(o,l,b),s=p}}return h(e),c(!r),r}static empty(e){return new ke(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")t.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)t.push(o[0],0);else{for(;n.length<l;)n.push(te.empty);n[l]=te.of(o.slice(1)),t.push(o[0],n[l].length)}}}return new ke(t,n)}static createSet(e,t){return new ke(e,t)}}function Ae(a,e,t,n=!1){if(e==0&&t<=0)return;let l=a.length-2;l>=0&&t<=0&&t==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=t:n?(a[l]+=e,a[l+1]+=t):a.push(e,t)}function ct(a,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<n;)a.push(te.empty);a.push(t)}}function An(a,e,t){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 h=l,f=o,d=te.empty;for(;h+=r,f+=c,c&&n&&(d=d.append(n[s-2>>1])),!(t||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,h,o,f,d),l=h,o=f}}}function xn(a,e,t,n=!1){let l=[],o=n?[]:null,s=new Kt(a),r=new Kt(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 h=Math.min(s.len,r.len);Ae(l,h,-1),s.forward(h),r.forward(h)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!t))){let h=r.len;for(Ae(l,r.ins,-1);h;){let f=Math.min(s.len,h);s.ins>=0&&c<s.i&&s.len<=f&&(Ae(l,0,s.ins),o&&ct(o,l,s.text),c=s.i),s.forward(f),h-=f}r.next()}else if(s.ins>=0){let h=0,f=s.len;for(;f;)if(r.ins==-1){let d=Math.min(f,r.len);h+=d,f-=d,r.forward(d)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;Ae(l,h,c<s.i?s.ins:0),o&&c<s.i&&ct(o,l,s.text),c=s.i,s.forward(s.len-f)}else{if(s.done&&r.done)return o?ke.createSet(l,o):Ze.create(l);throw new Error("Mismatched change set lengths")}}}function fo(a,e,t=!1){let n=[],l=t?[]:null,o=new Kt(a),s=new Kt(e);for(let r=!1;;){if(o.done&&s.done)return l?ke.createSet(n,l):Ze.create(n);if(o.ins==0)Ae(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ae(n,0,s.ins,r),l&&ct(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),h=n.length;if(o.ins==-1){let f=s.ins==-1?-1:s.off?0:s.ins;Ae(n,c,f,r),l&&f&&ct(l,n,s.text)}else s.ins==-1?(Ae(n,o.off?0:o.len,c,r),l&&ct(l,n,o.textBit(c))):(Ae(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&ct(l,n,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||n.length>h),o.forward2(c),s.forward(c)}}}}class Kt{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,t=this.i-2>>1;return t>=e.length?te.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?te.empty:t[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 bt{constructor(e,t,n){this.from=e,this.to=t,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,t=-1){let n,l;return this.empty?n=l=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),n==this.from&&l==this.to?this:new bt(n,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return K.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return K.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!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 K.range(e.anchor,e.head)}static create(e,t,n){return new bt(e,t,n)}}class K{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:K.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!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],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new K([this.main],0)}addRange(e,t=!0){return K.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,K.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 K(e.ranges.map(t=>bt.fromJSON(t)),e.main)}static single(e,t=e){return new K([K.range(e,t)],0)}static create(e,t=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 K.normalized(e.slice(),t);n=o.to}return new K(e,t)}static cursor(e,t=0,n,l){return bt.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(l??16777215)<<6)}static range(e,t,n,l){let o=(n??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?bt.create(t,e,48|o):bt.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort((l,o)=>l.from-o.from),t=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<=t&&t--,e.splice(--l,2,o.anchor>o.head?K.range(c,r):K.range(r,c))}}return new K(e,t)}}function uo(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Cn=0;class J{constructor(e,t,n,l,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=l,this.id=Cn++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new J(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:vn),!!e.static,e.enables)}of(e){return new Bi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function vn(a,e){return a==e||a.length==e.length&&a.every((t,n)=>t===e[n])}class Bi{constructor(e,t,n,l){this.dependencies=e,this.facet=t,this.type=n,this.value=l,this.id=Cn++}dynamicSlot(e){var t;let n=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,h=!1,f=[];for(let d of this.dependencies)d=="doc"?c=!0:d=="selection"?h=!0:((t=e[d.id])!==null&&t!==void 0?t:1)&1||f.push(e[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,p){if(c&&p.docChanged||h&&(p.docChanged||p.selection)||Sn(d,f)){let m=n(d);if(r?!po(m,d.values[s],l):!l(m,d.values[s]))return d.values[s]=m,1}return 0},reconfigure:(d,p)=>{let m,b=p.config.address[o];if(b!=null){let y=Ei(p,b);if(this.dependencies.every(A=>A instanceof J?p.facet(A)===d.facet(A):A instanceof yt?p.field(A,!1)==d.field(A,!1):!0)||(r?po(m=n(d),y,l):l(m=n(d),y)))return d.values[s]=y,0}else m=n(d);return d.values[s]=m,1}}}}function po(a,e,t){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(!t(a[n],e[n]))return!1;return!0}function Sn(a,e){let t=!1;for(let n of e)Jt(a,n)&1&&(t=!0);return t}function fh(a,e,t){let n=t.map(c=>a[c.id]),l=t.map(c=>c.type),o=n.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let h=[];for(let f=0;f<n.length;f++){let d=Ei(c,n[f]);if(l[f]==2)for(let p of d)h.push(p);else h.push(d)}return e.combine(h)}return{create(c){for(let h of n)Jt(c,h);return c.values[s]=r(c),1},update(c,h){if(!Sn(c,o))return 0;let f=r(c);return e.compare(f,c.values[s])?0:(c.values[s]=f,1)},reconfigure(c,h){let f=Sn(c,n),d=h.config.facets[e.id],p=h.facet(e);if(d&&!f&&vn(t,d))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 Ni=J.define({static:!0});class yt{constructor(e,t,n,l,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let t=new yt(Cn++,e.create,e.update,e.compare||((n,l)=>n===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ni).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,l)=>{let o=n.values[t],s=this.updateF(o,l);return this.compareF(o,s)?0:(n.values[t]=s,1)},reconfigure:(n,l)=>{let o=n.facet(Ni),s=l.facet(Ni),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(n.values[t]=r.create(n),1):l.config.address[this.id]!=null?(n.values[t]=l.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Ni.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function Gt(a){return e=>new mo(e,a)}const uh={highest:Gt(wt.highest),high:Gt(wt.high),default:Gt(wt.default),low:Gt(wt.low),lowest:Gt(wt.lowest)};class mo{constructor(e,t){this.inner=e,this.prec=t}}class Vi{of(e){return new Bn(this,e)}reconfigure(e){return Vi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bn{constructor(e,t){this.compartment=e,this.inner=t}}class Ri{constructor(e,t,n,l,o,s){for(this.base=e,this.compartments=t,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 t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let l=[],o=Object.create(null),s=new Map;for(let p of ph(e,t,s))p instanceof yt?l.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let r=Object.create(null),c=[],h=[];for(let p of l)r[p.id]=h.length<<1,h.push(m=>p.slot(m));let f=n?.config.facets;for(let p in o){let m=o[p],b=m[0].facet,y=f&&f[p]||[];if(m.every(A=>A.type==0))if(r[b.id]=c.length<<1|1,vn(y,m))c.push(n.facet(b));else{let A=b.combine(m.map(x=>x.value));c.push(n&&b.compare(A,n.facet(b))?n.facet(b):A)}else{for(let A of m)A.type==0?(r[A.id]=c.length<<1|1,c.push(A.value)):(r[A.id]=h.length<<1,h.push(x=>A.dynamicSlot(x)));r[b.id]=h.length<<1,h.push(A=>fh(A,b,m))}}let d=h.map(p=>p(r));return new Ri(e,s,d,r,c,o)}}function ph(a,e,t){let n=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let h=n[c].indexOf(s);h>-1&&n[c].splice(h,1),s instanceof Bn&&t.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let h of s)o(h,r);else if(s instanceof Bn){if(t.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(s.compartment)||s.inner;t.set(s.compartment,h),o(h,r)}else if(s instanceof mo)o(s.inner,s.prec);else if(s instanceof yt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Bi)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,wt.default);else{let h=s.extension;if(!h)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(h,r)}}return o(a,wt.default),n.reduce((s,r)=>s.concat(r))}function Jt(a,e){if(e&1)return 2;let t=e>>1,n=a.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;a.status[t]=4;let l=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|l}function Ei(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const go=J.define(),Nn=J.define({combine:a=>a.some(e=>e),static:!0}),ko=J.define({combine:a=>a.length?a[0]:void 0,static:!0}),bo=J.define(),yo=J.define(),wo=J.define(),Ao=J.define({combine:a=>a.length?a[0]:!1});class Nt{constructor(e,t){this.type=e,this.value=t}static define(){return new mh}}class mh{of(e){return new Nt(this,e)}}class gh{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new me(this.type,t)}is(e){return this.type==e}static define(e={}){return new gh(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let l of e){let o=l.map(t);o&&n.push(o)}return n}}me.reconfigure=me.define(),me.appendConfig=me.define();class xe{constructor(e,t,n,l,o,s){this.startState=e,this.changes=t,this.selection=n,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&uo(n,t.newLength),o.some(r=>r.type==xe.time)||(this.annotations=o.concat(xe.time.of(Date.now())))}static create(e,t,n,l,o,s){return new xe(e,t,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 t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(xe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}xe.time=Nt.define(),xe.userEvent=Nt.define(),xe.addToHistory=Nt.define(),xe.remote=Nt.define();function kh(a,e){let t=[];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 t;!t.length||t[t.length-1]<o?t.push(o,s):t[t.length-1]<s&&(t[t.length-1]=s)}}function xo(a,e,t){var n;let l,o,s;return t?(l=e.changes,o=ke.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:me.mapEffects(a.effects,l).concat(me.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Vn(a,e,t){let n=e.selection,l=Vt(e.annotations);return e.userEvent&&(l=l.concat(xe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ke?e.changes:ke.of(e.changes||[],t,a.facet(ko)),selection:n&&(n instanceof K?n:K.single(n.anchor,n.head)),effects:Vt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Co(a,e,t){let n=Vn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let s=!!e[o].sequential;n=xo(n,Vn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=xe.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return yh(t?bh(l):l)}function bh(a){let e=a.startState,t=!0;for(let l of e.facet(bo)){let o=l(a);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:kh(t,o))}if(t!==!0){let l,o;if(t===!1)o=a.changes.invertedDesc,l=ke.empty(e.doc.length);else{let s=a.changes.filter(t);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=xe.create(e,l,a.selection&&a.selection.map(o),me.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(yo);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof xe?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof xe?a=o[0]:a=Co(e,Vt(o),!1)}return a}function yh(a){let e=a.startState,t=e.facet(wo),n=a;for(let l=t.length-1;l>=0;l--){let o=t[l](a);o&&Object.keys(o).length&&(n=xo(n,Vn(e,o,a.changes.newLength),!0))}return n==a?a:xe.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const wh=[];function Vt(a){return a==null?wh:Array.isArray(a)?a:[a]}var et=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(et||(et={}));const Ah=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Rn;try{Rn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function xh(a){if(Rn)return Rn.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ah.test(t)))return!0}return!1}function Ch(a){return e=>{if(!/\S/.test(e))return et.Space;if(xh(e))return et.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return et.Word;return et.Other}}class le{constructor(e,t,n,l,o,s){this.config=e,this.doc=t,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++)Jt(this,r<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Jt(this,n),Ei(this,n)}update(...e){return Co(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:l}=t;for(let r of e.effects)r.is(Vi.reconfigure)?(t&&(l=new Map,t.compartments.forEach((c,h)=>l.set(h,c)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(me.reconfigure)?(t=null,n=r.value):r.is(me.appendConfig)&&(t=null,n=Vt(n).concat(r.value));let o;t?o=e.startState.values.slice():(t=Ri.resolve(n,l,this),o=new le(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let s=e.startState.facet(Nn)?e.newSelection:e.newSelection.asSingle();new le(t,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:K.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),l=this.changes(n.changes),o=[n.range],s=Vt(n.effects);for(let r=1;r<t.ranges.length;r++){let c=e(t.ranges[r]),h=this.changes(c.changes),f=h.map(l);for(let p=0;p<r;p++)o[p]=o[p].map(f);let d=l.mapDesc(h,!0);o.push(c.range.map(d)),l=l.compose(f),s=me.mapEffects(s,f).concat(me.mapEffects(Vt(c.effects),d))}return{changes:l,selection:K.create(o,t.mainIndex),effects:s}}changes(e=[]){return e instanceof ke?e:ke.of(e,this.doc.length,this.facet(le.lineSeparator))}toText(e){return te.of(e.split(this.facet(le.lineSeparator)||wn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Jt(this,t),Ei(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let l=e[n];l instanceof yt&&this.config.address[l.id]!=null&&(t[n]=l.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},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 le.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Ri.resolve(e.extensions||[],new Map),n=e.doc instanceof te?e.doc:te.of((e.doc||"").split(t.staticFacet(le.lineSeparator)||wn)),l=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return uo(l,n.length),t.staticFacet(Nn)||(l=l.asSingle()),new le(t,n,l,t.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(le.tabSize)}get lineBreak(){return this.facet(le.lineSeparator)||`
18
- `}get readOnly(){return this.facet(Ao)}phrase(e,...t){for(let n of this.facet(le.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?n:t[o-1]})),e}languageDataAt(e,t,n=-1){let l=[];for(let o of this.facet(go))for(let s of o(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return Ch(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-n,r=e-n;for(;s>0;){let c=Xe(t,s,!1);if(o(t.slice(c,s))!=et.Word)break;s=c}for(;r<l;){let c=Xe(t,r);if(o(t.slice(r,c))!=et.Word)break;r=c}return s==r?null:K.range(s+n,r+n)}}le.allowMultipleSelections=Nn,le.tabSize=J.define({combine:a=>a.length?a[0]:4}),le.lineSeparator=ko,le.readOnly=Ao,le.phrases=J.define({compare(a,e){let t=Object.keys(a),n=Object.keys(e);return t.length==n.length&&t.every(l=>a[l]==e[l])}}),le.languageData=go,le.changeFilter=bo,le.transactionFilter=yo,le.transactionExtender=wo,Vi.reconfigure=me.define();class Rt{eq(e){return this==e}range(e,t=e){return Xt.create(e,t,this)}}Rt.prototype.startSide=Rt.prototype.endSide=0,Rt.prototype.point=!1,Rt.prototype.mapMode=Re.TrackDel;class Xt{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Xt(e,t,n)}}function En(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class On{constructor(e,t,n,l){this.from=e,this.to=t,this.value=n,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,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,h=o[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==s)return h>=0?s:r;h>=0?r=c:s=c+1}}between(e,t,n,l){for(let o=this.findIndex(t,-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,t){let n=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let h=this.value[c],f=this.from[c]+e,d=this.to[c]+e,p,m;if(f==d){let b=t.mapPos(f,h.startSide,h.mapMode);if(b==null||(p=m=b,h.startSide!=h.endSide&&(m=t.mapPos(f,h.endSide),m<p)))continue}else if(p=t.mapPos(f,h.startSide),m=t.mapPos(d,h.endSide),p>m||p==m&&h.startSide>0&&h.endSide<=0)continue;(m-p||h.endSide-h.startSide)<0||(s<0&&(s=p),h.point&&(r=Math.max(r,m-p)),n.push(h),l.push(p-s),o.push(m-s))}return{mapped:n.length?new On(l,o,n,r):null,pos:s}}}class ce{constructor(e,t,n,l){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=l}static create(e,t,n,l){return new ce(e,t,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 t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(t.length==0&&!s)return this;if(n&&(t=t.slice().sort(En)),this.isEmpty)return t.length?ce.of(t):this;let r=new So(this,null,-1).goto(0),c=0,h=[],f=new Oi;for(;r.value||c<t.length;)if(c<t.length&&(r.from-t[c].from||r.startSide-t[c].value.startSide)>=0){let d=t[c++];f.addInner(d.from,d.to,d.value)||h.push(d)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(r.chunkIndex)<t[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&f.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))&&(f.addInner(r.from,r.to,r.value)||h.push(Xt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?ce.empty:this.nextLayer.update({add:h,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],l=-1;for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],c=this.chunk[s],h=e.touchesRange(r,r+c.length);if(h===!1)l=Math.max(l,c.maxPoint),t.push(c),n.push(e.mapPos(r));else if(h===!0){let{mapped:f,pos:d}=c.map(r,e);f&&(l=Math.max(l,f.maxPoint),t.push(f),n.push(d))}}let o=this.nextLayer.map(e);return t.length==0?o:new ce(n,t,o||ce.empty,l)}between(e,t,n){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(t>=o&&e<=o+s.length&&s.between(o,e-o,t-o,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Zt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Zt.from(e).goto(t)}static compare(e,t,n,l,o=-1){let s=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),r=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),c=vo(s,r,n),h=new ei(s,c,o),f=new ei(r,c,o);n.iterGaps((d,p,m)=>Bo(h,d,f,p,m,l)),n.empty&&n.length==0&&Bo(h,0,f,0,0,l)}static eq(e,t,n=0,l){l==null&&(l=999999999);let o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=vo(o,s),c=new ei(o,r,0).goto(n),h=new ei(s,r,0).goto(n);for(;;){if(c.to!=h.to||!Tn(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>l)return!0;c.next(),h.next()}}static spans(e,t,n,l,o=-1){let s=new ei(e,null,o).goto(t),r=t,c=s.openStart;for(;;){let h=Math.min(s.to,n);if(s.point){let f=s.activeForPoint(s.to),d=s.pointFrom<t?f.length+1:s.point.startSide<0?f.length:Math.min(f.length,c);l.point(r,h,s.point,f,d,s.pointRank),c=Math.min(s.openEnd(h),f.length)}else h>r&&(l.span(r,h,s.active,c),c=s.openEnd(h));if(s.to>n)return c+(s.point&&s.to>n?1:0);r=s.to,s.next()}}static of(e,t=!1){let n=new Oi;for(let l of e instanceof Xt?[e]:t?vh(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return ce.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=ce.empty;l=l.nextLayer)t=new ce(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}ce.empty=new ce([],[],null,-1);function vh(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let n=a[t];if(En(e,n)>0)return a.slice().sort(En);e=n}return a}ce.empty.nextLayer=ce.empty;class Oi{finishChunk(e){this.chunks.push(new On(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,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Oi)).add(e,t,n)}addInner(e,t,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(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ce.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function vo(a,e,t){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&&(t?t.mapPos(r):r)==o.chunkPos[s]&&!t?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class So{constructor(e,t,n,l=0){this.layer=e,this.skip=t,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,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,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],t,!0);(!n||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!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],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.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 Zt{constructor(e){this.heap=e}static from(e,t=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 So(s,t,n,o));return l.length==1?l[0]:new Zt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);(this.to-e||this.value.endSide-t)<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(),Mn(this.heap,0)}}}function Mn(a,e){for(let t=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++),t.compare(l)<0)break;a[n]=t,a[e]=l,e=n}}class ei{constructor(e,t,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=Zt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Mi(this.active,e),Mi(this.activeTo,e),Mi(this.activeRank,e),this.minActive=No(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:l,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Ti(this.active,t,n),Ti(this.activeTo,t,l),Ti(this.activeRank,t,o),e&&Ti(e,t,this.cursor.from),this.minActive=No(this.active,this.activeTo)}next(){let e=this.to,t=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&&Mi(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(t&&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 t=[];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)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Bo(a,e,t,n,l,o){a.goto(e),t.goto(n);let s=n+l,r=n,c=n-e;for(;;){let h=a.to+c-t.to,f=h||a.endSide-t.endSide,d=f<0?a.to+c:t.to,p=Math.min(d,s);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&Tn(a.activeForPoint(a.to),t.activeForPoint(t.to))||o.comparePoint(r,p,a.point,t.point):p>r&&!Tn(a.active,t.active)&&o.compareRange(r,p,a.active,t.active),d>s)break;(h||a.openEnd!=t.openEnd)&&o.boundChange&&o.boundChange(d),r=d,f<=0&&a.next(),f>=0&&t.next()}}function Tn(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function Mi(a,e){for(let t=e,n=a.length-1;t<n;t++)a[t]=a[t+1];a.pop()}function Ti(a,e,t){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=t}function No(a,e){let t=-1,n=1e9;for(let l=0;l<e.length;l++)(e[l]-n||a[l].endSide-a[t].endSide)<0&&(t=l,n=e[l]);return t}function Sh(a,e,t,n){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?t-o%t:1,l=Xe(a,l)}return n===!0?-1:a.length}const In="ͼ",Vo=typeof Symbol>"u"?"__"+In:Symbol.for(In),Fn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class dt{constructor(e,t){this.rules=[];let{finish:n}=t||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,h){let f=[],d=/^@(\w+)\b/.exec(s[0]),p=d&&d[1]=="keyframes";if(d&&r==null)return c.push(s[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(y=>s.map(A=>y.replace(/&/,A))).reduce((y,A)=>y.concat(A)),b,c);else if(b&&typeof b=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),b,f,p)}else b!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+b+";")}(f.length||p)&&c.push((n&&!d&&!h?s.map(n):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
19
- `)}static newName(){let e=Ro[Vo]||1;return Ro[Vo]=e+1,In+e.toString(36)}static mount(e,t,n){let l=e[Fn],o=n&&n.nonce;l?o&&l.setNonce(o):l=new Bh(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let Eo=new Map;class Bh{constructor(e,t){let n=e.ownerDocument||e,l=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=Eo.get(n);if(o)return e[Fn]=o;this.sheet=new l.CSSStyleSheet,Eo.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Fn]=this}mount(e,t){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 h=0;h<r.rules.length;h++)n.insertRule(r.rules[h],l++)}else{for(;o<c;)l+=this.modules[o++].rules.length;l+=r.rules.length,o++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.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=t.head||t;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 Et={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:"'"},Dn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},be=0;be<10;be++)Et[48+be]=Et[96+be]=String(be);for(var be=1;be<=24;be++)Et[be+111]="F"+be;for(var be=65;be<=90;be++)Et[be]=String.fromCharCode(be+32),Dn[be]=String.fromCharCode(be);for(var _n in Et)Dn.hasOwnProperty(_n)||(Dn[_n]=Et[_n]);function ti(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Pn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function Ii(a,e){if(!e.anchorNode)return!1;try{return Pn(a,e.anchorNode)}catch{return!1}}function ii(a){return a.nodeType==3?xt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ni(a,e,t,n){return t?Oo(a,e,t,n,-1)||Oo(a,e,t,n,1):!1}function At(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Fi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function Oo(a,e,t,n,l){for(;;){if(a==t&&e==n)return!0;if(e==(l<0?0:qe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=At(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?qe(a):0}else return!1}}function qe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Di(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function Nh(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 Mo(a,e){let t=e.width/a.offsetWidth,n=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-a.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function Vh(a,e,t,n,l,o,s,r){let c=a.ownerDocument,h=c.defaultView||window;for(let f=a,d=!1;f&&!d;)if(f.nodeType==1){let p,m=f==c.body,b=1,y=1;if(m)p=Nh(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(d=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let w=f.getBoundingClientRect();({scaleX:b,scaleY:y}=Mo(f,w)),p={left:w.left,right:w.left+f.clientWidth*b,top:w.top,bottom:w.top+f.clientHeight*y}}let A=0,x=0;if(l=="nearest")e.top<p.top?(x=e.top-(p.top+s),t>0&&e.bottom>p.bottom+x&&(x=e.bottom-p.bottom+s)):e.bottom>p.bottom&&(x=e.bottom-p.bottom+s,t<0&&e.top-x<p.top&&(x=e.top-(p.top+s)));else{let w=e.bottom-e.top,R=p.bottom-p.top;x=(l=="center"&&w<=R?e.top+w/2-R/2:l=="start"||l=="center"&&t<0?e.top-s:e.bottom-R+s)-p.top}if(n=="nearest"?e.left<p.left?(A=e.left-(p.left+o),t>0&&e.right>p.right+A&&(A=e.right-p.right+o)):e.right>p.right&&(A=e.right-p.right+o,t<0&&e.left<p.left+A&&(A=e.left-(p.left+o))):A=(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,A||x)if(m)h.scrollBy(A,x);else{let w=0,R=0;if(x){let k=f.scrollTop;f.scrollTop+=x/y,R=(f.scrollTop-k)*y}if(A){let k=f.scrollLeft;f.scrollLeft+=A/b,w=(f.scrollLeft-k)*b}e={left:e.left-w,top:e.top-R,right:e.right-w,bottom:e.bottom-R},w&&Math.abs(w-A)<1&&(n="nearest"),R&&Math.abs(R-x)<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)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Rh(a){let e=a.ownerDocument,t,n;for(let l=a.parentNode;l&&!(l==e.body||t&&n);)if(l.nodeType==1)!n&&l.scrollHeight>l.clientHeight&&(n=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:n}}class Eh{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:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?qe(t):0),n,Math.min(e.focusOffset,n?qe(n):0))}set(e,t,n,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=l}}let Ot=null;function To(a){if(a.setActive)return a.setActive();if(Ot)return a.focus(Ot);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;t<e.length;){let n=e[t++],l=e[t++],o=e[t++];n.scrollTop!=l&&(n.scrollTop=l),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let Io;function xt(a,e,t=e){let n=Io||(Io=document.createRange());return n.setEnd(a,t),n.setStart(a,e),n}function Mt(a,e,t,n){let l={key:e,code:e,keyCode:t,which:t,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 Oh(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Fo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function Mh(a,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,qe(t));;)if(n){if(t.nodeType!=1)return!1;let l=t.childNodes[n-1];l.contentEditable=="false"?n--:(t=l,n=qe(t))}else{if(t==a)return!0;n=At(t),t=t.parentNode}}function Do(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function _o(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=qe(t)}else if(t.parentNode&&!Fi(t))n=At(t),t=t.parentNode;else return null}}function Po(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Fi(t))n=At(t)+1,t=t.parentNode;else return null}}class Ce{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ce(e.parentNode,At(e),t)}static after(e,t){return new Ce(e.parentNode,At(e)+1,t)}}const $n=[];class oe{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 t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){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=oe.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,t),s.flags&=-8}if(o=l?l.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&o!=s.dom&&(t.written=!0),s.dom.parentNode==n)for(;o&&o!=s.dom;)o=$o(o);else n.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:n.firstChild,o&&t&&t.node==n&&(t.written=!0);o;)o=$o(o)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let l=qe(e)==0?0:t==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&&!oe.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,t,n=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,h=n,f=n;c<this.children.length;c++){let d=this.children[c],p=h+d.length;if(h<e&&p>t)return d.domBoundsAround(e,t,h);if(p>=e&&l==-1&&(l=c,o=h),h>t&&d.dom.parentNode==this.dom){s=c,r=f;break}f=p,h=p+d.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 t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.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 t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=$n){this.markDirty();for(let l=e;l<t;l++){let o=this.children[l];o.parent==this&&n.indexOf(o)<0&&o.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));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 Lo(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}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,t,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}}oe.prototype.breakAfter=0;function $o(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Lo{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>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 Uo(a,e,t,n,l,o,s,r,c){let{children:h}=a,f=h.length?h[e]:null,d=o.length?o[o.length-1]:null,p=d?d.breakAfter:s;if(!(e==n&&f&&!s&&!p&&o.length<2&&f.merge(t,l,o.length?d:null,t==0,r,c))){if(n<h.length){let m=h[n];m&&(l<m.length||m.breakAfter&&d?.breakAfter)?(e==n&&(m=m.split(l),l=0),!p&&d&&m.merge(0,l,d,!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&&(d?d.breakAfter=1:s=1),n++}for(f&&(f.breakAfter=s,t>0&&(!s&&o.length&&f.merge(t,f.length,o[0],!1,r,0)?f.breakAfter=o.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,r,0),e++));e<n&&o.length;)if(h[n-1].become(o[o.length-1]))n--,o.pop(),c=o.length?0:r;else if(h[e].become(o[0]))e++,o.shift(),r=o.length?0:c;else break;!o.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,r,c)&&e--,(e<n||o.length)&&a.replaceChildren(e,n,o)}}function zo(a,e,t,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(t,1),{i:h,off:f}=s.findPos(e,-1),d=e-t;for(let p of n)d+=p.length;a.length+=d,Uo(a,h,f,r,c,n,0,l,o)}let Ne=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ln=typeof document<"u"?document:{documentElement:{style:{}}};const Un=/Edge\/(\d+)/.exec(Ne.userAgent),jo=/MSIE \d/.test(Ne.userAgent),zn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),_i=!!(jo||zn||Un),qo=!_i&&/gecko\/(\d+)/i.test(Ne.userAgent),jn=!_i&&/Chrome\/(\d+)/.exec(Ne.userAgent),Qo="webkitFontSmoothing"in Ln.documentElement.style,Wo=!_i&&/Apple Computer/.test(Ne.vendor),Yo=Wo&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var W={mac:Yo||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:_i,ie_version:jo?Ln.documentMode||6:zn?+zn[1]:Un?+Un[1]:0,gecko:qo,gecko_version:qo?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Yo,android:/Android\b/.test(Ne.userAgent),webkit:Qo,safari:Wo,webkit_version:Qo?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:Ln.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Th=256;class _e extends oe{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof _e)||this.length-(t-e)+n.length>Th||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new _e(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ce(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Ih(this.dom,e,t)}}class tt extends oe{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let l of t)l.setParent(this)}setAttrs(e){if(Fo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);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,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,l,o,s){return n&&(!(n instanceof tt&&n.mark.eq(this.mark))||e&&o<=0||t<this.length&&s<=0)?!1:(zo(this,e,t,n?n.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let t=[],n=0,l=-1,o=0;for(let r of this.children){let c=n+r.length;c>e&&t.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 tt(this.mark,t,s)}domAtPos(e){return Ho(this,e)}coordsAt(e,t){return Go(this,e,t)}}function Ih(a,e,t){let n=a.nodeValue.length;e>n&&(e=n);let l=e,o=e,s=0;e==0&&t<0||e==n&&t>=0?W.chrome||W.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):t<0?l--:o<n&&o++;let r=xt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:t>=0)?0:r.length-1];return W.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,h=>h.width)||c),s?Di(c,s<0):c||null}class Ct extends oe{static create(e,t,n){return new Ct(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ct.create(this.widget,this.length-e,this.side);return this.length-=e,t}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,t,n,l,o,s){return n&&(!(n instanceof Ct)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Ct&&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 te.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,l=this.posAtStart;return n?n.slice(l,l+this.length):te.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);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 Di(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 Tt extends oe{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Tt&&e.side==this.side}split(){return new Tt(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?Ce.before(this.dom):Ce.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return te.empty}get isHidden(){return!0}}_e.prototype.children=Ct.prototype.children=Tt.prototype.children=$n;function Ho(a,e){let t=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==t)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==t)return s.domAtPos(s.length)}for(let o=l;o<n.length;o++){let s=n[o];if(s.dom.parentNode==t)return s.domAtPos(0)}return new Ce(t,0)}function Ko(a,e,t){let n,{children:l}=a;t>0&&e instanceof tt&&l.length&&(n=l[l.length-1])instanceof tt&&n.mark.eq(e.mark)?Ko(n,e.children[0],t-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Go(a,e,t){let n=null,l=-1,o=null,s=-1;function r(h,f){for(let d=0,p=0;d<h.children.length&&p<=f;d++){let m=h.children[d],b=p+m.length;b>=f&&(m.children.length?r(m,f-p):(!o||o.isHidden&&(t>0||Dh(o,m)))&&(b>f||p==b&&m.getSide()>0)?(o=m,s=f-p):(p<f||p==b&&m.getSide()<0&&!m.isHidden)&&(n=m,l=f-p)),p=b}}r(a,e);let c=(t<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),t):Fh(a)}function Fh(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=ii(e);return t[t.length-1]||null}function Dh(a,e){let t=a.coordsAt(0,1),n=e.coordsAt(0,1);return t&&n&&n.top<t.bottom}function qn(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const Jo=Object.create(null);function Pi(a,e,t){if(a==e)return!0;a||(a=Jo),e||(e=Jo);let n=Object.keys(a),l=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let o of n)if(o!=t&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Qn(a,e,t){let n=!1;if(e)for(let l in e)t&&l in t||(n=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(n=!0,l=="style"?a.style.cssText=t[l]:a.setAttribute(l,t[l]));return n}function _h(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let n=a.attributes[t];e[n.name]=n.value}return e}class Wn{eq(e){return!1}updateDOM(e,t){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,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Qe=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Qe||(Qe={}));class ve extends Rt{constructor(e,t,n,l){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=l}get heightRelevant(){return!1}static mark(e){return new li(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ht(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,l;if(e.isBlockGap)n=-5e8,l=4e8;else{let{start:o,end:s}=Xo(e,t);n=(o?t?-3e8:-1:5e8)-1,l=(s?t?2e8:1:-6e8)+1}return new ht(e,n,l,t,e.widget||null,!0)}static line(e){return new oi(e)}static set(e,t=!1){return ce.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ve.none=ce.empty;class li extends ve{constructor(e){let{start:t,end:n}=Xo(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof li&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Pi(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}li.prototype.point=!1;class oi extends ve{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof oi&&this.spec.class==e.spec.class&&Pi(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}oi.prototype.mapMode=Re.TrackBefore,oi.prototype.point=!0;class ht extends ve{constructor(e,t,n,l,o,s){super(t,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?t<=0?Re.TrackBefore:Re.TrackAfter:Re.TrackDel}get type(){return this.startSide!=this.endSide?Qe.WidgetRange:this.startSide<=0?Qe.WidgetBefore:Qe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ht&&Ph(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ht.prototype.point=!0;function Xo(a,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=a;return t==null&&(t=a.inclusive),n==null&&(n=a.inclusive),{start:t??e,end:n??e}}function Ph(a,e){return a==e||!!(a&&e&&a.compare(e))}function $i(a,e,t,n=0){let l=t.length-1;l>=0&&t[l]+n>=a?t[l]=Math.max(t[l],e):t.push(a,e)}class ue extends oe{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,l,o,s){if(n){if(!(n instanceof ue))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),zo(this,e,t,n?n.children.slice():[],o,s),!0}split(e){let t=new ue;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:l}=this.childPos(e);l&&(t.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++)t.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,t}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){Pi(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ko(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=qn(t,this.attrs||{})),n&&(this.attrs=qn({class:n},this.attrs||{}))}domAtPos(e){return Ho(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Fo(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&&(Qn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&oe.get(l)instanceof tt;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=oe.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!W.ios||!this.children.some(o=>o instanceof _e))){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,t;for(let n of this.children){if(!(n instanceof _e)||/[^ -~]/.test(n.text))return null;let l=ii(n.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Go(this,e,t);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 ue&&this.children.length==0&&e.children.length==0&&Pi(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,l=0;n<e.children.length;n++){let o=e.children[n],s=l+o.length;if(s>=t){if(o instanceof ue)return o;if(s>t)break}l=s+o.breakAfter}return null}}class it extends oe{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,l,o,s){return n&&(!(n instanceof it)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new it(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return $n}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):te.empty}domBoundsAround(){return null}become(e){return e instanceof it&&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,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof Yn?null:Di(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class Yn extends Wn{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 si{constructor(e,t,n,l){this.doc=e,this.pos=t,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=t}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 it&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ue),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Li(new Tt(-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 it)&&this.getLine()}buildText(e,t,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(t.slice(t.length-n)),this.getLine().append(Li(new _e(this.text.slice(this.textOff,this.textOff+l)),t),n),this.atCursorPos=!0,this.textOff+=l,e-=l,n=0}}span(e,t,n,l){this.buildText(t-e,n,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,n,l,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof ht){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(n instanceof ht)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new it(n.widget||It.block,r,n));else{let c=Ct.create(n.widget||It.inline,r,r?0:n.startSide),h=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<t||n.startSide>0),f=!c.isEditable&&(e<t||o>l.length||n.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(d.append(Li(new Tt(1),l),o),o=l.length+Math.max(0,o-l.length)),d.append(Li(c,l),o),this.atCursorPos=f,this.pendingBuffer=f?e<t||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=t),this.openStart<0&&(this.openStart=o)}static build(e,t,n,l,o){let s=new si(e,t,n,o);return s.openEnd=ce.spans(l,t,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Li(a,e){for(let t of e)a=new tt(t,[a],a.length);return a}class It extends Wn{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}}It.inline=new It("span"),It.block=new It("div");var ye=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(ye||(ye={}));const vt=ye.LTR,Hn=ye.RTL;function Zo(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const $h=Zo("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Lh=Zo("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Kn=Object.create(null),We=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Kn[e]=t,Kn[t]=-e}function es(a){return a<=247?$h[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Lh[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Uh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ft{get dir(){return this.level%2?Hn:vt}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=t&&r.to>=t){if(r.level==n)return s;(o<0||(l!=0?l<0?r.from<t:r.to>t:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ts(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let n=a[t],l=e[t];if(n.from!=l.from||n.to!=l.to||n.direction!=l.direction||!ts(n.inner,l.inner))return!1}return!0}const se=[];function zh(a,e,t,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:t,c=o?256:l;for(let h=s,f=c,d=c;h<r;h++){let p=es(a.charCodeAt(h));p==512?p=f:p==8&&d==4&&(p=16),se[h]=p==4?2:p,p&7&&(d=p),f=p}for(let h=s,f=c,d=c;h<r;h++){let p=se[h];if(p==128)h<r-1&&f==se[h+1]&&f&24?p=se[h]=f:se[h]=256;else if(p==64){let m=h+1;for(;m<r&&se[m]==64;)m++;let b=h&&f==8||m<t&&se[m]==8?d==1?1:8:256;for(let y=h;y<m;y++)se[y]=b;h=m-1}else p==8&&d==1&&(se[h]=1);f=p,p&7&&(d=p)}}}function jh(a,e,t,n,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=n.length;s++){let h=s?n[s-1].to:e,f=s<n.length?n[s].from:t;for(let d=h,p,m,b;d<f;d++)if(m=Kn[p=a.charCodeAt(d)])if(m<0){for(let y=r-3;y>=0;y-=3)if(We[y+1]==-m){let A=We[y+2],x=A&2?l:A&4?A&1?o:l:0;x&&(se[d]=se[We[y]]=x),r=y;break}}else{if(We.length==189)break;We[r++]=d,We[r++]=p,We[r++]=c}else if((b=se[d])==2||b==1){let y=b==l;c=y?0:1;for(let A=r-3;A>=0;A-=3){let x=We[A+2];if(x&2)break;if(y)We[A+2]|=2;else{if(x&4)break;We[A+2]|=4}}}}}function qh(a,e,t,n){for(let l=0,o=n;l<=t.length;l++){let s=l?t[l-1].to:a,r=l<t.length?t[l].from:e;for(let c=s;c<r;){let h=se[c];if(h==256){let f=c+1;for(;;)if(f==r){if(l==t.length)break;f=t[l++].to,r=l<t.length?t[l].from:e}else if(se[f]==256)f++;else break;let d=o==1,p=(f<e?se[f]:n)==1,m=d==p?d?1:2:n;for(let b=f,y=l,A=y?t[y-1].to:a;b>c;)b==A&&(b=t[--y].from,A=y?t[y-1].to:a),se[--b]=m;c=f}else o=h,c++}}}function Gn(a,e,t,n,l,o,s){let r=n%2?2:1;if(n%2==l%2)for(let c=e,h=0;c<t;){let f=!0,d=!1;if(h==o.length||c<o[h].from){let y=se[c];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h<o.length&&b==o[h].from){if(d)break e;let y=o[h];if(!f)for(let A=y.to,x=h+1;;){if(A==t)break e;if(x<o.length&&o[x].from==A)A=o[x++].to;else{if(se[A]==r)break e;break}}if(h++,p)p.push(y);else{y.from>c&&s.push(new ft(c,y.from,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.to}b=y.to}else{if(b==t||(f?se[b]!=r:se[b]==r))break;b++}p?Gn(a,c,b,n+1,l,p,s):c<b&&s.push(new ft(c,b,m)),c=b}else for(let c=t,h=o.length;c>e;){let f=!0,d=!1;if(!h||c>o[h-1].to){let y=se[c-1];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h&&b==o[h-1].to){if(d)break e;let y=o[--h];if(!f)for(let A=y.from,x=h;;){if(A==e)break e;if(x&&o[x-1].to==A)A=o[--x].from;else{if(se[A-1]==r)break e;break}}if(p)p.push(y);else{y.to<c&&s.push(new ft(y.to,c,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.from}b=y.from}else{if(b==e||(f?se[b-1]!=r:se[b-1]==r))break;b--}p?Gn(a,b,c,n+1,l,p,s):b<c&&s.push(new ft(b,c,m)),c=b}}function Jn(a,e,t,n,l,o,s){let r=e%2?2:1;zh(a,l,o,n,r),jh(a,l,o,n,r),qh(l,o,n,r),Gn(a,l,o,e,t,n,s)}function Qh(a,e,t){if(!a)return[new ft(0,0,e==Hn?1:0)];if(e==vt&&!t.length&&!Uh.test(a))return is(a.length);if(t.length)for(;a.length>se.length;)se[se.length]=256;let n=[],l=e==vt?0:1;return Jn(a,l,l,t,0,a.length,n),n}function is(a){return[new ft(0,a,0)]}let ns="";function Wh(a,e,t,n,l){var o;let s=n.head-a.from,r=ft.find(e,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),c=e[r],h=c.side(l,t);if(s==h){let p=r+=l?1:-1;if(p<0||p>=e.length)return null;c=e[r=p],s=c.side(!l,t),h=c.side(l,t)}let f=Xe(a.text,s,c.forward(l,t));(f<c.from||f>c.to)&&(f=h),ns=a.text.slice(Math.min(s,f),Math.max(s,f));let d=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return d&&f==h&&d.level+(l?0:1)<c.level?K.cursor(d.side(!l,t)+a.from,d.forward(l,t)?1:-1,d.level):K.cursor(f+a.from,c.forward(l,t)?-1:1,c.level)}function Yh(a,e,t){for(let n=e;n<t;n++){let l=es(a.charCodeAt(n));if(l==1)return vt;if(l==2||l==4)return Hn}return vt}const ls=J.define(),os=J.define(),ss=J.define(),as=J.define(),Xn=J.define(),rs=J.define(),cs=J.define(),Zn=J.define(),el=J.define(),ds=J.define({combine:a=>a.some(e=>e)}),Hh=J.define({combine:a=>a.some(e=>e)}),hs=J.define();class Ft{constructor(e,t="nearest",n="nearest",l=5,o=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Ft(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 Ft(K.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ui=me.define({map:(a,e)=>a.map(e)}),fs=me.define();function Ye(a,e,t){let n=a.facet(as);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const nt=J.define({combine:a=>a.length?a[0]:!0});let Kh=0;const Dt=J.define({combine(a){return a.filter((e,t)=>{for(let n=0;n<t;n++)if(a[n].plugin==e.plugin)return!1;return!0})}});class _t{constructor(e,t,n,l,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Dt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Dt.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=t||{};return new _t(Kh++,e,n,l,r=>{let c=[];return s&&c.push(ai.of(h=>{let f=h.plugin(r);return f?s(f):ve.none})),o&&c.push(o(r)),c})}static fromClass(e,t){return _t.define((n,l)=>new e(n,l),t)}}class tl{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 t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Ye(t.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(t){Ye(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Ye(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const us=J.define(),il=J.define(),ai=J.define(),ps=J.define(),nl=J.define(),ms=J.define();function gs(a,e){let t=a.state.facet(ms);if(!t.length)return t;let n=t.map(o=>o instanceof Function?o(a):o),l=[];return ce.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let h=o-e.from,f=s-e.from,d=l;for(let p=r.length-1;p>=0;p--,c--){let m=r[p].spec.bidiIsolate,b;if(m==null&&(m=Yh(e.text,h,f)),c>0&&d.length&&(b=d[d.length-1]).to==h&&b.direction==m)b.to=f,d=b.inner;else{let y={from:h,to:f,direction:m,inner:[]};d.push(y),d=y.inner}}}}),l}const ks=J.define();function bs(a){let e=0,t=0,n=0,l=0;for(let o of a.state.facet(ks)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(t=Math.max(t,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:t,top:n,bottom:l}}const ri=J.define();class Te{constructor(e,t,n,l){this.fromA=e,this.toA=t,this.fromB=n,this.toB=l}join(e){return new Te(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 t=e.length,n=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>n.toA)){if(l.toA<n.fromA)break;n=n.join(l),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.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],h=s-r,f=c?c.fromB:1e9;for(;o<t.length&&t[o]<f;){let d=t[o],p=t[o+1],m=Math.max(r,d),b=Math.min(f,p);if(m<=b&&new Te(m+h,b+h,m,b).addToSet(n),p>f)break;o+=2}if(!c)return n;new Te(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class zi{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ke.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 Te(o,s,r,c))),this.changedRanges=l}static create(e,t,n){return new zi(e,t,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 ys extends oe{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 ue],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Te(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:h,toA:f})=>f<this.minWidthFrom||h>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&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!nf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Jh(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;n=new Te(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,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=ef(s,r,e.changes);return n=Te.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,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,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 it&&s.widget instanceof Yn&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,t,n){let l=n?n.range.addToSet(e.slice()):e,o=this.childCursor(t);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:h,fromB:f,toB:d}=r,p,m,b,y;if(n&&n.range.fromB<d&&n.range.toB>f){let k=si.build(this.view.state.doc,f,n.range.fromB,this.decorations,this.dynamicDecorationMap),u=si.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,b=k.openStart,y=u.openEnd;let N=this.compositionView(n);u.breakAtStart?N.breakAfter=1:u.content.length&&N.merge(N.length,N.length,u.content[0],!1,u.openStart,0)&&(N.breakAfter=u.content[0].breakAfter,u.content.shift()),k.content.length&&N.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),p=k.content.concat(N).concat(u.content)}else({content:p,breakAtStart:m,openStart:b,openEnd:y}=si.build(this.view.state.doc,f,d,this.decorations,this.dynamicDecorationMap));let{i:A,off:x}=o.findPos(h,1),{i:w,off:R}=o.findPos(c,-1);Uo(this,w,R,A,x,p,m,b,y)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(fs)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new _e(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new tt(l,[t],t.length);let n=new ue;return n.append(t,0),n}fixCompositionDOM(e){let t=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=oe.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},n=this.childPos(e.range.fromB,1),l=this.children[n.i];t(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)n=l.childPos(n.off,1),l=l.children[n.i],t(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,t=!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(nt)||this.dom.tabIndex>-1)&&Ii(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(l||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?c:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Gh(c)){let d=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(d,c.node.childNodes[c.offset]||null)),c=h=new Ce(d,0),s=!0}let f=this.view.observer.selectionRange;(s||!f.focusNode||(!ni(c.node,c.offset,f.anchorNode,f.anchorOffset)||!ni(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(f.focusNode)&&tf(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=ti(this.view.root);if(d)if(r.empty){if(W.gecko){let p=Xh(c.node,c.offset);if(p&&p!=3){let m=(p==1?_o:Po)(c.node,c.offset);m&&(c=new Ce(m.node,m.offset))}}d.collapse(c.node,c.offset),r.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=r.bidiLevel)}else if(d.extend){d.collapse(c.node,c.offset);try{d.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();r.anchor>r.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ce(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Ce(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ni(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ti(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let s=ue.find(this,t.head);if(!s)return;let r=s.posAtStart;if(t.head==r||t.head==r+s.length)return;let c=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);n.collapse(f.node,f.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=t.from&&n.collapse(l,o)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let l=e.offset;!n&&l<t.childNodes.length;l++){let o=oe.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=oe.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(o.length))}return n?new Ce(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=oe.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){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,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(n<l.length||l instanceof ue)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){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,h=c-r.length;if(c<e)break;if(h<=e&&(h<e||r.covers(-1))&&(c>e||r.covers(1))&&(!n||r instanceof ue&&!(n instanceof ue&&t>=0)))n=r,l=h;else if(n&&h==e&&c==e&&r instanceof it&&Math.abs(t)<2){if(r.deco.startSide<0)break;s&&(n=null)}o=h}return n?n.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ue))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 _e))return null;let o=Xe(l.text,n);if(o==n)return null;let s=xt(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 t=[],{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==ye.LTR;for(let h=0,f=0;f<this.children.length;f++){let d=this.children[f],p=h+d.length;if(p>l)break;if(h>=n){let m=d.dom.getBoundingClientRect();if(t.push(m.height),s){let b=d.dom.lastChild,y=b?ii(b):[];if(y.length){let A=y[y.length-1],x=c?A.right-m.left:m.right-A.left;x>r&&(r=x,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=p)}}}h=p+d.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ye.RTL:ye.LTR}measureTextSize(){for(let o of this.children)if(o instanceof ue){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),t,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=ii(e.firstChild)[0];t=e.getBoundingClientRect().height,n=o?o.width/27:7,l=o?o.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Lo(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],s=o?o.from-1:this.length;if(s>n){let r=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ve.replace({widget:new Yn(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,t=this.view.state.facet(ai).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(ps).map((o,s)=>{let r=typeof o=="function";return r&&(n=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=n,t.push(ce.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(hs))try{if(h(this.view,e.range,e))return!0}catch(f){Ye(this.view.state,f,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!n)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.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=bs(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;Vh(this.view.scrollDOM,s,t.head<t.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==ye.LTR)}}function Gh(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 ws(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let n=_o(t.focusNode,t.focusOffset),l=Po(t.focusNode,t.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=oe.get(l.node);if(!r||r instanceof _e&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=oe.get(n.node);!c||c instanceof _e&&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 Jh(a,e,t){let n=ws(a,t);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,h=new Te(c.mapPos(o),c.mapPos(s),o,s),f=[];for(let d=l.parentNode;;d=d.parentNode){let p=oe.get(d);if(p instanceof tt)f.push({node:d,deco:p.mark});else{if(p instanceof ue||d.nodeName=="DIV"&&d.parentNode==a.contentDOM)return{range:h,text:l,marks:f,line:d};if(d!=a.contentDOM)f.push({node:d,deco:new li({inclusive:!0,attributes:_h(d),tagName:d.tagName.toLowerCase()})});else return null}}}function Xh(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 Zh=class{constructor(){this.changes=[]}compareRange(e,t){$i(e,t,this.changes)}comparePoint(e,t){$i(e,t,this.changes)}boundChange(e){$i(e,e,this.changes)}};function ef(a,e,t){let n=new Zh;return ce.compare(a,e,t,n),n.changes}function tf(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function nf(a,e){let t=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(t=!0)}),t}function lf(a,e,t=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return K.cursor(e);o==0?t=1:o==l.length&&(t=-1);let s=o,r=o;t<0?s=Xe(l.text,o,!1):r=Xe(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let h=Xe(l.text,s,!1);if(n(l.text.slice(h,s))!=c)break;s=h}for(;r<l.length;){let h=Xe(l.text,r);if(n(l.text.slice(r,h))!=c)break;r=h}return K.range(s+l.from,r+l.from)}function of(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function sf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ll(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function As(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function xs(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ol(a,e,t){let n,l,o,s,r=!1,c,h,f,d;for(let b=a.firstChild;b;b=b.nextSibling){let y=ii(b);for(let A=0;A<y.length;A++){let x=y[A];l&&ll(l,x)&&(x=As(xs(x,l.bottom),l.top));let w=of(e,x),R=sf(t,x);if(w==0&&R==0)return b.nodeType==3?Cs(b,e,t):ol(b,e,t);(!n||s>R||s==R&&o>w)&&(n=b,l=x,o=w,s=R,r=w?e<x.left?A>0:A<y.length-1:!0),w==0?t>x.bottom&&(!f||f.bottom<x.bottom)?(c=b,f=x):t<x.top&&(!d||d.top>x.top)&&(h=b,d=x):f&&ll(f,x)?f=xs(f,x.bottom):d&&ll(d,x)&&(d=As(d,x.top))}}if(f&&f.bottom>=t?(n=c,l=f):d&&d.top<=t&&(n=h,l=d),!n)return{node:a,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return Cs(n,p,t);if(r&&n.contentEditable!="false")return ol(n,p,t);let m=Array.prototype.indexOf.call(a.childNodes,n)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function Cs(a,e,t){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=xt(a,r,r+1).getClientRects();for(let h=0;h<c.length;h++){let f=c[h];if(f.top==f.bottom)continue;s||(s=e-f.left);let d=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&d<o){let p=e>=(f.left+f.right)/2,m=p;if((W.chrome||W.gecko)&&xt(a,r).getBoundingClientRect().left==f.right&&(m=!p),d<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=d}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function vs(a,e,t,n=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:h}=a.viewState,{x:f,y:d}=e,p=d-r;if(p<0)return 0;if(p>h)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,u=!1;c=a.elementAtHeight(p),c.type!=Qe.Text;)for(;p=n>0?c.bottom+k:c.top-k,!(p>=0&&p<=h);){if(u)return t?null:0;u=!0,n=-n}d=r+p;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:t?null:Ss(a,s,c,f,d);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:Ss(a,s,c,f,d);let b=a.dom.ownerDocument,y=a.root.elementFromPoint?a.root:b,A=y.elementFromPoint(f,d);A&&!a.contentDOM.contains(A)&&(A=null),A||(f=Math.max(s.left+1,Math.min(s.right-1,f)),A=y.elementFromPoint(f,d),A&&!a.contentDOM.contains(A)&&(A=null));let x,w=-1;if(A&&((l=a.docView.nearest(A))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(f,d);k&&({offsetNode:x,offset:w}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(f,d);k&&({startContainer:x,startOffset:w}=k,(!a.contentDOM.contains(x)||W.safari&&af(x,w,f)||W.chrome&&rf(x,w,f))&&(x=void 0))}x&&(w=Math.min(qe(x),w))}if(!x||!a.docView.dom.contains(x)){let k=ue.find(a.docView,m);if(!k)return p>c.top+c.height/2?c.to:c.from;({node:x,offset:w}=ol(k.dom,f,d))}let R=a.docView.nearest(x);if(!R)return null;if(R.isWidget&&((o=R.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=R.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?R.posAtStart:R.posAtEnd}else return R.localPosFromDOM(x,w)+R.posAtStart}function Ss(a,e,t,n,l){let o=Math.round((n-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-t.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(t.from,t.to);return t.from+Sh(s,o,a.state.tabSize)}function af(a,e,t){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 xt(a,n-1,n).getBoundingClientRect().right>t}function rf(a,e,t){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():xt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function cf(a,e,t){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==Qe.Text&&(l.type!=o.type||(t<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function df(a,e,t,n){let l=cf(a,e.head,e.assoc||-1),o=!n||l.type!=Qe.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:t==(r==ye.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return K.cursor(c,t?-1:1)}return K.cursor(t?l.to:l.from,t?-1:1)}function Bs(a,e,t,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 h=Wh(l,o,s,r,t),f=ns;if(!h){if(l.number==(t?a.state.doc.lines:1))return r;f=`
21
- `,l=a.state.doc.line(l.number+(t?1:-1)),o=a.bidiSpans(l),h=a.visualLineSide(l,!t)}if(c){if(!c(f))return r}else{if(!n)return h;c=n(f)}r=h}}function hf(a,e,t){let n=a.state.charCategorizer(e),l=n(t);return o=>{let s=n(o);return l==et.Space&&(l=s),l==s}}function ff(a,e,t,n){let l=e.head,o=t?1:-1;if(l==(t?a.state.doc.length:0))return K.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),h=a.coordsAtPos(l,e.assoc||-1),f=a.documentTop;if(h)s==null&&(s=h.left-c.left),r=o<0?h.top:h.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)+f}let d=c.left+s,p=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(p+m)*o,y=vs(a,{x:d,y:b},!1,o);if(b<c.top||b>c.bottom||(o<0?y<l:y>l)){let A=a.docView.coordsForChar(y),x=!A||b<A.top?-1:1;return K.cursor(y,x,void 0,s)}}}function ji(a,e,t){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||t||(e-o<s-e?-1:1);e=c<0?o:s,n=c}});if(!n)return e}}function sl(a,e,t){let n=ji(a.state.facet(nl).map(l=>l(a)),t.from,e.head>t.from?-1:1);return n==t.from?t:K.cursor(n,n<t.from?1:-1)}const ci="￿";class uf{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(le.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,t){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==t)break;let r=oe.get(l),c=oe.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:Fi(l))||Fi(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=l.exec(t))&&(o=r.index,s=r[0].length),this.append(t.slice(n,o<0?t.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 t=oe.get(e),n=t&&t.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,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(pf(e,n.node,n.offset)?t:0))}}function pf(a,e,t){for(;;){if(!e||t<qe(e))return!1;if(e==a)return!0;t=At(e)+1,e=e.parentNode}}class Ns{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class mf{constructor(e,t,n,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let r=o||s?[]:bf(e),c=new uf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=yf(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Pn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=s&&s.node==r.anchorNode&&s.offset==r.anchorOffset||!Pn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to<e.state.doc.length)){let d=Math.min(c,h),p=Math.max(c,h),m=f.from-d,b=f.to-p;(m==0||m==1||d==0)&&(b==0||b==-1||p==e.state.doc.length)&&(c=0,h=e.state.doc.length)}this.newSel=K.single(h,c)}}}function Vs(a,e){let t,{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,h=null;(o===8||W.android&&e.text.length<r-s)&&(c=l.to,h="end");let f=kf(a.state.doc.sliceString(s,r,ci),e.text,c-s,h);f&&(W.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ci+ci&&f.toB--,t={from:s+f.from,to:s+f.toA,insert:te.of(e.text.slice(f.from,f.toB).split(ci))})}else n&&(!a.hasFocus&&a.state.facet(nt)||n.main.eq(l))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!l.empty&&n&&n.main.empty?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(W.mac||W.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=K.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:te.of([t.insert.toString().replace("."," ")])}):t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,t.from).append(t.insert).append(a.state.doc.slice(t.to,l.to))}:W.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
22
- `&&a.lineWrapping&&(n&&(n=K.single(n.main.anchor-1,n.main.head-1)),t={from:l.from,to:l.to,insert:te.of([" "])}),t)return al(a,t,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 al(a,e,t,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&&Mt(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)&&Mt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Mt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=gf(a,e,t));return a.state.facet(rs).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function gf(a,e,t){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&&(!t||t.main.empty&&t.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=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let h=a.state.sliceDoc(e.from,e.to),f,d=t&&ws(a,t.main.head);if(d){let b=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-b}}else f=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 y=b.to-p,A=y-h.length;if(b.to-b.from!=m||a.state.sliceDoc(A,y)!=h||b.to>=f.from&&b.from<=f.to)return{range:b};let x=l.changes({from:A,to:y,insert:e.insert}),w=b.to-o.to;return{changes:x,range:c?K.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):b.map(x)}})}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 kf(a,e,t,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));t-=s+c-o}if(s<o&&a.length<e.length){let c=t<=o&&t>=s?o-t:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=t<=o&&t>=r?o-t:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function bf(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}=a.observer.selectionRange;return t&&(e.push(new Ns(t,n)),(l!=t||o!=n)&&e.push(new Ns(l,o))),e}function yf(a,e){if(a.length==0)return null;let t=a[0].pos,n=a.length==2?a[1].pos:t;return t>-1&&n>-1?K.single(t+e,n+e):null}class wf{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&&_f(e.contentDOM.ownerDocument)}handleEvent(e){!Rf(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,t){let n=this.handlers[e];if(n){for(let l of n.observers)l(this.view,t);for(let l of n.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Af(e),n=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let s=!t[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"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}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&&Cf.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 t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Es.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||xf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t: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 Rs(a,e){return(t,n)=>{try{return e.call(a,n,t)}catch(l){Ye(t.state,l)}}}function Af(a){let e=Object.create(null);function t(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&&t(r).handlers.push(Rs(n.value,c))}if(s)for(let r in s){let c=s[r];c&&t(r).observers.push(Rs(n.value,c))}}for(let n in Pe)t(n).handlers.push(Pe[n]);for(let n in Ie)t(n).observers.push(Ie[n]);return e}const Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xf="dthko",Cf=[16,17,18,20,91,92,224,225],qi=6;function Qi(a){return Math.max(0,a)*.7+8}function vf(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class Sf{constructor(e,t,n,l){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Rh(e.contentDOM),this.atoms=e.state.facet(nl).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=t.shiftKey,this.multiple=e.state.facet(le.allowMultipleSelections)&&Bf(e,t),this.dragging=Vf(e,t)&&$s(t)==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&&vf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=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=bs(this.view);e.clientX-c.left<=l+qi?t=-Qi(l-e.clientX):e.clientX+c.right>=s-qi&&(t=Qi(e.clientX-s)),e.clientY-c.top<=o+qi?n=-Qi(o-e.clientY):e.clientY+c.bottom>=r-qi&&(n=Qi(e.clientY-r)),this.setScrollSpeed(t,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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=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=K.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=K.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?K.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Bf(a,e){let t=a.state.facet(ls);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function Nf(a,e){let t=a.state.facet(os);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function Vf(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let n=ti(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 Rf(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=oe.get(t))&&n.ignoreEvent(e))return!1;return!0}const Pe=Object.create(null),Ie=Object.create(null),Os=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function Ef(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),Ms(a,t.value)},50)}function Wi(a,e,t){for(let n of a.facet(e))t=n(t,a);return t}function Ms(a,e){e=Wi(a.state,Zn,e);let{state:t}=a,n,l=1,o=t.toText(e),s=o.lines==t.selection.ranges.length;if(rl!=null&&t.selection.ranges.every(c=>c.empty)&&rl==o.toString()){let c=-1;n=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let d=t.toText((s?o.line(l++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:d},range:K.cursor(h.from+d.length)}})}else s?n=t.changeByRange(c=>{let h=o.line(l++);return{changes:{from:c.from,to:c.to,insert:h.text},range:K.cursor(c.from+h.length)}}):n=t.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ie.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Pe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Ie.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Ie.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Pe.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of a.state.facet(ss))if(t=n(a,e),t)break;if(!t&&e.button==0&&(t=Tf(a,e)),t){let n=!a.hasFocus;a.inputState.startMouseSelection(new Sf(a,e,t,n)),n&&a.observer.ignore(()=>{To(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 Ts(a,e,t,n){if(n==1)return K.cursor(e,t);if(n==2)return lf(a.state,e,t);{let l=ue.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++,K.range(s,r)}}let Is=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function Of(a,e,t,n){let l=ue.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&&Is(t,n,s))return-1;let r=l.coordsAt(o,1);return r&&Is(t,n,r)?1:s&&s.bottom>=n?-1:1}function Fs(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Of(a,t,e.clientX,e.clientY)}}const Mf=W.ie&&W.ie_version<=11;let Ds=null,_s=0,Ps=0;function $s(a){if(!Mf)return a.detail;let e=Ds,t=Ps;return Ds=a,Ps=Date.now(),_s=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(_s+1)%3:1}function Tf(a,e){let t=Fs(a,e),n=$s(e),l=a.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,s,r){let c=Fs(a,o),h,f=Ts(a,c.pos,c.bias,n);if(t.pos!=c.pos&&!s){let d=Ts(a,t.pos,t.bias,n),p=Math.min(d.from,f.from),m=Math.max(d.to,f.to);f=p<f.from?K.range(p,m):K.range(m,p)}return s?l.replaceRange(l.main.extend(f.from,f.to)):r&&n==1&&l.ranges.length>1&&(h=If(l,c.pos))?h:r?l.addRange(f):K.create([f])}}}function If(a,e){for(let t=0;t<a.ranges.length;t++){let{from:n,to:l}=a.ranges[t];if(n<=e&&l>=e)return K.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}Pe.dragstart=(a,e)=>{let{selection:{main:t}}=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>=t.to||s<=t.from)&&(t=K.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wi(a.state,el,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Pe.dragend=a=>(a.inputState.draggedContent=null,!1);function Ls(a,e,t,n){if(t=Wi(a.state,Zn,t),!t)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&Nf(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:t},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}Pe.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),l=0,o=()=>{++l==t.length&&Ls(a,e,n.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<t.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(t[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ls(a,e,n,!0),!0}return!1},Pe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=Os?null:e.clipboardData;return t?(Ms(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Ef(a),!1)};function Ff(a,e){let t=a.dom.parentNode;if(!t)return;let n=t.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 Df(a){let e=[],t=[],n=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),t.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),t.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}n=!0}return{text:Wi(a,el,e.join(a.lineBreak)),ranges:t,linewise:n}}let rl=null;Pe.copy=Pe.cut=(a,e)=>{let{text:t,ranges:n,linewise:l}=Df(a.state);if(!t&&!l)return!1;rl=l?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Os?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(Ff(a,t),!1)};const Us=Nt.define();function zs(a,e){let t=[];for(let n of a.facet(cs)){let l=n(a,e);l&&t.push(l)}return t.length?a.update({effects:t,annotations:Us.of(!0)}):null}function js(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=zs(a.state,e);t?a.dispatch(t):a.update([])}},10)}Ie.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),js(a)},Ie.blur=a=>{a.observer.clearSelectionRange(),js(a)},Ie.compositionstart=Ie.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Ie.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))},Ie.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Pe.beforeinput=(a,e)=>{var t,n;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),h=a.posAtDOM(r.endContainer,r.endOffset);return al(a,{from:c,to:h,insert:a.state.toText(o)},null),!0}}let l;if(W.chrome&&W.android&&(l=Es.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(()=>Ie.compositionend(a,e),20),!1};const qs=new Set;function _f(a){qs.has(a)||(qs.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Qs=["pre-wrap","normal","pre-line","break-spaces"];let Pt=!1;function Ws(){Pt=!1}class Pf{constructor(e){this.lineWrapping=e,this.doc=te.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-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 Qs.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let l=e[n];l<0?n++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,n,l,o,s){let r=Qs.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=n,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let h=0;h<s.length;h++){let f=s[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return c}}class $f{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class He{constructor(e,t,n,l,o){this.from=e,this.length=t,this.top=n,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Qe.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 ht?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new He(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var de=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(de||(de={}));const Yi=.001;class Se{constructor(e,t,n=2){this.length=e,this.height=t,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)>Yi&&(Pt=!0),this.height=e)}replace(e,t,n){return Se.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,l){let o=this,s=n.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:h,fromB:f,toB:d}=l[r],p=o.lineAt(c,de.ByPosNoHeight,n.setDoc(t),0,0),m=p.to>=h?p:o.lineAt(h,de.ByPosNoHeight,n,0,0);for(d+=m.to-h,h=m.to;r>0&&p.from<=l[r-1].toA;)c=l[r-1].fromA,f=l[r-1].fromB,r--,c<p.from&&(p=o.lineAt(c,de.ByPosNoHeight,n,0,0));f+=p.from-c,c=p.from;let b=cl.build(n.setDoc(s),e,f,d);o=Hi(o,o.replace(c,h,b))}return o.updateHeight(n,0)}static empty(){return new Ee(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,l=0,o=0;for(;;)if(t==n)if(l>o*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,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[t++];r&&(l+=r.size)}else{let r=e[--n];r&&(o+=r.size)}let s=0;return e[t-1]==null?(s=1,t--):e[t]==null&&(s=1,n++),new Lf(Se.of(e.slice(0,t)),s,Se.of(e.slice(n)))}}function Hi(a,e){return a==e?a:(a.constructor!=e.constructor&&(Pt=!0),e)}Se.prototype.size=1;class Ys extends Se{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,l,o){return this.blockAt(0,n,l,o)}forEachLine(e,t,n,l,o,s){e<=o+this.length&&t>=o&&s(this.blockAt(0,n,l,o))}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ee extends Ys{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.breaks)}replace(e,t,n){let l=n[0];return n.length==1&&(l instanceof Ee||l instanceof we&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof we?l=new Ee(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Se.of(n)}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&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 we extends Se{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,l=e.doc.lineAt(t+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,t,n,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),f=t.doc.lineAt(h),d=r+f.length*c,p=Math.max(n,e-d/2);return new He(f.from,f.length,p,d,0)}else{let h=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:f,length:d}=t.doc.line(o+h);return new He(f,d,n+r*h,r,0)}}lineAt(e,t,n,l,o){if(t==de.ByHeight)return this.blockAt(e,n,l,o);if(t==de.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new He(m,b-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),h=n.doc.lineAt(e),f=r+h.length*c,d=h.number-s,p=l+r*d+c*(h.from-o-d);return new He(h.from,h.length,Math.max(l,Math.min(p,l+this.height-f)),f,0)}forEachLine(e,t,n,l,o,s){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:r,perLine:c,perChar:h}=this.heightMetrics(n,o);for(let f=e,d=l;f<=t;){let p=n.doc.lineAt(f);if(f==e){let b=p.number-r;d+=c*b+h*(e-o-b)}let m=c+h*p.length;s(new He(p.from,p.length,d,m,0)),d+=m,f=p.to+1}}replace(e,t,n){let l=this.length-t;if(l>0){let o=n[n.length-1];o instanceof we?n[n.length-1]=new we(o.length+l):n.push(null,new we(l-1))}if(e>0){let o=n[0];o instanceof we?n[0]=new we(e+o.length):n.unshift(new we(e-1),null)}return Se.of(n)}decomposeLeft(e,t){t.push(new we(e-1),null)}decomposeRight(e,t){t.push(null,new we(this.length-e-1))}updateHeight(e,t=0,n=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let s=[],r=Math.max(t,l.from),c=-1;for(l.from>t&&s.push(new we(l.from-t-1).updateHeight(e,t));r<=o&&l.more;){let f=e.doc.lineAt(r).length;s.length&&s.push(null);let d=l.heights[l.index++];c==-1?c=d:Math.abs(d-c)>=Yi&&(c=-2);let p=new Ee(f,d);p.outdated=!1,s.push(p),r+=f+1}r<=o&&s.push(null,new we(o-r).updateHeight(e,r));let h=Se.of(s);return(c<0||Math.abs(h.height-this.height)>=Yi||Math.abs(c-this.heightMetrics(e,t).perLine)>=Yi)&&(Pt=!0),Hi(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Lf extends Se{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(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,t,n,l){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,l):this.right.blockAt(e,t,o,l+this.left.length+this.break)}lineAt(e,t,n,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=t==de.ByHeight?e<s:e<r,h=c?this.left.lineAt(e,t,n,l,o):this.right.lineAt(e,t,n,s,r);if(this.break||(c?h.to<r:h.from>r))return h;let f=t==de.ByPosNoHeight?de.ByPosNoHeight:de.ByPos;return c?h.join(this.right.lineAt(r,f,n,s,r)):this.left.lineAt(r,f,n,l,o).join(h)}forEachLine(e,t,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,t,n,l,o,s),t>=c&&this.right.forEachLine(e,t,n,r,c,s);else{let h=this.lineAt(c,de.ByPos,n,l,o);e<h.from&&this.left.forEachLine(e,h.from-1,n,l,o,s),h.to>=e&&h.from<=t&&s(h),t>h.to&&this.right.forEachLine(h.to+1,t,n,r,c,s)}}replace(e,t,n){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-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&&Hs(o,s-1),t<this.length){let r=o.length;this.decomposeRight(t,o),Hs(o,r)}return Se.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,l=n+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Se.of(this.break?[e,null,t]:[e,t]):(this.left=Hi(this.left,e),this.right=Hi(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,l){let{left:o,right:s}=this,r=t+o.length+this.break,c=null;return l&&l.from<=t+o.length&&l.more?c=o=o.updateHeight(e,t,n,l):o.updateHeight(e,t,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 Hs(a,e){let t,n;a[e]==null&&(t=a[e-1])instanceof we&&(n=a[e+1])instanceof we&&a.splice(e-1,3,new we(t.length+1+n.length))}const Uf=5;class cl{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ee?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ee(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||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=t-e;n.block?this.addBlock(new Ys(s,l,n)):(s||o||l>=Uf)&&this.addLineDeco(l,o,s)}else t>e&&this.span(e,t);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:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,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 Ee(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new we(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ee)return e;let t=new Ee(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let l=this.ensureLine();l.length+=n,l.collapsed+=n,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ee)&&!this.isCovered?this.nodes.push(new Ee(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let l of this.nodes)l instanceof Ee&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,t,n,l){let o=new cl(n,e);return ce.spans(t,n,l,o,0),o.finish(n)}}function zf(a,e,t){let n=new jf;return ce.compare(a,e,t,n,0),n.changes}class jf{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,l){(e<t||n&&n.heightRelevant||l&&l.heightRelevant)&&$i(e,t,this.changes,5)}}function qf(a,e){let t=a.getBoundingClientRect(),n=a.ownerDocument,l=n.defaultView||window,o=Math.max(0,t.left),s=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),c=Math.min(l.innerHeight,t.bottom);for(let h=a.parentNode;h&&h!=n.body;)if(h.nodeType==1){let f=h,d=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&d.overflow!="visible"){let p=f.getBoundingClientRect();o=Math.max(o,p.left),s=Math.min(s,p.right),r=Math.max(r,p.top),c=Math.min(h==a.parentNode?l.innerHeight:c,p.bottom)}h=d.position=="absolute"||d.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:o-t.left,right:Math.max(o,s)-t.left,top:r-(t.top+e),bottom:Math.max(r,c)-(t.top+e)}}function Qf(a){let e=a.getBoundingClientRect(),t=a.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Wf(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class dl{constructor(e,t,n,l){this.from=e,this.to=t,this.size=n,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let l=e[n],o=t[n];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,t){return ve.replace({widget:new Yf(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Yf extends Wn{constructor(e,t){super(),this.size=e,this.vertical=t}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 Ks{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=Gs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ye.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(il).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Pf(t),this.stateDeco=e.facet(ai).filter(n=>typeof n!="function"),this.heightMap=Se.empty().applyChanges(this.stateDeco,te.empty,this.heightOracle.setDoc(e.doc),[new Te(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:t}=this.state.selection;for(let n=0;n<=1;n++){let l=n?t.head:t.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new Ki(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?Gs:new hl(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(di(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ai).filter(f=>typeof f!="function");let l=e.changedRanges,o=Te.extendWithRanges(l,zf(n,this.stateDeco,e?e.changes:ke.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ws(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Pt)&&(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;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!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),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Hh)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ye.RTL:ye.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=t.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,f=0;if(r.width&&r.height){let{scaleX:k,scaleY:u}=Mo(t,r);(k>.005&&Math.abs(this.scaleX-k)>.005||u>.005&&Math.abs(this.scaleY-u)>.005)&&(this.scaleX=k,this.scaleY=u,h|=16,s=c=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=p)&&(this.paddingTop=d,this.paddingBottom=p,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Do(e.scrollDOM);let b=(this.printing?Wf:qf)(t,this.paddingTop),y=b.top-this.pixelViewport.top,A=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&!Qf(e.dom))return 0;let w=r.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(w-this.contentDOMWidth)>l.charWidth){let{lineHeight:u,charWidth:N,textHeight:M}=e.docView.measureTextSize();s=u>0&&l.refresh(o,u,N,M,Math.max(5,w/N),k),s&&(e.docView.minWidth=0,h|=16)}y>0&&A>0?f=Math.max(y,A):y<0&&A<0&&(f=Math.min(y,A)),Ws();for(let u of this.viewports){let N=u.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(u);this.heightMap=(s?Se.empty().applyChanges(this.stateDeco,te.empty,this.heightOracle,[new Te(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new $f(u.from,N))}Pt&&(h|=2)}let R=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){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 Ki(l.lineAt(s-n*1e3,de.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,de.ByHeight,o,0,0).to);if(t){let{head:h}=t.range;if(h<c.from||h>c.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=l.lineAt(h,de.ByPos,o,0,0),p;t.y=="center"?p=(d.top+d.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<c.from?p=d.top:p=d.bottom-f,c=new Ki(l.lineAt(p-1e3/2,de.ByHeight,o,0,0).from,l.lineAt(p+f+1e3/2,de.ByHeight,o,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Ki(this.heightMap.lineAt(n,de.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,de.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,de.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=r+Math.max(10,Math.min(n,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let l of e)t.touchesRange(l.from,l.to)||n.push(new dl(t.mapPos(l.from),t.mapPos(l.to),l.size,l.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,l=n?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=ye.LTR&&!n)return[];let r=[],c=(f,d,p,m)=>{if(d-f<o)return;let b=this.state.selection.main,y=[b.from];b.empty||y.push(b.to);for(let x of y)if(x>f&&x<d){c(f,x-10,p,m),c(x+10,d,p,m);return}let A=Kf(e,x=>x.from>=p.from&&x.to<=p.to&&Math.abs(x.from-f)<o&&Math.abs(x.to-d)<o&&!y.some(w=>x.from<w&&x.to>w));if(!A){if(d<p.to&&t&&n&&t.visibleRanges.some(R=>R.from<=d&&R.to>=d)){let R=t.moveToLineBoundary(K.cursor(d),!1,!0).head;R>f&&(d=R)}let x=this.gapSize(p,f,d,m),w=n||x<2e6?x:2e6;A=new dl(f,d,x,w)}r.push(A)},h=f=>{if(f.length<s||f.type!=Qe.Text)return;let d=Hf(f.from,f.to,this.stateDeco);if(d.total<s)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let y=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,A,x;if(p!=null){let w=Ji(d,p),R=((this.visibleBottom-this.visibleTop)/2+y)/f.height;A=w-R,x=w+R}else A=(this.visibleTop-f.top-y)/f.height,x=(this.visibleBottom-f.top+y)/f.height;m=Gi(d,A),b=Gi(d,x)}else{let y=d.total*this.heightOracle.charWidth,A=l*this.heightOracle.charWidth,x=0;if(y>2e6)for(let N of e)N.from>=f.from&&N.from<f.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=N.size-N.displaySize);let w=this.pixelViewport.left+x,R=this.pixelViewport.right+x,k,u;if(p!=null){let N=Ji(d,p),M=((R-w)/2+A)/y;k=N-M,u=N+M}else k=(w-A)/y,u=(R+A)/y;m=Gi(d,k),b=Gi(d,u)}m>f.from&&c(f.from,m,f,d),b<f.to&&c(b,f.to,f,d)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return r}gapSize(e,t,n,l){let o=Ji(l,n)-Ji(l,t);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){dl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ve.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];ce.spans(t,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(t=>t.from<=e&&t.to>=e)||di(this.heightMap.lineAt(e,de.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(t=>t.top<=e&&t.bottom>=e)||di(this.heightMap.lineAt(this.scaler.fromDOM(e),de.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return di(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 Ki{constructor(e,t){this.from=e,this.to=t}}function Hf(a,e,t){let n=[],l=a,o=0;return ce.spans(t,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 Gi({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(a*t);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(n<=r)return o+n;n-=r}}function Ji(a,e){let t=0;for(let{from:n,to:l}of a.ranges){if(e<=l){t+=e-n;break}t+=l-n}return t/a.total}function Kf(a,e){for(let t of a)if(e(t))return t}const Gs={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class hl{constructor(e,t,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let h=t.lineAt(r,de.ByPos,e,0,0).top,f=t.lineAt(c,de.ByPos,e,0,0).bottom;return l+=f-h,{from:r,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.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 t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]: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 t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]: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 hl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function di(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),n=e.toDOM(a.bottom);return new He(a.from,a.length,t,n-t,Array.isArray(a._content)?a._content.map(l=>di(l,e)):a._content)}const Xi=J.define({combine:a=>a.join(" ")}),fl=J.define({combine:a=>a.indexOf(!0)>-1}),ul=dt.newName(),Js=dt.newName(),Xs=dt.newName(),Zs={"&light":"."+Js,"&dark":"."+Xs};function pl(a,e,t){return new dt(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,l=>{if(l=="&")return a;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):a+" "+n}})}const Gf=pl("."+ul,{"&":{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"}},Zs),Jf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ml=W.ie&&W.ie_version<=11;class Xf{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Eh,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(t=>{for(let n of t)this.queue.push(n);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.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 eu(e),e.state.facet(nt)&&(e.contentDOM.editContext=this.editContext.editContext)),ml&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.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(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,l=this.selectionRange;if(n.state.facet(nt)?n.root.activeElement!=this.dom:!Ii(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!n.state.selection.main.empty&&l.focusNode&&ni(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ti(e.root);if(!t)return!1;let n=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Zf(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let l=Ii(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mh(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)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,Jf),ml&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ml&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){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&&Mt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 t=-1,n=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),t==-1?{from:t,to:n}=s:(t=Math.min(s.from,t),n=Math.max(s.to,n)))}return{from:t,to:n,typeOver:l}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),l=this.selectionChanged&&Ii(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 mf(this.view,e,t,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 t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,l=Vs(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=ea(t,e.previousSibling||e.target.previousSibling,-1),l=ea(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.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(nt)!=e.state.facet(nt)&&(e.view.contentDOM.editContext=e.state.facet(nt)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.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 ea(a,e,t){for(;e;){let n=oe.get(e);if(n&&n.parent==a)return n;let l=e.parentNode;e=l!=a.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function ta(a,e){let t=e.startContainer,n=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return ni(s.node,s.offset,l,o)&&([t,n,l,o]=[l,o,t,n]),{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}}function Zf(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ta(a,l)}let t=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",n,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",n,!0),t?ta(a,t):null}class eu{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=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 h={from:r,to:c,insert:te.of(n.text.split(`
23
- `))};if(h.from==this.from&&o<this.from?h.from=o:h.to==this.to&&o>this.to&&(h.to=o),h.from==h.to&&!h.insert.length){let f=K.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));f.main.eq(l)||e.dispatch({selection:f,userEvent:"select"});return}if((W.mac||W.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:r,to:c,insert:te.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);al(e,h,K.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}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)}t.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),h=this.toEditorPos(o.rangeEnd);if(c<h){let f=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(ve.mark({attributes:{style:f}}).range(c,h))}}}e.dispatch({effects:fs.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)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let l=ti(n.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,h)=>{if(n)return;let f=h.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(o+=t,s+=t,s<=this.from)this.from+=f,this.to+=f;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),h.toString()),this.to+=f}t+=f}),l&&!n&&this.revertPending(e.state),!n}update(e){let t=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||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+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 t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(n,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ne{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 t;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||Oh(e.parent)||document,this.viewState=new Ks(e.state||le.create(e)),e.scrollTo&&e.scrollTo.is(Ui)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Dt).map(l=>new tl(l));for(let l of this.plugins)l.update(this);this.observer=new Xf(this),this.inputState=new wf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ys(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof xe?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!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(Us))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=zs(o,s),c||(r=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(f=null)):this.observer.clear(),o.facet(le.phrases)!=this.state.facet(le.phrases))return this.setState(o);l=zi.create(this,o,e),l.flags|=r;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(d&&(d=d.map(p.changes)),p.scrollIntoView){let{main:m}=p.state.selection;d=new Ft(m.empty?m:K.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of p.effects)m.is(Ui)&&(d=m.value.clip(this.state))}this.viewState.update(l,d),this.bidiCache=Zi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(ri)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(p=>p.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Xi)!=l.state.facet(Xi)&&(this.viewState.mustMeasureContent=!0),(t||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(Xn))try{p(l)}catch(m){Ye(this.state,m,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!Vs(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.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 t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Ks(e),this.plugins=e.facet(Dt).map(n=>new tl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new ys(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Dt),n=e.state.facet(Dt);if(t!=n){let l=[];for(let o of n){let s=t.indexOf(o);if(s<0)l.push(new tl(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);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Ye(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 t=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(Do(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 h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(m=>{try{return m.read(this)}catch(b){return Ye(this.state,b),ia}}),d=zi.create(this,this.state,[]),p=!1;d.flags|=c,t?t.flags|=c:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d),p&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(f[m]!=ia)try{let b=h[m];b.write&&b.write(f[m],this)}catch(b){Ye(this.state,b)}if(p&&this.docView.updateSelection(!0),!d.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(t&&!t.empty)for(let r of this.state.facet(Xn))r(t)}get themeClasses(){return ul+" "+(this.state.facet(fl)?Xs:Js)+" "+this.state.facet(Xi)}updateAttrs(){let e=na(this,us,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nt)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),na(this,il,t);let n=this.observer.ignore(()=>{let l=Qn(this.contentDOM,this.contentAttrs,t),o=Qn(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let l of n.effects)if(l.is(ne.announce)){t&&(this.announceDOM.textContent=""),t=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(ri);let e=this.state.facet(ne.cspNonce);dt.mount(this.root,this.styleModules.concat(Gf).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 t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.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,t,n){return sl(this,e,Bs(this,e,t,n))}moveByGroup(e,t){return sl(this,e,Bs(this,e,t,n=>hf(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return K.cursor(o.side(t,l)+e.from,o.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,n=!0){return df(this,e,t,n)}moveVertically(e,t,n){return sl(this,e,ff(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),vs(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[ft.find(o,e-l.from,-1,t)];return Di(n,s.dir==ye.LTR==t>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(ds)||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>tu)return is(e.length);let t=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||ts(o.isolates,n=gs(this,e))))return o.order;n||(n=gs(this,e));let l=Qh(e.text,t,n);return this.bidiCache.push(new Zi(e.from,e.to,t,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(()=>{To(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,t={}){return Ui.of(new Ft(typeof e=="number"?K.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ui.of(new Ft(K.cursor(n.from),"start","start",n.top-e,t,!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 _t.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return _t.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=dt.newName(),l=[Xi.of(n),ri.of(pl(`.${n}`,e))];return t&&t.dark&&l.push(fl.of(!0)),l}static baseTheme(e){return uh.lowest(ri.of(pl("."+ul,e,Zs)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),l=n&&oe.get(n)||oe.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ne.styleModule=ri,ne.inputHandler=rs,ne.clipboardInputFilter=Zn,ne.clipboardOutputFilter=el,ne.scrollHandler=hs,ne.focusChangeEffect=cs,ne.perLineTextDirection=ds,ne.exceptionSink=as,ne.updateListener=Xn,ne.editable=nt,ne.mouseSelectionStyle=ss,ne.dragMovesSelection=os,ne.clickAddsSelectionRange=ls,ne.decorations=ai,ne.outerDecorations=ps,ne.atomicRanges=nl,ne.bidiIsolatedRanges=ms,ne.scrollMargins=ks,ne.darkTheme=fl,ne.cspNonce=J.define({combine:a=>a.length?a[0]:""}),ne.contentAttributes=il,ne.editorAttributes=us,ne.lineWrapping=ne.contentAttributes.of({class:"cm-lineWrapping"}),ne.announce=me.define();const tu=4096,ia={};class Zi{constructor(e,t,n,l,o,s){this.from=e,this.to=t,this.dir=n,this.isolates=l,this.fresh=o,this.order=s}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let n=[],l=e.length?e[e.length-1].dir:ye.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!t.touchesRange(s.from,s.to)&&n.push(new Zi(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function na(a,e,t){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&&qn(s,t)}return t}class $t extends Rt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}$t.prototype.elementClass="",$t.prototype.toDOM=void 0,$t.prototype.mapMode=Re.TrackBefore,$t.prototype.startSide=$t.prototype.endSide=-1,$t.prototype.point=!0;var gl;const Lt=new ie;function iu(a){return J.define({combine:a?e=>e.concat(a):void 0})}const nu=new ie;class $e{constructor(e,t,n=[],l=""){this.data=e,this.name=l,le.prototype.hasOwnProperty("tree")||Object.defineProperty(le.prototype,"tree",{get(){return kl(this)}}),this.parser=t,this.extension=[zt.of(this),le.languageData.of((o,s,r)=>{let c=la(o,s,r),h=c.type.prop(Lt);if(!h)return[];let f=o.facet(h),d=c.type.prop(nu);if(d){let p=c.resolve(s-c.from,r);for(let m of d)if(m.test(p,o)){let b=o.facet(m.facet);return m.type=="replace"?b:b.concat(f)}}return f})].concat(n)}isActiveAt(e,t,n=-1){return la(e,t,n).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(zt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],l=(o,s)=>{if(o.prop(Lt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(ie.mounted);if(r){if(r.tree.prop(Lt)==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 h=o.children[c];h instanceof fe&&l(h,o.positions[c]+s)}};return l(kl(e),0),n}get allowsNesting(){return!0}}$e.setState=me.define();function la(a,e,t){let n=a.facet(zt),l=kl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,t,ge.ExcludeBuffers))o.type.isTop&&(l=o);return l}class en extends $e{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=iu(e.languageData);return new en(t,e.parser.configure({props:[Lt.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new en(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kl(a){let e=a.field($e.state,!1);return e?e.tree:fe.empty}class lu{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,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let hi=null;class tn{constructor(e,t,n=[],l,o,s,r,c){this.parser=e,this.state=t,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,t,n){return new tn(e,t,[],fe.empty,0,n,[],null)}startParse(){return this.parser.startParse(new lu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=fe.empty&&this.isDone(t??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()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(gt.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<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(gt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hi;hi=this;try{return e()}finally{hi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=oa(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,d,p)=>c.push({fromA:h,toA:f,fromB:d,toB:p})),n=gt.applyChanges(n,c),l=fe.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);f<d&&r.push({from:f,to:d})}}}return new tn(this.parser,t,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 t=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=oa(this.fragments,l,o),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ql{createParse(t,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=hi;if(c){for(let h of l)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=s,new fe(Be.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return hi}}function oa(a,e,t){return gt.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ut{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=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),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ut(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=tn.create(e.facet(zt).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ut(n)}}$e.state=yt.define({create:Ut.init,update(a,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(zt)!=e.state.facet(zt)?Ut.init(e.state):a.apply(e)}});let sa=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(sa=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const bl=typeof navigator<"u"&&(!((gl=navigator.scheduling)===null||gl===void 0)&&gl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ou=_t.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 t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=sa(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:l}}=this.view,o=n.field($e.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()-t,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new Ut(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(t=>Ye(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zt=J.define({combine(a){return a.length?a[0]:null},enables:a=>[$e.state,ou,ne.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class su{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const au=new ie;function aa({except:a,units:e=1}={}){return t=>{let n=a&&a.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const ru=new ie;function cu(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}class yl{constructor(e,t){this.specs=e;let n;function l(r){let c=dt.newName();return(n||(n=Object.create(null)))["."+c]=r,c}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,s=t.scope;this.scope=s instanceof $e?r=>r.prop(Lt)==s.data:s?r=>r==s:void 0,this.style=Xl(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new dt(n):null,this.themeType=t.themeType}static define(e,t){return new yl(e,t||{})}}z.meta,z.link,z.heading,z.emphasis,z.strong,z.strikethrough,z.keyword,z.atom,z.bool,z.url,z.contentSeparator,z.labelName,z.literal,z.inserted,z.string,z.deleted,z.regexp,z.escape,z.string,z.variableName,z.variableName,z.typeName,z.namespace,z.className,z.variableName,z.macroName,z.propertyName,z.comment,z.invalid;const du=Object.create(null),ra=[Be.none],ca=[],da=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]=fu(du,e);function wl(a,e){ca.indexOf(a)>-1||(ca.push(a),console.warn(e))}function fu(a,e){let t=[];for(let r of e.split(" ")){let c=[];for(let h of r.split(".")){let f=a[h]||z[h];f?typeof f=="function"?c.length?c=c.map(f):wl(h,`Modifier ${h} used at start of tag`):c.length?wl(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:wl(h,`Unknown highlighting tag ${h}`)}for(let h of c)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),l=n+" "+t.map(r=>r.id),o=da[l];if(o)return o.id;let s=da[l]=Be.define({id:ra.length,name:n,props:[Jl({[n]:t})]});return ra.push(s),s.id}ye.RTL,ye.LTR;const uu=en.define({name:"json",parser:sh.configure({props:[au.add({Object:aa({except:/^\s*\}/}),Array:aa({except:/^\s*\]/})}),ru.add({"Object Array":cu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function pu(){return new su(uu)}const Al=[{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 mu(){const a=Fe();if(a.formRules?.length){const e={};Al.forEach(n=>{e[n.name]=n});const t=[...Al];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):t.push(l)}),t}return Al}const gu={loadAdvances:mu},ku={class:"unione-props-setting data-field-setting"},bu={key:0},yu=["onClick"],wu={class:"field-txt"},Au=["onClick"],xu={key:1,class:"field-txt"},Cu=["onClick"],vu={key:0,class:"field-txt"},Su={key:3,class:"edit-field"},Bu=["onClick"],Nu=ee(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([pu()]),t=i.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=i.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=i.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let u in k){const N=n.value.filter(M=>M.name==u);if(N&&N[0]){let M=o.value[u];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(k,u){s();const N={};u=="convertName"?(k.convert||(k.convert={}),N[u]=k.convert?.type):N[u]=k[u]||"",o.value[k.name]=N}function c(k,u){{o.value={};return}}function h(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 f(k,u){switch(u){case"query":k.configs=Y.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=Y.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=Y.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=Y.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=Y.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const d=i.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function p(k,u){switch(d.value.prop=u,d.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"),d.value.show=k.configs.query,d.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),d.value.show=k.configs.show.form,d.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),d.value.show=k.configs.show.view,d.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),d.value.show=k.configs.show.list,d.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),d.value.show=k.configs.sort,d.value.title=`排序设置/${k.title}(${k.name})`;break}d.value.visible=!0}const m=i.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(N=>N.value==k);return u[0]?u[0].label:k}}),b=i.ref({visible:!1,field:{},props:{},advances:gu.loadAdvances(),showInfo:k=>{let u=0;if(k.configs?.rule){const N=k.configs.rule;N.advance&&u++,typeof N.rangeMin<"u"&&u++,typeof N.rangeMax<"u"&&u++,typeof N.regExpress<"u"&&u++}if(u>0)return"("+u+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=Y.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function y(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const A=i.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,N=A.value.widgets.filter(M=>M.value==u);return N[0]?N[0].label:u},toSetting:(k,u)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=u},toclose:()=>{A.value.visible=!1}});function x(k){A.value.field=k,k.configs=Y.utils.obj.ext(k.configs,{widget:{props:{}}}),A.value.widget=k.configs.widget,A.value.visible=!0}const w=i.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="--")=>w.value.types.filter(N=>N.value==k)[0]?.label||u,toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(k,u)=>{w.value.convert.options.splice(k,1)},toSetting:()=>{w.value.visible=!1}});function R(k){w.value.visible=!0,w.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),w.value.convert=k.configs.convert}return(k,u)=>{const N=i.resolveComponent("ToolOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-checkbox"),B=i.resolveComponent("a-table"),E=i.resolveComponent("a-switch"),g=i.resolveComponent("a-form-item"),S=i.resolveComponent("a-select-option"),I=i.resolveComponent("a-input-number"),V=i.resolveComponent("a-form"),F=i.resolveComponent("a-modal"),$=i.resolveComponent("a-input"),D=i.resolveComponent("unione-select-box"),Q=i.resolveComponent("a-checkbox-group"),L=i.resolveComponent("unione-section");return i.openBlock(),i.createElementBlock("div",ku,[i.createVNode(B,{columns:t.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:O})=>[["widget","queryType","rules","convertName"].includes(O.key)?(i.openBlock(),i.createElementBlock("span",bu,[i.createVNode(N),i.createTextVNode(" "+i.toDisplayString(O.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:O,text:G,record:T})=>[["rules"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!b.value.showInfo(T)&&"empty"]),onClick:_=>y(T)},[i.createElementVNode("span",wu,i.toDisplayString(b.value.showInfo(T)),1),b.value.showInfo(T)?(i.openBlock(),i.createBlock(M,{key:0,type:"link"},{default:i.withCtx(()=>u[50]||(u[50]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,yu)):["widget"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!G&&"empty"]),onClick:_=>r(T,O.dataIndex)},[o.value[T.name]&&Object.keys(o.value[T.name]).includes(O.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(v,{key:0,value:T.configs?.widget?.name,allowClear:!0,options:A.value.widgets,onChange:_=>A.value.toSetting(T,_),onBlur:u[0]||(u[0]=_=>c())},null,8,["value","options","onChange"])),[[l]]):(i.openBlock(),i.createElementBlock("span",xu,i.toDisplayString(A.value.widgetName(T)),1)),i.createVNode(M,{type:"link",onClick:i.withModifiers(_=>x(T),["stop"])},{default:i.withCtx(()=>u[51]||(u[51]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Au)):["convertName"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!T.convert?.type&&"empty"]),onClick:_=>R(T)},[T.configs?.convert?.types?(i.openBlock(),i.createElementBlock("span",vu,i.toDisplayString(w.value.getTypes(T.configs.convert.types)),1)):i.createCommentVNode("",!0)],10,Cu)):["query","form","view","list","sort"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",Su,[i.createVNode(C,{checked:h(T,O.dataIndex),onClick:_=>f(T,O.dataIndex)},null,8,["checked","onClick"]),i.createVNode(M,{type:"link",onClick:_=>p(T,O.dataIndex)},{default:i.withCtx(()=>u[52]||(u[52]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(F,{visible:d.value.visible,"onUpdate:visible":u[14]||(u[14]=O=>d.value.visible=O),width:600,title:d.value.title,onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:i.normalizeClass(["field-setting-form","form-mix",d.value.prop])},{default:i.withCtx(()=>[i.createVNode(g,{label:"启用状态"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.enable,"onUpdate:checked":u[1]||(u[1]=O=>d.value.show.enable=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:0,label:"默认排序"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.defoult,"onUpdate:checked":u[2]||(u[2]=O=>d.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:1,label:"排序方式"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.asc,"onUpdate:checked":u[3]||(u[3]=O=>d.value.show.asc=O),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"&&d.value.show.types=="ADVANCE"?(i.openBlock(),i.createBlock(g,{key:2,label:"高级查询"})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.defoult,"onUpdate:checked":u[4]||(u[4]=O=>d.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.visible,"onUpdate:checked":u[5]||(u[5]=O=>d.value.show.visible=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:5,label:"查询方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.types,"onUpdate:value":u[6]||(u[6]=O=>d.value.show.types=O)},{default:i.withCtx(()=>[i.createVNode(S,{key:"EQ",value:"EQ"},{default:i.withCtx(()=>u[53]||(u[53]=[i.createTextVNode("精确查询")])),_:1}),i.createVNode(S,{key:"LIKE",value:"LIKE"},{default:i.withCtx(()=>u[54]||(u[54]=[i.createTextVNode("模糊查询")])),_:1}),i.createVNode(S,{key:"LLIKE",value:"LLIKE"},{default:i.withCtx(()=>u[55]||(u[55]=[i.createTextVNode("左模糊")])),_:1}),i.createVNode(S,{key:"RLIKE",value:"RLIKE"},{default:i.withCtx(()=>u[56]||(u[56]=[i.createTextVNode("右模糊")])),_:1}),i.createVNode(S,{key:"RANGE",value:"RANGE"},{default:i.withCtx(()=>u[57]||(u[57]=[i.createTextVNode("范围查询")])),_:1}),i.createVNode(S,{key:"ADVANCE",value:"ADVANCE"},{default:i.withCtx(()=>u[58]||(u[58]=[i.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0),["query","sort"].includes(d.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:i.withCtx(()=>[i.createVNode(I,{value:d.value.show.index,"onUpdate:value":u[7]||(u[7]=O=>d.value.show.index=O)},null,8,["value"])]),_:1})),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.width,"onUpdate:value":u[8]||(u[8]=O=>d.value.show.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,value:d.value.show.width,"onUpdate:value":u[9]||(u[9]=O=>d.value.show.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.labelWidth,"onUpdate:value":u[10]||(u[10]=O=>d.value.show.labelWidth=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.valueWidth,"onUpdate:value":u[11]||(u[11]=O=>d.value.show.valueWidth=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:11,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.fixed,"onUpdate:value":u[12]||(u[12]=O=>d.value.show.fixed=O),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:12,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.align,"onUpdate:value":u[13]||(u[13]=O=>d.value.show.align=O),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:w.value.visible,"onUpdate:visible":u[33]||(u[33]=O=>w.value.visible=O),width:600,title:w.value.getTypes(w.value.convert.types,"转换")+"设置",onOk:w.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:w.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"转换类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:w.value.convert.types,"onUpdate:value":u[15]||(u[15]=O=>w.value.convert.types=O),allowClear:!0,options:w.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"是否搜索"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.convert.search,"onUpdate:checked":u[16]||(u[16]=O=>d.value.convert.search=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="option"?(i.openBlock(),i.createBlock(g,{key:1,label:"选项设置"},{default:i.withCtx(()=>[i.createVNode(M,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:i.withCtx(()=>u[59]||(u[59]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(B,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:O,record:G,index:T})=>[O.dataIndex==="label"?(i.openBlock(),i.createBlock($,{key:0,value:G.label,"onUpdate:value":_=>G.label=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),O.dataIndex==="value"?(i.openBlock(),i.createBlock($,{key:1,value:G.value,"onUpdate:value":_=>G.value=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),O.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:_=>w.value.toDelOption(T,G)},"删除",8,Bu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):i.createCommentVNode("",!0),["dbtable","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:2,label:"数据源"},{default:i.withCtx(()=>[i.createVNode(D,{value:w.value.convert.dsId,"onUpdate:value":u[17]||(u[17]=O=>w.value.convert.dsId=O),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:3,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[18]||(u[18]=O=>w.value.convert.tableName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:4,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[19]||(u[19]=O=>w.value.convert.tableName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:5,label:"主键字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.idField,"onUpdate:value":u[20]||(u[20]=O=>w.value.convert.idField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:6,label:"父级字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.pidField,"onUpdate:value":u[21]||(u[21]=O=>w.value.convert.pidField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:7,label:"value字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.valueField,"onUpdate:value":u[22]||(u[22]=O=>w.value.convert.valueField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:8,label:"label字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.labelField,"onUpdate:value":u[23]||(u[23]=O=>w.value.convert.labelField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableField,"onUpdate:value":u[24]||(u[24]=O=>w.value.convert.tableField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableWhere,"onUpdate:value":u[25]||(u[25]=O=>w.value.convert.tableWhere=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[26]||(u[26]=O=>w.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[27]||(u[27]=O=>w.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:13,label:"异步加载"},{default:i.withCtx(()=>[i.createVNode(E,{checked:w.value.convert.isAsync,"onUpdate:checked":u[28]||(u[28]=O=>w.value.convert.isAsync=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:14,label:"分页加载"},{default:i.withCtx(()=>[i.createVNode(E,{checked:w.value.convert.isPaging,"onUpdate:checked":u[29]||(u[29]=O=>w.value.convert.isPaging=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dict"?(i.openBlock(),i.createBlock(g,{key:15,label:"字典名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.dictName,"onUpdate:value":u[30]||(u[30]=O=>w.value.convert.dictName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.url,"onUpdate:value":u[31]||(u[31]=O=>w.value.convert.url=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:w.value.convert.params,"onUpdate:modelValue":u[32]||(u[32]=O=>w.value.convert.params=O),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})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:A.value.visible,"onUpdate:visible":u[40]||(u[40]=O=>A.value.visible=O),width:600,title:"控件设置",onOk:A.value.toclose},{default:i.withCtx(()=>[i.createVNode(V,{model:A.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"组件类型"},{default:i.withCtx(()=>[i.withDirectives(i.createVNode(v,{value:A.value.widget.name,"onUpdate:value":u[34]||(u[34]=O=>A.value.widget.name=O),allowClear:!0,options:A.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),i.createVNode(g,{label:"输入提示"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.placeholder,"onUpdate:value":u[35]||(u[35]=O=>A.value.widget.placeholder=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"帮助说明"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.help,"onUpdate:value":u[36]||(u[36]=O=>A.value.widget.help=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"提示文本"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.tooltip,"onUpdate:value":u[37]||(u[37]=O=>A.value.widget.tooltip=O)},null,8,["value"])]),_:1}),["a-date-picker"].includes(A.value.widget.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"显示格式"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.field.dataFormat,"onUpdate:value":u[38]||(u[38]=O=>A.value.field.dataFormat=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),A.value.widget.name=="unione-select-box"?(i.openBlock(),i.createBlock(g,{key:1,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:A.value.widget.props.mode,"onUpdate:value":u[39]||(u[39]=O=>A.value.widget.props.mode=O),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(S,{value:"multiple"},{default:i.withCtx(()=>u[60]||(u[60]=[i.createTextVNode("多选")])),_:1}),i.createVNode(S,{value:"tags"},{default:i.withCtx(()=>u[61]||(u[61]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(F,{visible:b.value.visible,"onUpdate:visible":u[49]||(u[49]=O=>b.value.visible=O),width:600,title:"规则设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(L,{title:"基本设置",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(Q,{value:b.value.props.trigger,"onUpdate:value":u[41]||(u[41]=O=>b.value.props.trigger=O),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(C,{checked:b.value.props.whitespace,"onUpdate:checked":u[42]||(u[42]=O=>b.value.props.whitespace=O)},{default:i.withCtx(()=>u[62]||(u[62]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),i.createVNode(g,{label:"预设类型"},{default:i.withCtx(()=>[i.createVNode(v,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":u[43]||(u[43]=O=>b.value.props.advance=O)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(i.openBlock(),i.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(I,{value:b.value.props.rangeMin,"onUpdate:value":u[44]||(u[44]=O=>b.value.props.rangeMin=O)},null,8,["value"]),u[63]||(u[63]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(I,{value:b.value.props.rangeMax,"onUpdate:value":u[45]||(u[45]=O=>b.value.props.rangeMax=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":u[46]||(u[46]=O=>b.value.props.rangeMessage=O)},null,8,["value"])]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(L,{title:"正则验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":u[47]||(u[47]=O=>b.value.props.regExpress=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":u[48]||(u[48]=O=>b.value.props.regMessage=O)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),Vu={class:"unione-props-setting data-field-fkey"},Ru={key:0},Eu=["onClick"],Ou=["onClick"],Mu=["onClick"],Tu=["onClick"],Iu=["onClick"],Fu=["onClick"],Du=["onClick"],_u=["onClick"],Pu=ee(i.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.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=i.useModel(a,"modelValue"),l=i.computed(()=>n.value.filter(p=>p.configs?.fkey?.enable)||[]),o=i.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 h(p,m,b,y){p.configs.fkey[m]=b,m=="fieldName"&&(p.configs.fkey.fieldTitle=y.title),m=="labelName"&&(p.configs.fkey.labelTitle=y.title)}function f(p){d.value.record=p,d.value.visible=!0,d.value.fields=p.configs?.fkey?.fields||[]}const d=i.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)=>{d.value.editField[p]=m},onShowFieldChange:(p,m,b)=>{p.name=b.name,p.title=b.title},toAddField:()=>{d.value.fields.push({name:"",title:""}),d.value.editField[d.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{d.value.fields.splice(p,1)}})},toSetting:()=>{d.value.visible=!1,d.value.record.configs=Y.utils.obj.ext(d.value.record.configs,{fkey:{fields:d.value.fields}})}});return(p,m)=>{const b=i.resolveComponent("FormOutlined"),y=i.resolveComponent("unione-select-box"),A=i.resolveComponent("a-button"),x=i.resolveComponent("a-table"),w=i.resolveComponent("a-input-number"),R=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",Vu,[i.createVNode(x,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:i.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(i.openBlock(),i.createElementBlock("span",Ru,[i.createVNode(b),i.createTextVNode(" "+i.toDisplayString(k.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:k,record:u})=>[["dsnName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnName),1)],64))],10,Eu)):["dsnTitle"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnTitle&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnTitle),1)],64))],10,Ou)):i.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.fieldName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"fieldName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.fieldTitle),1)],64))],10,Mu)):["labelName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.labelName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"labelName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.labelTitle)+" ",1),u.configs?.fkey?.labelName?(i.openBlock(),i.createBlock(A,{key:0,type:"link",onClick:i.withModifiers(N=>f(u),["stop"])},{default:i.withCtx(()=>m[4]||(m[4]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,Tu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(R,{visible:d.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>d.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(A,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:d.value.toAddField},{default:i.withCtx(()=>m[5]||(m[5]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(x,{columns:d.value.columns,"data-source":d.value.fields,size:"small"},{bodyCell:i.withCtx(({column:k,record:u,index:N,text:M})=>[k.dataIndex==="title"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",d.value.editField!="title"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="title"?(i.openBlock(),i.createBlock(y,{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:d.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=v=>d.value.editField={}),onSelect:(v,C)=>d.value.onShowFieldChange(u,v,C)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Iu)):i.createCommentVNode("",!0),k.dataIndex==="width"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",d.value.editField!="width"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="width"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[1]||(m[1]=v=>d.value.editField={}),value:u.width,"onUpdate:value":v=>u.width=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Fu)):i.createCommentVNode("",!0),k.dataIndex==="index"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",d.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="index"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[2]||(m[2]=v=>d.value.editField={}),value:u.index,"onUpdate:value":v=>u.index=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Du)):i.createCommentVNode("",!0),k.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:3,onClick:v=>d.value.toDelField(N)},"删除",8,_u)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),$u={class:"unione-props-setting data-filter"},Lu={class:"title"},Uu={class:"name"},zu={class:"action"},ju=ee(i.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.useModel(a,"modelValue");function n(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function o(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const s=i.ref(),r=i.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(h=>{if(r.value.name){const f=t.value.filter(d=>d.name==r.value.name)[0];if(!f){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(p=>p.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(d=>{f[d]=h[d]})}else{if(t.value.filter(d=>d.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function c(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
24
- `),h.push(" AND XXX=#{params."),h.push(r.value.filter.name||"xxx"),h.push(`}
25
- `),h.push(`-- @}
26
- `),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,f)=>{const d=i.resolveComponent("a-button"),p=i.resolveComponent("a-card"),m=i.resolveComponent("PlusOutlined"),b=i.resolveComponent("a-empty"),y=i.resolveComponent("a-input"),A=i.resolveComponent("a-form-item"),x=i.resolveComponent("a-textarea"),w=i.resolveComponent("a-tag"),R=i.resolveComponent("a-form"),k=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",$u,[(t.value.length,i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,(u,N)=>(i.openBlock(),i.createBlock(p,{class:"filter-box",size:"small",key:N},{default:i.withCtx(()=>[i.createElementVNode("div",Lu,"过滤标题:"+i.toDisplayString(u.title),1),i.createElementVNode("div",Uu,"过滤名称:"+i.toDisplayString(u.name),1),i.createElementVNode("div",zu,[i.createVNode(d,{size:"small",onClick:M=>l(u)},{default:i.withCtx(()=>f[4]||(f[4]=[i.createTextVNode("编辑")])),_:2},1032,["onClick"]),i.createVNode(d,{danger:"",size:"small",onClick:M=>o(N)},{default:i.withCtx(()=>f[5]||(f[5]=[i.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),i.createVNode(p,{class:"filter-box btn-add",size:"small",onClick:n},{default:i.withCtx(()=>[i.createVNode(m,{class:"btn"})]),_:1})],64)),i.createVNode(k,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=u=>r.value.visible=u),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:i.withCtx(()=>[i.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:i.withCtx(()=>[i.createVNode(A,{label:"过滤标题",name:"title"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=u=>r.value.filter.title=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤名称",name:"name"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=u=>r.value.filter.name=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:i.withCtx(()=>[i.createVNode(x,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=u=>r.value.filter.filter=u),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),i.createVNode(w,{class:"btn-tmpl",color:"blue",onClick:c},{default:i.withCtx(()=>f[6]||(f[6]=[i.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),qu={class:"unione-page form-page data-define-edit"},Qu={class:"actions"},Wu=ee(i.defineComponent({__name:"edit",setup(a){const e=Y.useDialog(),t=i.inject("route"),n=i.inject("router"),l=i.ref(),o=i.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=i.ref(),r=i.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=i.ref({configs:{fields:[],filters:[]}}),h=i.ref(!1);function f(){n.back()}function d(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([c.value.id]).then(y=>{y.success?(e.success({title:"发布成功",content:y.body}),b(c.value.id)):e.error({title:"发布失败",content:y.body})})}})}async function p(){const y=await l.value.validate(),A={...c.value,...y};A.configs.show=await s.value.getValue(),console.log("formData",A),X.message.loading({content:"提交中..."}),h.value=!0,mt.save(A).then(x=>{X.message.destroy(),x.success?(c.value=x.body,l.value.setValue(x.body),s.value.setValue(x.body.configs?.show||{}),X.message.success("保存成功!")):X.message.error(x.message)}).finally(()=>{h.value=!1})}const m=i.ref(!1);i.onMounted(()=>{t.query.id&&b(t.query.id)});function b(y){X.message.loading({content:"加载中..."}),mt.detail(y).then(A=>{A.success?(c.value=A.body,l.value.setValue(A.body),s.value.setValue(A.body.configs?.show||{}),X.message.destroy()):X.message.error(A.message)})}return(y,A)=>{const x=i.resolveComponent("unione-form"),w=i.resolveComponent("unione-section"),R=i.resolveComponent("OrderedListOutlined"),k=i.resolveComponent("a-tab-pane"),u=i.resolveComponent("ToolOutlined"),N=i.resolveComponent("ApiOutlined"),M=i.resolveComponent("FunnelPlotOutlined"),v=i.resolveComponent("a-tabs"),C=i.resolveComponent("a-button");return i.openBlock(),i.createElementBlock("div",qu,[i.createVNode(w,{title:"基础信息",type:"line"},{default:i.withCtx(()=>[i.createVNode(x,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),i.createVNode(w,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":A[0]||(A[0]=B=>m.value=B)},{default:i.withCtx(()=>[i.createVNode(x,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),i.createVNode(v,null,{default:i.withCtx(()=>[i.createVNode(k,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(R),A[5]||(A[5]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(_d,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[1]||(A[1]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(u),A[6]||(A[6]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(Nu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[2]||(A[2]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-fkeys"},{tab:i.withCtx(()=>[i.createVNode(N),A[7]||(A[7]=i.createTextVNode("外键设置 "))]),default:i.withCtx(()=>[i.createVNode(Pu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[3]||(A[3]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"data-filter"},{tab:i.withCtx(()=>[i.createVNode(M),A[8]||(A[8]=i.createTextVNode("数据过滤 "))]),default:i.withCtx(()=>[i.createVNode(ju,{modelValue:c.value.configs.filters,"onUpdate:modelValue":A[4]||(A[4]=B=>c.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),i.createElementVNode("div",Qu,[i.createVNode(C,{type:"primary",onClick:p,loading:h.value},{default:i.withCtx(()=>A[9]||(A[9]=[i.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(i.openBlock(),i.createBlock(C,{key:0,danger:"",onClick:d,loading:h.value},{default:i.withCtx(()=>A[10]||(A[10]=[i.createTextVNode("发布")])),_:1},8,["loading"])):i.createCommentVNode("",!0),i.createVNode(C,{onClick:f},{default:i.withCtx(()=>A[11]||(A[11]=[i.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Yu={UnioneEditor:ut,locales:ln,loadConfig:Fe,DataStorage:on,Convertor:Ge,install(a,e){Y.loadConfig(e);const t=Fe(e);t.axios&&Y.axios.create(t.axios),a.component("UnioneBtn",Va),a.component("UnioneTabs",Ea),a.component("UnioneSection",Da),a.component("UnioneQuery",Vl),a.component("UnioneTable",Rl),a.component("UnioneRichText",zc),a.component("UnioneFormItem",er),a.component("UnioneForm",Ga),a.component("UnioneSelectBox",tr),a.component("UnioneSwitchBox",ir),a.component("UnioneRadioBox",nr),a.component("UnioneCheckBox",lr),a.component("UnionePwdBox",or),a.component("UnioneRandomInput",ar),a.component("UnionePageEditor",Tl),a.component("UnionePageForm",Il),a.component("UnionePageTree",Fl),a.component("UnionePageList",Dl)}};Z.Convertor=Ge,Z.DataStorage=on,Z.UnioneDataDefineEdit=Wu,Z.UnioneDataDefineList=Rd,Z.UnioneEditor=ut,Z.UnionePage=qt,Z.UnionePageEditor=Tl,Z.UnionePageForm=Il,Z.UnionePageList=Dl,Z.UnionePageSetting=Qt,Z.UnionePageTree=Fl,Z.UnioneQueryForm=Vl,Z.UnioneTableList=Rl,Z.default=Yu,Z.loadConfig=Fe,Z.locales=ln,Z.useDebounce=pt,Z.utils=sr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ }]`}],onConfirm:g=>{const S=g.find(R=>R.name==="valueSets")?.value;if(!S)return;const I=g.find(R=>R.name==="code")?.value;i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ce.ControlType.DATE:new _e({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 S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="value")?.value||"",R=g.find(F=>F.name==="dateFormat")?.value||"";i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,dateFormat:R,value:I?[{value:I}]:null,placeholder:S}})}});break;case ce.ControlType.NUMBER:new _e({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(R=>R.name==="placeholder")?.value;if(!S)return;const I=g.find(R=>R.name==="value")?.value||"";i.editor?.command.executeInsertControl({type:ce.ElementType.CONTROL,value:"",control:{type:V,value:I?[{value:I}]:null,placeholder:S}})}});break}}return t.onMounted(()=>{window.addEventListener("click",V=>{const g=n.value?.querySelector(".visible");!g||g.contains(V.target)||g.classList.remove("visible")},{capture:!0}),i.editor&&(i.editor.listener.rangeStyleChange=V=>{t.nextTick(()=>{if(V.type===ce.ElementType.TEXT){const g=n.value,S=g.querySelector(".menu-item__font .select");S&&(S.textContent=V.font);const I=g.querySelector(".menu-item__size .select");if(I){const T={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};I.textContent=T[V.size]||"小四"}const R=g.querySelector(".menu-item__bold");R&&R.classList.toggle("active",V.bold);const F=g.querySelector(".menu-item__italic");F&&F.classList.toggle("active",V.italic);const $=g.querySelector(".menu-item__underline");$&&$.classList.toggle("active",V.underline);const _=g.querySelector(".menu-item__strikeout");_&&_.classList.toggle("active",V.strikeout);const q=g.querySelector(".menu-item__color span");q&&(q.style.backgroundColor=V.color||"#000000");const L=g.querySelector(".menu-item__highlight span");L&&(L.style.backgroundColor=V.highlight);const O=g.querySelector(".menu-item__title .select");if(O){const T={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};O.textContent=T[V.level]||"正文"}["left","center","right","alignment","justify"].forEach(T=>{const D=g.querySelector(`.menu-item__${T}`);D&&D.classList.toggle("active",V.rowFlex===T)})}})})}),e({getHeight:o,getWidth:s}),(V,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,(S,I)=>(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:g[0]||(g[0]=R=>c("Undo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Dr)})`})},null,4)],8,Nc)):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:g[1]||(g[1]=R=>c("Redo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Pr)})`})},null,4)],8,Vc)):t.createCommentVNode("",!0),S=="Painter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__painter",key:S,title:"格式刷(双击可连续使用)",onClick:p,onDblclick:m},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref($r)})`})},null,4)],32)):t.createCommentVNode("",!0),S=="Format"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__format",key:S,title:"清除格式",onClick:g[2]||(g[2]=R=>c("Format")),"data-item":"Format"},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Lr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Divider"?(t.openBlock(),t.createElementBlock("div",{class:"menu-divider",key:S+I,"data-item":"Divider"})):t.createCommentVNode("",!0),S=="Font"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__font",onClick:g[19]||(g[19]=R=>d("menu-item__font",R)),style:{display:"none"},key:S},[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]=R=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),t.createElementVNode("li",{onClick:g[4]||(g[4]=R=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),t.createElementVNode("li",{onClick:g[5]||(g[5]=R=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),t.createElementVNode("li",{onClick:g[6]||(g[6]=R=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),t.createElementVNode("li",{onClick:g[7]||(g[7]=R=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:g[8]||(g[8]=R=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),t.createElementVNode("li",{onClick:g[9]||(g[9]=R=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:g[10]||(g[10]=R=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),t.createElementVNode("li",{onClick:g[11]||(g[11]=R=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),t.createElementVNode("li",{onClick:g[12]||(g[12]=R=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),t.createElementVNode("li",{onClick:g[13]||(g[13]=R=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),t.createElementVNode("li",{onClick:g[14]||(g[14]=R=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),t.createElementVNode("li",{onClick:g[15]||(g[15]=R=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),t.createElementVNode("li",{onClick:g[16]||(g[16]=R=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),t.createElementVNode("li",{onClick:g[17]||(g[17]=R=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),t.createElementVNode("li",{onClick:g[18]||(g[18]=R=>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:g[36]||(g[36]=R=>d("menu-item__size",R)),key:S},[g[100]||(g[100]=t.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),t.createElementVNode("div",Rc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:g[20]||(g[20]=R=>c("Size",56))},"初号"),t.createElementVNode("li",{onClick:g[21]||(g[21]=R=>c("Size",48))},"小初"),t.createElementVNode("li",{onClick:g[22]||(g[22]=R=>c("Size",34))},"一号"),t.createElementVNode("li",{onClick:g[23]||(g[23]=R=>c("Size",32))},"小一"),t.createElementVNode("li",{onClick:g[24]||(g[24]=R=>c("Size",29))},"二号"),t.createElementVNode("li",{onClick:g[25]||(g[25]=R=>c("Size",24))},"小二"),t.createElementVNode("li",{onClick:g[26]||(g[26]=R=>c("Size",21))},"三号"),t.createElementVNode("li",{onClick:g[27]||(g[27]=R=>c("Size",20))},"小三"),t.createElementVNode("li",{onClick:g[28]||(g[28]=R=>c("Size",18))},"四号"),t.createElementVNode("li",{onClick:g[29]||(g[29]=R=>c("Size",16))},"小四"),t.createElementVNode("li",{onClick:g[30]||(g[30]=R=>c("Size",14))},"五号"),t.createElementVNode("li",{onClick:g[31]||(g[31]=R=>c("Size",12))},"小五"),t.createElementVNode("li",{onClick:g[32]||(g[32]=R=>c("Size",10))},"六号"),t.createElementVNode("li",{onClick:g[33]||(g[33]=R=>c("Size",8))},"小六"),t.createElementVNode("li",{onClick:g[34]||(g[34]=R=>c("Size",7))},"七号"),t.createElementVNode("li",{onClick:g[35]||(g[35]=R=>c("Size",6))},"八号")])])])):t.createCommentVNode("",!0),S=="SizeAdd"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:g[37]||(g[37]=R=>c("SizeAdd")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ur)})`})},null,4)])):t.createCommentVNode("",!0),S=="SizeMinus"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:g[38]||(g[38]=R=>c("SizeMinus")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(zr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Bold"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:g[39]||(g[39]=R=>c("Bold")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(jr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Italic"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:g[40]||(g[40]=R=>c("Italic")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(qr)})`})},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:g[46]||(g[46]=R=>d("menu-item__underline",R)),"data-item":"Underline",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Qr)})`})},null,4),g[101]||(g[101]=t.createElementVNode("span",{class:"select"},null,-1)),t.createElementVNode("div",Oc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-decoration-style":"solid",onClick:g[41]||(g[41]=R=>c("Underline",{style:"solid"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ol)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"double",onClick:g[42]||(g[42]=R=>c("Underline",{style:"double"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(wc)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dashed",onClick:g[43]||(g[43]=R=>c("Underline",{style:"dashed"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ml)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dotted",onClick:g[44]||(g[44]=R=>c("Underline",{style:"dotted"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"wavy",onClick:g[45]||(g[45]=R=>c("Underline",{style:"wavy"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ac)})`})},null,4)])])])],8,Ec)):t.createCommentVNode("",!0),S=="Strikeout"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:g[47]||(g[47]=R=>c("Strikeout")),"data-item":"Strikeout",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Wr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Superscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:g[48]||(g[48]=R=>c("Superscript")),"data-item":"Superscript",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Yr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Subscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:g[49]||(g[49]=R=>c("Subscript")),"data-item":"Subscript",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Kr)})`})},null,4)])):t.createCommentVNode("",!0),S=="Color"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:C,"data-item":"Color",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Hr)})`})},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),S=="Highlight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:A,"data-item":"Highlight",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Gr)})`})},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),S=="Title"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__title",onClick:g[57]||(g[57]=R=>d("menu-item__title",R)),"data-item":"Title",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Jr)})`})},null,4),g[106]||(g[106]=t.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),t.createElementVNode("div",Mc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{style:{"font-size":"16px"},onClick:g[50]||(g[50]=R=>c("Title",null))},"正文"),t.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:g[51]||(g[51]=R=>c("Title","first"))},"标题1"),t.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:g[52]||(g[52]=R=>c("Title","second"))},"标题2"),t.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:g[53]||(g[53]=R=>c("Title","third"))},"标题3"),t.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:g[54]||(g[54]=R=>c("Title","fourth"))},"标题4"),t.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:g[55]||(g[55]=R=>c("Title","fifth"))},"标题5"),t.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:g[56]||(g[56]=R=>c("Title","sixth"))},"标题6")])])])):t.createCommentVNode("",!0),S=="RowFlexLeft"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__left",onClick:g[58]||(g[58]=R=>c("RowFlex","left")),title:`左对齐(${t.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Xr)})`})},null,4)],8,Tc)):t.createCommentVNode("",!0),S=="RowFlexCenter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__center",onClick:g[59]||(g[59]=R=>c("RowFlex","center")),title:`居中对齐(${t.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Zr)})`})},null,4)],8,Ic)):t.createCommentVNode("",!0),S=="RowFlexRight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__right",onClick:g[60]||(g[60]=R=>c("RowFlex","right")),title:`右对齐(${t.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ec)})`})},null,4)],8,Fc)):t.createCommentVNode("",!0),S=="RowFlexAlignment"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:g[61]||(g[61]=R=>c("RowFlex","alignment")),title:`两端对齐(${t.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(tc)})`})},null,4)],8,_c)):t.createCommentVNode("",!0),S=="RowFlexJustify"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:g[62]||(g[62]=R=>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(ic)})`})},null,4)],8,Dc)):t.createCommentVNode("",!0),S=="RowMargin"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:g[71]||(g[71]=R=>d("menu-item__row-margin",R)),"data-item":"RowMargin",key:S},[t.createElementVNode("i",{title:"行间距",style:t.normalizeStyle({backgroundImage:`url(${t.unref(nc)})`})},null,4),t.createElementVNode("div",Pc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-rowmargin":"1",onClick:g[63]||(g[63]=R=>c("RowMargin",1))},"1"),t.createElementVNode("li",{"data-rowmargin":"1.25",onClick:g[64]||(g[64]=R=>c("RowMargin",1.25))},"1.25"),t.createElementVNode("li",{"data-rowmargin":"1.5",onClick:g[65]||(g[65]=R=>c("RowMargin",1.5))},"1.5"),t.createElementVNode("li",{"data-rowmargin":"1.75",onClick:g[66]||(g[66]=R=>c("RowMargin",1.75))},"1.75"),t.createElementVNode("li",{"data-rowmargin":"2",onClick:g[67]||(g[67]=R=>c("RowMargin",2))},"2"),t.createElementVNode("li",{"data-rowmargin":"2.5",onClick:g[68]||(g[68]=R=>c("RowMargin",2.5))},"2.5"),t.createElementVNode("li",{"data-rowmargin":"3",onClick:g[69]||(g[69]=R=>c("RowMargin",3))},"3"),t.createElementVNode("li",{"data-rowmargin":"5",onClick:g[70]||(g[70]=R=>c("RowMargin",5))},"5")])])])):t.createCommentVNode("",!0),S=="List"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__list",onClick:g[77]||(g[77]=R=>d("menu-item__list",R)),key:S},[t.createElementVNode("i",{title:"列表",style:t.normalizeStyle({backgroundImage:`url(${t.unref(lc)})`})},null,4),t.createElementVNode("div",$c,[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]=R=>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]=R=>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]=R=>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]=R=>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]=R=>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),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(sc)})`})},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),S=="Image"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__image",onClick:E,key:S},[t.createElementVNode("i",{title:"图片",style:t.normalizeStyle({backgroundImage:`url(${t.unref(oc)})`})},null,4),g[114]||(g[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:w,key:S},[t.createElementVNode("i",{title:"超链接",style:t.normalizeStyle({backgroundImage:`url(${t.unref(ac)})`})},null,4)])):t.createCommentVNode("",!0),S=="Separator"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:g[84]||(g[84]=R=>d("menu-item__separator",R)),key:S},[t.createElementVNode("i",{title:"分割线",style:t.normalizeStyle({backgroundImage:`url(${t.unref(rc)})`})},null,4),t.createElementVNode("div",Lc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-separator":"0,0",onClick:g[78]||(g[78]=R=>c("Separator",[0,0]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ol)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"1,1",onClick:g[79]||(g[79]=R=>c("Separator",[1,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"3,1",onClick:g[80]||(g[80]=R=>c("Separator",[3,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ml)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"4,4",onClick:g[81]||(g[81]=R=>c("Separator",[4,4]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(xc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:g[82]||(g[82]=R=>c("Separator",[7,3,3,3]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(vc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:g[83]||(g[83]=R=>c("Separator",[6,2,2,2,2,2]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Cc)})`})},null,4)])])])])):t.createCommentVNode("",!0),S=="Watermark"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:g[87]||(g[87]=R=>d("menu-item__watermark",R)),key:S},[t.createElementVNode("i",{title:"水印(添加、删除)",style:t.normalizeStyle({backgroundImage:`url(${t.unref(cc)})`})},null,4),t.createElementVNode("div",Uc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-menu":"add",onClick:g[85]||(g[85]=R=>u("add"))},"添加水印"),t.createElementVNode("li",{"data-menu":"delete",onClick:g[86]||(g[86]=R=>u("delete"))},"删除水印")])])])):t.createCommentVNode("",!0),S=="Codeblock"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:B,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(dc)})`})},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(hc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Control"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__control",onClick:g[94]||(g[94]=R=>d("menu-item__control",R)),key:S},[t.createElementVNode("i",{title:"控件",style:t.normalizeStyle({backgroundImage:`url(${t.unref(fc)})`})},null,4),t.createElementVNode("div",zc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-control":"text",onClick:g[88]||(g[88]=R=>N("text"))},"文本"),t.createElementVNode("li",{"data-control":"number",onClick:g[89]||(g[89]=R=>N("number"))},"数值"),t.createElementVNode("li",{"data-control":"select",onClick:g[90]||(g[90]=R=>N("select"))},"列举"),t.createElementVNode("li",{"data-control":"date",onClick:g[91]||(g[91]=R=>N("date"))},"日期"),t.createElementVNode("li",{"data-control":"checkbox",onClick:g[92]||(g[92]=R=>N("checkbox"))},"复选框"),t.createElementVNode("li",{"data-control":"radio",onClick:g[93]||(g[93]=R=>N("radio"))},"单选框")])])])):t.createCommentVNode("",!0),S=="Checkbox"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:g[95]||(g[95]=R=>b("checkbox")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(uc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Radio"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:g[96]||(g[96]=R=>b("radio")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(pc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Latex"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:k,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(mc)})`})},null,4)])):t.createCommentVNode("",!0),S=="Date"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__date",onClick:g[97]||(g[97]=R=>x("menu-item__date",R)),key:S},[t.createElementVNode("i",{title:"日期",style:t.normalizeStyle({backgroundImage:`url(${t.unref(gc)})`})},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),S=="Block"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:v,key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(kc)})`})},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(bc)})`})},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",jc,[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",qc,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Sc)})`})},null,4)]),t.createElementVNode("div",Qc,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Bc)})`})},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),S=="Print"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:g[98]||(g[98]=R=>c("Print")),key:S},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(yc)})`})},null,4)])):t.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-9be2b83f"]]),Yc=te(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(),f=t.ref();t.onMounted(()=>{t.nextTick(()=>{h()}),window.addEventListener("click",()=>{l.value=!1})});function h(){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 k=JSON.parse(JSON.stringify(i.options));f.value=new ce.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}},...k}),f.value.listener.contentChange=()=>{f.value.command.getValueAsync().then(({data:b})=>{n.value=JSON.stringify(b)})},n.value&&(typeof n.value=="string"?f.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}return t.watch(n,()=>{l.value==!1&&n.value&&f.value&&(typeof n.value=="string"?f.value.command.executeSetValue(JSON.parse(n.value)):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}),t.watch(s,()=>{f.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(p,m)=>(t.openBlock(),t.createBlock(ot,{class:"unione-rich-text",model:i.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=t.withModifiers(k=>l.value=!0,["stop"]))},{default:t.withCtx(()=>[(s.value=="edit"||s.value=="run")&&f.value?(t.openBlock(),t.createBlock(Wc,{key:0,ref_key:"canvasMenuDom",ref:c,editor:f.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"]]),Kc={class:"page-setting-dialog"},St=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=W.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 f=t.ref("");function h(p){f.value||(f.value=n.value),p?i.editor?.setModel("edit"):i.editor?.setModel(f.value)}return(p,m)=>{const k=t.resolveComponent("SettingOutlined"),b=t.resolveComponent("a-tooltip"),x=t.resolveComponent("SaveOutlined"),v=t.resolveComponent("FormOutlined"),y=t.resolveComponent("StopOutlined"),E=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(b,{key:0,title:a.settingTitle},{default:t.withCtx(()=>[t.createVNode(k,{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(b,{key:1,title:"保存页面"},{default:t.withCtx(()=>[t.createVNode(x,{class:"btn-save",onClick:c})]),_:1})):t.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(b,{key:2,title:"编辑页面"},{default:t.withCtx(()=>[t.createVNode(v,{class:"btn-edit",onClick:m[0]||(m[0]=w=>h(!0))})]),_:1})):t.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(b,{key:3,title:"退出编辑"},{default:t.withCtx(()=>[t.createVNode(y,{class:"btn-edit",onClick:m[1]||(m[1]=w=>h(!1))})]),_:1})):t.createCommentVNode("",!0),t.renderSlot(p.$slots,"default"),n.value=="edit"?(t.openBlock(),t.createBlock(E,{key:4,title:i.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=w=>s.value=w),centered:"",width:"85%",onOk:d},{default:t.withCtx(()=>[t.createElementVNode("div",Kc,[t.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),Hc={class:"unione-props-setting data-field-manage"},Gc={key:0},Jc={key:1},Xc={key:2},Zc={key:3},ed={key:4},td={key:5},id={key:6},nd=["onClick"],ld=["onClick"],od=["onClick"],sd={key:1},ad=te(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 k=[];i.value.forEach(b=>{!p.includes(b.name)&&n.value.selectedRowKeys.includes(b.name)&&k.push(b.name)}),k.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(b=>!k.includes(b)))})}}),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 k=i.value.filter(b=>b.name==m);if(k&&k[0]){let b=o.value[m];Object.keys(b).forEach(x=>{k[0][x]=b[x]})}}o.value={}}function r(p,m){s();const k={};k[m]=p[m]||"",o.value[p.name]=k}function c(p,m){if(!p||!m){o.value={};return}const k=o.value[p.name][m];if(m=="name"&&i.value.filter(x=>x[m]==k&&x.name!=p.name).length>0){ee.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}p[m]=k,o.value={}}function d(p,m){i.value.filter(b=>b.name==p.name).forEach(b=>{b[m]=!b[m]})}function f(){if(s(),i.value.filter(k=>k.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 h(){if(!n.value.selectedRowKeys.length){ee.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}ee.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 k=t.resolveComponent("a-button"),b=t.resolveComponent("a-tooltip"),x=t.resolveComponent("a-input"),v=t.resolveComponent("a-input-number"),y=t.resolveComponent("a-select-option"),E=t.resolveComponent("a-select"),w=t.resolveComponent("a-checkbox"),u=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Hc,[t.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:t.withCtx(()=>m[1]||(m[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:h,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:B})=>[B.key==="name"?(t.openBlock(),t.createElementBlock("span",Gc,[m[3]||(m[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="title"?(t.openBlock(),t.createElementBlock("span",Jc,[m[4]||(m[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="descs"?(t.openBlock(),t.createElementBlock("span",Xc,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="dataLen"?(t.openBlock(),t.createElementBlock("span",Zc,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="dataPrec"?(t.openBlock(),t.createElementBlock("span",ed,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="defaultValue"?(t.openBlock(),t.createElementBlock("span",td,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="dataType"?(t.openBlock(),t.createElementBlock("span",id,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(B.title),1)])):t.createCommentVNode("",!0),B.key==="isPk"?(t.openBlock(),t.createBlock(b,{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(B.title),1)]),_:2},1024)):t.createCommentVNode("",!0),B.key==="isFk"?(t.openBlock(),t.createBlock(b,{key:8,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1024)):t.createCommentVNode("",!0),B.key==="isNull"?(t.openBlock(),t.createBlock(b,{key:9,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1024)):t.createCommentVNode("",!0),B.key==="syncDbEnable"?(t.openBlock(),t.createBlock(b,{key:10,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:B,text:M,record:C})=>[["name","title","descs","defaultValue"].includes(B.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(B.dataIndex))&&!M&&"empty"]),onClick:A=>r(C,B.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(B.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(x,{key:0,value:o.value[C.name][B.dataIndex],"onUpdate:value":A=>o.value[C.name][B.dataIndex]=A,onBlur:A=>c(C,B.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,nd)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(B.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(B.dataIndex))&&!M&&"empty"]),onClick:A=>r(C,B.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(B.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:o.value[C.name][B.dataIndex],"onUpdate:value":A=>o.value[C.name][B.dataIndex]=A,onBlur:A=>c(C,B.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,ld)):["dataType"].includes(B.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(B.dataIndex))&&!M&&"empty"]),onClick:A=>r(C,B.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(B.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(E,{key:0,value:C[B.dataIndex],"onUpdate:value":A=>C[B.dataIndex]=A,onBlur:m[0]||(m[0]=A=>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",sd,t.toDisplayString(M),1))],10,od)):["syncDbEnable","isFk","isPk"].includes(B.dataIndex)?(t.openBlock(),t.createBlock(w,{key:3,checked:C[B.dataIndex],onClick:A=>d(C,B.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(B.dataIndex)?(t.openBlock(),t.createBlock(w,{key:4,checked:!C[B.dataIndex],onClick:A=>d(C,B.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),rd={class:"unione-props-setting data-field-setting"},cd={key:0},dd=["onClick"],hd={class:"field-txt"},fd=["onClick"],ud={key:1,class:"field-txt"},pd=["onClick"],md={key:1},gd=["onClick"],kd={key:0,class:"field-txt"},bd={key:4,class:"edit-field"},yd={key:0},wd=["onClick"],Ad=te(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: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:"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:v=>v.focus()},l=t.ref({});function o(){const v=Object.keys(l.value);if(v.length)for(let y in v){const E=i.value.filter(w=>w.name==y);if(E&&E[0]){let w=l.value[y];Object.keys(w).forEach(u=>{u=="convertName"?(E[0].convert||(E[0].convert={}),E[0].convert.type=w[u]):E[0][u]=w[u]})}}l.value={}}function s(v,y){o();const E={};y=="convertName"?(v.convert||(v.convert={}),E[y]=v.convert?.type):E[y]=v[y]||"",l.value[v.name]=E}function r(v,y){{l.value={};return}}function c(v,y){i.value.filter(w=>w.name==v.name).forEach(w=>{w[y]=!w[y]})}const d=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function f(v,y){const E=i.value.filter(u=>u.name==v.name);E.forEach(u=>{y!="isSort"?u[y]=!0:u[y]=!u[y]});const w=E[0];if(!(!w||y=="isSort")){switch(d.value.prop=y,d.value.field=v,w.show||(w.show={}),y){case"isQuery":w.show.query||(w.show.query={}),d.value.show=w.show.query,d.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":w.show.form||(w.show.form={}),d.value.show=w.show.form,d.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":w.show.view||(w.show.view={}),d.value.show=w.show.view,d.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":w.show.list||(w.show.list={}),d.value.show=w.show.list,d.value.title=`列头设置/${v.title}(${v.name})`;break}d.value.visible=!0}}const h=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 y=h.value.options.filter(E=>E.value==v);return y[0]?y[0].label:v}}),p=t.ref({visible:!1,field:{},props:{},showInfo:v=>{let y="";return v.rules&&(y=v.rules.filter(E=>E.enable).length||""),y&&(y="("+y+")"),y},toSetting:()=>{const v=p.value.props,y={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(y.min=v.rangeMin,y.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(y.max=v.rangeMax,y.enable=!0);const E={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(E.pattern=v.regExpress,E.enable=!0),p.value.field.rules=[y,E],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function m(v){p.value.visible=!0,p.value.field=v;const y=v.rules||[],E={trigger:"change",whitespace:!0};y.forEach(w=>{w.name=="reg"&&(E.trigger=w.trigger,E.whitespace=w.whitespace,E.regExpress=w.pattern,E.regMessage=w.message),w.name=="range"&&(E.rangeMin=w.min,E.rangeMax=w.max,E.rangeMessage=w.message)}),p.value.props=E}const k=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 y=k.value.widgets.filter(E=>E.value==v);return y[0]?y[0].label:v},toSetting:()=>{}}),b=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{b.value.convert.options||(b.value.convert.options=[]),b.value.convert.options.push({label:"",value:""})},toDelOption:(v,y)=>{b.value.convert.options.splice(v,1)},toSetting:()=>{b.value.visible=!1}});function x(v){b.value.visible=!0,b.value.field=v,b.value.convert=v.convert||{}}return(v,y)=>{const E=t.resolveComponent("ToolOutlined"),w=t.resolveComponent("a-button"),u=t.resolveComponent("a-select"),B=t.resolveComponent("a-checkbox"),M=t.resolveComponent("a-table"),C=t.resolveComponent("a-input-number"),A=t.resolveComponent("a-form-item"),N=t.resolveComponent("a-input"),V=t.resolveComponent("a-form"),g=t.resolveComponent("a-modal"),S=t.resolveComponent("a-col"),I=t.resolveComponent("a-row"),R=t.resolveComponent("a-select-option"),F=t.resolveComponent("a-divider"),$=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createElementBlock("div",rd,[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:_})=>[["widget","queryType","rules","convertName"].includes(_.key)?(t.openBlock(),t.createElementBlock("span",cd,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(_.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:_,text:q,record:L})=>[["rules"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!p.value.showInfo(L)&&"empty"]),onClick:O=>m(L)},[t.createElementVNode("span",hd,t.toDisplayString(p.value.showInfo(L)),1),p.value.showInfo(L)?(t.openBlock(),t.createBlock(w,{key:0,type:"link"},{default:t.withCtx(()=>y[22]||(y[22]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,dd)):["widget"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(_.dataIndex))&&!q&&"empty"]),onClick:O=>s(L,_.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:L[_.dataIndex],"onUpdate:value":O=>L[_.dataIndex]=O,allowClear:!0,options:k.value.widgets,onBlur:y[0]||(y[0]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",ud,t.toDisplayString(k.value.widgetName(q)),1))],10,fd)):["queryType"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[L.isQuery?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(_.dataIndex))&&!q&&"empty"]),onClick:O=>s(L,_.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:L[_.dataIndex],"onUpdate:value":O=>L[_.dataIndex]=O,allowClear:!0,options:h.value.options,onBlur:y[1]||(y[1]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(t.openBlock(),t.createElementBlock("span",md,t.toDisplayString(h.value.showLabel(q)),1))],10,pd)):t.createCommentVNode("",!0)],64)):["convertName"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(_.dataIndex))&&!L.convert?.type&&"empty"]),onClick:O=>s(L,_.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(u,{key:0,value:L.convert.type,"onUpdate:value":O=>L.convert.type=O,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:y[2]||(y[2]=O=>r())},null,8,["value","onUpdate:value"])),[[n]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[L.convert?.type?(t.openBlock(),t.createElementBlock("span",kd,t.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),L.convert?.type?(t.openBlock(),t.createBlock(w,{key:1,type:"link",onClick:t.withModifiers(O=>x(L),["stop"])},{default:t.withCtx(()=>y[23]||(y[23]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,gd)):["isQuery","isForm","isView","isList","isSort"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",bd,[t.createVNode(B,{checked:L[_.dataIndex],onClick:O=>c(L,_.dataIndex)},null,8,["checked","onClick"]),t.createVNode(w,{type:"link",onClick:O=>f(L,_.dataIndex)},{default:t.withCtx(()=>y[24]||(y[24]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(g,{visible:d.value.visible,"onUpdate:visible":y[9]||(y[9]=_=>d.value.visible=_),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(A,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(C,{value:d.value.show.index,"onUpdate:value":y[3]||(y[3]=_=>d.value.show.index=_)},null,8,["value"])]),_:1}),["isQuery"].includes(d.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(A,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.width,"onUpdate:value":y[4]||(y[4]=_=>d.value.show.width=_)},null,8,["value"])]),_:1})),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(A,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.labelWidth,"onUpdate:value":y[5]||(y[5]=_=>d.value.show.labelWidth=_)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(A,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.valueWidth,"onUpdate:value":y[6]||(y[6]=_=>d.value.show.valueWidth=_)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(A,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(u,{value:d.value.show.fixed,"onUpdate:value":y[7]||(y[7]=_=>d.value.show.fixed=_),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(A,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(u,{value:d.value.show.align,"onUpdate:value":y[8]||(y[8]=_=>d.value.show.align=_),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:b.value.visible,"onUpdate:visible":y[11]||(y[11]=_=>b.value.visible=_),title:b.value.convert.type=="dict"?"字典设置":"选项设置",onOk:b.value.toSetting},{default:t.withCtx(()=>[b.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",yd,[t.createVNode(w,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:b.value.toAddOption},{default:t.withCtx(()=>y[25]||(y[25]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(M,{columns:b.value.optionColumn,"data-source":b.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:_,text:q,record:L,index:O})=>[_.dataIndex==="label"?(t.openBlock(),t.createBlock(N,{key:0,value:L.label,"onUpdate:value":G=>L.label=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),_.dataIndex==="value"?(t.openBlock(),t.createBlock(N,{key:1,value:L.value,"onUpdate:value":G=>L.value=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),_.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:G=>b.value.toDelOption(O,L)},"删除",8,wd)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),b.value.convert.type=="dict"?(t.openBlock(),t.createBlock(V,{key:1,model:b.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(I,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(S,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(A,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(N,{value:b.value.convert.dict,"onUpdate:value":y[10]||(y[10]=_=>b.value.convert.dict=_)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(g,{visible:k.value.visible,"onUpdate:visible":y[13]||(y[13]=_=>k.value.visible=_),title:"控件设置",onOk:k.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{model:k.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[k.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(A,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(u,{value:k.value.props.mode,"onUpdate:value":y[12]||(y[12]=_=>k.value.props.mode=_),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(R,{value:"multiple"},{default:t.withCtx(()=>y[26]||(y[26]=[t.createTextVNode("多选")])),_:1}),t.createVNode(R,{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(g,{visible:p.value.visible,"onUpdate:visible":y[21]||(y[21]=_=>p.value.visible=_),title:"规则设置",onOk:p.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(F,{orientation:"left"},{default:t.withCtx(()=>y[28]||(y[28]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(A,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode($,{value:p.value.props.trigger,"onUpdate:value":y[14]||(y[14]=_=>p.value.props.trigger=_),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(A,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(B,{value:p.value.props.whitespace,"onUpdate:value":y[15]||(y[15]=_=>p.value.props.whitespace=_),checked:p.value.props.whitespace},{default:t.withCtx(()=>y[29]||(y[29]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(F,{orientation:"left"},{default:t.withCtx(()=>y[30]||(y[30]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(A,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(C,{value:p.value.props.rangeMin,"onUpdate:value":y[16]||(y[16]=_=>p.value.props.rangeMin=_)},null,8,["value"]),y[31]||(y[31]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(C,{value:p.value.props.rangeMax,"onUpdate:value":y[17]||(y[17]=_=>p.value.props.rangeMax=_)},null,8,["value"])]),_:1}),t.createVNode(A,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.rangeMessage,"onUpdate:value":y[18]||(y[18]=_=>p.value.props.rangeMessage=_)},null,8,["value"])]),_:1}),t.createVNode(F,{orientation:"left"},{default:t.withCtx(()=>y[32]||(y[32]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(A,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.regExpress,"onUpdate:value":y[19]||(y[19]=_=>p.value.props.regExpress=_)},null,8,["value"])]),_:1}),t.createVNode(A,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:p.value.props.regMessage,"onUpdate:value":y[20]||(y[20]=_=>p.value.props.regMessage=_)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),xd={class:"unione-props-setting data-field"},vd=te(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",xd,[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(ad,{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(Ad,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Cd={key:0,class:"data-model-list"},Sd=["onClick"],Bd=te(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(h){n.value=h}function s(){if(i.value.length>=l.limit){ee.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const h=ga.v4(),p={sn:h,title:"新建数据",name:"new_",fields:[]};n.value=p,console.log("data model added",p),l.editor.dataModel(h,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 f(){c.value.validate().then(h=>{d&&d()})}return e({toSaving:f}),(h,p)=>{const m=t.resolveComponent("a-input"),k=t.resolveComponent("a-form-item"),b=t.resolveComponent("a-textarea"),x=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",Cd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,v=>(t.openBlock(),t.createElementBlock("div",{key:v.sn,class:t.normalizeClass(["title",n.value&&n.value.sn==v.sn&&"slt"]),onClick:y=>o(v)},t.toDisplayString(v.title),11,Sd))),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(x,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:t.withCtx(()=>[t.createVNode(k,{label:"数据标题",name:"title",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.title,"onUpdate:value":p[0]||(p[0]=v=>n.value.title=v)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"数据名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:n.value.name,"onUpdate:value":p[1]||(p[1]=v=>n.value.name=v)},null,8,["value"])]),_:1}),t.createVNode(k,{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]=v=>n.value.url=v)},null,8,["value"])]),_:1}),t.createVNode(k,{label:"数据说明",name:"descs"},{default:t.withCtx(()=>[t.createVNode(b,{value:n.value.descs,"onUpdate:value":p[3]||(p[3]=v=>n.value.descs=v)},null,8,["value"])]),_:1})]),_:1},8,["model"]),t.createVNode(vd,{modelValue:n.value.fields,"onUpdate:modelValue":p[4]||(p[4]=v=>n.value.fields=v)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Nd={class:"unione-props-setting unione-page-setting"},Bt=te(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"),f=t.resolveComponent("a-tab-pane"),h=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Nd,[t.createVNode(h,{type:"card"},{default:t.withCtx(()=>[t.createVNode(f,{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(f,{key:"dataDefine",tab:"数据设置"},{default:t.withCtx(()=>[t.createVNode(Bd,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Il=te(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 lt,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(St,{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(Bt,{editor:t.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Vd={class:"form-btns"},Fl=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}},setup(a){const e=t.inject("router"),i=a,n={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-form"};function l(){if(i.fields?.length){const p={widget:"unione-form",dsn:"primary",primary:!0,widgets:i.fields,setting:i.setting||{}};n.configs.widgets=[p]}i.storage&&(n.configs.dsnList=["primary"],o.dataManager().use("primary","form").store(i.storage)),n.configs.btns=i.btns||[],i.btns==!1&&(n.configs.btns=!1),n.configs.event=i.event||{}}const o=new lt,s=t.computed(()=>o.$widgetList.value||[]),r=t.computed(()=>{const p=o.define.value?.configs?.btns||[],m=p.map(k=>k.name);if(!m.includes("save")){const k={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};p.splice(k.index,0,k)}if(!m.includes("submit")){const k={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=k.index||1;p.splice(b,0,k)}if(!m.includes("reset")){const k={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};p.splice(k.index,0,k)}if(!m.includes("back")){const k={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};p.splice(k.index,0,k)}return o.model.value=="view"&&p.filter(k=>["save","submit","reset"].includes(k.name)).forEach(k=>{k.visible=!1}),p});function c({btn:p,event:m}){p.name=="save"&&d(),p.name=="reset",p.name=="back"&&f()}async function d(){const p=o.dataManager().form();let m={};for(let k in p){const b=await p[k].validate();if(o.dataManager().psn()==k){for(let x in m)b[x]=m[x];m=b}else m[k]=b}console.log("=======form data=====",m),o.dataManager().primary().save({data:m,params:o.dataManager().params}).then(k=>{console.log("save result:",k)})}function f(){e.back()}t.watch(()=>i.pageDefine,p=>{p&&o.load(h.value,p)});const h=t.ref("new_");return t.onMounted(()=>{const p=t.inject("route");console.log("unione page form route",p),h.value=i.psn||p?.query?.psn||p?.meta?.psn||"new_",console.log("unione page form,psn:"+h.value),o.setModel(p?.query?.model||p?.meta?.model||"run");const m={...i.params||{},...p?.query||{},...p?.params||{}};o.dataManager().params(m),l(),o.load(h.value,i.pageDefine||n)}),(p,m)=>{const k=t.resolveComponent("unione-btn");return t.openBlock(),t.createBlock(St,{class:"unione-page-form","setting-title":"页面设置",editor:t.unref(o)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,b=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:t.unref(o)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Vd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.name},[b.visible!=!1?(t.openBlock(),t.createBlock(k,{key:0,widget:b,editor:t.unref(o),ctx:{},onClick:c},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128))])]),_:2},[t.unref(o)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Bt,{editor:t.unref(o)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Rd=["onMouseover"],Ed={key:0,class:"node-opts"},Od={key:1,class:"tree-empty"},Md={class:"form-warp"},Td={class:"form-btns"},_l=te(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,{emit:e}){const i=W.useDialog(),n=t.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(l.fields?.length){const T={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[T]}o.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage),o.configs.btns=l.btns||[],l.btns==!1&&(o.configs.btns=!1),o.configs.opts=l.opts||[],l.opts==!1&&(o.configs.opts=!1),o.configs.event=l.event||{},o.configs.setting=l.setting||{}}const r=new lt,c=t.ref(!1),d=t.ref([]),f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.ref([]),k=t.ref([]),b=t.ref(0),x=t.computed(()=>{const T={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",...l.setting?.tree||{}};return r.define.value?.configs?.tree||T}),v=t.computed(()=>x.value.searchEnable),y=t.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return!1;const D=(T||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:U),Q=[];return D.forEach(U=>{Q.push(U.name)}),console.log("opts addBtn",D),D.filter(U=>U.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),E=t.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return[];const D=(T||[]).map(P=>typeof P=="string"?{name:P,visible:!1}:P),Q=[],U=[];return D.forEach(P=>{U.push(P.name),P.name!="add"&&Q.push(P)}),U.includes("delete")||Q.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),U.includes("child")||Q.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",Q),Q});function w({btn:T,event:D},Q){D.stopPropagation();const U=f.value[Q[x.value.idField]];if(console.log("onTreeMenuClick,btn:",T),console.log("onTreeMenuClick,node:",Q),console.log("onTreeMenuClick,curentNode:",U),T.name=="child"){if(R.value.preCreate&&R.value.preCreate(U)==!1)return;const P=f.value[U[x.value.idField]];P.isLeaf=!1,h.value={},h.value[x.value.pidField]=P[x.value.idField],h.value[x.value.labelField]="新建...",h.value[x.value.idField]="new_"+b.value,h.value.parentNode=P,b.value=b.value+1,P.children||(P.children=[],k.value.push(P[x.value.idField])),R.value.createNode&&R.value.createNode(h.value,P,r.dataManager().params()),f.value[h.value[x.value.idField]]=h.value,P.children.push(h.value),m.value=[h.value[x.value.idField]],r.dataManager().primary().setValue(h.value)}if(T.name=="delete"){if(R.value.preDelete&&R.value.preDelete(U)==!1)return;U[x.value.idField]&&(U[x.value.idField]+"").startsWith("new_")?(U.parentNode?U.parentNode.children=U.parentNode.children.filter(P=>P[x.value.idField]!=U[x.value.idField]):d.value=d.value.filter(P=>P[x.value.idField]!=U[x.value.idField]),delete f.value[U[x.value.idField]]):r.dataManager().primary().deleteByIds([U[x.value.idField]]).then(()=>{if(U.parentNode){const P=f.value[U[x.value.pidField]];P.children=P.children.filter(se=>se[x.value.idField]!=U[x.value.idField])}else d.value=d.value.filter(P=>P[x.value.idField]!=U[x.value.idField]);delete f.value[U[x.value.idField]]})}}function u(T,{expanded:D,node:Q}){D&&(h.value=Q.dataRef,r.dataManager().primary().setValue(h.value),S())}function B(T,D){D.selected?(h.value=D.node.dataRef,r.dataManager().primary().setValue(h.value)):h.value&&(m.value=[h.value[x.value.idField]]),_("treeClick",{keys:T,event:D}),_("select",{keys:T,event:D})}const M=t.computed(()=>{if(l.storage?.orderBy){const T=l.storage.orderBy.split(" ");return[{name:T[0],asc:T[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>l.params,()=>{c.value&&(d.value=[],f.value={},h.value=null,m.value=[],k.value=[],b.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),S())}),t.watch(()=>h.value,()=>{console.log("active node changed",h.value),A(!h.value)});const C=t.ref(null);t.watch(C,()=>{C.value&&h.value&&r.dataManager().primary().setValue(h.value)});function A(T=!0){const D=r.dataManager().form();for(let Q in D)D[Q].setDisabled(T)}function N(){if(!(R.value.preCreate&&R.value.preCreate()==!1)){if(h.value={},h.value[x.value.pidField]=-1,h.value[x.value.labelField]="新建...",h.value[x.value.idField]="new_"+b.value,b.value=b.value+1,R.value.createNode&&R.value.createNode(h.value,null,r.dataManager().params()),h.value[x.value.pidField]==-1)d.value.push(h.value);else{const T=f.value[h.value[x.value.pidField]];T?(T.children||(T.children=[]),T.children.push(h.value)):d.value.push(h.value)}m.value=[h.value[x.value.idField]],f.value[h.value[x.value.idField]]=h.value,r.dataManager().primary().setValue(h.value)}}const V=t.ref(""),g=pt(T=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:T||V.value,needCount:!1,body:x.value.async==!1?null:{},sorts:M.value}).then(D=>{if(f.value={},d.value=[],D.body?.length){const Q={};D.body.forEach(U=>{Q[U[x.value.idField]]=U}),D.body.forEach(U=>{const P=Q[U[x.value.pidField]];P?(P.children||(P.children=[],P.isLeaf=!1),P.children.push(U)):d.value.push(U)})}})},400);function S(){return new Promise((T,D)=>{const Q={};if(Q[x.value.pidField]=l.params[x.value.pidField]||-1,h.value){if(h.value.children?.length||x.value.async==!1){T(h.value.children);return}Q[x.value.pidField]=h.value[x.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:Q,sorts:M.value}).then(U=>{h.value.children=U.body||[],h.value.children.forEach(P=>{P.isLeaf=!!P[x.value.leafField],f.value[P[x.value.idField]]=P,P.parentNode=f.value[P[x.value.pidField]]}),T(U.body)})}else{const U=x.value.async==!1?null:{page:1,pageSize:999,body:Q,sorts:M.value};r.dataManager().primary().find(U).then(P=>{if(x.value.async==!1){if(d.value=[],P.body?.length){const se={};P.body.forEach(X=>{se[X[x.value.idField]]=X}),P.body.forEach(X=>{const H=se[X[x.value.pidField]];H?(H.children||(H.children=[],H.isLeaf=!1),H.children.push(X)):d.value.push(X)})}T(P.body)}else d.value=P.body||[],d.value.forEach(se=>{se.isLeaf=!!se[x.value.leafField],f.value[se[x.value.idField]]=se}),T(P.body)})}})}const I=t.computed(()=>r.$widgetList.value||[]),R=t.computed(()=>{const T={...r.define.value?.configs?.event||{}};for(const D in T)T[D]&&typeof T[D]!="function"&&T[D].enable&&T[D].scriptText&&(D=="createNode"&&(T[D]=new Function("node","parent","params",T[D].scriptText)),D=="preCreate"?T[D]=new Function("parent",T[D].scriptText):T[D]=new Function("data","event",T[D].scriptText));return T}),F=t.computed(()=>r.define.value?.configs?.setting||l.setting||{});t.provide("pageSetting",F.value);const $=t.computed(()=>{const T=r.define.value?.configs?.btns;if(typeof T=="boolean"&&T==!1)return[];const D=(r.define.value?.configs?.btns||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:{size:"default",...U}),Q=D.map(U=>U.name);if(!Q.includes("save")){const U={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};D.splice(U.index,0,U)}if(!Q.includes("reset")){const U={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};D.splice(U.index,0,U)}if(!Q.includes("back")){const U={title:"返回",type:"default",index:D.length,visible:!0,size:"default",name:"back"};D.splice(U.index,0,U)}return r.model.value=="view"&&D.filter(U=>["save","submit","reset"].includes(U.name)).forEach(U=>{U.visible=!1}),D}),_=e;function q({btn:T,event:D}){T.name=="save"&&L({btn:T,event:D}),T.name=="reset",T.name=="back"&&O(),_("btnClick",{btn:T,event:D})}async function L(T){const D=r.dataManager().form();let Q={...h.value};for(let U in D){const P=await D[U].validate();if(r.dataManager().psn()==U)for(let se in P)Q[se]=P[se];else Q[U]=P}if(Q[x.value.pidField]&&(Q[x.value.pidField]+"").startsWith("new_")){i.error({content:"请先保存父节点!"});return}Q[x.value.idField]&&(Q[x.value.idField]+"").startsWith("new_")&&delete Q[x.value.idField],delete Q.parentNode,delete Q.children,Q[x.value.leafField]=Q[x.value.leafField]?1:0,R.value.preSave&&R.value.preSave(Q,T),console.log("=======form data=====",Q),r.dataManager().primary().save({data:Q}).then(U=>{console.log("save result:",U),h.value[x.value.idField]=U.body,m.value=[U.body],f.value[U.body]=h.value,h.value.children?.forEach(P=>{P[x.value.pidField]=U.body}),R.value.postSaved&&R.value.postSaved(Q,T)})}function O(){n.back()}const G=t.ref("new_");return t.onMounted(()=>{const T=t.inject("route");console.log("unione page tree route",T),G.value=l.psn||T?.query?.psn||T?.meta?.psn||"new_",console.log("unione page tree,psn:"+G.value),r.setModel(T?.query?.model||T?.meta?.model||"run");const D={...l.params||{},...T?.query||{},...T?.params||{}};r.dataManager().params(D),s(),r.load(G.value,o),t.nextTick(()=>{A(!0)}),S().then(Q=>{if(Q&&Q[0]&&x.value.selectable&&x.value.autoselect){const U={...Q[0],dataRef:Q[0]};m.value=[Q[0].id],_("select",{keys:m.value,event:{node:U}})}}),c.value=!0}),(T,D)=>{const Q=t.resolveComponent("SearchOutlined"),U=t.resolveComponent("a-input"),P=t.resolveComponent("unione-btn"),se=t.resolveComponent("a-tree"),X=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(St,{class:"unione-page-tree","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"tree-warp",onContextmenu:D[6]||(D[6]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot(T.$slots,"tree-top",{onChange:D[0]||(D[0]=(...H)=>t.unref(g)&&t.unref(g)(...H)),onPressEnter:D[1]||(D[1]=(...H)=>t.unref(g)&&t.unref(g)(...H))},()=>[v.value?(t.openBlock(),t.createBlock(U,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:V.value,"onUpdate:value":D[2]||(D[2]=H=>V.value=H),onChange:t.unref(g),onPressEnter:t.unref(g)},{suffix:t.withCtx(()=>[t.createVNode(Q)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0)],!0),y.value?(t.openBlock(),t.createBlock(P,{key:0,widget:y.value,onClick:N},null,8,["widget"])):t.createCommentVNode("",!0),t.createVNode(se,{"show-line":x.value.showLine,"show-icon":x.value.showIcon,disabled:x.value.disabled,blockNode:!0,draggable:x.value.draggable,multiple:x.value.multiple,selectable:x.value.selectable,checkable:x.value.checkable,fieldNames:{title:x.value.labelField,key:x.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":D[4]||(D[4]=H=>m.value=H),expandedKeys:k.value,"onUpdate:expandedKeys":D[5]||(D[5]=H=>k.value=H),"tree-data":d.value,onExpand:u,onSelect:B},t.createSlots({icon:t.withCtx(({dataRef:H})=>[H[x.value.iconField]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(H[x.value.iconField]),{key:0,class:"node-icon"})):t.createCommentVNode("",!0)]),_:2},[E.value?.length?{name:"title",fn:t.withCtx(({dataRef:H})=>[t.createElementVNode("div",{class:"node-label",onMouseover:()=>p.value=H,onMouseleave:D[3]||(D[3]=()=>p.value=null)},[t.createElementVNode("span",null,t.toDisplayString(H[x.value.labelField]),1),h.value&&h.value[x.value.idField]==H[x.value.idField]||p.value&&p.value[x.value.idField]==H[x.value.idField]?(t.openBlock(),t.createElementBlock("div",Ed,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,xl=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!R.value.btnVisible||R.value.btnVisible(xl,H)?(t.openBlock(),t.createBlock(P,{key:xl.name,widget:xl,ctx:{node:H},onClick:op=>w(op,H)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],40,Rd)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"]),!d.value||!d.value.length?(t.openBlock(),t.createElementBlock("div",Od,[t.renderSlot(T.$slots,"tree-empty",{},()=>[t.createVNode(X)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",Md,[t.renderSlot(T.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:C},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,H=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(H.widget),{key:H.wid,wid:H.wid,widget:H,editor:t.unref(r)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Td,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList($.value,H=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:H.name},[H.visible!=!1?(t.openBlock(),t.createBlock(P,{key:0,widget:H,editor:t.unref(r),disabled:!h.value,ctx:{},onClick:q},null,8,["widget","editor","disabled"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Bt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-6776200f"]]),Dl=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(E=>E.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(E=>E.isPk)[0];y&&y.name&&(o.configs.widgets[1].dataKey=y.name),o.configs.widgets[1].columns=n.fields.filter(E=>E.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 lt,c=t.computed(()=>r.$widgetList.value||[]),d=i;function f(y){d("btnClick",y)}const h=t.ref("new_");t.onMounted(()=>{const y=t.inject("route");console.log("unione page view route",y),h.value=n.psn||y?.query?.psn||y?.meta?.psn||"new_",console.log("unione page view,psn:"+h.value),r.setModel(y?.query?.model||y?.meta?.model||"run");const E={...n.params||{},...y?.query||{},...y?.params||{}};r.dataManager().params(E),s(),r.load(h.value,o)});function p(){return r.dataManager().use("primary","list")}function m(y){y?r.ebus.$emit("table-list-search",y):r.ebus.$emit("table-list-reload")}function k(y){r.dataManager().params(y),r.ebus.$emit("query-form-params",y),r.ebus.$emit("table-list-search",{params:y})}function b(){return l.value?l.value[0]:null}function x(){return l.value?l.value[0].getSelected():null}function v(){l.value&&l.value[0].clearSelected()}return e({storage:p,editor:r,reload:m,setParams:k,getTable:b,getSelected:x,clearSelected:v}),(y,E)=>(t.openBlock(),t.createBlock(St,{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,w=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:w.wid},[w.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(w.widget),{key:0,wid:w.wid,widget:w,editor:t.unref(r),onBtnClick:f,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(w.widget),{key:1,wid:w.wid,widget:w,editor:t.unref(r),onBtnClick:f},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Bt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),Pl=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=W.useDialog(),l=W.useSession(),o=new Le({types:"dict",dictName:"FLOWLITETASKSTATUS"}),s=a,r=t.ref(null),c=t.ref(null),d={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:(C,A,N)=>{o.convert(C.status).then(V=>{const g=[];V&&g.push(V),C.handleUserId&&g.push("已签收"),g.length>0&&(C[N.dataIndex]=g.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:"操作",btns:["edit","delete",{title:"签收",name:"sign",event:{visible:C=>!C.row.handleUserId}},{title:"放弃",name:"waive",props:{danger:!0},event:{visible:C=>!!C.row.handleUserId}},{title:"审核",name:"audit",type:"primary"}],count:3,more:{layout:"vertical"}}}],dsnList:["primary"]},component:"unione-flow-todo"};function f(){W.axios.flow({url:`/api/engine/profile/${s.flowKey}${s.flowVers?"/"+s.flowVers:""}`,method:"post"}).then(C=>{if(console.log("loaded flow tmpl info",C),C.success){const A=C.body.busiField;A&&A.forEach(N=>{N.visible!=!1&&(N.index!=null&&N.index!=null?d.configs.widgets[1].columns.splice(N.index,0,{title:N.title,name:"instance.busiData."+N.name}):d.configs.widgets[1].columns.push({title:N.title,name:"instance.busiData."+N.name}))}),l.setStorage("page-define-flow-todo:"+s.flowKey,JSON.stringify(d.configs)),h.load(v.value,d)}})}const h=new lt,p=t.computed(()=>h.$widgetList.value||[]),m=i;function k(C){const{btn:A,row:N,keys:V}=C;if(A.name=="audit"&&c.value.open(N?N.id:V,{flowKey:N?.instance?.sn,nodeKey:N?.sn}),A.name=="auditBatch"&&c.value.open(V),A.name=="sign"&&b(N.id),A.name=="signBatch"){if(V.length==0){n.warning("请选择要签收的任务");return}b(V)}if(A.name=="waive"&&x(N.id),A.name=="waiveBatch"){if(V.length==0){n.warning("请选择要放弃的任务");return}x(V)}m("btnClick",C)}function b(C){const A={};Array.isArray(C)?A.taskIds=C:A.taskId=C,n.confirm({content:"确定签收吗?",onOk:()=>{W.axios.flow({url:"/api/engine/task/sign",method:"post",data:A}).then(N=>{N.success?(n.success("签收成功"),E()):n.error(N.msg)})}})}function x(C){const A={};Array.isArray(C)?A.taskIds=C:A.taskId=C,n.confirm({content:"确定签收吗?",onOk:()=>{W.axios.flow({url:"/api/engine/task/waive",method:"post",data:A}).then(N=>{N.success?(n.success("操作成功"),E()):n.error(N.msg)})}})}const v=t.ref("new_");t.onMounted(()=>{const C=t.inject("route");console.log("unione flow todo route",C),v.value=s.psn||C?.query?.psn||C?.meta?.psn||"new_",console.log("unione flow todo psn:"+v.value),h.setModel(C?.query?.model||C?.meta?.model||"run");const A={...s.params||{},...C?.query||{},...C?.params||{}};h.dataManager().params(A),s.leftBtns&&Array.isArray(s.leftBtns)&&(d.configs.widgets[1].leftBtns=[...d.configs.widgets[1].leftBtns,...s.leftBtns]),s.rightBtns&&Array.isArray(s.rightBtns)&&(d.configs.widgets[1].rightBtns=[...d.configs.widgets[1].rightBtns,...s.rightBtns]),s.operation&&typeof s.operation=="object"&&(d.configs.widgets[1].operation={...d.configs.widgets[1].operation,...s.operation}),h.dataManager().use("primary","list").store({ctx:"flow",controller:"/api/engine/task/",findUrl:"/todo",findParams:[{name:"flowSn",value:s.flowKey}]}),s.flowKey?f():h.load(v.value,d)});function y(){return h.dataManager().use("primary","list")}function E(C){M(),C?h.ebus.$emit("table-list-search",C):h.ebus.$emit("table-list-reload")}function w(C){h.dataManager().params(C),h.ebus.$emit("query-form-params",C),h.ebus.$emit("table-list-search",{params:C})}function u(){return r.value?r.value[0]:null}function B(){return r.value?r.value[0].getSelected():null}function M(){r.value&&r.value[0].clearSelected(!0)}return e({storage:y,editor:h,reload:E,setParams:w,getTable:u,getSelected:B,clearSelected:M}),(C,A)=>{const N=t.resolveComponent("UnioneFlowAudit");return t.openBlock(),t.createBlock(St,{class:"unione-flow-todo","setting-title":"页面设置",editor:t.unref(h)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,V=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:V.wid},[V.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(V.widget),{key:0,wid:V.wid,widget:V,editor:t.unref(h),onBtnClick:k,ref_for:!0,ref_key:"table",ref:r},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(V.widget),{key:1,wid:V.wid,widget:V,editor:t.unref(h),onBtnClick:k},null,40,["wid","widget","editor"]))],64))),128)),t.createVNode(N,{ref_key:"audit",ref:c,onSuccess:A[0]||(A[0]=V=>E())},null,512)]),_:2},[t.unref(h)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Bt,{editor:t.unref(h)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Id={class:"handel-opinion"},Fd={key:0,class:"preset-opinions"},_d={class:"ok"},Dd={class:"reject"},Pd=t.defineComponent({name:"FlowAudit",__name:"audit",props:{vars:{type:Object,required:!1}},emits:["success"],setup(a,{expose:e,emit:i}){const n=W.useDialog(),l=a,o=i,s=t.ref(!1),r=t.ref(),c=t.ref({flowKey:"",nodeKey:""}),d=t.ref([]),f=t.ref(),h=t.ref({data:{handelOpinion:""},rules:{handelOpinion:[{required:!0,message:"请输入处理意见"}]}});function p(){s.value=!1}function m(v,{flowKey:y,nodeKey:E}={}){if(r.value=v,!v){n.error("任务id不能为空");return}s.value=!0,c.value.flowKey=y,c.value.nodeKey=E,h.value.data.handelOpinion="",k()}function k(){const{flowKey:v,nodeKey:y}=c.value;W.axios.flow({url:`/api/engine/opinion/preset/${v||"-1"}/${y||"-1"}`,method:"post"}).then(E=>{d.value=E.body})}function b(v){h.value.data.handelOpinion=v.optxt}function x(v){f.value.validate().then(()=>{n.confirm({context:"确定提交么?",onOk:()=>{const y={result:v,opinion:h.value.data.handelOpinion,vars:l.vars};Array.isArray(r.value)?y.taskIds=r.value:y.taskId=r.value,W.axios.flow({url:"/api/engine/task/submit",method:"post",data:y}).then(E=>{E.success?(n.success("提交成功"),p(),o("success")):n.error(E.msg)})}})})}return e({open:m}),(v,y)=>{const E=t.resolveComponent("a-textarea"),w=t.resolveComponent("a-form-item"),u=t.resolveComponent("a-tag"),B=t.resolveComponent("a-form"),M=t.resolveComponent("a-button"),C=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(C,{title:"审核",visible:s.value,"onUpdate:visible":y[3]||(y[3]=A=>s.value=A),width:600,rootClassName:"flow-audit-drawer"},{footer:t.withCtx(()=>[t.createVNode(M,{type:"primary",onClick:y[1]||(y[1]=A=>x(!0))},{default:t.withCtx(()=>y[4]||(y[4]=[t.createTextVNode("同意")])),_:1}),t.createVNode(M,{type:"primary",danger:"",onClick:y[2]||(y[2]=A=>x(!1))},{default:t.withCtx(()=>y[5]||(y[5]=[t.createTextVNode("拒绝")])),_:1})]),default:t.withCtx(()=>[t.createVNode(B,{layout:"vertical",model:h.value.data,rules:h.value.rules,ref_key:"formRef",ref:f},{default:t.withCtx(()=>[t.createElementVNode("div",Id,[t.createVNode(w,{label:"处理意见:",name:"handelOpinion"},{default:t.withCtx(()=>[t.createVNode(E,{value:h.value.data.handelOpinion,"onUpdate:value":y[0]||(y[0]=A=>h.value.data.handelOpinion=A),autoSize:"",rows:10,placeholder:"请输入处理意见"},null,8,["value"])]),_:1})]),d.value&&d.value.length?(t.openBlock(),t.createElementBlock("div",Fd,[t.createVNode(w,{label:"预设意见:"},{default:t.withCtx(()=>[t.createElementVNode("div",_d,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.filter(A=>A.types==1),A=>(t.openBlock(),t.createBlock(u,{key:A.id,color:"success",onClick:N=>b(A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(A.title),1)]),_:2},1032,["onClick"]))),128))]),t.createElementVNode("div",Dd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.filter(A=>A.types==2),A=>(t.openBlock(),t.createBlock(u,{key:A.id,color:"orange",onClick:N=>b(A)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(A.title),1)]),_:2},1032,["onClick"]))),128))])]),_:1})])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])]),_:1},8,["visible"])}}}),mt={release(a){return W.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return W.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return W.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return W.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return W.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return W.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return W.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},$d={class:"unione-page list-page"},Ld=te(t.defineComponent({__name:"list",setup(a){const e=Fe(),i=W.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,mt.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(w=>{s.value.data=w.body,s.value.pagination.total=w.total*1}).finally(()=>{s.value.loading=!1})}function c(w){s.value.pagination.current=w.pagination.current,s.value.pagination.pageSize=w.pagination.pageSize,r()}function d({params:w,keywords:u}){s.value.pagination.current=1,s.value.params=w,s.value.keywords=u,r()}function f({btn:w,event:u,row:B}){console.log("table btn click",w,u,B),(w.name=="add"||w.name=="edit")&&n.push({path:"/dev/data/define/edit",query:B?{id:B.id}:{}}),w.name=="impFromDb"&&(p.value=!0),w.name=="release"&&h(B),w.name=="view"&&n.push({path:e.listPageUrl,query:{psn:B.sn+":list",model:"preview"}})}function h(w){i.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([w.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}}]}),k=t.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),b=t.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function x(w){!w||!Object.keys(w).length||!w.dsId||(ee.message.loading("数据加载中..."),b.value.params=w,b.value.loading=!0,mt.loadFromDb(w).then(u=>{b.value.loading=!1,ee.message.destroy(),u.success?(u.body.forEach(B=>{B.checkable=!!B.id}),b.value.data=u.body,b.value.pagination.total=u.body.length):ee.message.error(u.message)}))}function v(w){b.value.pagination.current=w.pagination.current,b.value.pagination.pageSize=w.pagination.pageSize}const y=t.ref();function E({btn:w}){if(w.name!="imp")return;const u=y.value.getSelected();u?.keys?.length?i.confirm({content:"确定导入选中的"+u.keys.length+"条记录么?",onOk:()=>{ee.message.loading("数据导入中..."),mt.impFromDb({dsId:b.value.params.dsId,tables:u.keys.join()}).then(B=>{ee.message.destroy(),B.success?(i.success({content:B.message}),s.value.pagination.current=1,r()):i.error({context:B.message})})}}):i.error({content:"请选择目标记录!"})}return(w,u)=>{const B=t.resolveComponent("UnioneQuery"),M=t.resolveComponent("UnioneTable"),C=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",$d,[t.createVNode(B,{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:f},null,8,["widget","dataList","loading","pagination"]),t.createVNode(C,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":u[0]||(u[0]=A=>p.value=A),placement:"left"},{default:t.withCtx(()=>[t.createVNode(B,{widget:m.value,onQuery:x,onReset:x,onBtnClick:E,class:"load-table-form"},null,8,["widget"]),t.createVNode(M,{widget:k.value,dataList:b.value.data,loading:b.value.loading,pagination:b.value.pagination,onChange:v,rowKey:"name",ref_key:"loadTableObj",ref:y},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),Ud={class:"unione-props-setting data-field-manage"},zd={key:0},jd={key:1},qd=["onClick"],Qd=["onClick"],Wd=["onClick"],Yd={key:1},Kd=te(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(k=>{n.value.selectedRowKeys.includes(k)||n.value.selectedRowKeys.push(k);const b=[];i.value.forEach(x=>{!m.includes(x.name)&&n.value.selectedRowKeys.includes(x.name)&&b.push(x.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(x=>!b.includes(x)))})}}),l={mounted:m=>m.focus()},o=t.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let k in m){const b=i.value.filter(x=>x.name==k);if(b&&b[0]){let x=o.value[k];Object.keys(x).forEach(v=>{b[0][v]=x[v]})}}o.value={}}function r(m,k){s();const b={};b[k]=m[k]||"",o.value[m.name]=b}function c(m,k){if(!m||!k){o.value={};return}const b=o.value[m.name][k];if(k=="name"&&i.value.filter(v=>v[k]==b&&v.name!=m.name).length>0){ee.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}m[k]=b,o.value={}}function d(m,k){const b=i.value.filter(x=>x.name==m.name)[0];return k=="isFk"?b.configs?.fkey?.enable:b[k]==1}function f(m,k){const b=i.value.filter(x=>x.name==m.name)[0];k=="isFk"?(b.configs||(b.configs={}),b.configs.fkey||(b.configs.fkey={}),b.configs.fkey.enable=!b.configs.fkey.enable):b[k]!=1?b[k]=1:b[k]=0}function h(){if(s(),i.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const k={title:"",name:"new_",dataType:"String",isPk:0};i.value.push(k),o.value[k.name]={name:"new_"}}function p(){if(!n.value.selectedRowKeys.length){ee.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}ee.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,k)=>{const b=t.resolveComponent("a-button"),x=t.resolveComponent("a-tooltip"),v=t.resolveComponent("a-input"),y=t.resolveComponent("a-input-number"),E=t.resolveComponent("a-select-option"),w=t.resolveComponent("a-select"),u=t.resolveComponent("a-checkbox"),B=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Ud,[t.createVNode(b,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:t.withCtx(()=>k[1]||(k[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:t.withCtx(()=>k[2]||(k[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(B,{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",zd,[k[3]||(k[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(t.openBlock(),t.createElementBlock("span",jd,[t.createVNode(t.unref(Ge.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(M.title),1)])):t.createCommentVNode("",!0),M.key==="isPk"?(t.openBlock(),t.createBlock(x,{key:2,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[k[4]||(k[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(x,{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(x,{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(x,{key:5,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(M.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:M,text:C,record:A})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[A.name]||!Object.keys(o.value[A.name]).includes(M.dataIndex))&&!C&&"empty"]),onClick:N=>r(A,M.dataIndex)},[o.value[A.name]&&Object.keys(o.value[A.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:o.value[A.name][M.dataIndex],"onUpdate:value":N=>o.value[A.name][M.dataIndex]=N,onBlur:N=>c(A,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(C||" "),1)],64))],10,qd)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[A.name]||!Object.keys(o.value[A.name]).includes(M.dataIndex))&&!C&&"empty"]),onClick:N=>r(A,M.dataIndex)},[o.value[A.name]&&Object.keys(o.value[A.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[A.name][M.dataIndex],"onUpdate:value":N=>o.value[A.name][M.dataIndex]=N,onBlur:N=>c(A,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(C||" "),1)],64))],10,Qd)):["dataType"].includes(M.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[A.name]||!Object.keys(o.value[A.name]).includes(M.dataIndex))&&!C&&"empty"]),onClick:N=>r(A,M.dataIndex)},[o.value[A.name]&&Object.keys(o.value[A.name]).includes(M.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(w,{key:0,value:A[M.dataIndex],"onUpdate:value":N=>A[M.dataIndex]=N,onBlur:k[0]||(k[0]=N=>c())},{default:t.withCtx(()=>[t.createVNode(E,{key:"String",value:"String"}),t.createVNode(E,{key:"Long",value:"Long"}),t.createVNode(E,{key:"Short",value:"Short"}),t.createVNode(E,{key:"Integer",value:"Integer"}),t.createVNode(E,{key:"Float",value:"Float"}),t.createVNode(E,{key:"Double",value:"Double"}),t.createVNode(E,{key:"Date",value:"Date"}),t.createVNode(E,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",Yd,t.toDisplayString(C),1))],10,Wd)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(u,{key:3,checked:d(A,M.dataIndex),onClick:N=>f(A,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(t.openBlock(),t.createBlock(u,{key:4,checked:!d(A,M.dataIndex),onClick:N=>f(A,M.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),$l=1024;let Hd=0,an=class{constructor(e,i){this.from=e,this.to=i}};class ne{constructor(e={}){this.id=Hd++,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=Be.match(e)),i=>{let n=e(i);return n===void 0?null:[this,n]}}}ne.closedBy=new ne({deserialize:a=>a.split(" ")}),ne.openedBy=new ne({deserialize:a=>a.split(" ")}),ne.group=new ne({deserialize:a=>a.split(" ")}),ne.isolate=new ne({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),ne.contextHash=new ne({perNode:!0}),ne.lookAhead=new ne({perNode:!0}),ne.mounted=new ne({perNode:!0});class ui{constructor(e,i,n){this.tree=e,this.overlay=i,this.parser=n}static get(e){return e&&e.props&&e.props[ne.mounted.id]}}const Gd=Object.create(null);class Be{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):Gd,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Be(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(ne.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(ne.group),o=-1;o<(l?l.length:0);o++){let s=i[o<0?n.name:l[o]];if(s)return s}}}}Be.none=new Be("",Object.create(null),0,8);class rn{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 Be(n.name,l,n.id,n.flags):n)}return new rn(i)}}const pi=new WeakMap,Ll=new WeakMap;var ge;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(ge||(ge={}));class ue{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=ui.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 hn(this.topNode,e)}cursorAt(e,i=0,n=0){let l=pi.get(this)||this.topNode,o=new hn(l);return o.moveTo(e,i),pi.set(this,o._tree),o}get topNode(){return new Oe(this,0,0,null)}resolve(e,i=0){let n=Wt(pi.get(this)||this.topNode,e,i,!1);return pi.set(this,n),n}resolveInner(e,i=0){let n=Wt(Ll.get(this)||this.topNode,e,i,!0);return Ll.set(this,n),n}resolveStack(e,i=0){return Zd(this,e,i)}iterate(e){let{enter:i,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&ge.IncludeAnonymous)>0;for(let c=this.cursor(s|ge.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:un(Be.none,this.children,this.positions,0,this.children.length,0,this.length,(i,n,l)=>new ue(this.type,i,n,l,this.propValues),e.makeTree||((i,n,l)=>new ue(Be.none,i,n,l)))}static build(e){return eh(e)}}ue.empty=new ue(Be.none,[],[],0);class cn{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 cn(this.buffer,this.index)}}class st{constructor(e,i,n){this.buffer=e,this.length=i,this.set=n}get type(){return Be.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&&!(Ul(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 st(o,s,this.set)}}function Ul(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 Wt(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 Oe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:ge.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Oe&&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 zl{cursor(e=0){return new hn(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 Wt(this,e,i,!1)}resolveInner(e,i=0){return Wt(this,e,i,!0)}matchContext(e){return dn(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 Oe extends zl{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 f=r[e],h=c[e]+s.from;if(Ul(l,n,h,h+f.length)){if(f instanceof st){if(o&ge.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,i,n-h,l);if(p>-1)return new at(new Jd(s,f,e,h),null,p)}else if(o&ge.IncludeAnonymous||!f.type.isAnonymous||fn(f)){let p;if(!(o&ge.IgnoreMounts)&&(p=ui.get(f))&&!p.overlay)return new Oe(p.tree,h,e,s);let m=new Oe(f,h,e,s);return o&ge.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(i<0?f.children.length-1:0,i,n,l)}}}if(o&ge.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&ge.IgnoreOverlays)&&(l=ui.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 Oe(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 dn(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 Jd{constructor(e,i,n,l){this.parent=e,this.buffer=i,this.index=n,this.start=l}}class at extends zl{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 at(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&ge.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 at(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 at(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 at(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 ue(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ql(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 Oe&&i.index<0?null:i.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Xd(l,i)}class Xd{constructor(e,i){this.heads=e,this.node=i}get next(){return ql(this.heads)}}function Zd(a,e,i){let n=a.resolveInner(e,i),l=null;for(let o=n instanceof Oe?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=ui.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Oe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(Wt(r,e,i,!1))}}return l?ql(l):n}class hn{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 Oe)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 Oe?(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&ge.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ge.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ge.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&ge.IncludeAnonymous||r instanceof st||!r.type.isAnonymous||fn(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 at(this.buffer,i,this.stack[l]);return this.bufferNode=new at(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 dn(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 dn(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 fn(a){return a.children.some(e=>e instanceof st||!e.type.isAnonymous||fn(e))}function eh(a){var e;let{buffer:i,nodeSet:n,maxBufferLength:l=$l,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(i)?new cn(i,i.length):i,c=n.types,d=0,f=0;function h(u,B,M,C,A,N){let{id:V,start:g,end:S,size:I}=r,R=f;for(;I<0;)if(r.next(),I==-1){let L=o[V];M.push(L),C.push(g-u);return}else if(I==-3){d=V;return}else if(I==-4){f=V;return}else throw new RangeError(`Unrecognized record size: ${I}`);let F=c[V],$,_,q=g-u;if(S-g<=l&&(_=x(r.pos-B,A))){let L=new Uint16Array(_.size-_.skip),O=r.pos-_.size,G=L.length;for(;r.pos>O;)G=v(_.start,L,G);$=new st(L,S-_.start,n),q=_.start-u}else{let L=r.pos-I;r.next();let O=[],G=[],T=V>=s?V:-1,D=0,Q=S;for(;r.pos>L;)T>=0&&r.id==T&&r.size>=0?(r.end<=Q-l&&(k(O,G,g,D,r.end,Q,T,R),D=O.length,Q=r.end),r.next()):N>2500?p(g,L,O,G):h(g,L,O,G,T,N+1);if(T>=0&&D>0&&D<O.length&&k(O,G,g,D,g,Q,T,R),O.reverse(),G.reverse(),T>-1&&D>0){let U=m(F);$=un(F,O,G,0,O.length,0,S-g,U,U)}else $=b(F,O,G,S-g,R-S)}M.push($),C.push(q)}function p(u,B,M,C){let A=[],N=0,V=-1;for(;r.pos>B;){let{id:g,start:S,end:I,size:R}=r;if(R>4)r.next();else{if(V>-1&&S<V)break;V<0&&(V=I-l),A.push(g,S,I),N++,r.next()}}if(N){let g=new Uint16Array(N*4),S=A[A.length-2];for(let I=A.length-3,R=0;I>=0;I-=3)g[R++]=A[I],g[R++]=A[I+1]-S,g[R++]=A[I+2]-S,g[R++]=R;M.push(new st(g,A[2]-S,n)),C.push(S-u)}}function m(u){return(B,M,C)=>{let A=0,N=B.length-1,V,g;if(N>=0&&(V=B[N])instanceof ue){if(!N&&V.type==u&&V.length==C)return V;(g=V.prop(ne.lookAhead))&&(A=M[N]+V.length+g)}return b(u,B,M,C,A)}}function k(u,B,M,C,A,N,V,g){let S=[],I=[];for(;u.length>C;)S.push(u.pop()),I.push(B.pop()+M-A);u.push(b(n.types[V],S,I,N-A,g-N)),B.push(A-M)}function b(u,B,M,C,A=0,N){if(d){let V=[ne.contextHash,d];N=N?[V].concat(N):[V]}if(A>25){let V=[ne.lookAhead,A];N=N?[V].concat(N):[V]}return new ue(u,B,M,C,N)}function x(u,B){let M=r.fork(),C=0,A=0,N=0,V=M.end-l,g={size:0,start:0,skip:0};e:for(let S=M.pos-u;M.pos>S;){let I=M.size;if(M.id==B&&I>=0){g.size=C,g.start=A,g.skip=N,N+=4,C+=4,M.next();continue}let R=M.pos-I;if(I<0||R<S||M.start<V)break;let F=M.id>=s?4:0,$=M.start;for(M.next();M.pos>R;){if(M.size<0)if(M.size==-3)F+=4;else break e;else M.id>=s&&(F+=4);M.next()}A=$,C+=I,N+=F}return(B<0||C==u)&&(g.size=C,g.start=A,g.skip=N),g.size>4?g:void 0}function v(u,B,M){let{id:C,start:A,end:N,size:V}=r;if(r.next(),V>=0&&C<s){let g=M;if(V>4){let S=r.pos-(V-4);for(;r.pos>S;)M=v(u,B,M)}B[--M]=g,B[--M]=N-u,B[--M]=A-u,B[--M]=C}else V==-3?d=C:V==-4&&(f=C);return M}let y=[],E=[];for(;r.pos>0;)h(a.start||0,a.bufferStart||0,y,E,-1,0);let w=(e=a.length)!==null&&e!==void 0?e:y.length?E[0]+y[0].length:0;return new ue(c[a.topID],y.reverse(),E.reverse(),w)}const Ql=new WeakMap;function mi(a,e){if(!a.isAnonymous||e instanceof st||e.type!=a)return 1;let i=Ql.get(e);if(i==null){i=1;for(let n of e.children){if(n.type!=a||!(n instanceof ue)){i=1;break}i+=mi(a,n)}Ql.set(e,i)}return i}function un(a,e,i,n,l,o,s,r,c){let d=0;for(let k=n;k<l;k++)d+=mi(a,e[k]);let f=Math.ceil(d*1.5/8),h=[],p=[];function m(k,b,x,v,y){for(let E=x;E<v;){let w=E,u=b[E],B=mi(a,k[E]);for(E++;E<v;E++){let M=mi(a,k[E]);if(B+M>=f)break;B+=M}if(E==w+1){if(B>f){let M=k[w];m(M.children,M.positions,0,M.children.length,b[w]+y);continue}h.push(k[w])}else{let M=b[E-1]+k[E-1].length-u;h.push(un(a,k,b,w,E,u,M,null,c))}p.push(u+y-o)}}return m(e,i,n,l,0),(r||c)(h,p,s)}class gt{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 gt(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 f=r<i.length?i[r]:null,h=f?f.fromA:1e9;if(h-c>=n)for(;s&&s.from<h;){let p=s;if(c>=p.from||h<=p.to||d){let m=Math.max(p.from,c)-d,k=Math.min(p.to,h)-d;p=m>=k?null:new gt(m,k,p.tree,p.offset+d,r>0,!!f)}if(p&&l.push(p),s.to>h)break;s=o<e.length?e[o++]:null}if(!f)break;c=f.toA,d=f.toA-f.toB}return l}}class Wl{startParse(e,i,n){return typeof e=="string"&&(e=new th(e)),n=n?n.length?n.map(l=>new an(l.from,l.to)):[new an(0,0)]:[new an(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 th{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 ne({perNode:!0});class gi{constructor(e,i,n,l,o,s,r,c,d,f=0,h){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=f,this.parent=h}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 gi(e,[],i,n,n,0,[],0,l?new Yl(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,f=this.reducePos-d;f>=2e3&&!(!((i=this.p.parser.nodeSet.types[l])===null||i===void 0)&&i.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=f));let h=c?this.stack[c-1]:0,p=this.bufferBase+this.buffer.length-h;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 gi(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 ih(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 Yl(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 Yl{constructor(e,i){this.tracker=e,this.context=i,this.hash=e.strict?e.hash(i):0}}class ih{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 ki{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 ki(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 ki(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 yi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Kl=new yi;class nh{constructor(e,i){this.input=e,this.ranges=i,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Kl,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=Kl,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 Nt{constructor(e,i){this.data=e,this.id=i}token(e,i){let{parser:n}=i.p;lh(this.data,e,i,this.id,n.data,n.tokenPrecTable)}}Nt.prototype.contextual=Nt.prototype.fallback=Nt.prototype.extend=!1,Nt.prototype.fallback=Nt.prototype.extend=!1;function lh(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 k=a[m];if(c.allows(k)&&(e.token.value==-1||e.token.value==k||oh(k,e.token.value,l,o))){e.acceptToken(k);break}}let f=e.next,h=0,p=a[s+2];if(e.next<0&&p>h&&a[d+p*3-3]==65535){s=a[d+p*3-1];continue e}for(;h<p;){let m=h+p>>1,k=d+m+(m<<1),b=a[k],x=a[k+1]||65536;if(f<b)p=m;else if(f>=x)h=m+1;else{s=a[k+2],e.advance();continue e}}break}}function Hl(a,e,i){for(let n=e,l;(l=a[n])!=65535;n++)if(l==i)return n-e;return-1}function oh(a,e,i,n){let l=Hl(i,n,e);return l<0||Hl(i,n,a)<l}const Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let pn=null;function Gl(a,e,i){let n=a.cursor(ge.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 sh{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?Gl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Gl(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 ue){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(ne.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 ah{constructor(e,i){this.stream=i,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new yi)}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 f=o[d],h=this.tokens[d];if(!(n&&!f.fallback)&&((f.contextual||h.start!=e.pos||h.mask!=s||h.context!=r)&&(this.updateCachedToken(h,f,e),h.mask=s,h.context=r),h.lookAhead>h.end+25&&(c=Math.max(h.lookAhead,c)),h.value!=0)){let p=i;if(h.extended>-1&&(i=this.addActions(e,h.extended,h.end,i)),i=this.addActions(e,h.value,h.end,i),!f.extend&&(n=h,i>p))break}}for(;this.actions.length>i;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new yi,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 yi,{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=Je(r,d+2);else{l==0&&r[d+1]==2&&(l=this.putAction(Je(r,d+2),i,n,l));break}r[d]==i&&(l=this.putAction(Je(r,d+1),i,n,l))}return l}}class rh{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 nh(i,l),this.tokens=new ah(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[gi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new sh(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 Ve&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ve&&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 Ve&&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=Ve?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,f=d?e.curContext.hash:0;for(let h=this.fragments.nodeAt(l);h;){let p=this.parser.nodeSet.types[h.type.id]==h.type?o.getGoto(e.state,h.type.id):-1;if(p>-1&&h.length&&(!d||(h.prop(ne.contextHash)||0)==f))return e.useNode(h,p),Ve&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(h.type.id)})`),!0;if(!(h instanceof ue)||h.children.length==0||h.positions[0]>0)break;let m=h.children[0];if(m instanceof ue&&h.positions[0]==0)h=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ve&&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 f=c[d++],h=c[d++],p=c[d++],m=d==c.length||!n,k=m?e:e.split(),b=this.tokens.mainToken;if(k.apply(f,h,b?b.start:k.pos,p),Ve&&console.log(s+this.stackID(k)+` (via ${f&65536?`reduce of ${o.getName(f&65535)}`:"shift"} for ${o.getName(h)} @ ${l}${k==e?"":", split"})`),m)return!0;k.pos>l?i.push(k):n.push(k)}return!1}advanceFully(e,i){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Jl(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],f=Ve?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Ve&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let h=r.split(),p=f;for(let m=0;h.forceReduce()&&m<10&&(Ve&&console.log(p+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));m++)Ve&&(p=this.stackID(h)+" -> ");for(let m of r.recoverByInsert(c))Ve&&console.log(f+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),Ve&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),Jl(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),ue.build({buffer:ki.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=(pn||(pn=new WeakMap)).get(e);return i||pn.set(e,i=String.fromCodePoint(this.nextStackID++)),i+e}}function Jl(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 ch{constructor(e,i,n){this.source=e,this.flags=i,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class wi extends Wl{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=ne[c]);for(let d=1;d<r.length;){let f=r[d++];if(f>=0)o(f,c,r[d++]);else{let h=r[d+-f];for(let p=-f;p>0;p--)o(r[d++],c,h);d++}}}this.nodeSet=new rn(i.map((r,c)=>Be.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=$l;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(Xl),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 Nt(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 rh(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=Je(n,o+2)];else{if(n[o+1]==2)return Je(n,o+2);break}if(s==i||s==0)return Je(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=Je(this.data,o+2);else break;l=i(Je(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=Je(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(wi.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]=Xl(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 ch(e,n,l)}static deserialize(e){return new wi(e)}}function Je(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 Xl(a){if(a.external){let e=a.extend?1:0;return(i,n)=>a.external(i,n)<<1|e}return a.get}let hh=0;class Me{constructor(e,i,n,l){this.name=e,this.set=i,this.base=n,this.modified=l,this.id=hh++}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 Me&&(i=e),i?.base)throw new Error("Can not derive from a modified tag");let l=new Me(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 Ai(e);return n=>n.modified.indexOf(i)>-1?n:Ai.get(n.base||n,n.modified.concat(i).sort((l,o)=>l.id-o.id))}}let fh=0;class Ai{constructor(e){this.name=e,this.instances=[],this.id=fh++}static get(e,i){if(!i.length)return e;let n=i[0].instances.find(r=>r.base==e&&uh(i,r.modified));if(n)return n;let l=[],o=new Me(e.name,l,e,i);for(let r of i)r.instances.push(o);let s=ph(i);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ai.get(r,c));return o}}function uh(a,e){return a.length==e.length&&a.every((i,n)=>i==e[n])}function ph(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 Zl(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 h=0;;){if(r=="..."&&h>0&&h+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]),h+=p[0].length,h==l.length)break;let m=l[h++];if(h==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(h)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+l);let f=new mn(n,s,c>0?o.slice(0,c):null);e[d]=f.sort(e[d])}}return mh.add(e)}const mh=new ne;class mn{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}}mn.empty=new mn([],2,null);function eo(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 j=Me.define,xi=j(),rt=j(),to=j(rt),io=j(rt),ct=j(),vi=j(ct),gn=j(ct),Ue=j(),kt=j(Ue),ze=j(),je=j(),kn=j(),Yt=j(kn),Ci=j(),z={comment:xi,lineComment:j(xi),blockComment:j(xi),docComment:j(xi),name:rt,variableName:j(rt),typeName:to,tagName:j(to),propertyName:io,attributeName:j(io),className:j(rt),labelName:j(rt),namespace:j(rt),macroName:j(rt),literal:ct,string:vi,docString:j(vi),character:j(vi),attributeValue:j(vi),number:gn,integer:j(gn),float:j(gn),bool:j(ct),regexp:j(ct),escape:j(ct),color:j(ct),url:j(ct),keyword:ze,self:j(ze),null:j(ze),atom:j(ze),unit:j(ze),modifier:j(ze),operatorKeyword:j(ze),controlKeyword:j(ze),definitionKeyword:j(ze),moduleKeyword:j(ze),operator:je,derefOperator:j(je),arithmeticOperator:j(je),logicOperator:j(je),bitwiseOperator:j(je),compareOperator:j(je),updateOperator:j(je),definitionOperator:j(je),typeOperator:j(je),controlOperator:j(je),punctuation:kn,separator:j(kn),bracket:Yt,angleBracket:j(Yt),squareBracket:j(Yt),paren:j(Yt),brace:j(Yt),content:Ue,heading:kt,heading1:j(kt),heading2:j(kt),heading3:j(kt),heading4:j(kt),heading5:j(kt),heading6:j(kt),contentSeparator:j(Ue),list:j(Ue),quote:j(Ue),emphasis:j(Ue),strong:j(Ue),link:j(Ue),monospace:j(Ue),strikethrough:j(Ue),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:Ci,documentMeta:j(Ci),annotation:j(Ci),processingInstruction:j(Ci),definition:Me.defineModifier("definition"),constant:Me.defineModifier("constant"),function:Me.defineModifier("function"),standard:Me.defineModifier("standard"),local:Me.defineModifier("local"),special:Me.defineModifier("special")};for(let a in z){let e=z[a];e instanceof Me&&(e.name=a)}eo([{tag:z.link,class:"tok-link"},{tag:z.heading,class:"tok-heading"},{tag:z.emphasis,class:"tok-emphasis"},{tag:z.strong,class:"tok-strong"},{tag:z.keyword,class:"tok-keyword"},{tag:z.atom,class:"tok-atom"},{tag:z.bool,class:"tok-bool"},{tag:z.url,class:"tok-url"},{tag:z.labelName,class:"tok-labelName"},{tag:z.inserted,class:"tok-inserted"},{tag:z.deleted,class:"tok-deleted"},{tag:z.literal,class:"tok-literal"},{tag:z.string,class:"tok-string"},{tag:z.number,class:"tok-number"},{tag:[z.regexp,z.escape,z.special(z.string)],class:"tok-string2"},{tag:z.variableName,class:"tok-variableName"},{tag:z.local(z.variableName),class:"tok-variableName tok-local"},{tag:z.definition(z.variableName),class:"tok-variableName tok-definition"},{tag:z.special(z.variableName),class:"tok-variableName2"},{tag:z.definition(z.propertyName),class:"tok-propertyName tok-definition"},{tag:z.typeName,class:"tok-typeName"},{tag:z.namespace,class:"tok-namespace"},{tag:z.className,class:"tok-className"},{tag:z.macroName,class:"tok-macroName"},{tag:z.propertyName,class:"tok-propertyName"},{tag:z.operator,class:"tok-operator"},{tag:z.comment,class:"tok-comment"},{tag:z.meta,class:"tok-meta"},{tag:z.invalid,class:"tok-invalid"},{tag:z.punctuation,class:"tok-punctuation"}]);const gh=Zl({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),kh=wi.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:[gh],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=[],no=[];(()=>{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?no:bn).push(i=i+a[e])})();function bh(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>=no[n])e=n+1;else return!0;if(e==i)return!1}}function lo(a){return a>=127462&&a<=127487}const oo=8205;function yh(a,e,i=!0,n=!0){return(i?so:wh)(a,e,n)}function so(a,e,i){if(e==a.length)return e;e&&ao(a.charCodeAt(e))&&ro(a.charCodeAt(e-1))&&e--;let n=yn(a,e);for(e+=co(n);e<a.length;){let l=yn(a,e);if(n==oo||l==oo||i&&bh(l))e+=co(l),n=l;else if(lo(l)){let o=0,s=e-2;for(;s>=0&&lo(yn(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=so(a,e-2,i);if(n<e)return n;e--}return 0}function yn(a,e){let i=a.charCodeAt(e);if(!ro(i)||e+1==a.length)return i;let n=a.charCodeAt(e+1);return ao(n)?(i-55296<<10)+(n-56320)+65536:i}function ao(a){return a>=56320&&a<57344}function ro(a){return a>=55296&&a<56320}function co(a){return a<65536?1:2}class ie{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]=Vt(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),qe.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]=Vt(this,e,i);let n=[];return this.decompose(e,i,n,0),qe.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 Kt(this),o=new Kt(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 Kt(this,e)}iterRange(e,i=this.length){return new fo(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 uo(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]?ie.empty:e.length<=32?new fe(e):qe.from(fe.split(e,[]))}}class fe extends ie{constructor(e,i=Ah(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 xh(l,r,n,s);l=r+1,n++}}decompose(e,i,n,l){let o=e<=0&&i>=this.length?this:new fe(ho(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=Si(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new fe(r,s.length+o.length));else{let c=r.length>>1;n.push(new fe(r.slice(0,c)),new fe(r.slice(c)))}}else n.push(o)}replace(e,i,n){if(!(n instanceof fe))return super.replace(e,i,n);[e,i]=Vt(this,e,i);let l=Si(this.text,Si(n.text,ho(this.text,0,e)),i),o=this.length+n.length-(i-e);return l.length<=32?new fe(l,o):qe.from(fe.split(l,[]),o)}sliceString(e,i=this.length,n=`
15
+ `){[e,i]=Vt(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 fe(n,l)),n=[],l=-1);return l>-1&&i.push(new fe(n,l)),i}}class qe extends ie{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]=Vt(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 f=this.children.slice();return f[l]=c,new qe(f,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]=Vt(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 qe))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 k of e)k.flatten(m);return new fe(m,i)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,d=-1,f=[];function h(m){let k;if(m.lines>o&&m instanceof qe)for(let b of m.children)h(b);else m.lines>s&&(c>s||!c)?(p(),r.push(m)):m instanceof fe&&c&&(k=f[f.length-1])instanceof fe&&m.lines+k.lines<=32?(c+=m.lines,d+=m.length+1,f[f.length-1]=new fe(k.text.concat(m.text),k.length+1+m.length)):(c+m.lines>l&&p(),c+=m.lines,d+=m.length+1,f.push(m))}function p(){c!=0&&(r.push(f.length==1?f[0]:qe.from(f,d)),d=-1,c=f.length=0)}for(let m of e)h(m);return p(),r.length==1?r[0]:new qe(r,i)}}ie.empty=new fe([""],0);function Ah(a){let e=-1;for(let i of a)e+=i.length+1;return e}function Si(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 ho(a,e,i){return Si(a,[""],e,i)}class Kt{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 fe?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 fe?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 fe){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 fe?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 fo{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new Kt(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 uo{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"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},Kt.prototype[Symbol.iterator]=fo.prototype[Symbol.iterator]=uo.prototype[Symbol.iterator]=function(){return this});class xh{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 Vt(a,e,i){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,i))]}function Xe(a,e,i=!0,n=!0){return yh(a,e,i,n)}const wn=/\r\n?|\n/;var Re=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Re||(Re={}));class Ze{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){An(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 Ze(e)}composeDesc(e){return this.empty?e:e.empty?this:po(this,e)}mapDesc(e,i=!1){return e.empty?this:xn(this,e,i)}mapPos(e,i=-1,n=Re.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!=Re.Simple&&d>=e&&(n==Re.TrackDel&&l<e&&d>e||n==Re.TrackBefore&&l<e||n==Re.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 Ze(e)}static create(e){return new Ze(e)}}class ke extends Ze{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 An(this,(i,n,l,o,s)=>e=e.replace(l,l+(n-i),s),!1),e}mapDesc(e,i=!1){return xn(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(ie.empty);n.push(s?e.slice(o,o+s):ie.empty)}o+=s}return new ke(i,n)}compose(e){return this.empty?e:e.empty?this:po(this,e,!0)}map(e,i=!1){return e.empty?this:xn(this,e,i,!0)}iterChanges(e,i=!1){An(this,e,i)}get desc(){return Ze.create(this.sections)}filter(e){let i=[],n=[],l=[],o=new Ht(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 f=Math.min(o.len,c-r);Ae(l,f,-1);let h=o.ins==-1?-1:o.off==0?o.ins:0;Ae(i,f,h),h>0&&dt(n,i,o.text),o.forward(f),r+=f}let d=e[s++];for(;r<d;){if(o.done)break e;let f=Math.min(o.len,d-r);Ae(i,f,-1),Ae(l,f,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(f),r+=f}}return{changes:new ke(i,n),filtered:Ze.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(f=!1){if(!f&&!l.length)return;s<i&&Ae(l,i-s,-1);let h=new ke(l,o);r=r?r.compose(h.map(r)):h,l=[],o=[],s=0}function d(f){if(Array.isArray(f))for(let h of f)d(h);else if(f instanceof ke){if(f.length!=i)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${i})`);c(),r=r?r.compose(f.map(r)):f}else{let{from:h,to:p=h,insert:m}=f;if(h>p||h<0||p>i)throw new RangeError(`Invalid change range ${h} to ${p} (in doc of length ${i})`);let k=m?typeof m=="string"?ie.of(m.split(n||wn)):m:ie.empty,b=k.length;if(h==p&&b==0)return;h<s&&c(),h>s&&Ae(l,h-s,-1),Ae(l,p-h,b),dt(o,l,k),s=p}}return d(e),c(!r),r}static empty(e){return new ke(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(ie.empty);n[l]=ie.of(o.slice(1)),i.push(o[0],n[l].length)}}}return new ke(i,n)}static createSet(e,i){return new ke(e,i)}}function Ae(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 dt(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(ie.empty);a.push(i)}}function An(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,f=o,h=ie.empty;for(;d+=r,f+=c,c&&n&&(h=h.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,f,h),l=d,o=f}}}function xn(a,e,i,n=!1){let l=[],o=n?[]:null,s=new Ht(a),r=new Ht(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);Ae(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(Ae(l,r.ins,-1);d;){let f=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=f&&(Ae(l,0,s.ins),o&&dt(o,l,s.text),c=s.i),s.forward(f),d-=f}r.next()}else if(s.ins>=0){let d=0,f=s.len;for(;f;)if(r.ins==-1){let h=Math.min(f,r.len);d+=h,f-=h,r.forward(h)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;Ae(l,d,c<s.i?s.ins:0),o&&c<s.i&&dt(o,l,s.text),c=s.i,s.forward(s.len-f)}else{if(s.done&&r.done)return o?ke.createSet(l,o):Ze.create(l);throw new Error("Mismatched change set lengths")}}}function po(a,e,i=!1){let n=[],l=i?[]:null,o=new Ht(a),s=new Ht(e);for(let r=!1;;){if(o.done&&s.done)return l?ke.createSet(n,l):Ze.create(n);if(o.ins==0)Ae(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ae(n,0,s.ins,r),l&&dt(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 f=s.ins==-1?-1:s.off?0:s.ins;Ae(n,c,f,r),l&&f&&dt(l,n,s.text)}else s.ins==-1?(Ae(n,o.off?0:o.len,c,r),l&&dt(l,n,o.textBit(c))):(Ae(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&dt(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 Ht{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?ie.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?ie.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 bt{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 bt(n,l,this.flags)}extend(e,i=e){if(e<=this.anchor&&i>=this.anchor)return K.range(e,i);let n=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return K.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 K.range(e.anchor,e.head)}static create(e,i,n){return new bt(e,i,n)}}class K{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:K.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 K([this.main],0)}addRange(e,i=!0){return K.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let n=this.ranges.slice();return n[i]=e,K.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 K(e.ranges.map(i=>bt.fromJSON(i)),e.main)}static single(e,i=e){return new K([K.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 K.normalized(e.slice(),i);n=o.to}return new K(e,i)}static cursor(e,i=0,n,l){return bt.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?bt.create(i,e,48|o):bt.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?K.range(c,r):K.range(r,c))}}return new K(e,i)}}function mo(a,e){for(let i of a.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let vn=0;class J{constructor(e,i,n,l,o){this.combine=e,this.compareInput=i,this.compare=n,this.isStatic=l,this.id=vn++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new J(e.combine||(i=>i),e.compareInput||((i,n)=>i===n),e.compare||(e.combine?(i,n)=>i===n:Cn),!!e.static,e.enables)}of(e){return new Bi([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,2,i)}from(e,i){return i||(i=n=>n),this.compute([e],n=>i(n.field(e)))}}function Cn(a,e){return a==e||a.length==e.length&&a.every((i,n)=>i===e[n])}class Bi{constructor(e,i,n,l){this.dependencies=e,this.facet=i,this.type=n,this.value=l,this.id=vn++}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,f=[];for(let h of this.dependencies)h=="doc"?c=!0:h=="selection"?d=!0:((i=e[h.id])!==null&&i!==void 0?i:1)&1||f.push(e[h.id]);return{create(h){return h.values[s]=n(h),1},update(h,p){if(c&&p.docChanged||d&&(p.docChanged||p.selection)||Sn(h,f)){let m=n(h);if(r?!go(m,h.values[s],l):!l(m,h.values[s]))return h.values[s]=m,1}return 0},reconfigure:(h,p)=>{let m,k=p.config.address[o];if(k!=null){let b=Ei(p,k);if(this.dependencies.every(x=>x instanceof J?p.facet(x)===h.facet(x):x instanceof yt?p.field(x,!1)==h.field(x,!1):!0)||(r?go(m=n(h),b,l):l(m=n(h),b)))return h.values[s]=b,0}else m=n(h);return h.values[s]=m,1}}}}function go(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 Sn(a,e){let i=!1;for(let n of e)Jt(a,n)&1&&(i=!0);return i}function vh(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 f=0;f<n.length;f++){let h=Ei(c,n[f]);if(l[f]==2)for(let p of h)d.push(p);else d.push(h)}return e.combine(d)}return{create(c){for(let d of n)Jt(c,d);return c.values[s]=r(c),1},update(c,d){if(!Sn(c,o))return 0;let f=r(c);return e.compare(f,c.values[s])?0:(c.values[s]=f,1)},reconfigure(c,d){let f=Sn(c,n),h=d.config.facets[e.id],p=d.facet(e);if(h&&!f&&Cn(i,h))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 Ni=J.define({static:!0});class yt{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 yt(vn++,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(Ni).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(Ni),s=l.facet(Ni),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,Ni.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function Gt(a){return e=>new ko(e,a)}const Ch={highest:Gt(wt.highest),high:Gt(wt.high),default:Gt(wt.default),low:Gt(wt.low),lowest:Gt(wt.lowest)};class ko{constructor(e,i){this.inner=e,this.prec=i}}class Vi{of(e){return new Bn(this,e)}reconfigure(e){return Vi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bn{constructor(e,i){this.compartment=e,this.inner=i}}class Ri{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 Sh(e,i,s))p instanceof yt?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 f=n?.config.facets;for(let p in o){let m=o[p],k=m[0].facet,b=f&&f[p]||[];if(m.every(x=>x.type==0))if(r[k.id]=c.length<<1|1,Cn(b,m))c.push(n.facet(k));else{let x=k.combine(m.map(v=>v.value));c.push(n&&k.compare(x,n.facet(k))?n.facet(k):x)}else{for(let x of m)x.type==0?(r[x.id]=c.length<<1|1,c.push(x.value)):(r[x.id]=d.length<<1,d.push(v=>x.dynamicSlot(v)));r[k.id]=d.length<<1,d.push(x=>vh(x,k,m))}}let h=d.map(p=>p(r));return new Ri(e,s,h,r,c,o)}}function Sh(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 Bn&&i.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let d of s)o(d,r);else if(s instanceof Bn){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 ko)o(s.inner,s.prec);else if(s instanceof yt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Bi)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,wt.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,wt.default),n.reduce((s,r)=>s.concat(r))}function Jt(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 Ei(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const bo=J.define(),Nn=J.define({combine:a=>a.some(e=>e),static:!0}),yo=J.define({combine:a=>a.length?a[0]:void 0,static:!0}),wo=J.define(),Ao=J.define(),xo=J.define(),vo=J.define({combine:a=>a.length?a[0]:!1});class Rt{constructor(e,i){this.type=e,this.value=i}static define(){return new Bh}}class Bh{of(e){return new Rt(this,e)}}class Nh{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{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 me(this.type,i)}is(e){return this.type==e}static define(e={}){return new Nh(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}}me.reconfigure=me.define(),me.appendConfig=me.define();class xe{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&&mo(n,i.newLength),o.some(r=>r.type==xe.time)||(this.annotations=o.concat(xe.time.of(Date.now())))}static create(e,i,n,l,o,s){return new xe(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(xe.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}xe.time=Rt.define(),xe.userEvent=Rt.define(),xe.addToHistory=Rt.define(),xe.remote=Rt.define();function Vh(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 Co(a,e,i){var n;let l,o,s;return i?(l=e.changes,o=ke.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:me.mapEffects(a.effects,l).concat(me.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Vn(a,e,i){let n=e.selection,l=Et(e.annotations);return e.userEvent&&(l=l.concat(xe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ke?e.changes:ke.of(e.changes||[],i,a.facet(yo)),selection:n&&(n instanceof K?n:K.single(n.anchor,n.head)),effects:Et(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function So(a,e,i){let n=Vn(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=Co(n,Vn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=xe.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return Eh(i?Rh(l):l)}function Rh(a){let e=a.startState,i=!0;for(let l of e.facet(wo)){let o=l(a);if(o===!1){i=!1;break}Array.isArray(o)&&(i=i===!0?o:Vh(i,o))}if(i!==!0){let l,o;if(i===!1)o=a.changes.invertedDesc,l=ke.empty(e.doc.length);else{let s=a.changes.filter(i);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=xe.create(e,l,a.selection&&a.selection.map(o),me.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(Ao);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof xe?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof xe?a=o[0]:a=So(e,Et(o),!1)}return a}function Eh(a){let e=a.startState,i=e.facet(xo),n=a;for(let l=i.length-1;l>=0;l--){let o=i[l](a);o&&Object.keys(o).length&&(n=Co(n,Vn(e,o,a.changes.newLength),!0))}return n==a?a:xe.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const Oh=[];function Et(a){return a==null?Oh:Array.isArray(a)?a:[a]}var et=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(et||(et={}));const Mh=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Rn;try{Rn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Th(a){if(Rn)return Rn.test(a);for(let e=0;e<a.length;e++){let i=a[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||Mh.test(i)))return!0}return!1}function Ih(a){return e=>{if(!/\S/.test(e))return et.Space;if(Th(e))return et.Word;for(let i=0;i<a.length;i++)if(e.indexOf(a[i])>-1)return et.Word;return et.Other}}class oe{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++)Jt(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 Jt(this,n),Ei(this,n)}update(...e){return So(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:l}=i;for(let r of e.effects)r.is(Vi.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(me.reconfigure)?(i=null,n=r.value):r.is(me.appendConfig)&&(i=null,n=Et(n).concat(r.value));let o;i?o=e.startState.values.slice():(i=Ri.resolve(n,l,this),o=new oe(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(Nn)?e.newSelection:e.newSelection.asSingle();new oe(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:K.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=Et(n.effects);for(let r=1;r<i.ranges.length;r++){let c=e(i.ranges[r]),d=this.changes(c.changes),f=d.map(l);for(let p=0;p<r;p++)o[p]=o[p].map(f);let h=l.mapDesc(d,!0);o.push(c.range.map(h)),l=l.compose(f),s=me.mapEffects(s,f).concat(me.mapEffects(Et(c.effects),h))}return{changes:l,selection:K.create(o,i.mainIndex),effects:s}}changes(e=[]){return e instanceof ke?e:ke.of(e,this.doc.length,this.facet(oe.lineSeparator))}toText(e){return ie.of(e.split(this.facet(oe.lineSeparator)||wn))}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:(Jt(this,i),Ei(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 yt&&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 oe.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:i.extensions?l.concat([i.extensions]):l})}static create(e={}){let i=Ri.resolve(e.extensions||[],new Map),n=e.doc instanceof ie?e.doc:ie.of((e.doc||"").split(i.staticFacet(oe.lineSeparator)||wn)),l=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return mo(l,n.length),i.staticFacet(Nn)||(l=l.asSingle()),new oe(i,n,l,i.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(oe.tabSize)}get lineBreak(){return this.facet(oe.lineSeparator)||`
18
+ `}get readOnly(){return this.facet(vo)}phrase(e,...i){for(let n of this.facet(oe.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 Ih(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=Xe(i,s,!1);if(o(i.slice(c,s))!=et.Word)break;s=c}for(;r<l;){let c=Xe(i,r);if(o(i.slice(r,c))!=et.Word)break;r=c}return s==r?null:K.range(s+n,r+n)}}oe.allowMultipleSelections=Nn,oe.tabSize=J.define({combine:a=>a.length?a[0]:4}),oe.lineSeparator=yo,oe.readOnly=vo,oe.phrases=J.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])}}),oe.languageData=bo,oe.changeFilter=wo,oe.transactionFilter=Ao,oe.transactionExtender=xo,Vi.reconfigure=me.define();class Ot{eq(e){return this==e}range(e,i=e){return Xt.create(e,i,this)}}Ot.prototype.startSide=Ot.prototype.endSide=0,Ot.prototype.point=!1,Ot.prototype.mapMode=Re.TrackDel;class Xt{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new Xt(e,i,n)}}function En(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class On{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],f=this.from[c]+e,h=this.to[c]+e,p,m;if(f==h){let k=i.mapPos(f,d.startSide,d.mapMode);if(k==null||(p=m=k,d.startSide!=d.endSide&&(m=i.mapPos(f,d.endSide),m<p)))continue}else if(p=i.mapPos(f,d.startSide),m=i.mapPos(h,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 On(l,o,n,r):null,pos:s}}}class de{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 de(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(En)),this.isEmpty)return i.length?de.of(i):this;let r=new No(this,null,-1).goto(0),c=0,d=[],f=new Oi;for(;r.value||c<i.length;)if(c<i.length&&(r.from-i[c].from||r.startSide-i[c].value.startSide)>=0){let h=i[c++];f.addInner(h.from,h.to,h.value)||d.push(h)}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])&&f.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))&&(f.addInner(r.from,r.to,r.value)||d.push(Xt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!d.length?de.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:f,pos:h}=c.map(r,e);f&&(l=Math.max(l,f.maxPoint),i.push(f),n.push(h))}}let o=this.nextLayer.map(e);return i.length==0?o:new de(n,i,o||de.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 Zt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return Zt.from(e).goto(i)}static compare(e,i,n,l,o=-1){let s=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=o),r=i.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=o),c=Bo(s,r,n),d=new ei(s,c,o),f=new ei(r,c,o);n.iterGaps((h,p,m)=>Vo(d,h,f,p,m,l)),n.empty&&n.length==0&&Vo(d,0,f,0,0,l)}static eq(e,i,n=0,l){l==null&&(l=999999999);let o=e.filter(f=>!f.isEmpty&&i.indexOf(f)<0),s=i.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=Bo(o,s),c=new ei(o,r,0).goto(n),d=new ei(s,r,0).goto(n);for(;;){if(c.to!=d.to||!Tn(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 ei(e,null,o).goto(i),r=i,c=s.openStart;for(;;){let d=Math.min(s.to,n);if(s.point){let f=s.activeForPoint(s.to),h=s.pointFrom<i?f.length+1:s.point.startSide<0?f.length:Math.min(f.length,c);l.point(r,d,s.point,f,h,s.pointRank),c=Math.min(s.openEnd(d),f.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 Oi;for(let l of e instanceof Xt?[e]:i?Fh(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return de.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=de.empty;l=l.nextLayer)i=new de(l.chunkPos,l.chunk,i,Math.max(l.maxPoint,i.maxPoint));return i}}de.empty=new de([],[],null,-1);function Fh(a){if(a.length>1)for(let e=a[0],i=1;i<a.length;i++){let n=a[i];if(En(e,n)>0)return a.slice().sort(En);e=n}return a}de.empty.nextLayer=de.empty;class Oi{finishChunk(e){this.chunks.push(new On(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 Oi)).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(de.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=de.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function Bo(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 No{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 Zt{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 No(s,i,n,o));return l.length==1?l[0]:new Zt(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--)Mn(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--)Mn(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(),Mn(this.heap,0)}}}function Mn(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 ei{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=Zt.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){Mi(this.active,e),Mi(this.activeTo,e),Mi(this.activeRank,e),this.minActive=Ro(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++;Ti(this.active,i,n),Ti(this.activeTo,i,l),Ti(this.activeRank,i,o),e&&Ti(e,i,this.cursor.from),this.minActive=Ro(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&&Mi(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 Vo(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,f=d||a.endSide-i.endSide,h=f<0?a.to+c:i.to,p=Math.min(h,s);if(a.point||i.point?a.point&&i.point&&(a.point==i.point||a.point.eq(i.point))&&Tn(a.activeForPoint(a.to),i.activeForPoint(i.to))||o.comparePoint(r,p,a.point,i.point):p>r&&!Tn(a.active,i.active)&&o.compareRange(r,p,a.active,i.active),h>s)break;(d||a.openEnd!=i.openEnd)&&o.boundChange&&o.boundChange(h),r=h,f<=0&&a.next(),f>=0&&i.next()}}function Tn(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 Mi(a,e){for(let i=e,n=a.length-1;i<n;i++)a[i]=a[i+1];a.pop()}function Ti(a,e,i){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=i}function Ro(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 _h(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=Xe(a,l)}return n===!0?-1:a.length}const In="ͼ",Eo=typeof Symbol>"u"?"__"+In:Symbol.for(In),Fn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ht{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 f=[],h=/^@(\w+)\b/.exec(s[0]),p=h&&h[1]=="keyframes";if(h&&r==null)return c.push(s[0]+";");for(let m in r){let k=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(b=>s.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),k,c);else if(k&&typeof k=="object"){if(!h)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),k,f,p)}else k!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+k+";")}(f.length||p)&&c.push((n&&!h&&!d?s.map(n):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
19
+ `)}static newName(){let e=Oo[Eo]||1;return Oo[Eo]=e+1,In+e.toString(36)}static mount(e,i,n){let l=e[Fn],o=n&&n.nonce;l?o&&l.setNonce(o):l=new Dh(e,o),l.mount(Array.isArray(i)?i:[i],e)}}let Mo=new Map;class Dh{constructor(e,i){let n=e.ownerDocument||e,l=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=Mo.get(n);if(o)return e[Fn]=o;this.sheet=new l.CSSStyleSheet,Mo.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Fn]=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 Mt={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:"'"},_n={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},be=0;be<10;be++)Mt[48+be]=Mt[96+be]=String(be);for(var be=1;be<=24;be++)Mt[be+111]="F"+be;for(var be=65;be<=90;be++)Mt[be]=String.fromCharCode(be+32),_n[be]=String.fromCharCode(be);for(var Dn in Mt)_n.hasOwnProperty(Dn)||(_n[Dn]=Mt[Dn]);function ti(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Pn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function Ii(a,e){if(!e.anchorNode)return!1;try{return Pn(a,e.anchorNode)}catch{return!1}}function ii(a){return a.nodeType==3?xt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ni(a,e,i,n){return i?To(a,e,i,n,-1)||To(a,e,i,n,1):!1}function At(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Fi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function To(a,e,i,n,l){for(;;){if(a==i&&e==n)return!0;if(e==(l<0?0:Qe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=At(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?Qe(a):0}else return!1}}function Qe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function _i(a,e){let i=e?a.left:a.right;return{left:i,right:i,top:a.top,bottom:a.bottom}}function Ph(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 Io(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 $h(a,e,i,n,l,o,s,r){let c=a.ownerDocument,d=c.defaultView||window;for(let f=a,h=!1;f&&!h;)if(f.nodeType==1){let p,m=f==c.body,k=1,b=1;if(m)p=Ph(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(h=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let y=f.getBoundingClientRect();({scaleX:k,scaleY:b}=Io(f,y)),p={left:y.left,right:y.left+f.clientWidth*k,top:y.top,bottom:y.top+f.clientHeight*b}}let x=0,v=0;if(l=="nearest")e.top<p.top?(v=e.top-(p.top+s),i>0&&e.bottom>p.bottom+v&&(v=e.bottom-p.bottom+s)):e.bottom>p.bottom&&(v=e.bottom-p.bottom+s,i<0&&e.top-v<p.top&&(v=e.top-(p.top+s)));else{let y=e.bottom-e.top,E=p.bottom-p.top;v=(l=="center"&&y<=E?e.top+y/2-E/2:l=="start"||l=="center"&&i<0?e.top-s:e.bottom-E+s)-p.top}if(n=="nearest"?e.left<p.left?(x=e.left-(p.left+o),i>0&&e.right>p.right+x&&(x=e.right-p.right+o)):e.right>p.right&&(x=e.right-p.right+o,i<0&&e.left<p.left+x&&(x=e.left-(p.left+o))):x=(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,x||v)if(m)d.scrollBy(x,v);else{let y=0,E=0;if(v){let w=f.scrollTop;f.scrollTop+=v/b,E=(f.scrollTop-w)*b}if(x){let w=f.scrollLeft;f.scrollLeft+=x/k,y=(f.scrollLeft-w)*k}e={left:e.left-y,top:e.top-E,right:e.right-y,bottom:e.bottom-E},y&&Math.abs(y-x)<1&&(n="nearest"),E&&Math.abs(E-v)<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)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Lh(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 Uh{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?Qe(i):0),n,Math.min(e.focusOffset,n?Qe(n):0))}set(e,i,n,l){this.anchorNode=e,this.anchorOffset=i,this.focusNode=n,this.focusOffset=l}}let Tt=null;function Fo(a){if(a.setActive)return a.setActive();if(Tt)return a.focus(Tt);let e=[];for(let i=a;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(a.focus(Tt==null?{get preventScroll(){return Tt={preventScroll:!0},!0}}:void 0),!Tt){Tt=!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 _o;function xt(a,e,i=e){let n=_o||(_o=document.createRange());return n.setEnd(a,i),n.setStart(a,e),n}function It(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 zh(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Do(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function jh(a,e){let i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(n=Math.min(n,Qe(i));;)if(n){if(i.nodeType!=1)return!1;let l=i.childNodes[n-1];l.contentEditable=="false"?n--:(i=l,n=Qe(i))}else{if(i==a)return!0;n=At(i),i=i.parentNode}}function Po(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function $o(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=Qe(i)}else if(i.parentNode&&!Fi(i))n=At(i),i=i.parentNode;else return null}}function Lo(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&&!Fi(i))n=At(i)+1,i=i.parentNode;else return null}}class ve{constructor(e,i,n=!0){this.node=e,this.offset=i,this.precise=n}static before(e,i){return new ve(e.parentNode,At(e),i)}static after(e,i){return new ve(e.parentNode,At(e)+1,i)}}const $n=[];class ae{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=ae.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=Uo(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=Uo(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=Qe(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&&!ae.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,f=n;c<this.children.length;c++){let h=this.children[c],p=d+h.length;if(d<e&&p>i)return h.domBoundsAround(e,i,d);if(p>=e&&l==-1&&(l=c,o=d),d>i&&h.dom.parentNode==this.dom){s=c,r=f;break}f=p,d=p+h.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=$n){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 zo(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}}ae.prototype.breakAfter=0;function Uo(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class zo{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,f=d.length?d[e]:null,h=o.length?o[o.length-1]:null,p=h?h.breakAfter:s;if(!(e==n&&f&&!s&&!p&&o.length<2&&f.merge(i,l,o.length?h:null,i==0,r,c))){if(n<d.length){let m=d[n];m&&(l<m.length||m.breakAfter&&h?.breakAfter)?(e==n&&(m=m.split(l),l=0),!p&&h&&m.merge(0,l,h,!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&&(h?h.breakAfter=1:s=1),n++}for(f&&(f.breakAfter=s,i>0&&(!s&&o.length&&f.merge(i,f.length,o[0],!1,r,0)?f.breakAfter=o.shift().breakAfter:(i<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(i,f.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 qo(a,e,i,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(i,1),{i:d,off:f}=s.findPos(e,-1),h=e-i;for(let p of n)h+=p.length;a.length+=h,jo(a,d,f,r,c,n,0,l,o)}let Ne=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ln=typeof document<"u"?document:{documentElement:{style:{}}};const Un=/Edge\/(\d+)/.exec(Ne.userAgent),Qo=/MSIE \d/.test(Ne.userAgent),zn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),Di=!!(Qo||zn||Un),Wo=!Di&&/gecko\/(\d+)/i.test(Ne.userAgent),jn=!Di&&/Chrome\/(\d+)/.exec(Ne.userAgent),Yo="webkitFontSmoothing"in Ln.documentElement.style,Ko=!Di&&/Apple Computer/.test(Ne.vendor),Ho=Ko&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var Y={mac:Ho||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:Di,ie_version:Qo?Ln.documentMode||6:zn?+zn[1]:Un?+Un[1]:0,gecko:Wo,gecko_version:Wo?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Ho,android:/Android\b/.test(Ne.userAgent),webkit:Yo,safari:Ko,webkit_version:Yo?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:Ln.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const qh=256;class De extends ae{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 De)||this.length-(i-e)+n.length>qh||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 De(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 ve(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 Qh(this.dom,e,i)}}class tt extends ae{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(Do(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 tt&&n.mark.eq(this.mark))||e&&o<=0||i<this.length&&s<=0)?!1:(qo(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 tt(this.mark,i,s)}domAtPos(e){return Go(this,e)}coordsAt(e,i){return Xo(this,e,i)}}function Qh(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?Y.chrome||Y.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):i<0?l--:o<n&&o++;let r=xt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:i>=0)?0:r.length-1];return Y.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,d=>d.width)||c),s?_i(c,s<0):c||null}class vt extends ae{static create(e,i,n){return new vt(e,i,n)}constructor(e,i,n){super(),this.widget=e,this.length=i,this.side=n,this.prevWidget=null}split(e){let i=vt.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 vt)||!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 vt&&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 ie.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):ie.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ve.before(this.dom):ve.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 _i(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 Ft extends ae{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Ft&&e.side==this.side}split(){return new Ft(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?ve.before(this.dom):ve.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ie.empty}get isHidden(){return!0}}De.prototype.children=vt.prototype.children=Ft.prototype.children=$n;function Go(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 ve(i,0)}function Jo(a,e,i){let n,{children:l}=a;i>0&&e instanceof tt&&l.length&&(n=l[l.length-1])instanceof tt&&n.mark.eq(e.mark)?Jo(n,e.children[0],i-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Xo(a,e,i){let n=null,l=-1,o=null,s=-1;function r(d,f){for(let h=0,p=0;h<d.children.length&&p<=f;h++){let m=d.children[h],k=p+m.length;k>=f&&(m.children.length?r(m,f-p):(!o||o.isHidden&&(i>0||Yh(o,m)))&&(k>f||p==k&&m.getSide()>0)?(o=m,s=f-p):(p<f||p==k&&m.getSide()<0&&!m.isHidden)&&(n=m,l=f-p)),p=k}}r(a,e);let c=(i<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),i):Wh(a)}function Wh(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let i=ii(e);return i[i.length-1]||null}function Yh(a,e){let i=a.coordsAt(0,1),n=e.coordsAt(0,1);return i&&n&&n.top<i.bottom}function qn(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 Zo=Object.create(null);function Pi(a,e,i){if(a==e)return!0;a||(a=Zo),e||(e=Zo);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 Qn(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 Kh(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 Wn{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 We=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(We||(We={}));class Ce extends Ot{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 li(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 ft(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}=es(e,i);n=(o?i?-3e8:-1:5e8)-1,l=(s?i?2e8:1:-6e8)+1}return new ft(e,n,l,i,e.widget||null,!0)}static line(e){return new oi(e)}static set(e,i=!1){return de.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ce.none=de.empty;class li extends Ce{constructor(e){let{start:i,end:n}=es(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 li&&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))&&Pi(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)}}li.prototype.point=!1;class oi extends Ce{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof oi&&this.spec.class==e.spec.class&&Pi(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)}}oi.prototype.mapMode=Re.TrackBefore,oi.prototype.point=!0;class ft extends Ce{constructor(e,i,n,l,o,s){super(i,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?i<=0?Re.TrackBefore:Re.TrackAfter:Re.TrackDel}get type(){return this.startSide!=this.endSide?We.WidgetRange:this.startSide<=0?We.WidgetBefore:We.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ft&&Hh(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)}}ft.prototype.point=!0;function es(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 Hh(a,e){return a==e||!!(a&&e&&a.compare(e))}function $i(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 pe extends ae{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 pe))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),qo(this,e,i,n?n.children.slice():[],o,s),!0}split(e){let i=new pe;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){Pi(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,i){Jo(this,e,i)}addLineDeco(e){let i=e.spec.attributes,n=e.spec.class;i&&(this.attrs=qn(i,this.attrs||{})),n&&(this.attrs=qn({class:n},this.attrs||{}))}domAtPos(e){return Go(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,i){var n;this.dom?this.flags&4&&(Do(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&&(Qn(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&&ae.get(l)instanceof tt;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=ae.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!Y.ios||!this.children.some(o=>o instanceof De))){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 De)||/[^ -~]/.test(n.text))return null;let l=ii(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=Xo(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 pe&&this.children.length==0&&e.children.length==0&&Pi(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 pe)return o;if(s>i)break}l=s+o.breakAfter}return null}}class it extends ae{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 it)||!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?ve.before(this.dom):ve.after(this.dom,e==this.length)}split(e){let i=this.length-e;this.length=e;let n=new it(this.widget,i,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return $n}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):ie.empty}domBoundsAround(){return null}become(e){return e instanceof it&&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 Yn?null:_i(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 Yn extends Wn{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 si{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 it&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new pe),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Li(new Ft(-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 it)&&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(Li(new De(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 ft){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 ft)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new it(n.widget||_t.block,r,n));else{let c=vt.create(n.widget||_t.inline,r,r?0:n.startSide),d=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<i||n.startSide>0),f=!c.isEditable&&(e<i||o>l.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),d&&(h.append(Li(new Ft(1),l),o),o=l.length+Math.max(0,o-l.length)),h.append(Li(c,l),o),this.atCursorPos=f,this.pendingBuffer=f?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 si(e,i,n,o);return s.openEnd=de.spans(l,i,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Li(a,e){for(let i of e)a=new tt(i,[a],a.length);return a}class _t extends Wn{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}}_t.inline=new _t("span"),_t.block=new _t("div");var ye=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(ye||(ye={}));const Ct=ye.LTR,Kn=ye.RTL;function ts(a){let e=[];for(let i=0;i<a.length;i++)e.push(1<<+a[i]);return e}const Gh=ts("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Jh=ts("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Hn=Object.create(null),Ye=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),i=a.charCodeAt(1);Hn[e]=i,Hn[i]=-e}function is(a){return a<=247?Gh[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Jh[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Xh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ut{get dir(){return this.level%2?Kn:Ct}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 ns(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||!ns(n.inner,l.inner))return!1}return!0}const re=[];function Zh(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,f=c,h=c;d<r;d++){let p=is(a.charCodeAt(d));p==512?p=f:p==8&&h==4&&(p=16),re[d]=p==4?2:p,p&7&&(h=p),f=p}for(let d=s,f=c,h=c;d<r;d++){let p=re[d];if(p==128)d<r-1&&f==re[d+1]&&f&24?p=re[d]=f:re[d]=256;else if(p==64){let m=d+1;for(;m<r&&re[m]==64;)m++;let k=d&&f==8||m<i&&re[m]==8?h==1?1:8:256;for(let b=d;b<m;b++)re[b]=k;d=m-1}else p==8&&h==1&&(re[d]=1);f=p,p&7&&(h=p)}}}function ef(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,f=s<n.length?n[s].from:i;for(let h=d,p,m,k;h<f;h++)if(m=Hn[p=a.charCodeAt(h)])if(m<0){for(let b=r-3;b>=0;b-=3)if(Ye[b+1]==-m){let x=Ye[b+2],v=x&2?l:x&4?x&1?o:l:0;v&&(re[h]=re[Ye[b]]=v),r=b;break}}else{if(Ye.length==189)break;Ye[r++]=h,Ye[r++]=p,Ye[r++]=c}else if((k=re[h])==2||k==1){let b=k==l;c=b?0:1;for(let x=r-3;x>=0;x-=3){let v=Ye[x+2];if(v&2)break;if(b)Ye[x+2]|=2;else{if(v&4)break;Ye[x+2]|=4}}}}}function tf(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=re[c];if(d==256){let f=c+1;for(;;)if(f==r){if(l==i.length)break;f=i[l++].to,r=l<i.length?i[l].from:e}else if(re[f]==256)f++;else break;let h=o==1,p=(f<e?re[f]:n)==1,m=h==p?h?1:2:n;for(let k=f,b=l,x=b?i[b-1].to:a;k>c;)k==x&&(k=i[--b].from,x=b?i[b-1].to:a),re[--k]=m;c=f}else o=d,c++}}}function Gn(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 f=!0,h=!1;if(d==o.length||c<o[d].from){let b=re[c];b!=r&&(f=!1,h=b==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,k=c;e:for(;;)if(d<o.length&&k==o[d].from){if(h)break e;let b=o[d];if(!f)for(let x=b.to,v=d+1;;){if(x==i)break e;if(v<o.length&&o[v].from==x)x=o[v++].to;else{if(re[x]==r)break e;break}}if(d++,p)p.push(b);else{b.from>c&&s.push(new ut(c,b.from,m));let x=b.direction==Ct!=!(m%2);Jn(a,x?n+1:n,l,b.inner,b.from,b.to,s),c=b.to}k=b.to}else{if(k==i||(f?re[k]!=r:re[k]==r))break;k++}p?Gn(a,c,k,n+1,l,p,s):c<k&&s.push(new ut(c,k,m)),c=k}else for(let c=i,d=o.length;c>e;){let f=!0,h=!1;if(!d||c>o[d-1].to){let b=re[c-1];b!=r&&(f=!1,h=b==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,k=c;e:for(;;)if(d&&k==o[d-1].to){if(h)break e;let b=o[--d];if(!f)for(let x=b.from,v=d;;){if(x==e)break e;if(v&&o[v-1].to==x)x=o[--v].from;else{if(re[x-1]==r)break e;break}}if(p)p.push(b);else{b.to<c&&s.push(new ut(b.to,c,m));let x=b.direction==Ct!=!(m%2);Jn(a,x?n+1:n,l,b.inner,b.from,b.to,s),c=b.from}k=b.from}else{if(k==e||(f?re[k-1]!=r:re[k-1]==r))break;k--}p?Gn(a,k,c,n+1,l,p,s):k<c&&s.push(new ut(k,c,m)),c=k}}function Jn(a,e,i,n,l,o,s){let r=e%2?2:1;Zh(a,l,o,n,r),ef(a,l,o,n,r),tf(l,o,n,r),Gn(a,l,o,e,i,n,s)}function nf(a,e,i){if(!a)return[new ut(0,0,e==Kn?1:0)];if(e==Ct&&!i.length&&!Xh.test(a))return ls(a.length);if(i.length)for(;a.length>re.length;)re[re.length]=256;let n=[],l=e==Ct?0:1;return Jn(a,l,l,i,0,a.length,n),n}function ls(a){return[new ut(0,a,0)]}let os="";function lf(a,e,i,n,l){var o;let s=n.head-a.from,r=ut.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 f=Xe(a.text,s,c.forward(l,i));(f<c.from||f>c.to)&&(f=d),os=a.text.slice(Math.min(s,f),Math.max(s,f));let h=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return h&&f==d&&h.level+(l?0:1)<c.level?K.cursor(h.side(!l,i)+a.from,h.forward(l,i)?1:-1,h.level):K.cursor(f+a.from,c.forward(l,i)?-1:1,c.level)}function of(a,e,i){for(let n=e;n<i;n++){let l=is(a.charCodeAt(n));if(l==1)return Ct;if(l==2||l==4)return Kn}return Ct}const ss=J.define(),as=J.define(),rs=J.define(),cs=J.define(),Xn=J.define(),ds=J.define(),hs=J.define(),Zn=J.define(),el=J.define(),fs=J.define({combine:a=>a.some(e=>e)}),sf=J.define({combine:a=>a.some(e=>e)}),us=J.define();class Dt{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 Dt(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 Dt(K.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ui=me.define({map:(a,e)=>a.map(e)}),ps=me.define();function Ke(a,e,i){let n=a.facet(cs);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 nt=J.define({combine:a=>a.length?a[0]:!0});let af=0;const Pt=J.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 $t{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(Pt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Pt.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=i||{};return new $t(af++,e,n,l,r=>{let c=[];return s&&c.push(ai.of(d=>{let f=d.plugin(r);return f?s(f):Ce.none})),o&&c.push(o(r)),c})}static fromClass(e,i){return $t.define((n,l)=>new e(n,l),i)}}class tl{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(Ke(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){Ke(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){Ke(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ms=J.define(),il=J.define(),ai=J.define(),gs=J.define(),nl=J.define(),ks=J.define();function bs(a,e){let i=a.state.facet(ks);if(!i.length)return i;let n=i.map(o=>o instanceof Function?o(a):o),l=[];return de.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let d=o-e.from,f=s-e.from,h=l;for(let p=r.length-1;p>=0;p--,c--){let m=r[p].spec.bidiIsolate,k;if(m==null&&(m=of(e.text,d,f)),c>0&&h.length&&(k=h[h.length-1]).to==d&&k.direction==m)k.to=f,h=k.inner;else{let b={from:d,to:f,direction:m,inner:[]};h.push(b),h=b.inner}}}}),l}const ys=J.define();function ws(a){let e=0,i=0,n=0,l=0;for(let o of a.state.facet(ys)){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 ri=J.define();class Te{constructor(e,i,n,l){this.fromA=e,this.toA=i,this.fromB=n,this.toB=l}join(e){return new Te(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,f=c?c.fromB:1e9;for(;o<i.length&&i[o]<f;){let h=i[o],p=i[o+1],m=Math.max(r,h),k=Math.min(f,p);if(m<=k&&new Te(m+d,k+d,m,k).addToSet(n),p>f)break;o+=2}if(!c)return n;new Te(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class zi{constructor(e,i,n){this.view=e,this.state=i,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ke.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 Te(o,s,r,c))),this.changedRanges=l}static create(e,i,n){return new zi(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 As extends ae{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=Ce.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 pe],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Te(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:f})=>f<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:!pf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?cf(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:f}=this.hasComposition;n=new Te(d,f,e.changes.mapPos(d,-1),e.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Y.ie||Y.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=ff(s,r,e.changes);return n=Te.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=Y.chrome||Y.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 it&&s.widget instanceof Yn&&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:f,toB:h}=r,p,m,k,b;if(n&&n.range.fromB<h&&n.range.toB>f){let w=si.build(this.view.state.doc,f,n.range.fromB,this.decorations,this.dynamicDecorationMap),u=si.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);m=w.breakAtStart,k=w.openStart,b=u.openEnd;let B=this.compositionView(n);u.breakAtStart?B.breakAfter=1:u.content.length&&B.merge(B.length,B.length,u.content[0],!1,u.openStart,0)&&(B.breakAfter=u.content[0].breakAfter,u.content.shift()),w.content.length&&B.merge(0,0,w.content[w.content.length-1],!0,0,w.openEnd)&&w.content.pop(),p=w.content.concat(B).concat(u.content)}else({content:p,breakAtStart:m,openStart:k,openEnd:b}=si.build(this.view.state.doc,f,h,this.decorations,this.dynamicDecorationMap));let{i:x,off:v}=o.findPos(d,1),{i:y,off:E}=o.findPos(c,-1);jo(this,y,E,x,v,p,m,k,b)}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(ps)&&(this.editContextFormatting=n.value)}compositionView(e){let i=new De(e.text.nodeValue);i.flags|=8;for(let{deco:l}of e.marks)i=new tt(l,[i],i.length);let n=new pe;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=ae.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(nt)||this.dom.tabIndex>-1)&&Ii(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(Y.gecko&&r.empty&&!this.hasComposition&&rf(c)){let h=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(h,c.node.childNodes[c.offset]||null)),c=d=new ve(h,0),s=!0}let f=this.view.observer.selectionRange;(s||!f.focusNode||(!ni(c.node,c.offset,f.anchorNode,f.anchorOffset)||!ni(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{Y.android&&Y.chrome&&this.dom.contains(f.focusNode)&&uf(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=ti(this.view.root);if(h)if(r.empty){if(Y.gecko){let p=df(c.node,c.offset);if(p&&p!=3){let m=(p==1?$o:Lo)(c.node,c.offset);m&&(c=new ve(m.node,m.offset))}}h.collapse(c.node,c.offset),r.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=r.bidiLevel)}else if(h.extend){h.collapse(c.node,c.offset);try{h.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),h.removeAllRanges(),h.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 ve(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new ve(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&ni(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=ti(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!i.empty||!i.assoc||!n.modify)return;let s=pe.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 f=this.domAtPos(i.head+i.assoc);n.collapse(f.node,f.offset),n.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.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=ae.get(i.childNodes[l]);o instanceof pe&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=ae.get(i.childNodes[l]);o instanceof pe&&(n=o.domAtPos(o.length))}return n?new ve(n.node,n.offset,!0):e}nearest(e){for(let i=e;i;){let n=ae.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 pe)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 pe&&!(n instanceof pe&&i>=0)))n=r,l=d;else if(n&&d==e&&c==e&&r instanceof it&&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 pe))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 De))return null;let o=Xe(l.text,n);if(o==n)return null;let s=xt(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==ye.LTR;for(let d=0,f=0;f<this.children.length;f++){let h=this.children[f],p=d+h.length;if(p>l)break;if(d>=n){let m=h.dom.getBoundingClientRect();if(i.push(m.height),s){let k=h.dom.lastChild,b=k?ii(k):[];if(b.length){let x=b[b.length-1],v=c?x.right-m.left:m.right-x.left;v>r&&(r=v,this.minWidth=o,this.minWidthFrom=d,this.minWidthTo=p)}}}d=p+h.breakAfter}return i}textDirectionAt(e){let{i}=this.childPos(e,1);return getComputedStyle(this.children[i].dom).direction=="rtl"?ye.RTL:ye.LTR}measureTextSize(){for(let o of this.children)if(o instanceof pe){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=ii(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 zo(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(Ce.replace({widget:new Yn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return Ce.set(e)}updateDeco(){let e=1,i=this.view.state.facet(ai).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(gs).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(de.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(us))try{if(d(this.view,e.range,e))return!0}catch(f){Ke(this.view.state,f,"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=ws(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;$h(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==ye.LTR)}}function rf(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 xs(a,e){let i=a.observer.selectionRange;if(!i.focusNode)return null;let n=$o(i.focusNode,i.focusOffset),l=Lo(i.focusNode,i.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=ae.get(l.node);if(!r||r instanceof De&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=ae.get(n.node);!c||c instanceof De&&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 cf(a,e,i){let n=xs(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 Te(c.mapPos(o),c.mapPos(s),o,s),f=[];for(let h=l.parentNode;;h=h.parentNode){let p=ae.get(h);if(p instanceof tt)f.push({node:h,deco:p.mark});else{if(p instanceof pe||h.nodeName=="DIV"&&h.parentNode==a.contentDOM)return{range:d,text:l,marks:f,line:h};if(h!=a.contentDOM)f.push({node:h,deco:new li({inclusive:!0,attributes:Kh(h),tagName:h.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 hf=class{constructor(){this.changes=[]}compareRange(e,i){$i(e,i,this.changes)}comparePoint(e,i){$i(e,i,this.changes)}boundChange(e){$i(e,e,this.changes)}};function ff(a,e,i){let n=new hf;return de.compare(a,e,i,n),n.changes}function uf(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 pf(a,e){let i=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(i=!0)}),i}function mf(a,e,i=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return K.cursor(e);o==0?i=1:o==l.length&&(i=-1);let s=o,r=o;i<0?s=Xe(l.text,o,!1):r=Xe(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let d=Xe(l.text,s,!1);if(n(l.text.slice(d,s))!=c)break;s=d}for(;r<l.length;){let d=Xe(l.text,r);if(n(l.text.slice(r,d))!=c)break;r=d}return K.range(s+l.from,r+l.from)}function gf(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function kf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ll(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function vs(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function Cs(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ol(a,e,i){let n,l,o,s,r=!1,c,d,f,h;for(let k=a.firstChild;k;k=k.nextSibling){let b=ii(k);for(let x=0;x<b.length;x++){let v=b[x];l&&ll(l,v)&&(v=vs(Cs(v,l.bottom),l.top));let y=gf(e,v),E=kf(i,v);if(y==0&&E==0)return k.nodeType==3?Ss(k,e,i):ol(k,e,i);(!n||s>E||s==E&&o>y)&&(n=k,l=v,o=y,s=E,r=y?e<v.left?x>0:x<b.length-1:!0),y==0?i>v.bottom&&(!f||f.bottom<v.bottom)?(c=k,f=v):i<v.top&&(!h||h.top>v.top)&&(d=k,h=v):f&&ll(f,v)?f=Cs(f,v.bottom):h&&ll(h,v)&&(h=vs(h,v.top))}}if(f&&f.bottom>=i?(n=c,l=f):h&&h.top<=i&&(n=d,l=h),!n)return{node:a,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return Ss(n,p,i);if(r&&n.contentEditable!="false")return ol(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 Ss(a,e,i){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=xt(a,r,r+1).getClientRects();for(let d=0;d<c.length;d++){let f=c[d];if(f.top==f.bottom)continue;s||(s=e-f.left);let h=(f.top>i?f.top-i:i-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&h<o){let p=e>=(f.left+f.right)/2,m=p;if((Y.chrome||Y.gecko)&&xt(a,r).getBoundingClientRect().left==f.right&&(m=!p),h<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=h}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function Bs(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:f,y:h}=e,p=h-r;if(p<0)return 0;if(p>d)return a.state.doc.length;for(let w=a.viewState.heightOracle.textHeight/2,u=!1;c=a.elementAtHeight(p),c.type!=We.Text;)for(;p=n>0?c.bottom+w:c.top-w,!(p>=0&&p<=d);){if(u)return i?null:0;u=!0,n=-n}h=r+p;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:i?null:Ns(a,s,c,f,h);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:i?null:Ns(a,s,c,f,h);let k=a.dom.ownerDocument,b=a.root.elementFromPoint?a.root:k,x=b.elementFromPoint(f,h);x&&!a.contentDOM.contains(x)&&(x=null),x||(f=Math.max(s.left+1,Math.min(s.right-1,f)),x=b.elementFromPoint(f,h),x&&!a.contentDOM.contains(x)&&(x=null));let v,y=-1;if(x&&((l=a.docView.nearest(x))===null||l===void 0?void 0:l.isEditable)!=!1){if(k.caretPositionFromPoint){let w=k.caretPositionFromPoint(f,h);w&&({offsetNode:v,offset:y}=w)}else if(k.caretRangeFromPoint){let w=k.caretRangeFromPoint(f,h);w&&({startContainer:v,startOffset:y}=w,(!a.contentDOM.contains(v)||Y.safari&&bf(v,y,f)||Y.chrome&&yf(v,y,f))&&(v=void 0))}v&&(y=Math.min(Qe(v),y))}if(!v||!a.docView.dom.contains(v)){let w=pe.find(a.docView,m);if(!w)return p>c.top+c.height/2?c.to:c.from;({node:v,offset:y}=ol(w.dom,f,h))}let E=a.docView.nearest(v);if(!E)return null;if(E.isWidget&&((o=E.dom)===null||o===void 0?void 0:o.nodeType)==1){let w=E.dom.getBoundingClientRect();return e.y<w.top||e.y<=w.bottom&&e.x<=(w.left+w.right)/2?E.posAtStart:E.posAtEnd}else return E.localPosFromDOM(v,y)+E.posAtStart}function Ns(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+_h(s,o,a.state.tabSize)}function bf(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 xt(a,n-1,n).getBoundingClientRect().right>i}function yf(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():xt(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==We.Text&&(l.type!=o.type||(i<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function Af(a,e,i,n){let l=wf(a,e.head,e.assoc||-1),o=!n||l.type!=We.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==ye.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return K.cursor(c,i?-1:1)}return K.cursor(i?l.to:l.from,i?-1:1)}function Vs(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=lf(l,o,s,r,i),f=os;if(!d){if(l.number==(i?a.state.doc.lines:1))return r;f=`
21
+ `,l=a.state.doc.line(l.number+(i?1:-1)),o=a.bidiSpans(l),d=a.visualLineSide(l,!i)}if(c){if(!c(f))return r}else{if(!n)return d;c=n(f)}r=d}}function xf(a,e,i){let n=a.state.charCategorizer(e),l=n(i);return o=>{let s=n(o);return l==et.Space&&(l=s),l==s}}function vf(a,e,i,n){let l=e.head,o=i?1:-1;if(l==(i?a.state.doc.length:0))return K.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),d=a.coordsAtPos(l,e.assoc||-1),f=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)+f}let h=c.left+s,p=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let k=r+(p+m)*o,b=Bs(a,{x:h,y:k},!1,o);if(k<c.top||k>c.bottom||(o<0?b<l:b>l)){let x=a.docView.coordsForChar(b),v=!x||k<x.top?-1:1;return K.cursor(b,v,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 sl(a,e,i){let n=ji(a.state.facet(nl).map(l=>l(a)),i.from,e.head>i.from?-1:1);return n==i.from?i:K.cursor(n,n<i.from?1:-1)}const ci="￿";class Cf{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(oe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}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=ae.get(l),c=ae.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:Fi(l))||Fi(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=ae.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+(Sf(e,n.node,n.offset)?i:0))}}function Sf(a,e,i){for(;;){if(!e||i<Qe(e))return!1;if(e==a)return!0;i=At(e)+1,e=e.parentNode}}class Rs{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class Bf{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?[]:Rf(e),c=new Cf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Ef(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Pn(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||!Pn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((Y.ios||Y.chrome)&&e.state.selection.main.empty&&c!=d&&(f.from>0||f.to<e.state.doc.length)){let h=Math.min(c,d),p=Math.max(c,d),m=f.from-h,k=f.to-p;(m==0||m==1||h==0)&&(k==0||k==-1||p==e.state.doc.length)&&(c=0,d=e.state.doc.length)}this.newSel=K.single(d,c)}}}function Es(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||Y.android&&e.text.length<r-s)&&(c=l.to,d="end");let f=Vf(a.state.doc.sliceString(s,r,ci),e.text,c-s,d);f&&(Y.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ci+ci&&f.toB--,i={from:s+f.from,to:s+f.toA,insert:ie.of(e.text.slice(f.from,f.toB).split(ci))})}else n&&(!a.hasFocus&&a.state.facet(nt)||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)}:(Y.mac||Y.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=K.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:ie.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))}:Y.chrome&&i&&i.from==i.to&&i.from==l.head&&i.insert.toString()==`
22
+ `&&a.lineWrapping&&(n&&(n=K.single(n.main.anchor-1,n.main.head-1)),i={from:l.from,to:l.to,insert:ie.of([" "])}),i)return al(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 al(a,e,i,n=-1){if(Y.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(Y.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&&It(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)&&It(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&It(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=Nf(a,e,i));return a.state.facet(ds).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function Nf(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),f,h=i&&xs(a,i.main.head);if(h){let k=e.insert.length-(e.to-e.from);f={from:h.from,to:h.to-k}}else f=a.state.doc.lineAt(o.head);let p=o.to-e.to,m=o.to-o.from;n=l.changeByRange(k=>{if(k.from==o.from&&k.to==o.to)return{changes:r,range:c||k.map(r)};let b=k.to-p,x=b-d.length;if(k.to-k.from!=m||a.state.sliceDoc(x,b)!=d||k.to>=f.from&&k.from<=f.to)return{range:k};let v=l.changes({from:x,to:b,insert:e.insert}),y=k.to-o.to;return{changes:v,range:c?K.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):k.map(v)}})}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 Vf(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 Rf(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 Rs(i,n)),(l!=i||o!=n)&&e.push(new Rs(l,o))),e}function Ef(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?K.single(i+e,n+e):null}class Of{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,Y.safari&&e.contentDOM.addEventListener("input",()=>null),Y.gecko&&Kf(e.contentDOM.ownerDocument)}handleEvent(e){!Lf(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=Mf(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&&If.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Y.android&&Y.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return Y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((i=Ms.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||Tf.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,It(this.view.contentDOM,i.key,i.keyCode,i instanceof KeyboardEvent?i:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Y.safari&&!Y.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 Os(a,e){return(i,n)=>{try{return e.call(a,n,i)}catch(l){Ke(i.state,l)}}}function Mf(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(Os(n.value,c))}if(s)for(let r in s){let c=s[r];c&&i(r).observers.push(Os(n.value,c))}}for(let n in Pe)i(n).handlers.push(Pe[n]);for(let n in Ie)i(n).observers.push(Ie[n]);return e}const Ms=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Tf="dthko",If=[16,17,18,20,91,92,224,225],qi=6;function Qi(a){return Math.max(0,a)*.7+8}function Ff(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class _f{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=Lh(e.contentDOM),this.atoms=e.state.facet(nl).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(oe.allowMultipleSelections)&&Df(e,i),this.dragging=$f(e,i)&&Us(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&&Ff(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=ws(this.view);e.clientX-c.left<=l+qi?i=-Qi(l-e.clientX):e.clientX+c.right>=s-qi&&(i=Qi(e.clientX-s)),e.clientY-c.top<=o+qi?n=-Qi(o-e.clientY):e.clientY+c.bottom>=r-qi&&(n=Qi(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=K.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=K.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(i||(i=e.ranges.slice()),i[n]=o)}return i?K.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 Df(a,e){let i=a.state.facet(ss);return i.length?i[0](e):Y.mac?e.metaKey:e.ctrlKey}function Pf(a,e){let i=a.state.facet(as);return i.length?i[0](e):Y.mac?!e.altKey:!e.ctrlKey}function $f(a,e){let{main:i}=a.state.selection;if(i.empty)return!1;let n=ti(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 Lf(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=ae.get(i))&&n.ignoreEvent(e))return!1;return!0}const Pe=Object.create(null),Ie=Object.create(null),Ts=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function Uf(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(),Is(a,i.value)},50)}function Wi(a,e,i){for(let n of a.facet(e))i=n(i,a);return i}function Is(a,e){e=Wi(a.state,Zn,e);let{state:i}=a,n,l=1,o=i.toText(e),s=o.lines==i.selection.ranges.length;if(rl!=null&&i.selection.ranges.every(c=>c.empty)&&rl==o.toString()){let c=-1;n=i.changeByRange(d=>{let f=i.doc.lineAt(d.from);if(f.from==c)return{range:d};c=f.from;let h=i.toText((s?o.line(l++).text:e)+i.lineBreak);return{changes:{from:f.from,insert:h},range:K.cursor(d.from+h.length)}})}else s?n=i.changeByRange(c=>{let d=o.line(l++);return{changes:{from:c.from,to:c.to,insert:d.text},range:K.cursor(c.from+d.length)}}):n=i.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ie.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Pe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Ie.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Ie.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Pe.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(rs))if(i=n(a,e),i)break;if(!i&&e.button==0&&(i=qf(a,e)),i){let n=!a.hasFocus;a.inputState.startMouseSelection(new _f(a,e,i,n)),n&&a.observer.ignore(()=>{Fo(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 Fs(a,e,i,n){if(n==1)return K.cursor(e,i);if(n==2)return mf(a.state,e,i);{let l=pe.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++,K.range(s,r)}}let _s=(a,e,i)=>e>=i.top&&e<=i.bottom&&a>=i.left&&a<=i.right;function zf(a,e,i,n){let l=pe.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&&_s(i,n,s))return-1;let r=l.coordsAt(o,1);return r&&_s(i,n,r)?1:s&&s.bottom>=n?-1:1}function Ds(a,e){let i=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:zf(a,i,e.clientX,e.clientY)}}const jf=Y.ie&&Y.ie_version<=11;let Ps=null,$s=0,Ls=0;function Us(a){if(!jf)return a.detail;let e=Ps,i=Ls;return Ps=a,Ls=Date.now(),$s=!e||i>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?($s+1)%3:1}function qf(a,e){let i=Ds(a,e),n=Us(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=Ds(a,o),d,f=Fs(a,c.pos,c.bias,n);if(i.pos!=c.pos&&!s){let h=Fs(a,i.pos,i.bias,n),p=Math.min(h.from,f.from),m=Math.max(h.to,f.to);f=p<f.from?K.range(p,m):K.range(m,p)}return s?l.replaceRange(l.main.extend(f.from,f.to)):r&&n==1&&l.ranges.length>1&&(d=Qf(l,c.pos))?d:r?l.addRange(f):K.create([f])}}}function Qf(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 K.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}Pe.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=K.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",Wi(a.state,el,a.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Pe.dragend=a=>(a.inputState.draggedContent=null,!1);function zs(a,e,i,n){if(i=Wi(a.state,Zn,i),!i)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&Pf(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}Pe.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&&zs(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 zs(a,e,n,!0),!0}return!1},Pe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let i=Ts?null:e.clipboardData;return i?(Is(a,i.getData("text/plain")||i.getData("text/uri-list")),!0):(Uf(a),!1)};function Wf(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 Yf(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:Wi(a,el,e.join(a.lineBreak)),ranges:i,linewise:n}}let rl=null;Pe.copy=Pe.cut=(a,e)=>{let{text:i,ranges:n,linewise:l}=Yf(a.state);if(!i&&!l)return!1;rl=l?i:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Ts?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",i),!0):(Wf(a,i),!1)};const js=Rt.define();function qs(a,e){let i=[];for(let n of a.facet(hs)){let l=n(a,e);l&&i.push(l)}return i.length?a.update({effects:i,annotations:js.of(!0)}):null}function Qs(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let i=qs(a.state,e);i?a.dispatch(i):a.update([])}},10)}Ie.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),Qs(a)},Ie.blur=a=>{a.observer.clearSelectionRange(),Qs(a)},Ie.compositionstart=Ie.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Ie.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,Y.chrome&&Y.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Ie.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Pe.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 al(a,{from:c,to:d,insert:a.state.toText(o)},null),!0}}let l;if(Y.chrome&&Y.android&&(l=Ms.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 Y.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),Y.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Ie.compositionend(a,e),20),!1};const Ws=new Set;function Kf(a){Ws.has(a)||(Ws.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Ys=["pre-wrap","normal","pre-line","break-spaces"];let Lt=!1;function Ks(){Lt=!1}class Hf{constructor(e){this.lineWrapping=e,this.doc=ie.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 Ys.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=Ys.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 f=s[d];f<0?d++:this.heightSamples[Math.floor(f*10)]=!0}}return c}}class Gf{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class He{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"?We.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 ft?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 He(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var he=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(he||(he={}));const Yi=.001;class Se{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)>Yi&&(Lt=!0),this.height=e)}replace(e,i,n){return Se.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:f,toB:h}=l[r],p=o.lineAt(c,he.ByPosNoHeight,n.setDoc(i),0,0),m=p.to>=d?p:o.lineAt(d,he.ByPosNoHeight,n,0,0);for(h+=m.to-d,d=m.to;r>0&&p.from<=l[r-1].toA;)c=l[r-1].fromA,f=l[r-1].fromB,r--,c<p.from&&(p=o.lineAt(c,he.ByPosNoHeight,n,0,0));f+=p.from-c,c=p.from;let k=cl.build(n.setDoc(s),e,f,h);o=Ki(o,o.replace(c,d,k))}return o.updateHeight(n,0)}static empty(){return new Ee(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 Jf(Se.of(e.slice(0,i)),s,Se.of(e.slice(n)))}}function Ki(a,e){return a==e?a:(a.constructor!=e.constructor&&(Lt=!0),e)}Se.prototype.size=1;class Hs extends Se{constructor(e,i,n){super(e,i),this.deco=n}blockAt(e,i,n,l){return new He(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 Ee extends Hs{constructor(e,i){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,i,n,l){return new He(l,this.length,n,this.height,this.breaks)}replace(e,i,n){let l=n[0];return n.length==1&&(l instanceof Ee||l instanceof we&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof we?l=new Ee(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Se.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 we extends Se{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)),f=i.doc.lineAt(d),h=r+f.length*c,p=Math.max(n,e-h/2);return new He(f.from,f.length,p,h,0)}else{let d=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:f,length:h}=i.doc.line(o+d);return new He(f,h,n+r*d,r,0)}}lineAt(e,i,n,l,o){if(i==he.ByHeight)return this.blockAt(e,n,l,o);if(i==he.ByPosNoHeight){let{from:m,to:k}=n.doc.lineAt(e);return new He(m,k-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),d=n.doc.lineAt(e),f=r+d.length*c,h=d.number-s,p=l+r*h+c*(d.from-o-h);return new He(d.from,d.length,Math.max(l,Math.min(p,l+this.height-f)),f,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 f=e,h=l;f<=i;){let p=n.doc.lineAt(f);if(f==e){let k=p.number-r;h+=c*k+d*(e-o-k)}let m=c+d*p.length;s(new He(p.from,p.length,h,m,0)),h+=m,f=p.to+1}}replace(e,i,n){let l=this.length-i;if(l>0){let o=n[n.length-1];o instanceof we?n[n.length-1]=new we(o.length+l):n.push(null,new we(l-1))}if(e>0){let o=n[0];o instanceof we?n[0]=new we(e+o.length):n.unshift(new we(e-1),null)}return Se.of(n)}decomposeLeft(e,i){i.push(new we(e-1),null)}decomposeRight(e,i){i.push(null,new we(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 we(l.from-i-1).updateHeight(e,i));r<=o&&l.more;){let f=e.doc.lineAt(r).length;s.length&&s.push(null);let h=l.heights[l.index++];c==-1?c=h:Math.abs(h-c)>=Yi&&(c=-2);let p=new Ee(f,h);p.outdated=!1,s.push(p),r+=f+1}r<=o&&s.push(null,new we(o-r).updateHeight(e,r));let d=Se.of(s);return(c<0||Math.abs(d.height-this.height)>=Yi||Math.abs(c-this.heightMetrics(e,i).perLine)>=Yi)&&(Lt=!0),Ki(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 Jf extends Se{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==he.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 f=i==he.ByPosNoHeight?he.ByPosNoHeight:he.ByPos;return c?d.join(this.right.lineAt(r,f,n,s,r)):this.left.lineAt(r,f,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,he.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&&Gs(o,s-1),i<this.length){let r=o.length;this.decomposeRight(i,o),Gs(o,r)}return Se.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?Se.of(this.break?[e,null,i]:[e,i]):(this.left=Ki(this.left,e),this.right=Ki(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 Gs(a,e){let i,n;a[e]==null&&(i=a[e-1])instanceof we&&(n=a[e+1])instanceof we&&a.splice(e-1,3,new we(i.length+1+n.length))}const Xf=5;class cl{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 Ee?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ee(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 Hs(s,l,n)):(s||o||l>=Xf)&&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 Ee(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,i){let n=new we(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 Ee)return e;let i=new Ee(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 Ee)&&!this.isCovered?this.nodes.push(new Ee(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 Ee&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,i,n,l){let o=new cl(n,e);return de.spans(i,n,l,o,0),o.finish(n)}}function Zf(a,e,i){let n=new eu;return de.compare(a,e,i,n,0),n.changes}class eu{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,n,l){(e<i||n&&n.heightRelevant||l&&l.heightRelevant)&&$i(e,i,this.changes,5)}}function tu(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 f=d,h=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&h.overflow!="visible"){let p=f.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=h.position=="absolute"||h.position=="fixed"?f.offsetParent:f.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 iu(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 nu(a,e){let i=a.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class dl{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 Ce.replace({widget:new lu(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class lu extends Wn{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 Js{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=Xs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ye.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=e.facet(il).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Hf(i),this.stateDeco=e.facet(ai).filter(n=>typeof n!="function"),this.heightMap=Se.empty().applyChanges(this.stateDeco,ie.empty,this.heightOracle.setDoc(e.doc),[new Te(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=Ce.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 Hi(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?Xs:new hl(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(di(e,this.scaler))})}update(e,i=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ai).filter(f=>typeof f!="function");let l=e.changedRanges,o=Te.extendWithRanges(l,Zf(n,this.stateDeco,e?e.changes:ke.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ks(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Lt)&&(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(sf)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ye.RTL:ye.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,f=0;if(r.width&&r.height){let{scaleX:w,scaleY:u}=Io(i,r);(w>.005&&Math.abs(this.scaleX-w)>.005||u>.005&&Math.abs(this.scaleY-u)>.005)&&(this.scaleX=w,this.scaleY=u,d|=16,s=c=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=p)&&(this.paddingTop=h,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=Po(e.scrollDOM);let k=(this.printing?nu:tu)(i,this.paddingTop),b=k.top-this.pixelViewport.top,x=k.bottom-this.pixelViewport.bottom;this.pixelViewport=k;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(c=!0)),!this.inView&&!this.scrollTarget&&!iu(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 w=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(w)&&(s=!0),s||l.lineWrapping&&Math.abs(y-this.contentDOMWidth)>l.charWidth){let{lineHeight:u,charWidth:B,textHeight:M}=e.docView.measureTextSize();s=u>0&&l.refresh(o,u,B,M,Math.max(5,y/B),w),s&&(e.docView.minWidth=0,d|=16)}b>0&&x>0?f=Math.max(b,x):b<0&&x<0&&(f=Math.min(b,x)),Ks();for(let u of this.viewports){let B=u.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(u);this.heightMap=(s?Se.empty().applyChanges(this.stateDeco,ie.empty,this.heightOracle,[new Te(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new Gf(u.from,B))}Lt&&(d|=2)}let E=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),d|=this.updateForViewport()),(d&2||E)&&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 Hi(l.lineAt(s-n*1e3,he.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,he.ByHeight,o,0,0).to);if(i){let{head:d}=i.range;if(d<c.from||d>c.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=l.lineAt(d,he.ByPos,o,0,0),p;i.y=="center"?p=(h.top+h.bottom)/2-f/2:i.y=="start"||i.y=="nearest"&&d<c.from?p=h.top:p=h.bottom-f,c=new Hi(l.lineAt(p-1e3/2,he.ByHeight,o,0,0).from,l.lineAt(p+f+1e3/2,he.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 Hi(this.heightMap.lineAt(n,he.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,he.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,he.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(i,he.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 dl(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!=ye.LTR&&!n)return[];let r=[],c=(f,h,p,m)=>{if(h-f<o)return;let k=this.state.selection.main,b=[k.from];k.empty||b.push(k.to);for(let v of b)if(v>f&&v<h){c(f,v-10,p,m),c(v+10,h,p,m);return}let x=su(e,v=>v.from>=p.from&&v.to<=p.to&&Math.abs(v.from-f)<o&&Math.abs(v.to-h)<o&&!b.some(y=>v.from<y&&v.to>y));if(!x){if(h<p.to&&i&&n&&i.visibleRanges.some(E=>E.from<=h&&E.to>=h)){let E=i.moveToLineBoundary(K.cursor(h),!1,!0).head;E>f&&(h=E)}let v=this.gapSize(p,f,h,m),y=n||v<2e6?v:2e6;x=new dl(f,h,v,y)}r.push(x)},d=f=>{if(f.length<s||f.type!=We.Text)return;let h=ou(f.from,f.to,this.stateDeco);if(h.total<s)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,m,k;if(n){let b=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,v;if(p!=null){let y=Ji(h,p),E=((this.visibleBottom-this.visibleTop)/2+b)/f.height;x=y-E,v=y+E}else x=(this.visibleTop-f.top-b)/f.height,v=(this.visibleBottom-f.top+b)/f.height;m=Gi(h,x),k=Gi(h,v)}else{let b=h.total*this.heightOracle.charWidth,x=l*this.heightOracle.charWidth,v=0;if(b>2e6)for(let B of e)B.from>=f.from&&B.from<f.to&&B.size!=B.displaySize&&B.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=B.size-B.displaySize);let y=this.pixelViewport.left+v,E=this.pixelViewport.right+v,w,u;if(p!=null){let B=Ji(h,p),M=((E-y)/2+x)/b;w=B-M,u=B+M}else w=(y-x)/b,u=(E+x)/b;m=Gi(h,w),k=Gi(h,u)}m>f.from&&c(f.from,m,f,h),k<f.to&&c(k,f.to,f,h)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(d):d(f);return r}gapSize(e,i,n,l){let o=Ji(l,n)-Ji(l,i);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){dl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ce.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=[];de.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)||di(this.heightMap.lineAt(e,he.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)||di(this.heightMap.lineAt(this.scaler.fromDOM(e),he.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 di(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 Hi{constructor(e,i){this.from=e,this.to=i}}function ou(a,e,i){let n=[],l=a,o=0;return de.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 Gi({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 Ji(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 su(a,e){for(let i of a)if(e(i))return i}const Xs={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class hl{constructor(e,i,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let d=i.lineAt(r,he.ByPos,e,0,0).top,f=i.lineAt(c,he.ByPos,e,0,0).bottom;return l+=f-d,{from:r,to:c,top:d,bottom:f,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 hl?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 di(a,e){if(e.scale==1)return a;let i=e.toDOM(a.top),n=e.toDOM(a.bottom);return new He(a.from,a.length,i,n-i,Array.isArray(a._content)?a._content.map(l=>di(l,e)):a._content)}const Xi=J.define({combine:a=>a.join(" ")}),fl=J.define({combine:a=>a.indexOf(!0)>-1}),ul=ht.newName(),Zs=ht.newName(),ea=ht.newName(),ta={"&light":"."+Zs,"&dark":"."+ea};function pl(a,e,i){return new ht(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 au=pl("."+ul,{"&":{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"}},ta),ru={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ml=Y.ie&&Y.ie_version<=11;class cu{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Uh,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);(Y.ie&&Y.ie_version<=11||Y.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&&Y.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Y.chrome&&Y.chrome_version<126)&&(this.editContext=new hu(e),e.state.facet(nt)&&(e.contentDOM.editContext=this.editContext.editContext)),ml&&(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(nt)?n.root.activeElement!=this.dom:!Ii(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(Y.ie&&Y.ie_version<=11||Y.android&&Y.chrome)&&!n.state.selection.main.empty&&l.focusNode&&ni(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=ti(e.root);if(!i)return!1;let n=Y.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=Ii(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&jh(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,ru),ml&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ml&&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&&It(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&&Ii(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 Bf(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=Es(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=ia(i,e.previousSibling||e.target.previousSibling,-1),l=ia(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(nt)!=e.state.facet(nt)&&(e.view.contentDOM.editContext=e.state.facet(nt)?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 ia(a,e,i){for(;e;){let n=ae.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 na(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 ni(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 na(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?na(a,i):null}class hu{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:ie.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 f=K.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));f.main.eq(l)||e.dispatch({selection:f,userEvent:"select"});return}if((Y.mac||Y.android)&&d.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:r,to:c,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);al(e,d,K.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}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 f=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(Ce.mark({attributes:{style:f}}).range(c,d))}}}e.dispatch({effects:ps.of(Ce.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=ti(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 f=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+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(o+=i,s+=i,s<=this.from)this.from+=f,this.to+=f;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+=f}i+=f}),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 le{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||zh(e.parent)||document,this.viewState=new Js(e.state||oe.create(e)),e.scrollTo&&e.scrollTo.is(Ui)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Pt).map(l=>new tl(l));for(let l of this.plugins)l.update(this);this.observer=new cu(this),this.inputState=new Of(this),this.inputState.ensureHandlers(this.plugins),this.docView=new As(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 xe?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=qs(o,s),c||(r=1));let d=this.observer.delayedAndroidKey,f=null;if(d?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(f=null)):this.observer.clear(),o.facet(oe.phrases)!=this.state.facet(oe.phrases))return this.setState(o);l=zi.create(this,o,e),l.flags|=r;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(h&&(h=h.map(p.changes)),p.scrollIntoView){let{main:m}=p.state.selection;h=new Dt(m.empty?m:K.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of p.effects)m.is(Ui)&&(h=m.value.clip(this.state))}this.viewState.update(l,h),this.bidiCache=Zi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),i=this.docView.update(l),this.state.facet(ri)!=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(Xi)!=l.state.facet(Xi)&&(this.viewState.mustMeasureContent=!0),(i||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(Xn))try{p(l)}catch(m){Ke(this.state,m,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!Es(this,f)&&d.force&&It(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 Js(e),this.plugins=e.facet(Pt).map(n=>new tl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new As(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(Pt),n=e.state.facet(Pt);if(i!=n){let l=[];for(let o of n){let s=i.indexOf(o);if(s<0)l.push(new tl(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){Ke(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(Po(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 f=d.map(m=>{try{return m.read(this)}catch(k){return Ke(this.state,k),la}}),h=zi.create(this,this.state,[]),p=!1;h.flags|=c,i?i.flags|=c:i=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),p=this.docView.update(h),p&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(f[m]!=la)try{let k=d[m];k.write&&k.write(f[m],this)}catch(k){Ke(this.state,k)}if(p&&this.docView.updateSelection(!0),!h.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 k=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(k>1||k<-1){l=l+k,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(Xn))r(i)}get themeClasses(){return ul+" "+(this.state.facet(fl)?ea:Zs)+" "+this.state.facet(Xi)}updateAttrs(){let e=oa(this,ms,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nt)?"true":"false",class:"cm-content",style:`${Y.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),oa(this,il,i);let n=this.observer.ignore(()=>{let l=Qn(this.contentDOM,this.contentAttrs,i),o=Qn(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(le.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(ri);let e=this.state.facet(le.cspNonce);ht.mount(this.root,this.styleModules.concat(au).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 sl(this,e,Vs(this,e,i,n))}moveByGroup(e,i){return sl(this,e,Vs(this,e,i,n=>xf(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 K.cursor(o.side(i,l)+e.from,o.forward(!i,l)?1:-1)}moveToLineBoundary(e,i,n=!0){return Af(this,e,i,n)}moveVertically(e,i,n){return sl(this,e,vf(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(),Bs(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[ut.find(o,e-l.from,-1,i)];return _i(n,s.dir==ye.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(fs)||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>fu)return ls(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||ns(o.isolates,n=bs(this,e))))return o.order;n||(n=bs(this,e));let l=nf(e.text,i,n);return this.bidiCache.push(new Zi(e.from,e.to,i,n,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Y.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Fo(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 Ui.of(new Dt(typeof e=="number"?K.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 Ui.of(new Dt(K.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 $t.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return $t.define(()=>({}),{eventObservers:e})}static theme(e,i){let n=ht.newName(),l=[Xi.of(n),ri.of(pl(`.${n}`,e))];return i&&i.dark&&l.push(fl.of(!0)),l}static baseTheme(e){return Ch.lowest(ri.of(pl("."+ul,e,ta)))}static findFromDOM(e){var i;let n=e.querySelector(".cm-content"),l=n&&ae.get(n)||ae.get(e);return((i=l?.rootView)===null||i===void 0?void 0:i.view)||null}}le.styleModule=ri,le.inputHandler=ds,le.clipboardInputFilter=Zn,le.clipboardOutputFilter=el,le.scrollHandler=us,le.focusChangeEffect=hs,le.perLineTextDirection=fs,le.exceptionSink=cs,le.updateListener=Xn,le.editable=nt,le.mouseSelectionStyle=rs,le.dragMovesSelection=as,le.clickAddsSelectionRange=ss,le.decorations=ai,le.outerDecorations=gs,le.atomicRanges=nl,le.bidiIsolatedRanges=ks,le.scrollMargins=ys,le.darkTheme=fl,le.cspNonce=J.define({combine:a=>a.length?a[0]:""}),le.contentAttributes=il,le.editorAttributes=ms,le.lineWrapping=le.contentAttributes.of({class:"cm-lineWrapping"}),le.announce=me.define();const fu=4096,la={};class Zi{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:ye.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 Zi(i.mapPos(s.from,1),i.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function oa(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&&qn(s,i)}return i}class Ut extends Ot{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ut.prototype.elementClass="",Ut.prototype.toDOM=void 0,Ut.prototype.mapMode=Re.TrackBefore,Ut.prototype.startSide=Ut.prototype.endSide=-1,Ut.prototype.point=!0;var gl;const zt=new ne;function uu(a){return J.define({combine:a?e=>e.concat(a):void 0})}const pu=new ne;class $e{constructor(e,i,n=[],l=""){this.data=e,this.name=l,oe.prototype.hasOwnProperty("tree")||Object.defineProperty(oe.prototype,"tree",{get(){return kl(this)}}),this.parser=i,this.extension=[qt.of(this),oe.languageData.of((o,s,r)=>{let c=sa(o,s,r),d=c.type.prop(zt);if(!d)return[];let f=o.facet(d),h=c.type.prop(pu);if(h){let p=c.resolve(s-c.from,r);for(let m of h)if(m.test(p,o)){let k=o.facet(m.facet);return m.type=="replace"?k:k.concat(f)}}return f})].concat(n)}isActiveAt(e,i,n=-1){return sa(e,i,n).type.prop(zt)==this.data}findRegions(e){let i=e.facet(qt);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(zt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(ne.mounted);if(r){if(r.tree.prop(zt)==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 ue&&l(d,o.positions[c]+s)}};return l(kl(e),0),n}get allowsNesting(){return!0}}$e.setState=me.define();function sa(a,e,i){let n=a.facet(qt),l=kl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,i,ge.ExcludeBuffers))o.type.isTop&&(l=o);return l}class en extends $e{constructor(e,i,n){super(e,i,[],n),this.parser=i}static define(e){let i=uu(e.languageData);return new en(i,e.parser.configure({props:[zt.add(n=>n.isTop?i:void 0)]}),e.name)}configure(e,i){return new en(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kl(a){let e=a.field($e.state,!1);return e?e.tree:ue.empty}class mu{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 hi=null;class tn{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 tn(e,i,[],ue.empty,0,n,[],null)}startParse(){return this.parser.startParse(new mu(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=ue.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(gt.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(gt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=hi;hi=this;try{return e()}finally{hi=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=aa(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,f,h,p)=>c.push({fromA:d,toA:f,fromB:h,toB:p})),n=gt.applyChanges(n,c),l=ue.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 f=e.mapPos(d.from,1),h=e.mapPos(d.to,-1);f<h&&r.push({from:f,to:h})}}}return new tn(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=aa(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 Wl{createParse(i,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=hi;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 ue(Be.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 hi}}function aa(a,e,i){return gt.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=tn.create(e.facet(qt).parser,e,{from:0,to:i});return n.work(20,i)||n.takeTree(),new jt(n)}}$e.state=yt.define({create:jt.init,update(a,e){for(let i of e.effects)if(i.is($e.setState))return i.value;return e.startState.facet(qt)!=e.state.facet(qt)?jt.init(e.state):a.apply(e)}});let ra=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ra=a=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const bl=typeof navigator<"u"&&(!((gl=navigator.scheduling)===null||gl===void 0)&&gl.isInputPending)?()=>navigator.scheduling.isInputPending():null,gu=$t.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($e.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($e.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=ra(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($e.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:$e.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=>Ke(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()}}}),qt=J.define({combine(a){return a.length?a[0]:null},enables:a=>[$e.state,gu,le.contentAttributes.compute([a],e=>{let i=e.facet(a);return i&&i.name?{"data-language":i.name}:{}})]});class ku{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const bu=new ne;function ca({except:a,units:e=1}={}){return i=>{let n=a&&a.test(i.textAfter);return i.baseIndent+(n?0:e*i.unit)}}const yu=new ne;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 yl{constructor(e,i){this.specs=e;let n;function l(r){let c=ht.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 $e?r=>r.prop(zt)==s.data:s?r=>r==s:void 0,this.style=eo(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new ht(n):null,this.themeType=i.themeType}static define(e,i){return new yl(e,i||{})}}z.meta,z.link,z.heading,z.emphasis,z.strong,z.strikethrough,z.keyword,z.atom,z.bool,z.url,z.contentSeparator,z.labelName,z.literal,z.inserted,z.string,z.deleted,z.regexp,z.escape,z.string,z.variableName,z.variableName,z.typeName,z.namespace,z.className,z.variableName,z.macroName,z.propertyName,z.comment,z.invalid;const Au=Object.create(null),da=[Be.none],ha=[],fa=Object.create(null),xu=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"]])xu[a]=vu(Au,e);function wl(a,e){ha.indexOf(a)>-1||(ha.push(a),console.warn(e))}function vu(a,e){let i=[];for(let r of e.split(" ")){let c=[];for(let d of r.split(".")){let f=a[d]||z[d];f?typeof f=="function"?c.length?c=c.map(f):wl(d,`Modifier ${d} used at start of tag`):c.length?wl(d,`Tag ${d} used as modifier`):c=Array.isArray(f)?f:[f]:wl(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=fa[l];if(o)return o.id;let s=fa[l]=Be.define({id:da.length,name:n,props:[Zl({[n]:i})]});return da.push(s),s.id}ye.RTL,ye.LTR;const Cu=en.define({name:"json",parser:kh.configure({props:[bu.add({Object:ca({except:/^\s*\}/}),Array:ca({except:/^\s*\]/})}),yu.add({"Object Array":wu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Su(){return new ku(Cu)}const Al=[{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 Bu(){const a=Fe();if(a.formRules?.length){const e={};Al.forEach(n=>{e[n.name]=n});const i=[...Al];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):i.push(l)}),i}return Al}const Nu={loadAdvances:Bu},Vu={class:"unione-props-setting data-field-setting"},Ru={key:0},Eu=["onClick"],Ou={class:"field-txt"},Mu=["onClick"],Tu={key:1,class:"field-txt"},Iu=["onClick"],Fu={key:0,class:"field-txt"},_u={key:3,class:"edit-field"},Du=["onClick"],Pu=te(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([Su()]),i=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:"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:w=>w.focus()},o=t.ref({});function s(){const w=Object.keys(o.value);if(w.length)for(let u in w){const B=n.value.filter(M=>M.name==u);if(B&&B[0]){let M=o.value[u];Object.keys(M).forEach(C=>{C=="convertName"?(B[0].convert||(B[0].convert={}),B[0].convert.type=M[C]):B[0][C]=M[C]})}}o.value={}}function r(w,u){s();const B={};u=="convertName"?(w.convert||(w.convert={}),B[u]=w.convert?.type):B[u]=w[u]||"",o.value[w.name]=B}function c(w,u){{o.value={};return}}function d(w,u){switch(u){case"query":return w.configs?.query?.enable;case"form":return w.configs?.show?.form?.enable;case"view":return w.configs?.show?.view?.enable;case"list":return w.configs?.show?.list?.enable;case"sort":return w.configs?.sort?.enable}}function f(w,u){switch(u){case"query":w.configs=W.utils.obj.ext(w.configs,{query:{enable:!1}}),w.configs.query.enable=!w.configs.query.enable;break;case"form":w.configs=W.utils.obj.ext(w.configs,{show:{form:{enable:!1}}}),w.configs.show.form.enable=!w.configs.show.form.enable;break;case"view":w.configs=W.utils.obj.ext(w.configs,{show:{view:{enable:!1}}}),w.configs.show.view.enable=!w.configs.show.view.enable;break;case"list":w.configs=W.utils.obj.ext(w.configs,{show:{list:{enable:!1}}}),w.configs.show.list.enable=!w.configs.show.list.enable;break;case"sort":w.configs=W.utils.obj.ext(w.configs,{sort:{enable:!1}}),w.configs.sort.enable=!w.configs.sort.enable;break}console.log("record.configs",w.configs)}const h=t.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function p(w,u){switch(h.value.prop=u,h.value.field=w,w.configs||(w.configs={}),w.configs.show||(w.configs.show={}),u){case"query":w.configs.query||(w.configs.query={}),w.configs.query.types||(w.configs.query.types="EQ"),h.value.show=w.configs.query,h.value.title=`查询设置/${w.title}(${w.name})`;break;case"form":w.configs.show.form||(w.configs.show.form={}),h.value.show=w.configs.show.form,h.value.title=`表单设置/${w.title}(${w.name})`;break;case"view":w.configs.show.view||(w.configs.show.view={}),h.value.show=w.configs.show.view,h.value.title=`详情设置/${w.title}(${w.name})`;break;case"list":w.configs.show.list||(w.configs.show.list={}),h.value.show=w.configs.show.list,h.value.title=`列头设置/${w.title}(${w.name})`;break;case"sort":w.configs.sort||(w.configs.sort={}),h.value.show=w.configs.sort,h.value.title=`排序设置/${w.title}(${w.name})`;break}h.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:w=>{const u=m.value.options.filter(B=>B.value==w);return u[0]?u[0].label:w}}),k=t.ref({visible:!1,field:{},props:{},advances:Nu.loadAdvances(),showInfo:w=>{let u=0;if(w.configs?.rule){const B=w.configs.rule;B.advance&&u++,typeof B.rangeMin<"u"&&u++,typeof B.rangeMax<"u"&&u++,typeof B.regExpress<"u"&&u++}if(u>0)return"("+u+")"},toSetting:()=>{const w=k.value.props;k.value.field.configs=W.utils.obj.ext(k.value.field.configs,{rule:{...w}}),k.value.visible=!1,k.value.props={}}});function b(w){k.value.visible=!0,k.value.field=w,k.value.props=w.configs?.rule||{}}const x=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:w=>{const u=w.configs?.widget?.name,B=x.value.widgets.filter(M=>M.value==u);return B[0]?B[0].label:u},toSetting:(w,u)=>{w.configs||(w.configs={}),w.configs.widget||(w.configs.widget={}),w.configs.widget.name=u},toclose:()=>{x.value.visible=!1}});function v(w){x.value.field=w,w.configs=W.utils.obj.ext(w.configs,{widget:{props:{}}}),x.value.widget=w.configs.widget,x.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:(w,u="--")=>y.value.types.filter(B=>B.value==w)[0]?.label||u,toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(w,u)=>{y.value.convert.options.splice(w,1)},toSetting:()=>{y.value.visible=!1}});function E(w){y.value.visible=!0,y.value.field=w,w.configs||(w.configs={}),w.configs.convert||(w.configs.convert={}),y.value.convert=w.configs.convert}return(w,u)=>{const B=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-button"),C=t.resolveComponent("a-select"),A=t.resolveComponent("a-checkbox"),N=t.resolveComponent("a-table"),V=t.resolveComponent("a-switch"),g=t.resolveComponent("a-form-item"),S=t.resolveComponent("a-select-option"),I=t.resolveComponent("a-input-number"),R=t.resolveComponent("a-form"),F=t.resolveComponent("a-modal"),$=t.resolveComponent("a-input"),_=t.resolveComponent("unione-select-box"),q=t.resolveComponent("a-checkbox-group"),L=t.resolveComponent("unione-section");return t.openBlock(),t.createElementBlock("div",Vu,[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:O})=>[["widget","queryType","rules","convertName"].includes(O.key)?(t.openBlock(),t.createElementBlock("span",Ru,[t.createVNode(B),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:G,record:T})=>[["rules"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!k.value.showInfo(T)&&"empty"]),onClick:D=>b(T)},[t.createElementVNode("span",Ou,t.toDisplayString(k.value.showInfo(T)),1),k.value.showInfo(T)?(t.openBlock(),t.createBlock(M,{key:0,type:"link"},{default:t.withCtx(()=>u[50]||(u[50]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Eu)):["widget"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!G&&"empty"]),onClick:D=>r(T,O.dataIndex)},[o.value[T.name]&&Object.keys(o.value[T.name]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(C,{key:0,value:T.configs?.widget?.name,allowClear:!0,options:x.value.widgets,onChange:D=>x.value.toSetting(T,D),onBlur:u[0]||(u[0]=D=>c())},null,8,["value","options","onChange"])),[[l]]):(t.openBlock(),t.createElementBlock("span",Tu,t.toDisplayString(x.value.widgetName(T)),1)),t.createVNode(M,{type:"link",onClick:t.withModifiers(D=>v(T),["stop"])},{default:t.withCtx(()=>u[51]||(u[51]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Mu)):["convertName"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!T.convert?.type&&"empty"]),onClick:D=>E(T)},[T.configs?.convert?.types?(t.openBlock(),t.createElementBlock("span",Fu,t.toDisplayString(y.value.getTypes(T.configs.convert.types)),1)):t.createCommentVNode("",!0)],10,Iu)):["query","form","view","list","sort"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",_u,[t.createVNode(A,{checked:d(T,O.dataIndex),onClick:D=>f(T,O.dataIndex)},null,8,["checked","onClick"]),t.createVNode(M,{type:"link",onClick:D=>p(T,O.dataIndex)},{default:t.withCtx(()=>u[52]||(u[52]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(F,{visible:h.value.visible,"onUpdate:visible":u[14]||(u[14]=O=>h.value.visible=O),width:600,title:h.value.title,onOk:h.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:t.normalizeClass(["field-setting-form","form-mix",h.value.prop])},{default:t.withCtx(()=>[t.createVNode(g,{label:"启用状态"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.show.enable,"onUpdate:checked":u[1]||(u[1]=O=>h.value.show.enable=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),h.value.prop=="sort"?(t.openBlock(),t.createBlock(g,{key:0,label:"默认排序"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.show.defoult,"onUpdate:checked":u[2]||(u[2]=O=>h.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),h.value.prop=="sort"?(t.openBlock(),t.createBlock(g,{key:1,label:"排序方式"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.show.asc,"onUpdate:checked":u[3]||(u[3]=O=>h.value.show.asc=O),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),h.value.prop=="query"&&h.value.show.types=="ADVANCE"?(t.openBlock(),t.createBlock(g,{key:2,label:"高级查询"})):t.createCommentVNode("",!0),h.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.show.defoult,"onUpdate:checked":u[4]||(u[4]=O=>h.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),h.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.show.visible,"onUpdate:checked":u[5]||(u[5]=O=>h.value.show.visible=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),h.value.prop=="query"?(t.openBlock(),t.createBlock(g,{key:5,label:"查询方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:h.value.show.types,"onUpdate:value":u[6]||(u[6]=O=>h.value.show.types=O)},{default:t.withCtx(()=>[t.createVNode(S,{key:"EQ",value:"EQ"},{default:t.withCtx(()=>u[53]||(u[53]=[t.createTextVNode("精确查询")])),_:1}),t.createVNode(S,{key:"LIKE",value:"LIKE"},{default:t.withCtx(()=>u[54]||(u[54]=[t.createTextVNode("模糊查询")])),_:1}),t.createVNode(S,{key:"LLIKE",value:"LLIKE"},{default:t.withCtx(()=>u[55]||(u[55]=[t.createTextVNode("左模糊")])),_:1}),t.createVNode(S,{key:"RLIKE",value:"RLIKE"},{default:t.withCtx(()=>u[56]||(u[56]=[t.createTextVNode("右模糊")])),_:1}),t.createVNode(S,{key:"RANGE",value:"RANGE"},{default:t.withCtx(()=>u[57]||(u[57]=[t.createTextVNode("范围查询")])),_:1}),t.createVNode(S,{key:"ADVANCE",value:"ADVANCE"},{default:t.withCtx(()=>u[58]||(u[58]=[t.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0),["query","sort"].includes(h.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:t.withCtx(()=>[t.createVNode(I,{value:h.value.show.index,"onUpdate:value":u[7]||(u[7]=O=>h.value.show.index=O)},null,8,["value"])]),_:1})),["form","view"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:t.withCtx(()=>[t.createVNode(I,{min:0,max:24,value:h.value.show.width,"onUpdate:value":u[8]||(u[8]=O=>h.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:t.withCtx(()=>[t.createVNode(I,{min:0,value:h.value.show.width,"onUpdate:value":u[9]||(u[9]=O=>h.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(I,{min:0,max:24,value:h.value.show.labelWidth,"onUpdate:value":u[10]||(u[10]=O=>h.value.show.labelWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(I,{min:0,max:24,value:h.value.show.valueWidth,"onUpdate:value":u[11]||(u[11]=O=>h.value.show.valueWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:11,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:h.value.show.fixed,"onUpdate:value":u[12]||(u[12]=O=>h.value.show.fixed=O),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(h.value.prop)?(t.openBlock(),t.createBlock(g,{key:12,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:h.value.show.align,"onUpdate:value":u[13]||(u[13]=O=>h.value.show.align=O),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(F,{visible:y.value.visible,"onUpdate:visible":u[33]||(u[33]=O=>y.value.visible=O),width:600,title:y.value.getTypes(y.value.convert.types,"转换")+"设置",onOk:y.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:y.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(C,{value:y.value.convert.types,"onUpdate:value":u[15]||(u[15]=O=>y.value.convert.types=O),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(g,{key:0,label:"是否搜索"},{default:t.withCtx(()=>[t.createVNode(V,{checked:h.value.convert.search,"onUpdate:checked":u[16]||(u[16]=O=>h.value.convert.search=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.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:y.value.toAddOption},{default:t.withCtx(()=>u[59]||(u[59]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(N,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:O,record:G,index:T})=>[O.dataIndex==="label"?(t.openBlock(),t.createBlock($,{key:0,value:G.label,"onUpdate:value":D=>G.label=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="value"?(t.openBlock(),t.createBlock($,{key:1,value:G.value,"onUpdate:value":D=>G.value=D,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:D=>y.value.toDelOption(T,G)},"删除",8,Du)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):t.createCommentVNode("",!0),["dbtable","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:2,label:"数据源"},{default:t.withCtx(()=>[t.createVNode(_,{value:y.value.convert.dsId,"onUpdate:value":u[17]||(u[17]=O=>y.value.convert.dsId=O),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(g,{key:3,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableName,"onUpdate:value":u[18]||(u[18]=O=>y.value.convert.tableName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:4,label:"table名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableName,"onUpdate:value":u[19]||(u[19]=O=>y.value.convert.tableName=O)},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(g,{key:5,label:"主键字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.idField,"onUpdate:value":u[20]||(u[20]=O=>y.value.convert.idField=O)},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(g,{key:6,label:"父级字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.pidField,"onUpdate:value":u[21]||(u[21]=O=>y.value.convert.pidField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:7,label:"value字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.valueField,"onUpdate:value":u[22]||(u[22]=O=>y.value.convert.valueField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:8,label:"label字段"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.labelField,"onUpdate:value":u[23]||(u[23]=O=>y.value.convert.labelField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableField,"onUpdate:value":u[24]||(u[24]=O=>y.value.convert.tableField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableWhere,"onUpdate:value":u[25]||(u[25]=O=>y.value.convert.tableWhere=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableOrder,"onUpdate:value":u[26]||(u[26]=O=>y.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.tableOrder,"onUpdate:value":u[27]||(u[27]=O=>y.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:13,label:"异步加载"},{default:t.withCtx(()=>[t.createVNode(V,{checked:y.value.convert.isAsync,"onUpdate:checked":u[28]||(u[28]=O=>y.value.convert.isAsync=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(g,{key:14,label:"分页加载"},{default:t.withCtx(()=>[t.createVNode(V,{checked:y.value.convert.isPaging,"onUpdate:checked":u[29]||(u[29]=O=>y.value.convert.isPaging=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),y.value.convert.types=="dict"?(t.openBlock(),t.createBlock(g,{key:15,label:"字典名称"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.dictName,"onUpdate:value":u[30]||(u[30]=O=>y.value.convert.dictName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:t.withCtx(()=>[t.createVNode($,{value:y.value.convert.url,"onUpdate:value":u[31]||(u[31]=O=>y.value.convert.url=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(y.value.convert.types)?(t.openBlock(),t.createBlock(g,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:t.withCtx(()=>[t.createVNode(t.unref(Qt.Codemirror),{modelValue:y.value.convert.params,"onUpdate:modelValue":u[32]||(u[32]=O=>y.value.convert.params=O),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(F,{visible:x.value.visible,"onUpdate:visible":u[40]||(u[40]=O=>x.value.visible=O),width:600,title:"控件设置",onOk:x.value.toclose},{default:t.withCtx(()=>[t.createVNode(R,{model:x.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(C,{value:x.value.widget.name,"onUpdate:value":u[34]||(u[34]=O=>x.value.widget.name=O),allowClear:!0,options:x.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),t.createVNode(g,{label:"输入提示"},{default:t.withCtx(()=>[t.createVNode($,{value:x.value.widget.placeholder,"onUpdate:value":u[35]||(u[35]=O=>x.value.widget.placeholder=O)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"帮助说明"},{default:t.withCtx(()=>[t.createVNode($,{value:x.value.widget.help,"onUpdate:value":u[36]||(u[36]=O=>x.value.widget.help=O)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"提示文本"},{default:t.withCtx(()=>[t.createVNode($,{value:x.value.widget.tooltip,"onUpdate:value":u[37]||(u[37]=O=>x.value.widget.tooltip=O)},null,8,["value"])]),_:1}),["a-date-picker"].includes(x.value.widget.name)?(t.openBlock(),t.createBlock(g,{key:0,label:"显示格式"},{default:t.withCtx(()=>[t.createVNode($,{value:x.value.field.dataFormat,"onUpdate:value":u[38]||(u[38]=O=>x.value.field.dataFormat=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),x.value.widget.name=="unione-select-box"?(t.openBlock(),t.createBlock(g,{key:1,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:x.value.widget.props.mode,"onUpdate:value":u[39]||(u[39]=O=>x.value.widget.props.mode=O),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(S,{value:"multiple"},{default:t.withCtx(()=>u[60]||(u[60]=[t.createTextVNode("多选")])),_:1}),t.createVNode(S,{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(F,{visible:k.value.visible,"onUpdate:visible":u[49]||(u[49]=O=>k.value.visible=O),width:600,title:"规则设置",onOk:k.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:k.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(L,{title:"基本设置",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(q,{value:k.value.props.trigger,"onUpdate:value":u[41]||(u[41]=O=>k.value.props.trigger=O),options:["change","blur"]},null,8,["value"])]),_:1}),k.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(g,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(A,{checked:k.value.props.whitespace,"onUpdate:checked":u[42]||(u[42]=O=>k.value.props.whitespace=O)},{default:t.withCtx(()=>u[62]||(u[62]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),t.createVNode(g,{label:"预设类型"},{default:t.withCtx(()=>[t.createVNode(C,{options:k.value.advances,fieldNames:{label:"title",value:"name"},value:k.value.props.advance,"onUpdate:value":u[43]||(u[43]=O=>k.value.props.advance=O)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(k.value.field.dataType)?(t.openBlock(),t.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(I,{value:k.value.props.rangeMin,"onUpdate:value":u[44]||(u[44]=O=>k.value.props.rangeMin=O)},null,8,["value"]),u[63]||(u[63]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(I,{value:k.value.props.rangeMax,"onUpdate:value":u[45]||(u[45]=O=>k.value.props.rangeMax=O)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:k.value.props.rangeMessage,"onUpdate:value":u[46]||(u[46]=O=>k.value.props.rangeMessage=O)},null,8,["value"])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(L,{title:"正则验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(g,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode($,{value:k.value.props.regExpress,"onUpdate:value":u[47]||(u[47]=O=>k.value.props.regExpress=O)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode($,{value:k.value.props.regMessage,"onUpdate:value":u[48]||(u[48]=O=>k.value.props.regMessage=O)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),$u={class:"unione-props-setting data-field-fkey"},Lu={key:0},Uu=["onClick"],zu=["onClick"],ju=["onClick"],qu=["onClick"],Qu=["onClick"],Wu=["onClick"],Yu=["onClick"],Ku=["onClick"],Hu=te(t.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=W.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 k={};k[m]=p.configs.fkey[m]||"",o.value[p.name]=k}function c(p,m,k){p.configs.fkey.dsn=m,p.configs.fkey.dsnName=k.name,p.configs.fkey.dsnTitle=k.title,p.configs.fkey.dsnId=k.id}function d(p,m,k,b){p.configs.fkey[m]=k,m=="fieldName"&&(p.configs.fkey.fieldTitle=b.title),m=="labelName"&&(p.configs.fkey.labelTitle=b.title)}function f(p){h.value.record=p,h.value.visible=!0,h.value.fields=p.configs?.fkey?.fields||[]}const h=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)=>{h.value.editField[p]=m},onShowFieldChange:(p,m,k)=>{p.name=k.name,p.title=k.title},toAddField:()=>{h.value.fields.push({name:"",title:""}),h.value.editField[h.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{h.value.fields.splice(p,1)}})},toSetting:()=>{h.value.visible=!1,h.value.record.configs=W.utils.obj.ext(h.value.record.configs,{fkey:{fields:h.value.fields}})}});return(p,m)=>{const k=t.resolveComponent("FormOutlined"),b=t.resolveComponent("unione-select-box"),x=t.resolveComponent("a-button"),v=t.resolveComponent("a-table"),y=t.resolveComponent("a-input-number"),E=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",$u,[t.createVNode(v,{columns:i.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:t.withCtx(({column:w})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(w.key)?(t.openBlock(),t.createElementBlock("span",Lu,[t.createVNode(k),t.createTextVNode(" "+t.toDisplayString(w.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:w,record:u})=>[["dsnName"].includes(w.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(w.dataIndex))&&!u.configs?.fkey?.dsnName&&"empty"]),onClick:B=>r(u,w.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(w.dataIndex)?(t.openBlock(),t.createBlock(b,{key:0,value:o.value[u.name][w.dataIndex],"onUpdate:value":B=>o.value[u.name][w.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(B,M)=>c(u,B,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,Uu)):["dsnTitle"].includes(w.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(w.dataIndex))&&!u.configs?.fkey?.dsnTitle&&"empty"]),onClick:B=>r(u,w.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(w.dataIndex)?(t.openBlock(),t.createBlock(b,{key:0,value:o.value[u.name][w.dataIndex],"onUpdate:value":B=>o.value[u.name][w.dataIndex]=B,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(B,M)=>c(u,B,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,zu)):t.createCommentVNode("",!0),["fieldName"].includes(w.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(w.dataIndex))&&!u.configs?.fkey?.fieldName&&"empty"]),onClick:B=>r(u,w.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(w.dataIndex)?(t.openBlock(),t.createBlock(b,{key:0,value:o.value[u.name][w.dataIndex],"onUpdate:value":B=>o.value[u.name][w.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(B,M)=>d(u,"fieldName",B,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,ju)):["labelName"].includes(w.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(w.dataIndex))&&!u.configs?.fkey?.labelName&&"empty"]),onClick:B=>r(u,w.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(w.dataIndex)?(t.openBlock(),t.createBlock(b,{key:0,value:o.value[u.name][w.dataIndex],"onUpdate:value":B=>o.value[u.name][w.dataIndex]=B,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(B,M)=>d(u,"labelName",B,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(x,{key:0,type:"link",onClick:t.withModifiers(B=>f(u),["stop"])},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,qu)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(E,{visible:h.value.visible,"onUpdate:visible":m[3]||(m[3]=w=>h.value.visible=w),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:h.value.toSetting},{default:t.withCtx(()=>[t.createVNode(x,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:h.value.toAddField},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(v,{columns:h.value.columns,"data-source":h.value.fields,size:"small"},{bodyCell:t.withCtx(({column:w,record:u,index:B,text:M})=>[w.dataIndex==="title"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",h.value.editField!="title"&&!M&&"empty"]),onClick:C=>h.value.toEditField(B,w.dataIndex)},[h.value.editField[B]=="title"?(t.openBlock(),t.createBlock(b,{key:0,value:u[u.dataIndex],"onUpdate:value":C=>u[u.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:h.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>h.value.editField={}),onSelect:(C,A)=>h.value.onShowFieldChange(u,C,A)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M),1)],64))],10,Qu)):t.createCommentVNode("",!0),w.dataIndex==="width"?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",h.value.editField!="width"&&!M&&"empty"]),onClick:C=>h.value.toEditField(B,w.dataIndex)},[h.value.editField[B]=="width"?(t.openBlock(),t.createBlock(y,{key:0,onBlur:m[1]||(m[1]=C=>h.value.editField={}),value:u.width,"onUpdate:value":C=>u.width=C,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,Wu)):t.createCommentVNode("",!0),w.dataIndex==="index"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",h.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:C=>h.value.toEditField(B,w.dataIndex)},[h.value.editField[B]=="index"?(t.openBlock(),t.createBlock(y,{key:0,onBlur:m[2]||(m[2]=C=>h.value.editField={}),value:u.index,"onUpdate:value":C=>u.index=C,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,Yu)):t.createCommentVNode("",!0),w.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:3,onClick:C=>h.value.toDelField(B)},"删除",8,Ku)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),Gu={class:"unione-props-setting data-filter"},Ju={class:"title"},Xu={class:"name"},Zu={class:"action"},ep=te(t.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=W.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 f=i.value.filter(h=>h.name==r.value.name)[0];if(!f){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(h=>{f[h]=d[h]})}else{if(i.value.filter(h=>h.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
+ `),d.push(" AND XXX=#{params."),d.push(r.value.filter.name||"xxx"),d.push(`}
25
+ `),d.push(`-- @}
26
+ `),r.value.filter.filter=r.value.filter.filter+d.join("")}return(d,f)=>{const h=t.resolveComponent("a-button"),p=t.resolveComponent("a-card"),m=t.resolveComponent("PlusOutlined"),k=t.resolveComponent("a-empty"),b=t.resolveComponent("a-input"),x=t.resolveComponent("a-form-item"),v=t.resolveComponent("a-textarea"),y=t.resolveComponent("a-tag"),E=t.resolveComponent("a-form"),w=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",Gu,[(i.value.length,t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,(u,B)=>(t.openBlock(),t.createBlock(p,{class:"filter-box",size:"small",key:B},{default:t.withCtx(()=>[t.createElementVNode("div",Ju,"过滤标题:"+t.toDisplayString(u.title),1),t.createElementVNode("div",Xu,"过滤名称:"+t.toDisplayString(u.name),1),t.createElementVNode("div",Zu,[t.createVNode(h,{size:"small",onClick:M=>l(u)},{default:t.withCtx(()=>f[4]||(f[4]=[t.createTextVNode("编辑")])),_:2},1032,["onClick"]),t.createVNode(h,{danger:"",size:"small",onClick:M=>o(B)},{default:t.withCtx(()=>f[5]||(f[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(w,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=u=>r.value.visible=u),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{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(x,{label:"过滤标题",name:"title"},{default:t.withCtx(()=>[t.createVNode(b,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=u=>r.value.filter.title=u)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"过滤名称",name:"name"},{default:t.withCtx(()=>[t.createVNode(b,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=u=>r.value.filter.name=u)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:t.withCtx(()=>[t.createVNode(v,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=u=>r.value.filter.filter=u),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),t.createVNode(y,{class:"btn-tmpl",color:"blue",onClick:c},{default:t.withCtx(()=>f[6]||(f[6]=[t.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),tp={class:"unione-page form-page data-define-edit"},ip={class:"actions"},np=te(t.defineComponent({__name:"edit",setup(a){const e=W.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 f(){n.back()}function h(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([c.value.id]).then(b=>{b.success?(e.success({title:"发布成功",content:b.body}),k(c.value.id)):e.error({title:"发布失败",content:b.body})})}})}async function p(){const b=await l.value.validate(),x={...c.value,...b};x.configs.show=await s.value.getValue(),console.log("formData",x),ee.message.loading({content:"提交中..."}),d.value=!0,mt.save(x).then(v=>{ee.message.destroy(),v.success?(c.value=v.body,l.value.setValue(v.body),s.value.setValue(v.body.configs?.show||{}),ee.message.success("保存成功!")):ee.message.error(v.message)}).finally(()=>{d.value=!1})}const m=t.ref(!1);t.onMounted(()=>{i.query.id&&k(i.query.id)});function k(b){ee.message.loading({content:"加载中..."}),mt.detail(b).then(x=>{x.success?(c.value=x.body,l.value.setValue(x.body),s.value.setValue(x.body.configs?.show||{}),ee.message.destroy()):ee.message.error(x.message)})}return(b,x)=>{const v=t.resolveComponent("unione-form"),y=t.resolveComponent("unione-section"),E=t.resolveComponent("OrderedListOutlined"),w=t.resolveComponent("a-tab-pane"),u=t.resolveComponent("ToolOutlined"),B=t.resolveComponent("ApiOutlined"),M=t.resolveComponent("FunnelPlotOutlined"),C=t.resolveComponent("a-tabs"),A=t.resolveComponent("a-button");return t.openBlock(),t.createElementBlock("div",tp,[t.createVNode(y,{title:"基础信息",type:"line"},{default:t.withCtx(()=>[t.createVNode(v,{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":x[0]||(x[0]=N=>m.value=N)},{default:t.withCtx(()=>[t.createVNode(v,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),t.createVNode(C,null,{default:t.withCtx(()=>[t.createVNode(w,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(E),x[5]||(x[5]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(Kd,{modelValue:c.value.configs.fields,"onUpdate:modelValue":x[1]||(x[1]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(w,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(u),x[6]||(x[6]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(Pu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":x[2]||(x[2]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(w,{key:"field-fkeys"},{tab:t.withCtx(()=>[t.createVNode(B),x[7]||(x[7]=t.createTextVNode("外键设置 "))]),default:t.withCtx(()=>[t.createVNode(Hu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":x[3]||(x[3]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(w,{key:"data-filter"},{tab:t.withCtx(()=>[t.createVNode(M),x[8]||(x[8]=t.createTextVNode("数据过滤 "))]),default:t.withCtx(()=>[t.createVNode(ep,{modelValue:c.value.configs.filters,"onUpdate:modelValue":x[4]||(x[4]=N=>c.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),t.createElementVNode("div",ip,[t.createVNode(A,{type:"primary",onClick:p,loading:d.value},{default:t.withCtx(()=>x[9]||(x[9]=[t.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(t.openBlock(),t.createBlock(A,{key:0,danger:"",onClick:h,loading:d.value},{default:t.withCtx(()=>x[10]||(x[10]=[t.createTextVNode("发布")])),_:1},8,["loading"])):t.createCommentVNode("",!0),t.createVNode(A,{onClick:f},{default:t.withCtx(()=>x[11]||(x[11]=[t.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),lp={UnioneEditor:lt,locales:ln,loadConfig:Fe,DataStorage:on,Convertor:Le,install(a,e){W.loadConfig(e);const i=Fe(e);i.axios&&W.axios.create(i.axios),a.component("UnioneBtn",Ea),a.component("UnioneTabs",Ma),a.component("UnioneSection",Pa),a.component("UnioneQuery",Rl),a.component("UnioneTable",El),a.component("UnioneRichText",Yc),a.component("UnioneFormItem",or),a.component("UnioneForm",tr),a.component("UnioneSelectBox",sr),a.component("UnioneSwitchBox",ar),a.component("UnioneRadioBox",rr),a.component("UnioneCheckBox",cr),a.component("UnionePwdBox",dr),a.component("UnioneRandomInput",fr),a.component("UnionePageEditor",Il),a.component("UnionePageForm",Fl),a.component("UnionePageTree",_l),a.component("UnionePageList",Dl),a.component("UnioneFlowTodo",Pl),a.component("UnioneFlowAudit",Pd)}};Z.Convertor=Le,Z.DataStorage=on,Z.UnioneDataDefineEdit=np,Z.UnioneDataDefineList=Ld,Z.UnioneEditor=lt,Z.UnioneFlowTodo=Pl,Z.UnionePage=St,Z.UnionePageEditor=Il,Z.UnionePageForm=Fl,Z.UnionePageList=Dl,Z.UnionePageSetting=Bt,Z.UnionePageTree=_l,Z.UnioneQueryForm=Rl,Z.UnioneTableList=El,Z.default=lp,Z.loadConfig=Fe,Z.locales=ln,Z.useDebounce=pt,Z.utils=hr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});