unione-form-vue 0.1.3 → 0.1.4
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 +15 -15
- package/dist/page/tree.vue.d.ts +12 -1
- package/dist/style.css +1 -1
- package/dist/version/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
(function(ie,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):(ie=typeof globalThis<"u"?globalThis:ie||self,Y(ie.index={},ie.UnioneBaseVue,ie.Vue,ie.antDesignVue,ie.lodashEs,ie.vueCodemirror,ie.langJavascript,ie.canvasEditor,ie.dayjs,ie.prism,ie.iconsVue,ie.uuid))})(this,function(ie,Y,t,oe,va,Zt,Ca,me,Sa,_l,it,Ba){"use strict";const Na={isDebug:!0,axios:{form:"/portal",flow:"/flow"},listPageUrl:"/data/page/list",addPageUrl:"/data/page/add",editPageUrl:"/data/page/edit",viewPageUrl:"/data/page/view",formRules:[]},hi=t.ref(Na);function De(a){return a&&(hi.value=Y.utils.obj.ext(a,hi.value)),hi.value}const Va={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},Ra={...{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"}},Ea=t.ref([Va,Ra]);function Oa(a,e){return Y.locales.loadLanguage(a,()=>new Promise((n,i)=>{const l=Ea.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};n(s)}else{const s={...l[0],...o};n(s)}});else if(l.length==0){const o={...e,localeName:a};n(o)}else{const o={...l[0],...e};n(o)}else l.length>0?n(l[0]):i("local language not defined ,lang:"+a)}))}const fi={...Y.locales};fi.loadLanguage=Oa;class _a{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,n){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=n}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 n in this.$store.value)this.$store.value[n].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,n){}setRefData(e,n,i){}use(e,n,i){let l=this.$store.value[e];return l||(l=new ui(e,n,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,n,i){const l=this.use(e,"form",n);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{i&&i(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 ui{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,n,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=n,this.$data=t.ref(n=="form"?{}:{body:[],total:0}),this.$dialog=Y.useDialog(),this.$model=i||t.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}reset(e){this.$data.value=e||{},this.$form?.setValue(e||{})}$processParams(e,n){if(n)n.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}request(e){return new Promise((n,i)=>{const l=oe.message.loading("数据请求中..."),o=this.$store.controller+e.url;Y.axios[this.$store.ctx||"form"]({method:"post",...e,url:o}).then(s=>{s.success?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const n=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((i,l)=>{const o=oe.message.loading("数据加载中...");Y.axios[this.$store.ctx||"form"]({url:n,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:n,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:n,params:e,err:s})}).finally(()=>{o()})})}save(e){const n=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((i,l)=>{const o=oe.message.loading("数据提交中...");Y.axios[this.$store.ctx||"form"]({url:n,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||oe.message.success(s.message),i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:n,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:n,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((n,i)=>{const l=oe.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";Y.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?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((n,i)=>{const l=oe.message.loading("数据加载中..."),o=this.$store.controller+"/detail";Y.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),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((n,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=oe.message.loading("数据处理中..."),o=this.$store.controller+"/delete";Y.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?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Ma{$event;$onces;$delayEmit;constructor(){this.$event=t.ref({}),this.$onces=t.ref({}),this.$delayEmit=t.ref({})}$on(e,n){if(this.$event.value[e]=n,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];n(i)}}$emit(e,n){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(n)}this.$event.value[e]?this.$event.value[e](n):(this.$delayEmit.value[e]=n,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,n){this.$onces.value[e]=n}$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 n=e.configs||{};this.model=t.ref("run"),this.type=t.ref(e.types||"setting"),this.define=t.ref(e),this.ebus=new Ma,this.$widgetList=t.ref([]),this.$widgetMap=t.ref({}),this.$dataManager=new _a(n.dsnList?n.dsnList[0]:"",this.model),this.$axiosProccess=t.ref({}),this.$dialog=Y.useDialog(),this.loadConfig(n)}sn(){return this.define.value.sn}load(e,n){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",n),n&&n.configs&&(this.define.value=n,this.type.value=this.define.value.types||"setting",this.loadConfig(n.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),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)):n&&n.configs&&(this.define.value=n,this.loadConfig(n.configs))})}save(){return new Promise((e,n)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),n();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),Y.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(oe.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}),n())}).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,n){if(n){const i={...n,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}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(n=>{n.wid||(n.wid="w:"+va.uniqueId()),this.$widgetMap.value[n.wid]=n,n.configs?.widgets&&this.$processWidget(n.configs.widgets)})}dataManager(){return this.$dataManager}}const Ta={class:"widget-setting-dialog"},Fa=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:n}){const i=n,l=t.ref(),o=t.ref(),s=t.ref(!1);function r(){o.value&&(s.value=!0),i("setting")}function c(){i("saving"),s.value=!1}function d(){return l.value?.clientHeight}function h(){return l.value?.clientWidth}return e({getHeight:d,getWidth:h}),(f,u)=>{const m=t.resolveComponent("SettingOutlined"),g=t.resolveComponent("a-tooltip"),w=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[t.createVNode(g,{title:a.settingTitle},{default:t.withCtx(()=>[a.model=="edit"&&(f.$slots["widget-setting"]||a.custome)?(t.openBlock(),t.createBlock(m,{key:0,class:"widget-setting",onClick:r})):t.createCommentVNode("",!0)]),_:1},8,["title"]),t.renderSlot(f.$slots,"default",{},void 0,!0),a.model=="edit"&&f.$slots["widget-setting"]?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":u[0]||(u[0]=v=>s.value=v),centered:"",width:"80%",onOk:c},{default:t.withCtx(()=>[t.createElementVNode("div",Ta,[t.renderSlot(f.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),le=(a,e)=>{const n=a.__vccOpts||a;for(const[i,l]of e)n[i]=l;return n},ft=le(Fa,[["__scopeId","data-v-17b517f5"]]),Ia={key:0},Da=["onClick"],An=le(t.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const n=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=t.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let p in k){const S=w.value.form.action.params[p];S&&s.value[p]&&Object.keys(s.value[p]).forEach(_=>{S[_]=s.value[p][_]})}s.value={}}function c(k,p,S){r();const _={};_[S]=p[S]||"",S=="showIndex"&&(_[S]=p.show?.query?.index),s.value[k]=_}function d(k,p,S){if(!p||!S){s.value={};return}const _=s.value[k][S];p[S]=_,s.value={}}function h(){w.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=t.ref(""),m=t.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,p)=>u.value!=p&&n.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+n.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),g=t.ref([Ca.javascript()]),w=t.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=t.ref();function y(k,p,S={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),u.value=k.name,w.value.form=k,w.value.helps=S,w.value.visible=!0,v.value=p}const A=t.ref(null);function V(){A.value&&A.value.validate().then(()=>{w.value.visible=!1,v.value(w.value.form)})}return e({open:y,close}),(k,p)=>{const S=t.resolveComponent("a-input"),_=t.resolveComponent("a-form-item"),C=t.resolveComponent("a-select"),x=t.resolveComponent("a-input-number"),N=t.resolveComponent("a-checkbox"),R=t.resolveComponent("a-tab-pane"),b=t.resolveComponent("a-switch"),B=t.resolveComponent("a-button"),T=t.resolveComponent("a-divider"),E=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-tooltip"),P=t.resolveComponent("a-table"),F=t.resolveComponent("a-tabs"),q=t.resolveComponent("a-form"),L=t.resolveComponent("a-modal");return t.openBlock(),t.createBlock(L,{visible:w.value.visible,"onUpdate:visible":p[23]||(p[23]=O=>w.value.visible=O),title:w.value.title,centered:"",width:"50%",onOk:V},{default:t.withCtx(()=>[t.createVNode(q,{name:"basic",ref_key:"form",ref:A,rules:m.value,model:w.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:t.withCtx(()=>[t.createVNode(F,null,{default:t.withCtx(()=>[t.createVNode(R,{key:"base",tab:"基本设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.title,"onUpdate:value":p[0]||(p[0]=O=>w.value.form.title=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"操作名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.name,"onUpdate:value":p[1]||(p[1]=O=>w.value.form.name=O),disabled:n.preset.includes(w.value.form.name)},null,8,["value","disabled"])]),_:1}),t.createVNode(_,{label:"操作图标"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.icon,"onUpdate:value":p[2]||(p[2]=O=>w.value.form.icon=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.type,"onUpdate:value":p[3]||(p[3]=O=>w.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(_,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.index,"onUpdate:value":p[4]||(p[4]=O=>w.value.form.index=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮大小"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.size,"onUpdate:value":p[5]||(p[5]=O=>w.value.form.size=O),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮特性"},{default:t.withCtx(()=>[t.createVNode(N,{checked:w.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=O=>w.value.form.props.block=O)},{default:t.withCtx(()=>p[24]||(p[24]=[t.createTextVNode("自适应 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=O=>w.value.form.props.danger=O)},{default:t.withCtx(()=>p[25]||(p[25]=[t.createTextVNode("危险 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=O=>w.value.form.props.ghost=O)},{default:t.withCtx(()=>p[26]||(p[26]=[t.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),t.createVNode(R,{key:"action",tab:"响应设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"响应方式",required:""},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.type,"onUpdate:value":p[9]||(p[9]=O=>w.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(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=O=>w.value.form.action.psn=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.component,"onUpdate:value":p[11]||(p[11]=O=>w.value.form.action.component=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(_,{label:"连接地址"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.href,"onUpdate:value":p[12]||(p[12]=O=>w.value.form.action.href=O)},null,8,["value"])]),_:1}),["link","route"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:2,label:"连接方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.target,"onUpdate:value":p[13]||(p[13]=O=>w.value.form.action.target=O),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:3,label:"抽屉位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.position,"onUpdate:value":p[14]||(p[14]=O=>w.value.form.action.position=O),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:4,label:"显示标题",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.title,"onUpdate:value":p[15]||(p[15]=O=>w.value.form.action.title=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:5,label:"蒙层关闭"},{default:t.withCtx(()=>[t.createVNode(b,{checked:w.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=O=>w.value.form.action.maskClosable=O),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:6,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.width,"onUpdate:value":p[17]||(p[17]=O=>w.value.form.action.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:7,label:"显示高度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.height,"onUpdate:value":p[18]||(p[18]=O=>w.value.form.action.height=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(T,{orientation:"left"},{default:t.withCtx(()=>[p[29]||(p[29]=t.createTextVNode("参数列表 ")),t.createVNode(B,{size:"small",class:"param-btn",onClick:h},{default:t.withCtx(()=>p[27]||(p[27]=[t.createTextVNode("添加")])),_:1}),t.createVNode(B,{size:"small",class:"param-btn",danger:"",onClick:f},{default:t.withCtx(()=>p[28]||(p[28]=[t.createTextVNode("删除")])),_:1})]),_:1}),t.createVNode(P,{columns:i.value,"data-source":w.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",Ia,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0),["value"].includes(O.key)?(t.openBlock(),t.createBlock(M,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:t.withCtx(()=>[t.createElementVNode("span",null,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(O.title),1)])]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:ee,record:D,index:K})=>[["name","title","value"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!s.value[K]||!Object.keys(s.value[K]).includes(O.dataIndex))&&!ee&&"empty"]),onClick:fe=>c(K,D,O.dataIndex)},[s.value[K]&&Object.keys(s.value[K]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(S,{key:0,value:s.value[K][O.dataIndex],"onUpdate:value":fe=>s.value[K][O.dataIndex]=fe,onBlur:fe=>d(K,D,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(ee),1)],64))],10,Da)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),t.createVNode(R,{key:"event",tab:"事件设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"点击事件",help:w.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=O=>w.value.form.event.clickScript=O),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"禁用逻辑",help:w.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=O=>w.value.form.event.disableScript=O),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"显示逻辑",help:w.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=O=>w.value.form.event.visibleScript=O),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"动态标题",help:w.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:w.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=O=>w.value.form.event.titleScript=O),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),$a=["src"],Pa=["src"],La=le(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 n=De(),i=a,l=Y.useSession();t.watch(()=>i.widget?.event,()=>{r()}),t.onMounted(()=>{r()});const o=t.ref({...i.editor?.widget(i.wid)||i.widget||{}}),s=t.ref({});function r(){o.value?.event&&(o.value.event.clickScript?s.value.click=new Function("ctx","btn","event",o.value.event.clickScript):o.value.event.click&&(s.value.click=o.value.event.click),o.value.event.disableScript?s.value.disable=new Function("ctx","btn",o.value.event.disableScript):o.value.event.disable&&(s.value.disable=o.value.event.disable),o.value.event.visibleScript?s.value.visible=new Function("ctx","btn",o.value.event.visibleScript):o.value.event.visible&&(s.value.visible=o.value.event.visible),o.value.event.titleScript?s.value.title=new Function("ctx","btn",o.value.event.titleScript):o.value.event.title&&(s.value.title=o.value.event.title)),typeof o.value.click=="function"&&(s.value.click=o.value.click),typeof o.value.title=="function"&&(s.value.title=o.value.title),typeof o.value.visible=="function"&&(s.value.visible=o.value.visible),typeof o.value.disabled=="function"&&(s.value.disable=o.value.disabled)}const c=t.computed(()=>s.value.title?s.value.title(m.value,o.value):o.value.title),d=t.computed(()=>s.value.visible?s.value.visible(m.value,o.value)!=!1:o.value.visible!=!1),h=t.computed(()=>i.disabled==!0?!0:s.value.disable?s.value.disable(m.value,o.value):o.value.disable==!0),f=t.ref(null);function u(){f.value?.open(o.value,p=>{console.log("btn props",p),Object.keys(p).forEach(S=>{o.value[S]=p[S]}),console.log("props btn",o.value)})}const m=t.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),g=t.ref({open:!1}),w=t.computed(()=>{if(o.value.action?.href){let p=o.value.action.href;const S=p.matchAll("{[a-zA-Z.]*}"),_=[];let C=null;for(;C=S.next();){if(C&&C.value&&C.value[0]){let x=C.value[0].substring(1,C.value[0].length-1);_.includes(x)||_.push(x)}if(C.done)break}if(_.length>0)for(let x=0;x<_.length;x++){let N=_[x],R=Y.utils.obj.getValue(m.value,N);R?R instanceof Object?p=p.replaceAll("{"+N+"}",JSON.stringify(R)):Array.isArray(R)?p=p.replaceAll("{"+N+"}",R.join(",")):p=p.replaceAll("{"+N+"}",R):p=p.replaceAll("{"+N+"}","")}return p}return""}),v=t.computed(()=>{const p={};let S=o.value.action?.href||o.value.action?.link;if(S){const _=S.matchAll("{[a-zA-Z0-9.]*}"),C=[];let x=null;for(;x=_.next();){if(x&&x.value&&x.value[0]){let R=x.value[0].substring(1,x.value[0].length-1);C.includes(R)||C.push(R)}if(x.done)break}if(C.length>0)for(let R=0;R<C.length;R++){let b=C[R],B=Y.utils.obj.getValue(m.value,b);B?B instanceof Object?S=S.replaceAll("{"+b+"}",JSON.stringify(B)):Array.isArray(B)?S=S.replaceAll("{"+b+"}",B.join(",")):S=S.replaceAll("{"+b+"}",B):S=S.replaceAll("{"+b+"}","")}const N=S.split("?")[1];N&&N.split("&").forEach(R=>{const b=R.split("=");b[0]&&b[1]&&(p[b[0]]=b[1])})}return o.value.action?.params&&o.value.action.params.filter(_=>_.value+"").forEach(_=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(_.value)){let x=Y.utils.obj.getValue(m.value,_.value);p[_.name]=x}else p[_.name]=_.value}),p}),y=e,A=t.inject("router");function V(p){if(n.isDebug&&console.log("unione btn click",o.value,p),!(s.value.click&&s.value.click(m.value,o.value,p)==!1)){if(o.value.action?.type=="drawer"||o.value.action?.type=="dialog")g.value.open=!0;else if(o.value.action?.type=="route"&&(o.value.action?.href||o.value.action?.link)){if(o.value.action.link&&i.editor?.type.value=="code")return;A.push({path:o.value.action.href||o.value.action?.link,query:v.value})}y("click",{btn:o.value,event:p,ctx:m.value})}}function k(p){y("click",p)}return(p,S)=>{const _=t.resolveComponent("a-button"),C=t.resolveComponent("unione-btn"),x=t.resolveComponent("a-dropdown"),N=t.resolveComponent("a-drawer"),R=t.resolveComponent("a-modal");return d.value?(t.openBlock(),t.createBlock(ft,{key:0,class:t.normalizeClass(["unione-btn",o.value.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:u,custome:!0,"setting-title":"按钮设置"},{default:t.withCtx(()=>[!o.value.widget||o.value.widget=="button"?(t.openBlock(),t.createBlock(_,t.mergeProps({key:0,disabled:h.value,size:o.value.size||"small",type:a.type||a.widget.type,shape:o.value.shape,class:"unione-btn-"+o.value.name,loading:o.value.loading,target:o.value.action?.target,title:o.value.tooltip,onClick:V},o.value.props),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value)+" ",1)]),_:2},[o.value.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):t.createCommentVNode("",!0),o.value.widget=="dropdown"?(t.openBlock(),t.createBlock(x,{key:1,trigger:[o.value.trigger||"hover"],class:t.normalizeClass([o.value.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["dropdown-overlay",o.value.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.items,b=>(t.openBlock(),t.createBlock(C,{key:b.name,class:"item",widget:b,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:S[0]||(S[0]=B=>k(B))},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(_,{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:g.value.open,"onUpdate:open":S[1]||(S[1]=b=>g.value.open=b),title:o.value.action?.title,placement:o.value.action?.position,maskClosable:o.value.action?.maskClosable,width:o.value.action?.width,bodyStyle:{padding:0,overflow:!o.value.action.component||o.value.action.component=="iframe"?"hidden":"auto"}},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value},null,8,$a)):t.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):t.createCommentVNode("",!0),o.value.action?.type=="dialog"?(t.openBlock(),t.createBlock(R,{key:3,open:g.value.open,"onUpdate:open":S[2]||(S[2]=b=>g.value.open=b),title:o.value.action?.title,width:o.value.action?.width,maskClosable:o.value.action?.maskClosable,centered:"",footer:null},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value,style:t.normalizeStyle({height:o.value.action?.height?o.value.action?.height+"px":""})},null,12,Pa)):t.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):t.createCommentVNode("",!0),t.createVNode(An,{ref_key:"btnSetting",ref:f,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8f0eca98"]]),Ua={key:0,class:"unione-widget-empty-tip"},ja=le(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,n=t.ref(),i=t.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=t.resolveComponent("a-tab-pane"),r=t.resolveComponent("a-tabs");return t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createBlock(r,{key:0,activeKey:n.value,"onUpdate:activeKey":o[0]||(o[0]=c=>n.value=c)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.chidlren,(c,d)=>(t.openBlock(),t.createBlock(s,{key:d,class:"unione-layout-tab-pane"},{tab:t.withCtx(()=>[t.createElementVNode("span",null,[c.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.icon),{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(c.title),1)])]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.chidlren,(h,f)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(t.openBlock(),t.createElementBlock("div",Ua,t.toDisplayString(c.emptyTips),1)):t.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):t.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),za={class:"title"},qa={class:"text"},Qa={key:0,class:"reactive"},Wa={key:1,class:"opts"},Ka={class:"warp"},Ya=le(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,n=t.computed(()=>e.editor?.widget(e.wid)||e.widget),i=t.computed(()=>n.value?.title||e.title),l=t.computed(()=>n.value?.icon||e.icon),o=t.computed(()=>n.value?.type||e.type),s=t.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,d)=>(t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[t.createElementVNode("div",za,[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",qa,t.toDisplayString(i.value),1)]),a.reactive?(t.openBlock(),t.createElementBlock("div",Qa,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):t.createCommentVNode("",!0),a.location=="left"?(t.openBlock(),t.createElementBlock("div",Wa,[t.renderSlot(c.$slots,"opts",{},void 0,!0)])):t.createCommentVNode("",!0)],2),t.withDirectives(t.createElementVNode("div",Ka,[t.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Ha={class:"unione-props-setting unione-form-setting"},Ga={class:"unione-form-btns"},Ja={key:0},Xa=["onClick"],Za={class:"field-txt"},er=["onClick"],tr={key:1,class:"field-txt"},nr=["onClick"],ir={key:0,class:"field-txt"},lr={key:3,class:"edit-field"},or={key:0},sr=["onClick"],ar=le(t.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=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"}]),i=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(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{const C=i.value.configs.settings.btns,x=C.map(N=>N.name);if(!x.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!x.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let R=N.index||1;C.splice(R,0,N)}if(!x.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!x.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,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.settings.btns.sort((N,R)=>{const b=N.index||1,B=R.index||1;return b-B}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function c(){const C=i.value.configs.settings.btns.length+1;let x={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x.name="new_"+i.value.configs.settings.btns.length;const N=i.value.configs.settings.btns.filter(R=>R.name==x.name).length;N>0&&(x.name=x.name+N),i.value.configs.settings.btns.push(x),e.editor.widget(e.wid,i.value),s.value.open(x,R=>{Object.keys(R).forEach(b=>{x[b]=R[b]}),i.value.configs.btns=[...i.value.configs.btns]})}function d(C){const x=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(R=>{R.name!=C.name&&N.push(R)}),i.value.configs.settings.btns=N}};oe.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{x()}})}const h=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:C=>{const x=h.value.widgets.filter(N=>N.value==C);return x[0]?x[0].label:C},toSetting:()=>{}}),f=t.ref({visible:!1,field:{},props:{},showInfo:C=>{let x="";return C.rules&&(x=C.rules.filter(N=>N.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const C=f.value.props,x={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(x.min=C.rangeMin,x.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(x.max=C.rangeMax,x.enable=!0);const N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),f.value.field.rules=[x,N],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(C){f.value.visible=!0,f.value.field=C;const x=C.rules||[],N={trigger:"change",whitespace:!0};x.forEach(R=>{R.name=="reg"&&(N.trigger=R.trigger,N.whitespace=R.whitespace,N.regExpress=R.pattern,N.regMessage=R.message),R.name=="range"&&(N.rangeMin=R.min,N.rangeMax=R.max,N.rangeMessage=R.message)}),f.value.props=N}const m=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function g(C,x){const N=A.value.filter(b=>b.name==C.name);N.forEach(b=>{x!="isSort"?b[x]=!0:b[x]=!b[x]});const R=N[0];if(!(!R||x=="isSort")){switch(m.value.prop=x,m.value.field=C,R.show||(R.show={}),x){case"isQuery":R.show.query||(R.show.query={}),m.value.show=R.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":R.show.form||(R.show.form={}),m.value.show=R.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":R.show.view||(R.show.view={}),m.value.show=R.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":R.show.list||(R.show.list={}),m.value.show=R.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(C,x)=>{w.value.convert.options.splice(C,1)},toSetting:()=>{w.value.visible=!1}});function v(C){w.value.visible=!0,w.value.field=C,w.value.convert=C.convert||{}}const y=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),A=t.computed(()=>y.value.fields?.length?y.value.fields:[]),V={mounted:C=>C.focus()},k=t.ref({});function p(C,x){const N={};x=="convertName"?N[x]=C.convert?.type:N[x]=C[x]||"",k.value={},k.value[C.name]=N}function S(C,x){{k.value={};return}}function _(C,x){A.value.filter(R=>R.name==C.name).forEach(R=>{R[x]=!R[x]})}return(C,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),b=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-select"),E=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-checkbox"),P=t.resolveComponent("a-table"),F=t.resolveComponent("a-select-option"),q=t.resolveComponent("a-form-item"),L=t.resolveComponent("a-form"),O=t.resolveComponent("a-modal"),ee=t.resolveComponent("a-checkbox-group"),D=t.resolveComponent("a-input-number"),K=t.resolveComponent("a-input"),fe=t.resolveComponent("a-col"),U=t.resolveComponent("a-row");return t.openBlock(),t.createElementBlock("div",Ha,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[23]||(x[23]=[t.createTextVNode("按钮设置")])),_:1}),t.createElementVNode("div",Ga,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,I=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:Z=>r(I)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(I.title)+" ",1),I.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(Z=>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(b,{class:t.normalizeClass(["btn","btn-add"]),size:"small",onClick:x[0]||(x[0]=I=>c())},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[24]||(x[24]=[t.createTextVNode("表单设置")])),_:1}),x[36]||(x[36]=t.createTextVNode(" 数据模型:")),t.createVNode(T,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[1]||(x[1]=I=>i.value.dataModel=I)},null,8,["options","value"]),t.createVNode(P,{columns:n.value,"data-source":A.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:I})=>[["widget","rules","convertName"].includes(I.key)?(t.openBlock(),t.createElementBlock("span",Ja,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(I.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:I,text:Z,record:Q})=>[["rules"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!f.value.showInfo(Q)&&"empty"]),onClick:$=>u(Q)},[t.createElementVNode("span",Za,t.toDisplayString(f.value.showInfo(Q)),1),f.value.showInfo(Q)?(t.openBlock(),t.createBlock(b,{key:0,type:"link"},{default:t.withCtx(()=>x[25]||(x[25]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Xa)):["widget"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!k.value[Q.name]||!Object.keys(k.value[Q.name]).includes(I.dataIndex))&&!Z&&"empty"]),onClick:$=>p(Q,I.dataIndex)},[k.value[Q.name]&&Object.keys(k.value[Q.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:Q[I.dataIndex],"onUpdate:value":$=>Q[I.dataIndex]=$,options:h.value.widgets,onBlur:x[2]||(x[2]=$=>S())},null,8,["value","onUpdate:value","options"])),[[V]]):(t.openBlock(),t.createElementBlock("span",tr,t.toDisplayString(h.value.widgetName(Z)),1))],10,er)):["convertName"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!k.value[Q.name]||!Object.keys(k.value[Q.name]).includes(I.dataIndex))&&!Q.convert?.type&&"empty"]),onClick:$=>p(Q,I.dataIndex)},[k.value[Q.name]&&Object.keys(k.value[Q.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(T,{key:0,value:Q[I.dataIndex],"onUpdate:value":$=>Q[I.dataIndex]=$,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:x[3]||(x[3]=$=>S())},null,8,["value","onUpdate:value"])),[[V]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[Q.convert?.type?(t.openBlock(),t.createElementBlock("span",ir,t.toDisplayString(Q.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),Q.convert?.type?(t.openBlock(),t.createBlock(b,{key:1,type:"link",onClick:t.withModifiers($=>v(Q),["stop"])},{default:t.withCtx(()=>x[26]||(x[26]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,nr)):["isForm","isView"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",lr,[t.createVNode(M,{checked:Q[I.dataIndex],onClick:$=>_(Q,I.dataIndex)},null,8,["checked","onClick"]),t.createVNode(b,{type:"link",onClick:$=>g(Q,I.dataIndex)},{default:t.withCtx(()=>x[27]||(x[27]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(O,{visible:h.value.visible,"onUpdate:visible":x[5]||(x[5]=I=>h.value.visible=I),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"},{default:t.withCtx(()=>[h.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(q,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(T,{value:h.value.props.mode,"onUpdate:value":x[4]||(x[4]=I=>h.value.props.mode=I),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(F,{value:"multiple"},{default:t.withCtx(()=>x[28]||(x[28]=[t.createTextVNode("多选")])),_:1}),t.createVNode(F,{value:"tags"},{default:t.withCtx(()=>x[29]||(x[29]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:f.value.visible,"onUpdate:visible":x[13]||(x[13]=I=>f.value.visible=I),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",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[30]||(x[30]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(q,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(ee,{value:f.value.props.trigger,"onUpdate:value":x[6]||(x[6]=I=>f.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(M,{value:f.value.props.whitespace,"onUpdate:value":x[7]||(x[7]=I=>f.value.props.whitespace=I),checked:f.value.props.whitespace},{default:t.withCtx(()=>x[31]||(x[31]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[32]||(x[32]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(q,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(D,{value:f.value.props.rangeMin,"onUpdate:value":x[8]||(x[8]=I=>f.value.props.rangeMin=I)},null,8,["value"]),x[33]||(x[33]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(D,{value:f.value.props.rangeMax,"onUpdate:value":x[9]||(x[9]=I=>f.value.props.rangeMax=I)},null,8,["value"])]),_:1}),t.createVNode(q,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.rangeMessage,"onUpdate:value":x[10]||(x[10]=I=>f.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[34]||(x[34]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(q,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.regExpress,"onUpdate:value":x[11]||(x[11]=I=>f.value.props.regExpress=I)},null,8,["value"])]),_:1}),t.createVNode(q,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.regMessage,"onUpdate:value":x[12]||(x[12]=I=>f.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:m.value.visible,"onUpdate:visible":x[20]||(x[20]=I=>m.value.visible=I),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(D,{value:m.value.show.index,"onUpdate:value":x[14]||(x[14]=I=>m.value.show.index=I)},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(K,{value:m.value.show.width,"onUpdate:value":x[15]||(x[15]=I=>m.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(q,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(K,{value:m.value.show.labelWidth,"onUpdate:value":x[16]||(x[16]=I=>m.value.show.labelWidth=I)},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(K,{value:m.value.show.valueWidth,"onUpdate:value":x[17]||(x[17]=I=>m.value.show.valueWidth=I)},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(T,{value:m.value.show.fixed,"onUpdate:value":x[18]||(x[18]=I=>m.value.show.fixed=I),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(T,{value:m.value.show.align,"onUpdate:value":x[19]||(x[19]=I=>m.value.show.align=I),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(O,{visible:w.value.visible,"onUpdate:visible":x[22]||(x[22]=I=>w.value.visible=I),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",or,[t.createVNode(b,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>x[35]||(x[35]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(P,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:I,record:Z,index:Q})=>[I.dataIndex==="label"?(t.openBlock(),t.createBlock(K,{key:0,value:Z.label,"onUpdate:value":$=>Z.label=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="value"?(t.openBlock(),t.createBlock(K,{key:1,value:Z.value,"onUpdate:value":$=>Z.value=$,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:$=>w.value.toDelOption(Q,Z)},"删除",8,sr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(L,{key:1,model:w.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(fe,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(q,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(K,{value:w.value.convert.dict,"onUpdate:value":x[21]||(x[21]=I=>w.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(An,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),rr={key:0,class:"form-left"},cr={class:"form-warp"},dr={key:1,class:"form-right"},hr=le(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 n=a,i=t.ref(!1),l=t.ref(),o=t.ref({}),s=t.ref(null);t.onMounted(()=>{if(c.value.dsn){const p=r.value.dataManager();c.value.primary&&p.psn(c.value.dsn),s.value.setDisabled=k,s.value.getValue=w,s.value.setValue=v,s.value.reset=y,l.value=p.useForm(c.value.dsn,s.value,S=>{o.value=S.body||{}})}n.editor||r.value.loadConfig({widgets:d.value}),n.form?.model&&r.value.setModel(n.form.model),A()});const r=t.computed(()=>n.editor||new lt),c=t.computed(()=>n.widget||n.form||{}),d=t.computed(()=>{let p=c.value.widgets||[];return!p.length&&n.form?.fields&&(p=n.form.fields),p.forEach(S=>{S.widget||(S.widget="unione-form-item"),S.control||(S.control="a-input")}),p}),h=t.computed(()=>d.value.filter(p=>p.float=="left")),f=t.computed(()=>d.value.filter(p=>!p.float)),u=t.computed(()=>d.value.filter(p=>p.float=="right")),m=t.inject("pageSetting",{}),g=t.computed(()=>c.value.setting||m?.form||{});t.provide("formSetting",g.value);function w(){return o.value}function v(p){o.value=p,A()}function y(){o.value={},A()}function A(){const p=S=>{S.widget=="unione-form-item"&&S.name&&(S.value!=null&&S.value!=null&&S.value!=""||S.value==0)&&(o.value[S.name]==null||o.value[S.name]==null||o.value[S.name]=="")&&(o.value[S.name]=S.value),S.widgets?.forEach(_=>{p(_)})};d.value.forEach(S=>{p(S)})}function V(){return new Promise((p,S)=>{s.value.validate().then(_=>{p(o.value)}).catch(_=>{S(_)})})}function k(p=!0){i.value=p}return e({validate:V,getValue:w,setValue:v,reset:y,setDisabled:k}),(p,S)=>{const _=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ft,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},t.createSlots({default:t.withCtx(()=>[t.createVNode(_,{ref_key:"formObj",ref:s,model:o.value,class:t.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(g.value.showColumn||3)])},{default:t.withCtx(()=>[h.value?.length?(t.openBlock(),t.createElementBlock("div",rr,[(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":x=>o.value[C.name]=x,disabled:i.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0),t.createElementVNode("div",cr,[(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":x=>o.value[C.name]=x,disabled:i.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),u.value?.length?(t.openBlock(),t.createElementBlock("div",dr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.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":x=>o.value[C.name]=x,disabled:i.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(ar,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a31125db"]]);function Ml(a,e=!1){const n=De();if(!a)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+a);return i&&e==!1?Promise.resolve(JSON.parse(i)):(n.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 n.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function Tl(a,e){const n=De();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await Ml(a),l=i.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(n.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function fr(a,e){const n=await Tl(a,e);return Promise.resolve(n.dictValue)}const Fl={load:Ml,getLabel:fr,getOption:Tl};class Ke{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=De()}load(e,n=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Fl.load(this.convertObj.dictName,n).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),i(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((i,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[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(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?i(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,Y.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(d=>{if(d.success){const h={};this.options.forEach(f=>{h[e]=!0}),d.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(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?Fl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const n=this.convertObj.options.filter(i=>i.value==e);return n.length?Promise.resolve(n[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 n=this.options.filter(i=>i.value==e);if(n.length)return Promise.resolve(n[0].label)}return new Promise((n,i)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return n(o[0].label);i()})})}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((i,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios[this.convertObj.ctx||"admin"]({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],i(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(i=>i.label.indexOf(e)>=0));const n={...this.convertObj.params||{}};return new Promise(i=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios[this.convertObj.ctx||"admin"]({url:l,data:{body:{...n,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),i(o.body)):i([])})})}$processOptions(e){return this.convertObj.types=="local"&&!this.convertObj.process&&e.forEach(n=>{this.convertObj.idField&&(n.id=n[this.convertObj.idField]),this.convertObj.pidField&&(n.pid=n[this.convertObj.pidField]),n.value=n[this.convertObj.valueField||"id"],n.label=n[this.convertObj.labelField||"title"]}),this.convertObj.process?this.convertObj.process(e):e}}function ut(a,e=350){let n=null;return i=>{clearTimeout(n),n=setTimeout(()=>{a(i)},e)}}const ur=["innerHTML"],pr={key:2,class:"text-view"},mr=le(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,n=t.useModel(a,"value"),i=t.computed(()=>o.value.showFormat?o.value.showFormat.call(this,n.value,{label:v.value,form:e.formValue}):v.value||n.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")&&(n.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?n.value=s.value.value.split(","):n.value=[s.value.value])))});const o=t.ref({}),s=t.computed(()=>{const y=e.editor?.widget(e.wid)||e.widget||{};return y.event&&Object.keys(y.event).forEach(A=>{const V=y.event[A];V&&(o.value[A]=null,typeof V=="function"?o.value[A]=V:V.enable&&V.scriptText&&(o.value[A]=new Function("value","ctx",V.scriptText)))}),y}),r=t.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=t.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=ut(()=>{if(o.value.change)return o.value.change(e.formValue[s.value.name],e.formValue)||s.value.change;s.value.change&&s.value.change(e.formValue[s.value.name],e.formValue)}),h=t.ref({}),f=t.computed(()=>{const y=[],A=s.value.rule||{};let V=s.value.props?.required||s.value.required;if(o.value.required&&(V=o.value.required(e.formValue[s.value.name],e.formValue)),V&&y.push({required:!0,whitespace:A?.whitespace||!1,trigger:A?.trigger||l.ruleTrigger||"change",validator:(k,p)=>(A?.whitespace&&p&&typeof p=="string"&&(p=p.trim()),p!=null&&p!=null&&(p+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),A.advance&&h.value[A.advance]){const k=h.value[A.advance];y.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"})}return A.regExpress&&y.push({pattern:A.regExpress,message:A.regMessage||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&y.push({validator:(k,p)=>p&&(p+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(p+"").length+"]"):Promise.resolve(),trigger:A?.trigger||l.ruleTrigger||"change"}),y}),u=t.computed(()=>{const y=s.value.props||{};if(s.value.control=="a-input-number"){const A=s.value.rule||{};A.rangeMin!=null&&A.rangeMin!=null&&(y.min=A.rangeMin),A.rangeMax!=null&&A.rangeMax!=null&&(y.max=A.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(y.format=s.value.view.dataFormat,y.valueFormat=s.value.view.dataFormat),s.value.required&&(y.required=s.value.required),y}),m=t.computed(()=>{const y=s.value.css||{},A=["form-item-"+s.value.name];return y.cssName&&A.push(y.cssName),l.platform=="app"?y.cssName?typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0&&A.push("all-line"):A.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!y.cssName||typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0)&&A.push("all-line"):s.value.view.width==2&&A.push("2in-line")),A}),g=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&y>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(A/y)}:s.value.view?.width>=3&&y>1?{span:Math.round(A/y)}:{span:A}}),w=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&y>1&&m.value.includes("all-line")?{}:{span:A}}),v=t.ref();return t.watch(n,()=>{n.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ke(s.value.convert).convert(n.value.toString()).then(y=>{v.value=y})}),(y,A)=>{const V=t.resolveComponent("a-form-item");return t.openBlock(),t.createBlock(ft,{class:t.normalizeClass(["unione-form-item",m.value]),style:t.normalizeStyle(s.value.css?.cssText)},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(V,{key:0,label:c.value,name:s.value.name,labelCol:g.value,wrapperCol:w.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:t.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value.control||"a-input"),t.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:t.unref(d),value:n.value,"onUpdate:value":A[0]||(A[0]=k=>n.value=k),formValue:a.formValue},u.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:i.value},null,8,ur)):(t.openBlock(),t.createElementBlock("div",pr,t.toDisplayString(i.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):t.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),gr=le(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){De();const e=a,n=t.ref(),i=t.useModel(a,"value"),l=t.ref([]),o=t.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=t.computed(()=>{const g=u.value.convert||e.convert||{};if(g.refValue){const w={};return g.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=Y.utils.obj.getValue(e.formValue,A[0]):w[A[0]]=Y.utils.obj.getValue(e.formValue,A[1])}),w}return{}}),r=t.computed(()=>(u.value.convert||e.convert||{}).search||!1),c=ut(g=>{const w=u.value.convert||e.convert||{};w.params={...h.value,...s.value},m.value.search(g).then(v=>{l.value=v})},500);function d(g,w){f.value.select&&f.value.select(g,{option:w,formValue:e.formValue})}const h=t.ref();t.onMounted(()=>{const g=u.value.convert||e.convert||{};h.value=g.params||{},g.params={...h.value,...s.value},e.mode=="multiple"&&typeof i.value=="string"&&(n.value=i.value.split(",")),m.value.load(i.value).then(w=>{l.value=w})});const f=t.ref({}),u=t.computed(()=>{const g=e.editor?.widget(e.wid)||e.widget||{};return g.event&&Object.keys(g.event).forEach(w=>{const v=g.event[w];v&&(f.value[w]=null,typeof v=="function"?f.value[w]=v:v.enable&&v.scriptText&&(f.value[w]=new Function("value","ctx",v.scriptText)))}),g}),m=t.computed(()=>{const g=u.value.convert||e.convert||{};return new Ke(g)});return t.watch(i,ut(()=>{i.value!=null&&i.value!==""&&i.value!==void 0&&(i.value+"").length>0&&(e.mode=="multiple"&&typeof i.value=="string"?n.value=i.value.split(","):(n.value=i.value,l.value[0]&&(typeof l.value[0].value=="number"?n.value=Number(n.value):typeof l.value[0].value=="string"&&(n.value=String(n.value)))),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(i.value).then(g=>{l.value=g}))},200)),t.watch(()=>u.value.convert||e.convert||{},ut(()=>{m.value.load().then(g=>{l.value=g})})),t.watch(()=>s.value,ut(()=>{if(console.log(u.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const g=u.value.convert||e.convert||{};g.params={...h.value,...s.value},m.value.load(i.value,!0).then(w=>{l.value=w})}},200),{deep:!0}),t.watch(n,()=>{Array.isArray(n.value)&&e.valueType=="string"?i.value=n.value.join(","):i.value=n.value}),(g,w)=>{const v=t.resolveComponent("a-select");return t.openBlock(),t.createBlock(v,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:n.value,"onUpdate:value":w[0]||(w[0]=y=>n.value=y),onSearch:t.unref(c),onSelect:d},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-6ba8560f"]]),br=le(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,n=t.useModel(a,"value"),i=t.ref({});t.onMounted(()=>{s.value?.load(n.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(i.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?i.value.unCheckedValue=!1:i.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 Ke(r):null});return(r,c)=>{const d=t.resolveComponent("a-switch");return t.openBlock(),t.createBlock(d,t.mergeProps({class:"unione-form-switch"},i.value,{checked:n.value,"onUpdate:checked":c[0]||(c[0]=h=>n.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),kr=le(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,n=t.useModel(a,"value"),i=t.ref([]),l=t.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),o=t.computed(()=>{const h=c.value.convert||e.convert||{};if(h.refValue){const f={};return h.refValue.split(",").forEach(m=>{const g=m.split("=");g.length==1?f[g[0]]=Y.utils.obj.getValue(e.formValue,g[0]):f[g[0]]=Y.utils.obj.getValue(e.formValue,g[1])}),console.log(c.value.name+" ref field:"+h.refValue+",ref value",f),f}return{}}),s=t.ref();t.onMounted(()=>{const h=c.value.convert||e.convert||{};s.value=h.params||{},h.params={...s.value,...o.value},d.value.load(n.value||c.value.value).then(f=>{i.value=f})});const r=t.ref({}),c=t.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];u&&(r.value[f]=null,typeof u=="function"?r.value[f]=u:u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText)))}),h}),d=t.computed(()=>{const h=c.value.convert||e.convert||{};return new Ke(h)});return t.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const h=c.value.convert||e.convert||{};h.params={...s.value,...o.value},d.value.load(void 0,!0).then(f=>{i.value=f})}},{deep:!0}),(h,f)=>{const u=t.resolveComponent("a-radio-group");return t.openBlock(),t.createBlock(u,{class:"unione-form-radio",options:l.value,value:n.value,"onUpdate:value":f[0]||(f[0]=m=>n.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),yr=le(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 n=a,i=t.useModel(a,"value"),l=t.ref(),o=t.ref([]),s=t.computed(()=>o.value?.length?o.value:n.options?.length?n.options:[]),r=t.computed(()=>{const g=h.value.convert||n.convert||{};if(g.refValue){const w={};return g.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=Y.utils.obj.getValue(n.formValue,A[0]):w[A[0]]=Y.utils.obj.getValue(n.formValue,A[1])}),console.log(h.value.name+" ref field:"+g.refValue+",ref value",w),w}return{}}),c=t.ref();t.onMounted(()=>{const g=i.value||h.value.value;n.returnType==="string"?l.value=g.split(","):l.value=g;const w=h.value.convert||n.convert||{};c.value=w.params||{},w.params={...c.value,...r.value},m.value.load().then(v=>{o.value=v})});const d=t.ref({}),h=t.computed(()=>{const g=n.editor?.widget(n.wid)||n.widget||{};return g.event&&Object.keys(g.event).forEach(w=>{const v=g.event[w];d.value[w]=null,v.enable&&v.scriptText&&(d.value[w]=new Function("value","ctx",v.scriptText))}),g}),f=e;function u(g){n.returnType==="string"?i.value=g.join(","):i.value=g,console.log("checkbox changed",i.value),f("change",i.value)}const m=t.computed(()=>{const g=h.value.convert||n.convert||{};return new Ke(g)});return t.watch(()=>i.value,()=>{l.value=Array.isArray(i.value)?i.value:[],i.value&&!Array.isArray(i.value)&&(l.value=i.value.split(","))}),t.watch(()=>r.value,()=>{if(console.log(h.value.name+" ref value changed",r.value),r.value){l.value=[],n.returnType==="string"?i.value="":i.value=[];const g=h.value.convert||n.convert||{};g.params={...c.value,...r.value},m.value.load(void 0,!0).then(w=>{o.value=w})}},{deep:!0}),(g,w)=>{const v=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createBlock(v,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":w[0]||(w[0]=y=>l.value=y),onChange:u},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),wr=le(t.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=t.ref(),n=t.useModel(a,"value");return t.watch(()=>e.value,()=>{e.value?n.value=Y.utils.sm2Encrypt(e.value):n.value=""}),(i,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 pi(a){const e=a.toLowerCase().split("_"),n=[];n.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(n.push(l.charAt(0).toUpperCase()),l.length>1&&n.push(l.substring(1)))}return n.join("")}const Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Dl(a=10){const e=Date.now().toString(),n=new Uint32Array(a);crypto.getRandomValues(n);let i="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+n[l])%Il.length;i+=Il[o]}return i}const Ar={toHump:pi,randomStr:Dl},xr=le(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,n=t.useModel(a,"value");function i(){n.value=Dl(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:n.value,"onUpdate:value":o[0]||(o[0]=c=>n.value=c)},{suffix:t.withCtx(()=>[t.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:i})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),vr=le(t.defineComponent({__name:"uploadBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},btnLabel:{type:String,default:"上传文件"},valueType:{type:String,default:"array"},autoUpload:{type:Boolean,default:!1},beforeUpload:{type:Function,required:!1},disabled:{type:Boolean,default:!1}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const n=a,i=e,l=t.useModel(a,"value"),o=t.ref([]),s=t.computed(()=>!n.disabled||n.editor?.model.value!="view");t.watch(l,()=>{o.value=[],l.value&&(Array.isArray(l.value)?o.value=l.value:o.value=JSON.parse(l.value))});function r(d){return n.beforeUpload?n.beforeUpload(d):n.autoUpload}function c({fileList:d}){n.valueType=="array"?(l.value=d,i("change",d)):(l.value=JSON.stringify(d),i("change",JSON.stringify(d)))}return(d,h)=>{const f=t.resolveComponent("upload-outlined"),u=t.resolveComponent("a-button"),m=t.resolveComponent("a-upload");return t.openBlock(),t.createBlock(m,{class:"unione-form-upload-box","file-list":o.value,"onUpdate:fileList":h[0]||(h[0]=g=>o.value=g),disabled:!s.value,beforeUpload:r,onChange:c},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createBlock(u,{key:0},{default:t.withCtx(()=>[t.createVNode(f),t.createTextVNode(" "+t.toDisplayString(a.btnLabel),1)]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["file-list","disabled"])}}}),[["__scopeId","data-v-a6190474"]]),Cr={class:"unione-props-setting unione-query-setting"},Sr={class:"unione-query-opts"},Br={key:0},Nr=["onClick"],Vr={key:1},Rr={key:1,class:"edit-field"},Er=["onClick"],Or=le(t.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),i=t.computed(()=>{const V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),l=t.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=t.computed(()=>{const V=[],k=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{V.push(p),k.push(p.name)}),k.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),V}),s=t.ref(null);function r(V){s.value&&s.value.open(V,k=>{k.visible=!0,Object.keys(k).forEach(p=>{V[p]=k[p]}),i.value.configs.btns.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),i.value.configs.btns=[...i.value.configs.btns]})}function c(){const V=i.value.configs.btns.length+1;let k={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(k),e.editor.widget(e.wid,i.value),s.value.open(k,p=>{Object.keys(p).forEach(S=>{k[S]=p[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function d(V){const k=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(S=>{S.name!=V.name&&p.push(S)}),i.value.configs.btns=p}};oe.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const h=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=t.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:V=>V.focus()},m=t.ref({});function g(){const V=Object.keys(m.value);if(V.length)for(let k in V){const p=f.value.filter(S=>S.name==k);if(p&&p[0]){let S=m.value[k];Object.keys(S).forEach(_=>{if(_=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:S[_]}}else p[0][_]=S[_]})}}m.value={}}function w(V,k){g();const p={};p[k]=V[k]||"",k=="showIndex"&&(p[k]=V.show?.query?.index),m.value[V.name]=p}function v(V,k){if(!V||!k){m.value={};return}const p=m.value[V.name][k];if(k=="showIndex"){const S=V.show?.query||{};V.show||(V.show={}),V.show.query={...S,index:p}}else V[k]=p;m.value={}}function y(V,k){f.value.filter(S=>S.name==V.name).forEach(S=>{S[k]=!S[k]})}const A=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:V=>{const k=A.value.options.filter(p=>p.value==V);return k[0]?k[0].label:V}});return(V,k)=>{const p=t.resolveComponent("a-divider"),S=t.resolveComponent("CloseOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("PlusOutlined"),x=t.resolveComponent("a-select"),N=t.resolveComponent("ToolOutlined"),R=t.resolveComponent("a-checkbox"),b=t.resolveComponent("a-input-number"),B=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Cr,[t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>k[3]||(k[3]=[t.createTextVNode("查询按钮")])),_:1}),t.createElementVNode("div",Sr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,T=>(t.openBlock(),t.createBlock(_,t.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"default",ref_for:!0},T.props||{},{onClick:E=>r(T)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(T.title)+" ",1),T.visible?(t.openBlock(),t.createBlock(S,{key:0,class:"btn-del",onClick:t.withModifiers(E=>d(T),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(_,{class:t.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=T=>c()),size:"small"},{default:t.withCtx(()=>[t.createVNode(C)]),_:1})]),t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>k[4]||(k[4]=[t.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=t.createTextVNode(" 数据模型:")),t.createVNode(x,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":k[1]||(k[1]=T=>i.value.dataModel=T)},null,8,["options","value"]),t.createVNode(B,{columns:n.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:T})=>[["showIndex","queryType"].includes(T.key)?(t.openBlock(),t.createElementBlock("span",Br,[t.createVNode(N),t.createTextVNode(" "+t.toDisplayString(T.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:T,text:E,record:M})=>[["queryType"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!m.value[M.name]||!Object.keys(m.value[M.name]).includes(T.dataIndex))&&!E&&"empty"]),onClick:P=>w(M,T.dataIndex)},[m.value[M.name]&&Object.keys(m.value[M.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(x,{key:0,value:M[T.dataIndex],"onUpdate:value":P=>M[T.dataIndex]=P,allowClear:!0,options:A.value.options,onBlur:k[2]||(k[2]=P=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(t.openBlock(),t.createElementBlock("span",Vr,t.toDisplayString(A.value.showLabel(E)),1))],10,Nr)):["isQuery"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",Rr,[t.createVNode(R,{checked:M[T.dataIndex],onClick:P=>y(M,T.dataIndex)},null,8,["checked","onClick"])])):T.dataIndex=="showIndex"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!m.value[M.name]||!Object.keys(m.value[M.name]).includes(T.dataIndex))&&!E&&"empty"]),onClick:P=>w(M,T.dataIndex)},[m.value[M.name]&&Object.keys(m.value[M.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(b,{key:0,value:m.value[M.name][T.dataIndex],"onUpdate:value":P=>m.value[M.name][T.dataIndex]=P,onBlur:P=>v(M,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M.show?.query?.index||" "),1)],64))],10,Er)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(An,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),_r={class:"query-btn"},Mr={class:"btn-advanced-overlay"},$l=le(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 n=a,i=t.computed(()=>{const v=n.editor?.widget(n.wid)||n.widget||{};return v.btns||(v.btns=[]),v}),l=t.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),o=t.computed(()=>{let v=[];return i.value.fields?.length&&(v=i.value.fields),v.length==0&&n.fields?.length&&(v=n.fields),v.sort((y,A)=>{const V=y.show?.query?.index||1,k=A.show?.query?.index||1;return V-k}),v.forEach(y=>{!y.widget&&!y.control&&y.convert&&(y.widget="unione-select-box"),y.widget=y.widget||y.control||"a-input",y.defaultValue!=null&&y.defaultValue!="undefined"&&typeof y.defaultValue<"u"&&(h.value[y.name]=y.defaultValue,y.value=y.defaultValue)}),v}),s=t.computed(()=>i.value.labelWidth||7),r=t.computed(()=>{const v=i.value.btns.filter(y=>y.name=="advanced")[0]||{};return v.event?.clickScript&&(v.event.click=new Function("ctx","btn","event",v.event.clickScript)),v.event?.disableScript&&(v.event.disable=new Function("ctx","btn",v.event.disableScript)),v.event?.visibleScript&&(v.event.visible=new Function("ctx","btn",v.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...v}}),c=["query","reset","advanced"],d=t.computed(()=>{const v=i.value.btns.filter(A=>A.name!="advanced"),y=[];return v.forEach(A=>{A.size||(A.size="default"),y.push(A.name)}),y.includes("query")||v.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),y.includes("reset")||v.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),v.sort((A,V)=>{const k=A.index||1,p=V.index||1;return k-p}),v}),h=t.ref({}),f=t.computed(()=>{const v={};return i.value.params?Object.keys(i.value.params).forEach(y=>{v[y]=i.value.params[y]}):n.params&&Object.keys(n.params).forEach(y=>{v[y]=n.params[y]}),v});t.onMounted(()=>{n.editor?.ebus.$on("query-form-params",v=>{i.value.params=v}),g()});const u=e;function m({btn:v,event:y}){console.log("unione query form btn click",v,y),v.name=="query"&&g(),v.name=="reset"&&w(),u("btnClick",{btn:v,event:y})}function g(){const v=[];o.value.forEach(A=>{A.visible&&v.push(A.name)});const y={params:{...f.value},keywords:""};Object.keys(h.value).forEach(A=>{v.includes(A)&&(y.params[A]=h.value[A])}),l.value.visible&&h.value[l.value.name]&&(y.keywords=h.value[l.value.name]),u("query",y),n.editor?.ebus.$emit("table-list-search",y)}function w(){h.value={},o.value.forEach(y=>{y.visible=!1});const v={params:{...f.value},keywords:""};u("reset",v),n.editor?.ebus.$emit("table-list-reset",v)}return(v,y)=>{const A=t.resolveComponent("a-input"),V=t.resolveComponent("a-form-item"),k=t.resolveComponent("unione-btn"),p=t.resolveComponent("a-checkbox"),S=t.resolveComponent("DownOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("a-dropdown"),x=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ft,{class:"unione-query-form",model:n.editor?.model.value,"setting-title":"查询设置"},t.createSlots({default:t.withCtx(()=>[t.createVNode(x,{model:h.value,layout:"horizontal","label-col":{span:s.value}},{default:t.withCtx(()=>[l.value.visible?(t.openBlock(),t.createBlock(V,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:t.normalizeStyle({width:s.value})},{default:t.withCtx(()=>[t.createVNode(A,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":y[0]||(y[0]=N=>h.value[l.value.name]=N),allowClear:"",onKeyup:t.withKeys(g,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible?(t.openBlock(),t.createBlock(V,{key:0,label:N.title,class:t.normalizeClass(["query-field",N.name]),style:t.normalizeStyle({width:s.value}),name:N.name},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(N.widget),t.mergeProps({placeholder:N.placeholder,value:h.value[N.name],"onUpdate:value":R=>h.value[N.name]=R,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):t.createCommentVNode("",!0)],64))),128)),t.createElementVNode("div",_r,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible!=!1?(t.openBlock(),t.createBlock(k,{key:0,widget:N,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(t.openBlock(),t.createBlock(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:t.withCtx(()=>[t.createElementVNode("div",Mr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createBlock(p,{key:N.name,class:"item",checked:N.visible,onClick:R=>N.visible=!N.visible},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:t.withCtx(()=>[t.createVNode(_,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.value.title)+" ",1),t.createVNode(S)]),_:1})]),_:1},8,["trigger"])):t.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[n.editor&&n.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(Or,{editor:n.editor,wid:n.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),Tr={class:"unione-props-setting unione-table-setting"},Fr={class:"unione-table-tools"},Ir={key:1,class:"unione-table-opts"},Dr={key:0},$r=["onClick"],Pr={key:1,class:"edit-field"},Lr=["onClick"],Ur={key:1},jr=le(t.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=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,x){let N=C.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,x){let N=C.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=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(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.leftBtns;if(x.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"};x.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"};x.splice(1,0,N)}return x}),s=t.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.rightBtns;if(x.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"};x.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"};x.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"};x.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"};x.splice(3,0,N)}return x});function r(C,x){C=="left"?h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.leftBtns.sort((R,b)=>{const B=R.index||1,T=b.index||1;return B-T}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.rightBtns.sort((R,b)=>{const B=R.index||1,T=b.index||1;return B-T}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function c(C){const x=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let N={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(C,N)}function d(C,x){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(x.name))x.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const R=[];i.value.configs.leftBtns.forEach(b=>{b.name!=x.name&&R.push(b)}),i.value.configs.leftBtns=R}else{const R=[];i.value.configs.rightBtns.forEach(b=>{b.name!=x.name&&R.push(b)}),i.value.configs.rightBtns=R}};oe.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const h=t.ref(null);function f(C){h.value.open(C,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.operation.btns.sort((N,R)=>{const b=N.index||1,B=R.index||1;return b-B}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let x={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:""}};i.value.configs.operation.btns.push(x),e.editor.widget(e.wid,i.value),h.value.open(x,N=>{Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const x=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(R=>{R.name!=C.name&&N.push(R)}),i.value.configs.operation.btns=N}};oe.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{x()}})}const g=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),w=t.computed(()=>g.value.fields?.length?(g.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),g.value.fields):[]),v={mounted:C=>C.focus()},y=t.ref({});function A(){const C=Object.keys(y.value);if(C.length)for(let x in C){const N=w.value.filter(R=>R.name==x);if(N&&N[0]){let R=y.value[x];Object.keys(R).forEach(b=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),b=="showIndex"?N[0].show.list.index=R[b]:b=="showWidth"?N[0].show.list.width=R[b]:b=="fixed"?N[0].show.list.fixed=R[b]:b=="align"?N[0].show.list.align=R[b]:N[0][b]=R[b]})}}y.value={}}function V(C,x){A();const N={};x=="showIndex"?N[x]=C.show?.list?.index:x=="showWidth"?N[x]=C.show?.list?.width:x=="fixed"?N[x]=C.show?.list?.fixed:x=="align"?N[x]=C.show?.list?.align:N[x]=C[x]||"",y.value[C.name]=N}function k(C,x){if(!C||!x){y.value={};return}const N=y.value[C.name][x];C.show||(C.show={}),C.show.list||(C.show.list={}),x=="showIndex"?C.show.list.index=N:x=="showWidth"?C.show.list.width=N:x=="fixed"?C.show.list.fixed=N:x=="align"?C.show.list.align=N:C[x]=N,y.value={}}function p(C,x){return x=="showIndex"?C.show?.list?.index:x=="showWidth"?C.show?.list?.width:x=="fixed"?C.show?.list?.fixed:x=="align"?C.show?.list?.align:C[x]}function S(C,x){w.value.filter(R=>R.name==C.name).forEach(R=>{R[x]=!R[x]})}const _=t.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const x=_.value.options.filter(N=>N.value==C);return x[0]?x[0].label:C}});return(C,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),b=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),T=t.resolveComponent("a-input"),E=t.resolveComponent("a-form-item"),M=t.resolveComponent("a-col"),P=t.resolveComponent("a-input-number"),F=t.resolveComponent("a-checkbox"),q=t.resolveComponent("a-row"),L=t.resolveComponent("a-select"),O=t.resolveComponent("ToolOutlined"),ee=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Tr,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[8]||(x[8]=[t.createTextVNode("工具设置")])),_:1}),t.createElementVNode("div",Fr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size,ref_for:!0},D.props||{},{onClick:K=>r("left",D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(K=>d("left",D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(b,{class:t.normalizeClass(["btn","tool-add"]),size:"small",onClick:x[0]||(x[0]=D=>c("left"))},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),t.createVNode(b,{class:t.normalizeClass(["btn","tool-add","right"]),onClick:x[1]||(x[1]=D=>c("right")),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn","right",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size,ref_for:!0},D.props||{},{onClick:K=>r("right",D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(K=>d("right",D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[9]||(x[9]=[t.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(t.openBlock(),t.createBlock(q,{key:0},{default:t.withCtx(()=>[t.createVNode(M,{span:7},{default:t.withCtx(()=>[t.createVNode(E,{label:"操作标题"},{default:t.withCtx(()=>[t.createVNode(T,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:5},{default:t.withCtx(()=>[t.createVNode(E,{label:"显示宽度",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode(P,{value:i.value.configs.operation.width,"onUpdate:value":x[2]||(x[2]=D=>i.value.configs.operation.width=D)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:6},{default:t.withCtx(()=>[t.createVNode(E,{label:"显示按钮数量",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode(P,{value:i.value.configs.operation.count,"onUpdate:value":x[3]||(x[3]=D=>i.value.configs.operation.count=D)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:5},{default:t.withCtx(()=>[t.createVNode(E,{label:"是否显示"},{default:t.withCtx(()=>[t.createVNode(F,{checked:i.value.configs.operation.visible,"onUpdate:checked":x[4]||(x[4]=D=>i.value.configs.operation.visible=D)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[10]||(x[10]=[t.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(t.openBlock(),t.createElementBlock("div",Ir,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.configs.operation.btns,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"small",ref_for:!0},D.props||{},{onClick:K=>f(D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(K=>m(D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(b,{class:t.normalizeClass(["btn","btn-add"]),onClick:x[5]||(x[5]=D=>u()),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[11]||(x[11]=[t.createTextVNode("表头设置")])),_:1}),x[12]||(x[12]=t.createTextVNode(" 数据模型:")),t.createVNode(L,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[6]||(x[6]=D=>i.value.dataModel=D)},null,8,["options","value"]),t.createVNode(ee,{columns:n.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:D})=>[["showIndex","showWidth","align","fixed"].includes(D.key)?(t.openBlock(),t.createElementBlock("span",Dr,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(D.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:D,record:K})=>[["showIndex","showWidth"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!y.value[K.name]||!Object.keys(y.value[K.name]).includes(D.dataIndex))&&!p(K,D.dataIndex)&&"empty"]),onClick:fe=>V(K,D.dataIndex)},[y.value[K.name]&&Object.keys(y.value[K.name]).includes(D.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(P,{key:0,value:y.value[K.name][D.dataIndex],"onUpdate:value":fe=>y.value[K.name][D.dataIndex]=fe,onBlur:fe=>k(K,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[v]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p(K,D.dataIndex)),1)],64))],10,$r)):["isList","isQuery","isSort"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",Pr,[t.createVNode(F,{checked:K[D.dataIndex],onClick:fe=>S(K,D.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!y.value[K.name]||!Object.keys(y.value[K.name]).includes(D.dataIndex))&&!p(K,D.dataIndex)&&"empty"]),onClick:fe=>V(K,D.dataIndex)},[y.value[K.name]&&Object.keys(y.value[K.name]).includes(D.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(L,{key:0,value:K.show.list[D.dataIndex],"onUpdate:value":fe=>K.show.list[D.dataIndex]=fe,allowClear:!0,options:D.options,onBlur:x[7]||(x[7]=fe=>k())},null,8,["value","onUpdate:value","options"])),[[v]]):(t.openBlock(),t.createElementBlock("span",Ur,t.toDisplayString(D.showLabel(D.options,p(K,D.dataIndex))),1))],10,Lr)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(An,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),zr={class:"unione-table-tools"},qr={class:"unione-table-data"},Qr={key:0,class:"unione-table-opts"},Pl=le(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:n}){const i=De(),l=a,o=t.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=t.computed(()=>o.value.props||{}),r=t.computed(()=>o.value.rowKey||l.rowKey||"id"),c=t.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),d=t.computed(()=>{const B=l.dataList||[];return!B.length&&c.value?c.value.data().body||[]:B}),h=t.computed(()=>{if(o.value.operation==!1||!Array.isArray(o.value.operation?.btns))return{visible:!1};const B=Y.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),T=[];let E=(o.value.operation?.btns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M));if(E.forEach(M=>{T.push(M.name)}),T.includes("edit")||E.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),T.includes("view")||E.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),T.includes("delete")||E.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const M=E.filter(F=>F.name=="edit")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const F=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",q=l.editor.model.value;M.action.link=i.editPageUrl+"?psn="+F+"&model="+q+"&id={row."+l.rowKey+"}"}const P=E.filter(F=>F.name=="view")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const F=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";P.action.link=i.viewPageUrl+"?psn="+F+"&model=view&id={row."+l.rowKey+"}"}}return E=E.filter(M=>M.visible!=!1).sort((M,P)=>{const F=M.index||1,q=P.index||1;return F-q}),B.count&&(E.length>B.count+1?(B.btns=E.slice(0,B.count),B.more.items=E.slice(B.count,E.length),B.more.visible=!0):(B.btns=E,B.more.visible=!1)),B}),f=t.computed(()=>{let B=[];o.value.columns?.length&&(B=[...o.value.columns]);const T=[];B.forEach((M,P)=>{M.dataIndex=M.name,M.convert&&(M.dataIndex=M.name+"Label",M.convertObj=new Ke(M.convert),M.customCell=(F,q,L)=>{const O=Y.utils.obj.getValue(F,L.name);M.convertObj&&(F[L.dataIndex]==null||F[L.dataIndex]==null)&&O!=null&&O!=null&&(O+"").length>0&&(F[L.dataIndex]=O,M.convertObj.convert(O).then(ee=>{ee&&Y.utils.obj.setValue(F,L.dataIndex,ee)}))}),M.sort?.enable&&(M.sorter=!0,M.sort.multiple&&(M.sorter={},M.sorter.multiple=M.sort.multiple),M.sort.defoult&&(M.defaultSortOrder=M.sort.asc?"ascend":"descend")),M.customRender=({record:F,column:q})=>Y.utils.obj.getValue(F,q.dataIndex)||"--",M.fkey?.enable&&(M.fkey.labelName&&(M.dataIndex=pi(M.fkey.labelName)),M.fkey.labelTitle&&(M.title=M.fkey.labelTitle),M.customRender=({record:F,column:q})=>F&&F[q.name+"FEntry"]&&F[q.name+"FEntry"][q.dataIndex]||"--",M.fkey.fields?.forEach((F,q)=>{if(!F.name)return;const L=pi(F.name),O={fkName:M.name,title:F.title,name:L,dataIndex:F.name,width:F.width,index:F.index||P+q+1,customRender:({record:ee,column:D})=>{if(ee&&ee[D.fkName+"FEntry"]){const K=ee[D.fkName+"FEntry"][D.name];if(K)return F.convertObj&&F.convertObj.convert(K)||K}return"--"}};F.convert&&(F.convertObj=new Ke(F.convert)),T.push(O)}))}),T.forEach(M=>{B.splice(M.index,0,M)});const E=Y.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return E&&E.visible!=!1&&(E.customRender=M=>V.value?(V.value.current-1)*V.value.pageSize+M.index+1:M.index,B=[E,...B]),h.value&&h.value.visible!=!1&&B.push({fixed:"right",align:"center",...h.value,name:"operation"}),B}),u=t.computed(()=>{if(o.value.leftBtns===!1||!Array.isArray(o.value.leftBtns))return[];const B=[],T=[];if((o.value.leftBtns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M)).forEach(M=>{M.visible!=!1&&B.push(M),T.push(M.name),M.name=="delBatch"&&!k.value&&(M.visible=!1)}),!T.includes("add")){const M={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};B.splice(0,0,M)}if(!T.includes("delBatch")&&k.value){const M={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};B.splice(1,0,M)}if(l.editor&&l.editor.type.value!="code"){const M=B.filter(P=>P.name=="add")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",F=l.editor.model.value;M.action.link=i.addPageUrl+"?psn="+P+"&model="+F}}return B});function m({btn:B,event:T}){if(i.isDebug&&console.log("unione table left btn click",B,T),B.name=="delBatch"){if(!p.value.selectedRowKeys.length){oe.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(p.value.selectedRowKeys).then(()=>{R(),N(!0)});return}oe.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{_("delBatch",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("leftBtnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}_(B.name,{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("leftBtnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const g=t.computed(()=>{if(o.value.rightBtns===!1||!Array.isArray(o.value.rightBtns))return[];const B=[],T=[];if((o.value.rightBtns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M)).forEach(M=>{M.visible!=!1&&B.push(M),T.push(M.name)}),!T.includes("impData")){const M={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};B.splice(1,0,M)}if(!T.includes("expData")){const M={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};B.splice(2,0,M)}if(!T.includes("downTmpl")){const M={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};B.splice(3,0,M)}return B});function w({btn:B,event:T}){i.isDebug&&console.log("unione table right btn click",B,T),_(B.name,{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("rightBtnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:T,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const v=t.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),y=t.ref({}),A=t.ref(null),V=t.computed(()=>Y.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:B=>"共"+B+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),k=t.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),p=t.ref({selectedRowKeys:[],selectedRowList:[],onChange:(B,T)=>{p.value.selectedRowKeys=B,p.value.selectedRowList=T},getCheckboxProps:B=>({disabled:B.checkable})}),S=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],_=n;function C({btn:B,event:T},E){if(i.isDebug&&console.log("unione table opt btn click",B,T),B.name=="delete"){if(c.value){c.value.deleteByIds([E[r.value]]).then(()=>{R(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(M=>M!=E[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(M=>M[r.value]!=E[r.value])});return}oe.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{_(B.name,{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("optBtnClick",{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}_(B.name,{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("optBtnClick",{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:T,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}function x(B,T,E,M){console.log("tableChanged",B,T,E,M),A.value={page:B.current,pageSize:B.pageSize},E&&(Array.isArray(E)?(A.value.sorts=[],E.forEach(P=>{A.value.sorts.push({name:P.column.name,asc:P.order=="ascend"})})):E.column&&(A.value.sorts=[{name:E.column.name,asc:E.order=="ascend"}])),R(),_("change",{pagination:B,filters:T,sorter:E,event:M})}function N(B=!1){B?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):oe.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function R(){if(c.value){const B={page:V.value.current,pageSize:V.value.pageSize,keywords:y.value.keywords,body:y.value.params||{}};A.value?.page&&(B.page=A.value.page),A.value?.pageSize&&(B.pageSize=A.value.pageSize),A.value?.sorts&&(B.sorts=A.value.sorts),console.log("dataStorage find params",B),c.value.find(B)}}t.onMounted(()=>{f.value?.forEach(B=>{B.sort?.enable&&B.sort.defoult&&(A.value||(A.value={},A.value.sorts||(A.value.sorts=[]),A.value.sorts.push({name:B.name,asc:B.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",B=>{console.log("table-list-search",B),y.value=B||{},R()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),y.value={},R(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),R()})});function b(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:b,clearSelected:N}),(B,T)=>{const E=t.resolveComponent("unione-btn"),M=t.resolveComponent("DownOutlined"),P=t.resolveComponent("a-button"),F=t.resolveComponent("a-dropdown"),q=t.resolveComponent("a-table");return t.openBlock(),t.createBlock(ft,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",zr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,L=>(t.openBlock(),t.createBlock(E,{key:L.name,class:"btn",widget:L,editor:a.editor,onClick:m,preset:S,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(t.openBlock(),t.createElementBlock("span",{key:0,class:"selected-info",onClick:T[0]||(T[0]=L=>N())},"当前选中记录("+t.toDisplayString(p.value.selectedRowKeys.length)+")",1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,L=>(t.openBlock(),t.createBlock(E,{key:L.name,class:"btn right",widget:L,editor:a.editor,onClick:w,preset:S,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),t.createElementVNode("div",qr,[f.value&&f.value.length?(t.openBlock(),t.createBlock(q,t.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":d.value,"row-selection":k.value?p.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:V.value,onChange:x},v.value),{bodyCell:t.withCtx(({column:L,record:O})=>[L.name==="operation"?(t.openBlock(),t.createElementBlock("div",Qr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.btns,ee=>(t.openBlock(),t.createBlock(E,{key:ee.name,class:"opt",widget:ee,editor:a.editor,onClick:D=>C(D,O),preset:S,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(t.openBlock(),t.createBlock(F,{key:0,trigger:[h.value.more.trigger||"hover"],class:t.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.more.items,ee=>(t.openBlock(),t.createBlock(E,{key:ee.name,class:"item",widget:ee,editor:a.editor,onClick:D=>C(D,O),type:"text",preset:S,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(P,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h.value.more.title)+" ",1),t.createVNode(M)]),_: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(jr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-e29dc519"]]);class je{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:n,onClose:i,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(me.EDITOR_COMPONENT,me.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(me.EDITOR_COMPONENT,me.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const d=document.createElement("div");d.classList.add("dialog-title");const h=document.createElement("span");h.append(document.createTextNode(e));const f=document.createElement("i");f.onclick=()=>{i&&i(),this._dispose()},d.append(h),d.append(f),c.append(d);const u=document.createElement("div");u.classList.add("dialog-option");for(let v=0;v<n.length;v++){const y=n[v],A=document.createElement("div");if(A.classList.add("dialog-option__item"),y.label){const k=document.createElement("span");k.append(document.createTextNode(y.label)),A.append(k),y.required&&k.classList.add("dialog-option__item--require")}let V;y.type==="select"?(V=document.createElement("select"),y.options?.forEach(k=>{const p=document.createElement("option");p.value=k.value,p.label=k.label,V.append(p)})):y.type==="textarea"?V=document.createElement("textarea"):(V=document.createElement("input"),V.type=y.type),y.width&&(V.style.width=`${y.width}px`),y.height&&(V.style.height=`${y.height}px`),V.name=y.name,V.value=y.value||"",V instanceof HTMLSelectElement||(V.placeholder=y.placeholder||""),A.append(V),u.append(A),this.inputList.push(V)}c.append(u);const m=document.createElement("div");m.classList.add("dialog-menu");const g=document.createElement("button");g.classList.add("dialog-menu__cancel"),g.append(document.createTextNode("取消")),g.type="button",g.onclick=()=>{l&&l(),this._dispose()},m.append(g);const w=document.createElement("button");w.append(document.createTextNode("确定")),w.type="submit",w.onclick=()=>{if(o){const v=this.inputList.map(y=>({name:y.name,value:y.value}));o(v)}this._dispose()},m.append(w),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Wr(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 Kr(a){const e=[];function n(i){for(let l=0;l<i.length;l++){const o=i[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))n(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...Wr(s)})}}}return n(a),e}const Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Xr="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==",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",ic="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==",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",xc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",Cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",Sc="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",Bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",Nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",Vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",Rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",Ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",Ll="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",Oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ul="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",jl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",_c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",Mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",Tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",Fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",Ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",$c=["title"],Pc=["title"],Lc={class:"options"},Uc=["title"],jc={class:"options"},zc={class:"options"},qc=["title"],Qc=["title"],Wc=["title"],Kc=["title"],Yc=["title"],Hc={class:"options"},Gc={class:"options"},Jc={class:"options"},Xc={class:"options"},Zc={class:"options"},ed={class:"menu-item__search__collapse__search"},td={class:"arrow-left"},nd={class:"arrow-right"},id=le(t.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const n=a,i=t.ref(),l=t.computed(()=>{let R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return n.items&&(n.items.length>1?R=n.items:n.items[0]=="simple"&&(R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),R});function o(){return i.value?.clientHeight}function s(){return i.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(R,b){console.log("exec cmd "+R+",params:",b),R!="Separator"&&Array.isArray(b)?n.editor?.command["execute"+R](b[0],b[1]):n.editor?.command["execute"+R](b)}function d(R,b){const B=b.target.getBoundingClientRect(),T=i.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=B.height+B.top+"px"}let h=!0,f;function u(){h?(h=!1,f=window.setTimeout(()=>{h=!0,n.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(f)}function m(){h=!0,window.clearTimeout(f),n.editor?.command.executePainter({isDblclick:!0})}function g(){new je({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:R=>{const b=R.find(B=>B.name==="value")?.value;b&&n.editor?.command.executeInsertElementList([{type:me.ElementType.LATEX,value:b}])}})}function w(R){n.editor?.command.executeInsertElementList([{type:R,checkbox:{value:!1},value:""}])}function v(R,b){const B=b.target.getBoundingClientRect(),T=i.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=B.height+B.top+"px";const E=Sa();T.firstChild.childNodes.forEach(M=>{const P=M.attributes.getNamedItem("label-format").value;M.innerText=E.format(P),M.onclick=()=>{n.editor?.command.executeInsertElementList([{type:me.ElementType.DATE,dateFormat:M.attributes.getNamedItem("data-format").value,valueList:[{value:M.innerText.trim()}]}])}})}function y(){new je({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:R=>{const b=R.find(q=>q.name==="type")?.value;if(!b)return;const B=R.find(q=>q.name==="width")?.value,T=R.find(q=>q.name==="height")?.value;if(!T)return;const E=R.find(q=>q.name==="src")?.value,M=R.find(q=>q.name==="srcdoc")?.value,P={type:b};if(P.type===me.BlockType.IFRAME){if(!E&&!M)return;P.iframeBlock={src:E,srcdoc:M}}else if(P.type===me.BlockType.VIDEO){if(!E)return;P.videoBlock={src:E}}const F={type:me.ElementType.BLOCK,value:"",height:Number(T),block:P};B&&(F.width=Number(B)),n.editor?.command.executeInsertElementList([F])}})}function A(R){const b=R.target.getBoundingClientRect(),B=i.value.querySelector(".menu-item__table__collapse");B.style.display="block",B.style.top=b.height+b.top+"px",B.style.left=b.left-270/2+"px";const T=i.value.querySelector(".menu-item__table__collapse .table-close"),E=i.value.querySelector(".menu-item__table__collapse .table-select"),M=i.value.querySelector(".menu-item__table__collapse .table-panel"),P=[];i.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(L=>{P.push(L.childNodes)});let F=0,q=0;M.onmousemove=L=>{const{offsetX:K,offsetY:fe}=L;P.forEach(U=>{U.forEach(I=>{I.classList.remove("active")})}),F=Math.ceil(K/22)||1,q=Math.ceil(fe/26)||1,P.forEach((U,I)=>{U.forEach((Z,Q)=>{Q<F&&I<q&&Z.classList.add("active")})}),E.innerText=`${q}×${F}`},M.onclick=()=>{B.style.display="none",n.editor?.command.executeInsertTable(q,F)},T.onclick=L=>{L.stopPropagation(),B.style.display="none"}}function V(){const R=i.value.querySelector(".menu-item__image .image");R.click(),R.onchange=function(){const b=R.files[0],B=new FileReader;B.readAsDataURL(b),B.onload=function(){const T=new Image,E=B.result;T.src=E,T.onload=function(){n.editor?.command.executeImage({value:E,width:T.width,height:T.height}),R.value=""}}}}function k(){new je({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:n.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:R=>{const b=R.find(T=>T.name==="name")?.value;if(!b)return;const B=R.find(T=>T.name==="url")?.value;B&&n.editor?.command.executeHyperlink({type:me.ElementType.HYPERLINK,value:"",url:B,valueList:me.splitText(b).map(T=>({value:T,size:16}))})}})}function p(R){R==="add"?new je({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:b=>{if(~b.findIndex(M=>!M.value))return;const T=b.reduce((M,P)=>(M[P.name]=P.value,M),{}),E=T.repeat==="1";n.editor?.command.executeAddWatermark({data:T.data,color:T.color,size:Number(T.size),opacity:Number(T.opacity),repeat:E,gap:E&&T.horizontalGap&&T.verticalGap?[Number(T.horizontalGap),Number(T.verticalGap)]:void 0})}}):n.editor?.command.executeDeleteWatermark()}function S(){new je({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:R=>{const b=R.find(M=>M.name==="codeblock")?.value;if(!b)return;const B=_l.tokenize(b,_l.languages.javascript),T=Kr(B),E=[];for(let M=0;M<T.length;M++){const P=T[M],F=me.splitText(P.content);for(let q=0;q<F.length;q++){const O={value:F[q]};P.color&&(O.color=P.color),P.bold&&(O.bold=!0),P.italic&&(O.italic=!0),E.push(O)}}E.unshift({value:`
|
|
2
|
-
`}),n.editor?.command.executeInsertElementList(E)}})}function _(R){const b=R.target.getBoundingClientRect(),B=i.value.querySelector(".menu-item__search__collapse");B.style.display="block",B.style.top=b.height+b.top+"px",B.style.left=b.left-260/2+"px";const
|
|
1
|
+
(function(le,q){typeof exports=="object"&&typeof module<"u"?q(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"],q):(le=typeof globalThis<"u"?globalThis:le||self,q(le.index={},le.UnioneBaseVue,le.Vue,le.antDesignVue,le.lodashEs,le.vueCodemirror,le.langJavascript,le.canvasEditor,le.dayjs,le.prism,le.iconsVue,le.uuid))})(this,function(le,q,t,se,Ca,en,Sa,me,Ba,Ml,it,Na){"use strict";const Va={isDebug:!0,axios:{form:"/portal",flow:"/flow"},listPageUrl:"/data/page/list",addPageUrl:"/data/page/add",editPageUrl:"/data/page/edit",viewPageUrl:"/data/page/view",formRules:[]},fi=t.ref(Va);function $e(a){return a&&(fi.value=q.utils.obj.ext(a,fi.value)),fi.value}const Ra={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},Ea={...{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"}},Oa=t.ref([Ra,Ea]);function _a(a,e){return q.locales.loadLanguage(a,()=>new Promise((n,i)=>{const l=Oa.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};n(s)}else{const s={...l[0],...o};n(s)}});else if(l.length==0){const o={...e,localeName:a};n(o)}else{const o={...l[0],...e};n(o)}else l.length>0?n(l[0]):i("local language not defined ,lang:"+a)}))}const ui={...q.locales};ui.loadLanguage=_a;class Ma{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,n){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=n}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 n in this.$store.value)this.$store.value[n].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,n){}setRefData(e,n,i){}use(e,n,i){let l=this.$store.value[e];return l||(l=new pi(e,n,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,n,i){const l=this.use(e,"form",n);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{i&&i(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 pi{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,n,i){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=n,this.$data=t.ref(n=="form"?{}:{body:[],total:0}),this.$dialog=q.useDialog(),this.$model=i||t.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}reset(e){this.$data.value=e||{},this.$form?.setValue(e||{})}$processParams(e,n){if(n)n.forEach(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}request(e){return new Promise((n,i)=>{const l=se.message.loading("数据请求中..."),o=this.$store.controller+e.url;q.axios[this.$store.ctx||"form"]({method:"post",...e,url:o}).then(s=>{s.success?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const n=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((i,l)=>{const o=se.message.loading("数据加载中...");q.axios[this.$store.ctx||"form"]({url:n,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:n,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:n,params:e,err:s})}).finally(()=>{o()})})}save(e){const n=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((i,l)=>{const o=se.message.loading("数据提交中...");q.axios[this.$store.ctx||"form"]({url:n,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||se.message.success(s.message),i(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:n,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:n,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((n,i)=>{const l=se.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";q.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?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((n,i)=>{const l=se.message.loading("数据加载中..."),o=this.$store.controller+"/detail";q.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),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((n,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=se.message.loading("数据处理中..."),o=this.$store.controller+"/delete";q.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?n(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Fa{$event;$onces;$delayEmit;constructor(){this.$event=t.ref({}),this.$onces=t.ref({}),this.$delayEmit=t.ref({})}$on(e,n){if(this.$event.value[e]=n,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];n(i)}}$emit(e,n){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(n)}this.$event.value[e]?this.$event.value[e](n):(this.$delayEmit.value[e]=n,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,n){this.$onces.value[e]=n}$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 n=e.configs||{};this.model=t.ref("run"),this.type=t.ref(e.types||"setting"),this.define=t.ref(e),this.ebus=new Fa,this.$widgetList=t.ref([]),this.$widgetMap=t.ref({}),this.$dataManager=new Ma(n.dsnList?n.dsnList[0]:"",this.model),this.$axiosProccess=t.ref({}),this.$dialog=q.useDialog(),this.loadConfig(n)}sn(){return this.define.value.sn}load(e,n){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",n),n&&n.configs&&(this.define.value=n,this.type.value=this.define.value.types||"setting",this.loadConfig(n.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}q.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)):n&&n.configs&&(this.define.value=n,this.loadConfig(n.configs))})}save(){return new Promise((e,n)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),n();return}this.$axiosProccess.value.save=!0;const i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),q.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(se.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}),n())}).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,n){if(n){const i={...n,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}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(n=>{n.wid||(n.wid="w:"+Ca.uniqueId()),this.$widgetMap.value[n.wid]=n,n.configs?.widgets&&this.$processWidget(n.configs.widgets)})}dataManager(){return this.$dataManager}}const Ta={class:"widget-setting-dialog"},Ia=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:n}){const i=n,l=t.ref(),o=t.ref(),s=t.ref(!1);function r(){o.value&&(s.value=!0),i("setting")}function c(){i("saving"),s.value=!1}function d(){return l.value?.clientHeight}function h(){return l.value?.clientWidth}return e({getHeight:d,getWidth:h}),(f,u)=>{const m=t.resolveComponent("SettingOutlined"),g=t.resolveComponent("a-tooltip"),w=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[t.createVNode(g,{title:a.settingTitle},{default:t.withCtx(()=>[a.model=="edit"&&(f.$slots["widget-setting"]||a.custome)?(t.openBlock(),t.createBlock(m,{key:0,class:"widget-setting",onClick:r})):t.createCommentVNode("",!0)]),_:1},8,["title"]),t.renderSlot(f.$slots,"default",{},void 0,!0),a.model=="edit"&&f.$slots["widget-setting"]?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":u[0]||(u[0]=v=>s.value=v),centered:"",width:"80%",onOk:c},{default:t.withCtx(()=>[t.createElementVNode("div",Ta,[t.renderSlot(f.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),oe=(a,e)=>{const n=a.__vccOpts||a;for(const[i,l]of e)n[i]=l;return n},ut=oe(Ia,[["__scopeId","data-v-17b517f5"]]),Da={key:0},$a=["onClick"],xn=oe(t.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const n=a,i=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=t.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let p in k){const S=w.value.form.action.params[p];S&&s.value[p]&&Object.keys(s.value[p]).forEach(_=>{S[_]=s.value[p][_]})}s.value={}}function c(k,p,S){r();const _={};_[S]=p[S]||"",S=="showIndex"&&(_[S]=p.show?.query?.index),s.value[k]=_}function d(k,p,S){if(!p||!S){s.value={};return}const _=s.value[k][S];p[S]=_,s.value={}}function h(){w.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=t.ref(""),m=t.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,p)=>u.value!=p&&n.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+n.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),g=t.ref([Sa.javascript()]),w=t.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),v=t.ref();function y(k,p,S={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),u.value=k.name,w.value.form=k,w.value.helps=S,w.value.visible=!0,v.value=p}const A=t.ref(null);function V(){A.value&&A.value.validate().then(()=>{w.value.visible=!1,v.value(w.value.form)})}return e({open:y,close}),(k,p)=>{const S=t.resolveComponent("a-input"),_=t.resolveComponent("a-form-item"),C=t.resolveComponent("a-select"),x=t.resolveComponent("a-input-number"),N=t.resolveComponent("a-checkbox"),R=t.resolveComponent("a-tab-pane"),b=t.resolveComponent("a-switch"),B=t.resolveComponent("a-button"),F=t.resolveComponent("a-divider"),E=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-tooltip"),P=t.resolveComponent("a-table"),T=t.resolveComponent("a-tabs"),W=t.resolveComponent("a-form"),L=t.resolveComponent("a-modal");return t.openBlock(),t.createBlock(L,{visible:w.value.visible,"onUpdate:visible":p[23]||(p[23]=O=>w.value.visible=O),title:w.value.title,centered:"",width:"50%",onOk:V},{default:t.withCtx(()=>[t.createVNode(W,{name:"basic",ref_key:"form",ref:A,rules:m.value,model:w.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:t.withCtx(()=>[t.createVNode(T,null,{default:t.withCtx(()=>[t.createVNode(R,{key:"base",tab:"基本设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.title,"onUpdate:value":p[0]||(p[0]=O=>w.value.form.title=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"操作名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.name,"onUpdate:value":p[1]||(p[1]=O=>w.value.form.name=O),disabled:n.preset.includes(w.value.form.name)},null,8,["value","disabled"])]),_:1}),t.createVNode(_,{label:"操作图标"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.icon,"onUpdate:value":p[2]||(p[2]=O=>w.value.form.icon=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.type,"onUpdate:value":p[3]||(p[3]=O=>w.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(_,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.index,"onUpdate:value":p[4]||(p[4]=O=>w.value.form.index=O)},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮大小"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.size,"onUpdate:value":p[5]||(p[5]=O=>w.value.form.size=O),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),t.createVNode(_,{label:"按钮特性"},{default:t.withCtx(()=>[t.createVNode(N,{checked:w.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=O=>w.value.form.props.block=O)},{default:t.withCtx(()=>p[24]||(p[24]=[t.createTextVNode("自适应 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=O=>w.value.form.props.danger=O)},{default:t.withCtx(()=>p[25]||(p[25]=[t.createTextVNode("危险 ")])),_:1},8,["checked"]),t.createVNode(N,{checked:w.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=O=>w.value.form.props.ghost=O)},{default:t.withCtx(()=>p[26]||(p[26]=[t.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),t.createVNode(R,{key:"action",tab:"响应设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"响应方式",required:""},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.type,"onUpdate:value":p[9]||(p[9]=O=>w.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(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=O=>w.value.form.action.psn=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.component,"onUpdate:value":p[11]||(p[11]=O=>w.value.form.action.component=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(_,{label:"连接地址"},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.href,"onUpdate:value":p[12]||(p[12]=O=>w.value.form.action.href=O)},null,8,["value"])]),_:1}),["link","route"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:2,label:"连接方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.target,"onUpdate:value":p[13]||(p[13]=O=>w.value.form.action.target=O),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:3,label:"抽屉位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:w.value.form.action.position,"onUpdate:value":p[14]||(p[14]=O=>w.value.form.action.position=O),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:4,label:"显示标题",required:""},{default:t.withCtx(()=>[t.createVNode(S,{value:w.value.form.action.title,"onUpdate:value":p[15]||(p[15]=O=>w.value.form.action.title=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:5,label:"蒙层关闭"},{default:t.withCtx(()=>[t.createVNode(b,{checked:w.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=O=>w.value.form.action.maskClosable=O),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),["drawer","dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:6,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.width,"onUpdate:value":p[17]||(p[17]=O=>w.value.form.action.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["dialog"].includes(w.value.form.action.type)?(t.openBlock(),t.createBlock(_,{key:7,label:"显示高度"},{default:t.withCtx(()=>[t.createVNode(x,{value:w.value.form.action.height,"onUpdate:value":p[18]||(p[18]=O=>w.value.form.action.height=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),t.createVNode(F,{orientation:"left"},{default:t.withCtx(()=>[p[29]||(p[29]=t.createTextVNode("参数列表 ")),t.createVNode(B,{size:"small",class:"param-btn",onClick:h},{default:t.withCtx(()=>p[27]||(p[27]=[t.createTextVNode("添加")])),_:1}),t.createVNode(B,{size:"small",class:"param-btn",danger:"",onClick:f},{default:t.withCtx(()=>p[28]||(p[28]=[t.createTextVNode("删除")])),_:1})]),_:1}),t.createVNode(P,{columns:i.value,"data-source":w.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",Da,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0),["value"].includes(O.key)?(t.openBlock(),t.createBlock(M,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:t.withCtx(()=>[t.createElementVNode("span",null,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(O.title),1)])]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:te,record:D,index:K})=>[["name","title","value"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!s.value[K]||!Object.keys(s.value[K]).includes(O.dataIndex))&&!te&&"empty"]),onClick:ue=>c(K,D,O.dataIndex)},[s.value[K]&&Object.keys(s.value[K]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(S,{key:0,value:s.value[K][O.dataIndex],"onUpdate:value":ue=>s.value[K][O.dataIndex]=ue,onBlur:ue=>d(K,D,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(te),1)],64))],10,$a)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),t.createVNode(R,{key:"event",tab:"事件设置"},{default:t.withCtx(()=>[t.createVNode(_,{label:"点击事件",help:w.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:t.withCtx(()=>[t.createVNode(t.unref(en.Codemirror),{modelValue:w.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=O=>w.value.form.event.clickScript=O),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"禁用逻辑",help:w.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:t.withCtx(()=>[t.createVNode(t.unref(en.Codemirror),{modelValue:w.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=O=>w.value.form.event.disableScript=O),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"显示逻辑",help:w.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:t.withCtx(()=>[t.createVNode(t.unref(en.Codemirror),{modelValue:w.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=O=>w.value.form.event.visibleScript=O),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),t.createVNode(_,{label:"动态标题",help:w.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:t.withCtx(()=>[t.createVNode(t.unref(en.Codemirror),{modelValue:w.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=O=>w.value.form.event.titleScript=O),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:g.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Pa=["src"],La=["src"],Ua=oe(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 n=$e(),i=a,l=q.useSession();t.watch(()=>i.widget?.event,()=>{r()}),t.onMounted(()=>{r()});const o=t.ref({...i.editor?.widget(i.wid)||i.widget||{}}),s=t.ref({});function r(){o.value?.event&&(o.value.event.clickScript?s.value.click=new Function("ctx","btn","event",o.value.event.clickScript):o.value.event.click&&(s.value.click=o.value.event.click),o.value.event.disableScript?s.value.disable=new Function("ctx","btn",o.value.event.disableScript):o.value.event.disable&&(s.value.disable=o.value.event.disable),o.value.event.visibleScript?s.value.visible=new Function("ctx","btn",o.value.event.visibleScript):o.value.event.visible&&(s.value.visible=o.value.event.visible),o.value.event.titleScript?s.value.title=new Function("ctx","btn",o.value.event.titleScript):o.value.event.title&&(s.value.title=o.value.event.title)),typeof o.value.click=="function"&&(s.value.click=o.value.click),typeof o.value.title=="function"&&(s.value.title=o.value.title),typeof o.value.visible=="function"&&(s.value.visible=o.value.visible),typeof o.value.disabled=="function"&&(s.value.disable=o.value.disabled)}const c=t.computed(()=>s.value.title?s.value.title(m.value,o.value):o.value.title),d=t.computed(()=>s.value.visible?s.value.visible(m.value,o.value)!=!1:o.value.visible!=!1),h=t.computed(()=>i.disabled==!0?!0:s.value.disable?s.value.disable(m.value,o.value):o.value.disable==!0),f=t.ref(null);function u(){f.value?.open(o.value,p=>{console.log("btn props",p),Object.keys(p).forEach(S=>{o.value[S]=p[S]}),console.log("props btn",o.value)})}const m=t.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),g=t.ref({open:!1}),w=t.computed(()=>{if(o.value.action?.href){let p=o.value.action.href;const S=p.matchAll("{[a-zA-Z.]*}"),_=[];let C=null;for(;C=S.next();){if(C&&C.value&&C.value[0]){let x=C.value[0].substring(1,C.value[0].length-1);_.includes(x)||_.push(x)}if(C.done)break}if(_.length>0)for(let x=0;x<_.length;x++){let N=_[x],R=q.utils.obj.getValue(m.value,N);R?R instanceof Object?p=p.replaceAll("{"+N+"}",JSON.stringify(R)):Array.isArray(R)?p=p.replaceAll("{"+N+"}",R.join(",")):p=p.replaceAll("{"+N+"}",R):p=p.replaceAll("{"+N+"}","")}return p}return""}),v=t.computed(()=>{const p={};let S=o.value.action?.href||o.value.action?.link;if(S){const _=S.matchAll("{[a-zA-Z0-9.]*}"),C=[];let x=null;for(;x=_.next();){if(x&&x.value&&x.value[0]){let R=x.value[0].substring(1,x.value[0].length-1);C.includes(R)||C.push(R)}if(x.done)break}if(C.length>0)for(let R=0;R<C.length;R++){let b=C[R],B=q.utils.obj.getValue(m.value,b);B?B instanceof Object?S=S.replaceAll("{"+b+"}",JSON.stringify(B)):Array.isArray(B)?S=S.replaceAll("{"+b+"}",B.join(",")):S=S.replaceAll("{"+b+"}",B):S=S.replaceAll("{"+b+"}","")}const N=S.split("?")[1];N&&N.split("&").forEach(R=>{const b=R.split("=");b[0]&&b[1]&&(p[b[0]]=b[1])})}return o.value.action?.params&&o.value.action.params.filter(_=>_.value+"").forEach(_=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(_.value)){let x=q.utils.obj.getValue(m.value,_.value);p[_.name]=x}else p[_.name]=_.value}),p}),y=e,A=t.inject("router");function V(p){if(n.isDebug&&console.log("unione btn click",o.value,p),!(s.value.click&&s.value.click(m.value,o.value,p)==!1)){if(o.value.action?.type=="drawer"||o.value.action?.type=="dialog")g.value.open=!0;else if(o.value.action?.type=="route"&&(o.value.action?.href||o.value.action?.link)){if(o.value.action.link&&i.editor?.type.value=="code")return;A.push({path:o.value.action.href||o.value.action?.link,query:v.value})}y("click",{btn:o.value,event:p,ctx:m.value})}}function k(p){y("click",p)}return(p,S)=>{const _=t.resolveComponent("a-button"),C=t.resolveComponent("unione-btn"),x=t.resolveComponent("a-dropdown"),N=t.resolveComponent("a-drawer"),R=t.resolveComponent("a-modal");return d.value?(t.openBlock(),t.createBlock(ut,{key:0,class:t.normalizeClass(["unione-btn",o.value.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:u,custome:!0,"setting-title":"按钮设置"},{default:t.withCtx(()=>[!o.value.widget||o.value.widget=="button"?(t.openBlock(),t.createBlock(_,t.mergeProps({key:0,disabled:h.value,size:o.value.size||"small",type:a.type||a.widget.type,shape:o.value.shape,class:"unione-btn-"+o.value.name,loading:o.value.loading,target:o.value.action?.target,title:o.value.tooltip,onClick:V},o.value.props),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(c.value)+" ",1)]),_:2},[o.value.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):t.createCommentVNode("",!0),o.value.widget=="dropdown"?(t.openBlock(),t.createBlock(x,{key:1,trigger:[o.value.trigger||"hover"],class:t.normalizeClass([o.value.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["dropdown-overlay",o.value.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.items,b=>(t.openBlock(),t.createBlock(C,{key:b.name,class:"item",widget:b,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:S[0]||(S[0]=B=>k(B))},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(_,{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:g.value.open,"onUpdate:open":S[1]||(S[1]=b=>g.value.open=b),title:o.value.action?.title,placement:o.value.action?.position,maskClosable:o.value.action?.maskClosable,width:o.value.action?.width,bodyStyle:{padding:0,overflow:!o.value.action.component||o.value.action.component=="iframe"?"hidden":"auto"}},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value},null,8,Pa)):t.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):t.createCommentVNode("",!0),o.value.action?.type=="dialog"?(t.openBlock(),t.createBlock(R,{key:3,open:g.value.open,"onUpdate:open":S[2]||(S[2]=b=>g.value.open=b),title:o.value.action?.title,width:o.value.action?.width,maskClosable:o.value.action?.maskClosable,centered:"",footer:null},{default:t.withCtx(()=>[!o.value.action.component||o.value.action.component=="iframe"?(t.openBlock(),t.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:w.value,style:t.normalizeStyle({height:o.value.action?.height?o.value.action?.height+"px":""})},null,12,La)):t.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):t.createCommentVNode("",!0),t.createVNode(xn,{ref_key:"btnSetting",ref:f,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):t.createCommentVNode("",!0)}}}),[["__scopeId","data-v-8f0eca98"]]),ja={key:0,class:"unione-widget-empty-tip"},za=oe(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,n=t.ref(),i=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(ut,{class:t.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:t.withCtx(()=>[i.value?(t.openBlock(),t.createBlock(r,{key:0,activeKey:n.value,"onUpdate:activeKey":o[0]||(o[0]=c=>n.value=c)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.chidlren,(c,d)=>(t.openBlock(),t.createBlock(s,{key:d,class:"unione-layout-tab-pane"},{tab:t.withCtx(()=>[t.createElementVNode("span",null,[c.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(c.icon),{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(c.title),1)])]),default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.chidlren,(h,f)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(t.openBlock(),t.createElementBlock("div",ja,t.toDisplayString(c.emptyTips),1)):t.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):t.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),qa={class:"title"},Qa={class:"text"},Wa={key:0,class:"reactive"},Ka={key:1,class:"opts"},Ya={class:"warp"},Ha=oe(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,n=t.computed(()=>e.editor?.widget(e.wid)||e.widget),i=t.computed(()=>n.value?.title||e.title),l=t.computed(()=>n.value?.icon||e.icon),o=t.computed(()=>n.value?.type||e.type),s=t.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,d)=>(t.openBlock(),t.createBlock(ut,{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",qa,[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",Qa,t.toDisplayString(i.value),1)]),a.reactive?(t.openBlock(),t.createElementBlock("div",Wa,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):t.createCommentVNode("",!0),a.location=="left"?(t.openBlock(),t.createElementBlock("div",Ka,[t.renderSlot(c.$slots,"opts",{},void 0,!0)])):t.createCommentVNode("",!0)],2),t.withDirectives(t.createElementVNode("div",Ya,[t.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Ga={class:"unione-props-setting unione-form-setting"},Ja={class:"unione-form-btns"},Xa={key:0},Za=["onClick"],er={class:"field-txt"},tr=["onClick"],nr={key:1,class:"field-txt"},ir=["onClick"],lr={key:0,class:"field-txt"},or={key:3,class:"edit-field"},sr={key:0},ar=["onClick"],rr=oe(t.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=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"}]),i=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(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{const C=i.value.configs.settings.btns,x=C.map(N=>N.name);if(!x.includes("save")){const N={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(N.index,0,N)}if(!x.includes("submit")){const N={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let R=N.index||1;C.splice(R,0,N)}if(!x.includes("reset")){const N={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(N.index,0,N)}if(!x.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,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.settings.btns.sort((N,R)=>{const b=N.index||1,B=R.index||1;return b-B}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function c(){const C=i.value.configs.settings.btns.length+1;let x={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};x.name="new_"+i.value.configs.settings.btns.length;const N=i.value.configs.settings.btns.filter(R=>R.name==x.name).length;N>0&&(x.name=x.name+N),i.value.configs.settings.btns.push(x),e.editor.widget(e.wid,i.value),s.value.open(x,R=>{Object.keys(R).forEach(b=>{x[b]=R[b]}),i.value.configs.btns=[...i.value.configs.btns]})}function d(C){const x=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const N=[];i.value.configs.settings.btns.forEach(R=>{R.name!=C.name&&N.push(R)}),i.value.configs.settings.btns=N}};se.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{x()}})}const h=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:C=>{const x=h.value.widgets.filter(N=>N.value==C);return x[0]?x[0].label:C},toSetting:()=>{}}),f=t.ref({visible:!1,field:{},props:{},showInfo:C=>{let x="";return C.rules&&(x=C.rules.filter(N=>N.enable).length||""),x&&(x="("+x+")"),x},toSetting:()=>{const C=f.value.props,x={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(x.min=C.rangeMin,x.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(x.max=C.rangeMax,x.enable=!0);const N={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(N.pattern=C.regExpress,N.enable=!0),f.value.field.rules=[x,N],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(C){f.value.visible=!0,f.value.field=C;const x=C.rules||[],N={trigger:"change",whitespace:!0};x.forEach(R=>{R.name=="reg"&&(N.trigger=R.trigger,N.whitespace=R.whitespace,N.regExpress=R.pattern,N.regMessage=R.message),R.name=="range"&&(N.rangeMin=R.min,N.rangeMax=R.max,N.rangeMessage=R.message)}),f.value.props=N}const m=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function g(C,x){const N=A.value.filter(b=>b.name==C.name);N.forEach(b=>{x!="isSort"?b[x]=!0:b[x]=!b[x]});const R=N[0];if(!(!R||x=="isSort")){switch(m.value.prop=x,m.value.field=C,R.show||(R.show={}),x){case"isQuery":R.show.query||(R.show.query={}),m.value.show=R.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":R.show.form||(R.show.form={}),m.value.show=R.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":R.show.view||(R.show.view={}),m.value.show=R.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":R.show.list||(R.show.list={}),m.value.show=R.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(C,x)=>{w.value.convert.options.splice(C,1)},toSetting:()=>{w.value.visible=!1}});function v(C){w.value.visible=!0,w.value.field=C,w.value.convert=C.convert||{}}const y=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),A=t.computed(()=>y.value.fields?.length?y.value.fields:[]),V={mounted:C=>C.focus()},k=t.ref({});function p(C,x){const N={};x=="convertName"?N[x]=C.convert?.type:N[x]=C[x]||"",k.value={},k.value[C.name]=N}function S(C,x){{k.value={};return}}function _(C,x){A.value.filter(R=>R.name==C.name).forEach(R=>{R[x]=!R[x]})}return(C,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),b=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),F=t.resolveComponent("a-select"),E=t.resolveComponent("ToolOutlined"),M=t.resolveComponent("a-checkbox"),P=t.resolveComponent("a-table"),T=t.resolveComponent("a-select-option"),W=t.resolveComponent("a-form-item"),L=t.resolveComponent("a-form"),O=t.resolveComponent("a-modal"),te=t.resolveComponent("a-checkbox-group"),D=t.resolveComponent("a-input-number"),K=t.resolveComponent("a-input"),ue=t.resolveComponent("a-col"),j=t.resolveComponent("a-row");return t.openBlock(),t.createElementBlock("div",Ga,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[23]||(x[23]=[t.createTextVNode("按钮设置")])),_:1}),t.createElementVNode("div",Ja,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,I=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:Z=>r(I)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(I.title)+" ",1),I.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(Z=>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(b,{class:t.normalizeClass(["btn","btn-add"]),size:"small",onClick:x[0]||(x[0]=I=>c())},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[24]||(x[24]=[t.createTextVNode("表单设置")])),_:1}),x[36]||(x[36]=t.createTextVNode(" 数据模型:")),t.createVNode(F,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[1]||(x[1]=I=>i.value.dataModel=I)},null,8,["options","value"]),t.createVNode(P,{columns:n.value,"data-source":A.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:I})=>[["widget","rules","convertName"].includes(I.key)?(t.openBlock(),t.createElementBlock("span",Xa,[t.createVNode(E),t.createTextVNode(" "+t.toDisplayString(I.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:I,text:Z,record:Y})=>[["rules"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!f.value.showInfo(Y)&&"empty"]),onClick:ie=>u(Y)},[t.createElementVNode("span",er,t.toDisplayString(f.value.showInfo(Y)),1),f.value.showInfo(Y)?(t.openBlock(),t.createBlock(b,{key:0,type:"link"},{default:t.withCtx(()=>x[25]||(x[25]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Za)):["widget"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!k.value[Y.name]||!Object.keys(k.value[Y.name]).includes(I.dataIndex))&&!Z&&"empty"]),onClick:ie=>p(Y,I.dataIndex)},[k.value[Y.name]&&Object.keys(k.value[Y.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(F,{key:0,value:Y[I.dataIndex],"onUpdate:value":ie=>Y[I.dataIndex]=ie,options:h.value.widgets,onBlur:x[2]||(x[2]=ie=>S())},null,8,["value","onUpdate:value","options"])),[[V]]):(t.openBlock(),t.createElementBlock("span",nr,t.toDisplayString(h.value.widgetName(Z)),1))],10,tr)):["convertName"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!k.value[Y.name]||!Object.keys(k.value[Y.name]).includes(I.dataIndex))&&!Y.convert?.type&&"empty"]),onClick:ie=>p(Y,I.dataIndex)},[k.value[Y.name]&&Object.keys(k.value[Y.name]).includes(I.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(F,{key:0,value:Y[I.dataIndex],"onUpdate:value":ie=>Y[I.dataIndex]=ie,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:x[3]||(x[3]=ie=>S())},null,8,["value","onUpdate:value"])),[[V]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[Y.convert?.type?(t.openBlock(),t.createElementBlock("span",lr,t.toDisplayString(Y.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),Y.convert?.type?(t.openBlock(),t.createBlock(b,{key:1,type:"link",onClick:t.withModifiers(ie=>v(Y),["stop"])},{default:t.withCtx(()=>x[26]||(x[26]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,ir)):["isForm","isView"].includes(I.dataIndex)?(t.openBlock(),t.createElementBlock("div",or,[t.createVNode(M,{checked:Y[I.dataIndex],onClick:ie=>_(Y,I.dataIndex)},null,8,["checked","onClick"]),t.createVNode(b,{type:"link",onClick:ie=>g(Y,I.dataIndex)},{default:t.withCtx(()=>x[27]||(x[27]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(O,{visible:h.value.visible,"onUpdate:visible":x[5]||(x[5]=I=>h.value.visible=I),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"},{default:t.withCtx(()=>[h.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(W,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(F,{value:h.value.props.mode,"onUpdate:value":x[4]||(x[4]=I=>h.value.props.mode=I),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(T,{value:"multiple"},{default:t.withCtx(()=>x[28]||(x[28]=[t.createTextVNode("多选")])),_:1}),t.createVNode(T,{value:"tags"},{default:t.withCtx(()=>x[29]||(x[29]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:f.value.visible,"onUpdate:visible":x[13]||(x[13]=I=>f.value.visible=I),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",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[30]||(x[30]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(W,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(te,{value:f.value.props.trigger,"onUpdate:value":x[6]||(x[6]=I=>f.value.props.trigger=I),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(W,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(M,{value:f.value.props.whitespace,"onUpdate:value":x[7]||(x[7]=I=>f.value.props.whitespace=I),checked:f.value.props.whitespace},{default:t.withCtx(()=>x[31]||(x[31]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[32]||(x[32]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(W,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(D,{value:f.value.props.rangeMin,"onUpdate:value":x[8]||(x[8]=I=>f.value.props.rangeMin=I)},null,8,["value"]),x[33]||(x[33]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(D,{value:f.value.props.rangeMax,"onUpdate:value":x[9]||(x[9]=I=>f.value.props.rangeMax=I)},null,8,["value"])]),_:1}),t.createVNode(W,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.rangeMessage,"onUpdate:value":x[10]||(x[10]=I=>f.value.props.rangeMessage=I)},null,8,["value"])]),_:1}),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[34]||(x[34]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(W,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.regExpress,"onUpdate:value":x[11]||(x[11]=I=>f.value.props.regExpress=I)},null,8,["value"])]),_:1}),t.createVNode(W,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(K,{value:f.value.props.regMessage,"onUpdate:value":x[12]||(x[12]=I=>f.value.props.regMessage=I)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(O,{visible:m.value.visible,"onUpdate:visible":x[20]||(x[20]=I=>m.value.visible=I),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(W,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(D,{value:m.value.show.index,"onUpdate:value":x[14]||(x[14]=I=>m.value.show.index=I)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(W,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(K,{value:m.value.show.width,"onUpdate:value":x[15]||(x[15]=I=>m.value.show.width=I)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(W,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(K,{value:m.value.show.labelWidth,"onUpdate:value":x[16]||(x[16]=I=>m.value.show.labelWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(t.openBlock(),t.createBlock(W,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(K,{value:m.value.show.valueWidth,"onUpdate:value":x[17]||(x[17]=I=>m.value.show.valueWidth=I)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(t.openBlock(),t.createBlock(W,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(F,{value:m.value.show.fixed,"onUpdate:value":x[18]||(x[18]=I=>m.value.show.fixed=I),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(W,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(F,{value:m.value.show.align,"onUpdate:value":x[19]||(x[19]=I=>m.value.show.align=I),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),t.createVNode(O,{visible:w.value.visible,"onUpdate:visible":x[22]||(x[22]=I=>w.value.visible=I),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",sr,[t.createVNode(b,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>x[35]||(x[35]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(P,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:I,record:Z,index:Y})=>[I.dataIndex==="label"?(t.openBlock(),t.createBlock(K,{key:0,value:Z.label,"onUpdate:value":ie=>Z.label=ie,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="value"?(t.openBlock(),t.createBlock(K,{key:1,value:Z.value,"onUpdate:value":ie=>Z.value=ie,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),I.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:ie=>w.value.toDelOption(Y,Z)},"删除",8,ar)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(L,{key:1,model:w.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(j,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(ue,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(W,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(K,{value:w.value.convert.dict,"onUpdate:value":x[21]||(x[21]=I=>w.value.convert.dict=I)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(xn,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),cr={key:0,class:"form-left"},dr={class:"form-warp"},hr={key:1,class:"form-right"},fr=oe(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 n=a,i=t.ref(!1),l=t.ref(),o=t.ref({}),s=t.ref(null);t.onMounted(()=>{if(c.value.dsn){const p=r.value.dataManager();c.value.primary&&p.psn(c.value.dsn),s.value.setDisabled=k,s.value.getValue=w,s.value.setValue=v,s.value.reset=y,l.value=p.useForm(c.value.dsn,s.value,S=>{o.value=S.body||{}})}n.editor||r.value.loadConfig({widgets:d.value}),n.form?.model&&r.value.setModel(n.form.model),A()});const r=t.computed(()=>n.editor||new lt),c=t.computed(()=>n.widget||n.form||{}),d=t.computed(()=>{let p=c.value.widgets||[];return!p.length&&n.form?.fields&&(p=n.form.fields),p.forEach(S=>{S.widget||(S.widget="unione-form-item"),S.control||(S.control="a-input")}),p}),h=t.computed(()=>d.value.filter(p=>p.float=="left")),f=t.computed(()=>d.value.filter(p=>!p.float)),u=t.computed(()=>d.value.filter(p=>p.float=="right")),m=t.inject("pageSetting",{}),g=t.computed(()=>c.value.setting||m?.form||{});t.provide("formSetting",g.value);function w(){return o.value}function v(p){o.value=p,A()}function y(){o.value={},A()}function A(){const p=S=>{S.widget=="unione-form-item"&&S.name&&(S.value!=null&&S.value!=null&&S.value!=""||S.value==0)&&(o.value[S.name]==null||o.value[S.name]==null||o.value[S.name]=="")&&(o.value[S.name]=S.value),S.widgets?.forEach(_=>{p(_)})};d.value.forEach(S=>{p(S)})}function V(){return new Promise((p,S)=>{s.value.validate().then(_=>{p(o.value)}).catch(_=>{S(_)})})}function k(p=!0){i.value=p}return e({validate:V,getValue:w,setValue:v,reset:y,setDisabled:k}),(p,S)=>{const _=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ut,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},t.createSlots({default:t.withCtx(()=>[t.createVNode(_,{ref_key:"formObj",ref:s,model:o.value,class:t.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(g.value.showColumn||3)])},{default:t.withCtx(()=>[h.value?.length?(t.openBlock(),t.createElementBlock("div",cr,[(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":x=>o.value[C.name]=x,disabled:i.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))])):t.createCommentVNode("",!0),t.createElementVNode("div",dr,[(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":x=>o.value[C.name]=x,disabled:i.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),u.value?.length?(t.openBlock(),t.createElementBlock("div",hr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.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":x=>o.value[C.name]=x,disabled:i.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(rr,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a31125db"]]);function Fl(a,e=!1){const n=$e();if(!a)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+a);return i&&e==!1?Promise.resolve(JSON.parse(i)):(n.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{q.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 n.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function Tl(a,e){const n=$e();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await Fl(a),l=i.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(n.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function ur(a,e){const n=await Tl(a,e);return Promise.resolve(n.dictValue)}const Il={load:Fl,getLabel:ur,getOption:Tl};class Ke{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=$e()}load(e,n=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Il.load(this.convertObj.dictName,n).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),i(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((i,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;q.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(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?i(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,q.axios[this.convertObj.ctx||"admin"]({url:s,data:o,method:"POST"}).then(d=>{if(d.success){const h={};this.options.forEach(f=>{h[e]=!0}),d.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(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?Il.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const n=this.convertObj.options.filter(i=>i.value==e);return n.length?Promise.resolve(n[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 n=this.options.filter(i=>i.value==e);if(n.length)return Promise.resolve(n[0].label)}return new Promise((n,i)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return n(o[0].label);i()})})}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((i,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;q.axios[this.convertObj.ctx||"admin"]({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],i(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(i=>i.label.indexOf(e)>=0));const n={...this.convertObj.params||{}};return new Promise(i=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;q.axios[this.convertObj.ctx||"admin"]({url:l,data:{body:{...n,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),i(o.body)):i([])})})}$processOptions(e){return this.convertObj.types=="local"&&!this.convertObj.process&&e.forEach(n=>{this.convertObj.idField&&(n.id=n[this.convertObj.idField]),this.convertObj.pidField&&(n.pid=n[this.convertObj.pidField]),n.value=n[this.convertObj.valueField||"id"],n.label=n[this.convertObj.labelField||"title"]}),this.convertObj.process?this.convertObj.process(e):e}}function pt(a,e=350){let n=null;return i=>{clearTimeout(n),n=setTimeout(()=>{a(i)},e)}}const pr=["innerHTML"],mr={key:2,class:"text-view"},gr=oe(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,n=t.useModel(a,"value"),i=t.computed(()=>o.value.showFormat?o.value.showFormat.call(this,n.value,{label:v.value,form:e.formValue}):v.value||n.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")&&(n.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?n.value=s.value.value.split(","):n.value=[s.value.value])))});const o=t.ref({}),s=t.computed(()=>{const y=e.editor?.widget(e.wid)||e.widget||{};return y.event&&Object.keys(y.event).forEach(A=>{const V=y.event[A];V&&(o.value[A]=null,typeof V=="function"?o.value[A]=V:V.enable&&V.scriptText&&(o.value[A]=new Function("value","ctx",V.scriptText)))}),y}),r=t.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=t.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=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)}),h=t.ref({}),f=t.computed(()=>{const y=[],A=s.value.rule||{};let V=s.value.props?.required||s.value.required;if(o.value.required&&(V=o.value.required(e.formValue[s.value.name],e.formValue)),V&&y.push({required:!0,whitespace:A?.whitespace||!1,trigger:A?.trigger||l.ruleTrigger||"change",validator:(k,p)=>(A?.whitespace&&p&&typeof p=="string"&&(p=p.trim()),p!=null&&p!=null&&(p+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),A.advance&&h.value[A.advance]){const k=h.value[A.advance];y.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"})}return A.regExpress&&y.push({pattern:A.regExpress,message:A.regMessage||"表单验证不通过!",trigger:A.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&y.push({validator:(k,p)=>p&&(p+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(p+"").length+"]"):Promise.resolve(),trigger:A?.trigger||l.ruleTrigger||"change"}),y}),u=t.computed(()=>{const y=s.value.props||{};if(s.value.control=="a-input-number"){const A=s.value.rule||{};A.rangeMin!=null&&A.rangeMin!=null&&(y.min=A.rangeMin),A.rangeMax!=null&&A.rangeMax!=null&&(y.max=A.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(y.format=s.value.view.dataFormat,y.valueFormat=s.value.view.dataFormat),s.value.required&&(y.required=s.value.required),y}),m=t.computed(()=>{const y=s.value.css||{},A=["form-item-"+s.value.name];return y.cssName&&A.push(y.cssName),l.platform=="app"?y.cssName?typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0&&A.push("all-line"):A.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!y.cssName||typeof y.cssName=="string"&&y.cssName.indexOf("all-line")<0)&&A.push("all-line"):s.value.view.width==2&&A.push("2in-line")),A}),g=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&y>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(A/y)}:s.value.view?.width>=3&&y>1?{span:Math.round(A/y)}:{span:A}}),w=t.computed(()=>{const y=l.showColumn||3;let A=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&y>1&&m.value.includes("all-line")?{}:{span:A}}),v=t.ref();return t.watch(n,()=>{n.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ke(s.value.convert).convert(n.value.toString()).then(y=>{v.value=y})}),(y,A)=>{const V=t.resolveComponent("a-form-item");return t.openBlock(),t.createBlock(ut,{class:t.normalizeClass(["unione-form-item",m.value]),style:t.normalizeStyle(s.value.css?.cssText)},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createBlock(V,{key:0,label:c.value,name:s.value.name,labelCol:g.value,wrapperCol:w.value,required:s.value.props?.required,rules:f.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:t.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value.control||"a-input"),t.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:t.unref(d),value:n.value,"onUpdate:value":A[0]||(A[0]=k=>n.value=k),formValue:a.formValue},u.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:i.value},null,8,pr)):(t.openBlock(),t.createElementBlock("div",mr,t.toDisplayString(i.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):t.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),br=oe(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){$e();const e=a,n=t.ref(),i=t.useModel(a,"value"),l=t.ref([]),o=t.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=t.computed(()=>{const g=u.value.convert||e.convert||{};if(g.refValue){const w={};return g.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=q.utils.obj.getValue(e.formValue,A[0]):w[A[0]]=q.utils.obj.getValue(e.formValue,A[1])}),w}return{}}),r=t.computed(()=>(u.value.convert||e.convert||{}).search||!1),c=pt(g=>{const w=u.value.convert||e.convert||{};w.params={...h.value,...s.value},m.value.search(g).then(v=>{l.value=v})},500);function d(g,w){f.value.select&&f.value.select(g,{option:w,formValue:e.formValue})}const h=t.ref();t.onMounted(()=>{const g=u.value.convert||e.convert||{};h.value=g.params||{},g.params={...h.value,...s.value},e.mode=="multiple"&&typeof i.value=="string"&&(n.value=i.value.split(",")),m.value.load(i.value).then(w=>{l.value=w})});const f=t.ref({}),u=t.computed(()=>{const g=e.editor?.widget(e.wid)||e.widget||{};return g.event&&Object.keys(g.event).forEach(w=>{const v=g.event[w];v&&(f.value[w]=null,typeof v=="function"?f.value[w]=v:v.enable&&v.scriptText&&(f.value[w]=new Function("value","ctx",v.scriptText)))}),g}),m=t.computed(()=>{const g=u.value.convert||e.convert||{};return new Ke(g)});return t.watch(i,pt(()=>{i.value!=null&&i.value!==""&&i.value!==void 0&&(i.value+"").length>0&&(e.mode=="multiple"&&typeof i.value=="string"?n.value=i.value.split(","):(n.value=i.value,l.value[0]&&(typeof l.value[0].value=="number"?n.value=Number(n.value):typeof l.value[0].value=="string"&&(n.value=String(n.value)))),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(i.value).then(g=>{l.value=g}))},200)),t.watch(()=>u.value.convert||e.convert||{},pt(()=>{m.value.load().then(g=>{l.value=g})})),t.watch(()=>s.value,pt(()=>{if(console.log(u.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const g=u.value.convert||e.convert||{};g.params={...h.value,...s.value},m.value.load(i.value,!0).then(w=>{l.value=w})}},200),{deep:!0}),t.watch(n,()=>{Array.isArray(n.value)&&e.valueType=="string"?i.value=n.value.join(","):i.value=n.value}),(g,w)=>{const v=t.resolveComponent("a-select");return t.openBlock(),t.createBlock(v,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:n.value,"onUpdate:value":w[0]||(w[0]=y=>n.value=y),onSearch:t.unref(c),onSelect:d},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-6ba8560f"]]),kr=oe(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,n=t.useModel(a,"value"),i=t.ref({});t.onMounted(()=>{s.value?.load(n.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(i.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?i.value.unCheckedValue=!1:i.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 Ke(r):null});return(r,c)=>{const d=t.resolveComponent("a-switch");return t.openBlock(),t.createBlock(d,t.mergeProps({class:"unione-form-switch"},i.value,{checked:n.value,"onUpdate:checked":c[0]||(c[0]=h=>n.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),yr=oe(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,n=t.useModel(a,"value"),i=t.ref([]),l=t.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),o=t.computed(()=>{const h=c.value.convert||e.convert||{};if(h.refValue){const f={};return h.refValue.split(",").forEach(m=>{const g=m.split("=");g.length==1?f[g[0]]=q.utils.obj.getValue(e.formValue,g[0]):f[g[0]]=q.utils.obj.getValue(e.formValue,g[1])}),console.log(c.value.name+" ref field:"+h.refValue+",ref value",f),f}return{}}),s=t.ref();t.onMounted(()=>{const h=c.value.convert||e.convert||{};s.value=h.params||{},h.params={...s.value,...o.value},d.value.load(n.value||c.value.value).then(f=>{i.value=f})});const r=t.ref({}),c=t.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];u&&(r.value[f]=null,typeof u=="function"?r.value[f]=u:u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText)))}),h}),d=t.computed(()=>{const h=c.value.convert||e.convert||{};return new Ke(h)});return t.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const h=c.value.convert||e.convert||{};h.params={...s.value,...o.value},d.value.load(void 0,!0).then(f=>{i.value=f})}},{deep:!0}),(h,f)=>{const u=t.resolveComponent("a-radio-group");return t.openBlock(),t.createBlock(u,{class:"unione-form-radio",options:l.value,value:n.value,"onUpdate:value":f[0]||(f[0]=m=>n.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),wr=oe(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 n=a,i=t.useModel(a,"value"),l=t.ref(),o=t.ref([]),s=t.computed(()=>o.value?.length?o.value:n.options?.length?n.options:[]),r=t.computed(()=>{const g=h.value.convert||n.convert||{};if(g.refValue){const w={};return g.refValue.split(",").forEach(y=>{const A=y.split("=");A.length==1?w[A[0]]=q.utils.obj.getValue(n.formValue,A[0]):w[A[0]]=q.utils.obj.getValue(n.formValue,A[1])}),console.log(h.value.name+" ref field:"+g.refValue+",ref value",w),w}return{}}),c=t.ref();t.onMounted(()=>{const g=i.value||h.value.value;n.returnType==="string"?l.value=g.split(","):l.value=g;const w=h.value.convert||n.convert||{};c.value=w.params||{},w.params={...c.value,...r.value},m.value.load().then(v=>{o.value=v})});const d=t.ref({}),h=t.computed(()=>{const g=n.editor?.widget(n.wid)||n.widget||{};return g.event&&Object.keys(g.event).forEach(w=>{const v=g.event[w];d.value[w]=null,v.enable&&v.scriptText&&(d.value[w]=new Function("value","ctx",v.scriptText))}),g}),f=e;function u(g){n.returnType==="string"?i.value=g.join(","):i.value=g,console.log("checkbox changed",i.value),f("change",i.value)}const m=t.computed(()=>{const g=h.value.convert||n.convert||{};return new Ke(g)});return t.watch(()=>i.value,()=>{l.value=Array.isArray(i.value)?i.value:[],i.value&&!Array.isArray(i.value)&&(l.value=i.value.split(","))}),t.watch(()=>r.value,()=>{if(console.log(h.value.name+" ref value changed",r.value),r.value){l.value=[],n.returnType==="string"?i.value="":i.value=[];const g=h.value.convert||n.convert||{};g.params={...c.value,...r.value},m.value.load(void 0,!0).then(w=>{o.value=w})}},{deep:!0}),(g,w)=>{const v=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createBlock(v,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":w[0]||(w[0]=y=>l.value=y),onChange:u},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),Ar=oe(t.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=t.ref(),n=t.useModel(a,"value");return t.watch(()=>e.value,()=>{e.value?n.value=q.utils.sm2Encrypt(e.value):n.value=""}),(i,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 mi(a){const e=a.toLowerCase().split("_"),n=[];n.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(n.push(l.charAt(0).toUpperCase()),l.length>1&&n.push(l.substring(1)))}return n.join("")}const Dl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function $l(a=10){const e=Date.now().toString(),n=new Uint32Array(a);crypto.getRandomValues(n);let i="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+n[l])%Dl.length;i+=Dl[o]}return i}const xr={toHump:mi,randomStr:$l},vr=oe(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,n=t.useModel(a,"value");function i(){n.value=$l(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:n.value,"onUpdate:value":o[0]||(o[0]=c=>n.value=c)},{suffix:t.withCtx(()=>[t.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:i})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),Cr=oe(t.defineComponent({__name:"uploadBox",props:t.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},btnLabel:{type:String,default:"上传文件"},valueType:{type:String,default:"array"},autoUpload:{type:Boolean,default:!1},beforeUpload:{type:Function,required:!1},disabled:{type:Boolean,default:!1}},{value:{},valueModifiers:{}}),emits:t.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const n=a,i=e,l=t.useModel(a,"value"),o=t.ref([]),s=t.computed(()=>!n.disabled||n.editor?.model.value!="view");t.watch(l,()=>{o.value=[],l.value&&(Array.isArray(l.value)?o.value=l.value:o.value=JSON.parse(l.value))});function r(d){return n.beforeUpload?n.beforeUpload(d):n.autoUpload}function c({fileList:d}){n.valueType=="array"?(l.value=d,i("change",d)):(l.value=JSON.stringify(d),i("change",JSON.stringify(d)))}return(d,h)=>{const f=t.resolveComponent("upload-outlined"),u=t.resolveComponent("a-button"),m=t.resolveComponent("a-upload");return t.openBlock(),t.createBlock(m,{class:"unione-form-upload-box","file-list":o.value,"onUpdate:fileList":h[0]||(h[0]=g=>o.value=g),disabled:!s.value,beforeUpload:r,onChange:c},{default:t.withCtx(()=>[s.value?(t.openBlock(),t.createBlock(u,{key:0},{default:t.withCtx(()=>[t.createVNode(f),t.createTextVNode(" "+t.toDisplayString(a.btnLabel),1)]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["file-list","disabled"])}}}),[["__scopeId","data-v-a6190474"]]),Sr={class:"unione-props-setting unione-query-setting"},Br={class:"unione-query-opts"},Nr={key:0},Vr=["onClick"],Rr={key:1},Er={key:1,class:"edit-field"},Or=["onClick"],_r=oe(t.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),i=t.computed(()=>{const V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),l=t.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=t.computed(()=>{const V=[],k=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{V.push(p),k.push(p.name)}),k.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),V}),s=t.ref(null);function r(V){s.value&&s.value.open(V,k=>{k.visible=!0,Object.keys(k).forEach(p=>{V[p]=k[p]}),i.value.configs.btns.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),i.value.configs.btns=[...i.value.configs.btns]})}function c(){const V=i.value.configs.btns.length+1;let k={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(k),e.editor.widget(e.wid,i.value),s.value.open(k,p=>{Object.keys(p).forEach(S=>{k[S]=p[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function d(V){const k=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(S=>{S.name!=V.name&&p.push(S)}),i.value.configs.btns=p}};se.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const h=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=t.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:V=>V.focus()},m=t.ref({});function g(){const V=Object.keys(m.value);if(V.length)for(let k in V){const p=f.value.filter(S=>S.name==k);if(p&&p[0]){let S=m.value[k];Object.keys(S).forEach(_=>{if(_=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:S[_]}}else p[0][_]=S[_]})}}m.value={}}function w(V,k){g();const p={};p[k]=V[k]||"",k=="showIndex"&&(p[k]=V.show?.query?.index),m.value[V.name]=p}function v(V,k){if(!V||!k){m.value={};return}const p=m.value[V.name][k];if(k=="showIndex"){const S=V.show?.query||{};V.show||(V.show={}),V.show.query={...S,index:p}}else V[k]=p;m.value={}}function y(V,k){f.value.filter(S=>S.name==V.name).forEach(S=>{S[k]=!S[k]})}const A=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:V=>{const k=A.value.options.filter(p=>p.value==V);return k[0]?k[0].label:V}});return(V,k)=>{const p=t.resolveComponent("a-divider"),S=t.resolveComponent("CloseOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("PlusOutlined"),x=t.resolveComponent("a-select"),N=t.resolveComponent("ToolOutlined"),R=t.resolveComponent("a-checkbox"),b=t.resolveComponent("a-input-number"),B=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Sr,[t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>k[3]||(k[3]=[t.createTextVNode("查询按钮")])),_:1}),t.createElementVNode("div",Br,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,F=>(t.openBlock(),t.createBlock(_,t.mergeProps({key:F.name,class:["btn",F.name,!F.visible&&"deleted"],type:F.visible?F.type:"default",size:F.size||"default",ref_for:!0},F.props||{},{onClick:E=>r(F)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(F.title)+" ",1),F.visible?(t.openBlock(),t.createBlock(S,{key:0,class:"btn-del",onClick:t.withModifiers(E=>d(F),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[F.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(F.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(_,{class:t.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=F=>c()),size:"small"},{default:t.withCtx(()=>[t.createVNode(C)]),_:1})]),t.createVNode(p,{orientation:"left"},{default:t.withCtx(()=>k[4]||(k[4]=[t.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=t.createTextVNode(" 数据模型:")),t.createVNode(x,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":k[1]||(k[1]=F=>i.value.dataModel=F)},null,8,["options","value"]),t.createVNode(B,{columns:n.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:F})=>[["showIndex","queryType"].includes(F.key)?(t.openBlock(),t.createElementBlock("span",Nr,[t.createVNode(N),t.createTextVNode(" "+t.toDisplayString(F.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:F,text:E,record:M})=>[["queryType"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!m.value[M.name]||!Object.keys(m.value[M.name]).includes(F.dataIndex))&&!E&&"empty"]),onClick:P=>w(M,F.dataIndex)},[m.value[M.name]&&Object.keys(m.value[M.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(x,{key:0,value:M[F.dataIndex],"onUpdate:value":P=>M[F.dataIndex]=P,allowClear:!0,options:A.value.options,onBlur:k[2]||(k[2]=P=>v())},null,8,["value","onUpdate:value","options"])),[[u]]):(t.openBlock(),t.createElementBlock("span",Rr,t.toDisplayString(A.value.showLabel(E)),1))],10,Vr)):["isQuery"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",Er,[t.createVNode(R,{checked:M[F.dataIndex],onClick:P=>y(M,F.dataIndex)},null,8,["checked","onClick"])])):F.dataIndex=="showIndex"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!m.value[M.name]||!Object.keys(m.value[M.name]).includes(F.dataIndex))&&!E&&"empty"]),onClick:P=>w(M,F.dataIndex)},[m.value[M.name]&&Object.keys(m.value[M.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(b,{key:0,value:m.value[M.name][F.dataIndex],"onUpdate:value":P=>m.value[M.name][F.dataIndex]=P,onBlur:P=>v(M,F.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(M.show?.query?.index||" "),1)],64))],10,Or)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(xn,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),Mr={class:"query-btn"},Fr={class:"btn-advanced-overlay"},Pl=oe(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 n=a,i=t.computed(()=>{const v=n.editor?.widget(n.wid)||n.widget||{};return v.btns||(v.btns=[]),v}),l=t.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),o=t.computed(()=>{let v=[];return i.value.fields?.length&&(v=i.value.fields),v.length==0&&n.fields?.length&&(v=n.fields),v.sort((y,A)=>{const V=y.show?.query?.index||1,k=A.show?.query?.index||1;return V-k}),v.forEach(y=>{!y.widget&&!y.control&&y.convert&&(y.widget="unione-select-box"),y.widget=y.widget||y.control||"a-input",y.defaultValue!=null&&y.defaultValue!="undefined"&&typeof y.defaultValue<"u"&&(h.value[y.name]=y.defaultValue,y.value=y.defaultValue)}),v}),s=t.computed(()=>i.value.labelWidth||7),r=t.computed(()=>{const v=i.value.btns.filter(y=>y.name=="advanced")[0]||{};return v.event?.clickScript&&(v.event.click=new Function("ctx","btn","event",v.event.clickScript)),v.event?.disableScript&&(v.event.disable=new Function("ctx","btn",v.event.disableScript)),v.event?.visibleScript&&(v.event.visible=new Function("ctx","btn",v.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...v}}),c=["query","reset","advanced"],d=t.computed(()=>{const v=i.value.btns.filter(A=>A.name!="advanced"),y=[];return v.forEach(A=>{A.size||(A.size="default"),y.push(A.name)}),y.includes("query")||v.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),y.includes("reset")||v.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),v.sort((A,V)=>{const k=A.index||1,p=V.index||1;return k-p}),v}),h=t.ref({}),f=t.computed(()=>{const v={};return i.value.params?Object.keys(i.value.params).forEach(y=>{v[y]=i.value.params[y]}):n.params&&Object.keys(n.params).forEach(y=>{v[y]=n.params[y]}),v});t.onMounted(()=>{n.editor?.ebus.$on("query-form-params",v=>{i.value.params=v}),g()});const u=e;function m({btn:v,event:y}){console.log("unione query form btn click",v,y),v.name=="query"&&g(),v.name=="reset"&&w(),u("btnClick",{btn:v,event:y})}function g(){const v=[];o.value.forEach(A=>{A.visible&&v.push(A.name)});const y={params:{...f.value},keywords:""};Object.keys(h.value).forEach(A=>{v.includes(A)&&(y.params[A]=h.value[A])}),l.value.visible&&h.value[l.value.name]&&(y.keywords=h.value[l.value.name]),u("query",y),n.editor?.ebus.$emit("table-list-search",y)}function w(){h.value={},o.value.forEach(y=>{y.visible=!1});const v={params:{...f.value},keywords:""};u("reset",v),n.editor?.ebus.$emit("table-list-reset",v)}return(v,y)=>{const A=t.resolveComponent("a-input"),V=t.resolveComponent("a-form-item"),k=t.resolveComponent("unione-btn"),p=t.resolveComponent("a-checkbox"),S=t.resolveComponent("DownOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("a-dropdown"),x=t.resolveComponent("a-form");return t.openBlock(),t.createBlock(ut,{class:"unione-query-form",model:n.editor?.model.value,"setting-title":"查询设置"},t.createSlots({default:t.withCtx(()=>[t.createVNode(x,{model:h.value,layout:"horizontal","label-col":{span:s.value}},{default:t.withCtx(()=>[l.value.visible?(t.openBlock(),t.createBlock(V,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:t.normalizeStyle({width:s.value})},{default:t.withCtx(()=>[t.createVNode(A,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":y[0]||(y[0]=N=>h.value[l.value.name]=N),allowClear:"",onKeyup:t.withKeys(g,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible?(t.openBlock(),t.createBlock(V,{key:0,label:N.title,class:t.normalizeClass(["query-field",N.name]),style:t.normalizeStyle({width:s.value}),name:N.name},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(N.widget),t.mergeProps({placeholder:N.placeholder,value:h.value[N.name],"onUpdate:value":R=>h.value[N.name]=R,ref_for:!0},N.props||{},{allowClear:"",widget:N}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):t.createCommentVNode("",!0)],64))),128)),t.createElementVNode("div",Mr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,N=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:N.name},[N.visible!=!1?(t.openBlock(),t.createBlock(k,{key:0,widget:N,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):t.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(t.openBlock(),t.createBlock(C,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:t.withCtx(()=>[t.createElementVNode("div",Fr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,N=>(t.openBlock(),t.createBlock(p,{key:N.name,class:"item",checked:N.visible,onClick:R=>N.visible=!N.visible},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:t.withCtx(()=>[t.createVNode(_,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(r.value.title)+" ",1),t.createVNode(S)]),_:1})]),_:1},8,["trigger"])):t.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[n.editor&&n.wid?{name:"widget-setting",fn:t.withCtx(()=>[t.createVNode(_r,{editor:n.editor,wid:n.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),Tr={class:"unione-props-setting unione-table-setting"},Ir={class:"unione-table-tools"},Dr={key:1,class:"unione-table-opts"},$r={key:0},Pr=["onClick"],Lr={key:1,class:"edit-field"},Ur=["onClick"],jr={key:1},zr=oe(t.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,n=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,x){let N=C.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,x){let N=C.filter(R=>R.value==x);return N&&N[0]&&N[0].label||x}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=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(x=>({value:x.sn,label:x.title+"("+x.name+")"}))),o=t.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.leftBtns;if(x.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"};x.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"};x.splice(1,0,N)}return x}),s=t.computed(()=>{if(!i.value)return[];const C=[],x=i.value.configs.rightBtns;if(x.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"};x.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"};x.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"};x.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"};x.splice(3,0,N)}return x});function r(C,x){C=="left"?h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.leftBtns.sort((R,b)=>{const B=R.index||1,F=b.index||1;return B-F}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(x,N=>{N.visible=!0,Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.rightBtns.sort((R,b)=>{const B=R.index||1,F=b.index||1;return B-F}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function c(C){const x=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let N={title:"新增"+x,name:"new_"+x,index:x,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(N):i.value.configs.rightBtns.push(N),e.editor.widget(e.wid,i.value),r(C,N)}function d(C,x){const N=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(x.name))x.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const R=[];i.value.configs.leftBtns.forEach(b=>{b.name!=x.name&&R.push(b)}),i.value.configs.leftBtns=R}else{const R=[];i.value.configs.rightBtns.forEach(b=>{b.name!=x.name&&R.push(b)}),i.value.configs.rightBtns=R}};se.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{N()}})}const h=t.ref(null);function f(C){h.value.open(C,x=>{x.visible=!0,Object.keys(x).forEach(N=>{C[N]=x[N]}),i.value.configs.operation.btns.sort((N,R)=>{const b=N.index||1,B=R.index||1;return b-B}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let x={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:""}};i.value.configs.operation.btns.push(x),e.editor.widget(e.wid,i.value),h.value.open(x,N=>{Object.keys(N).forEach(R=>{x[R]=N[R]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const x=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const N=[];i.value.configs.operation.btns.forEach(R=>{R.name!=C.name&&N.push(R)}),i.value.configs.operation.btns=N}};se.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{x()}})}const g=t.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),w=t.computed(()=>g.value.fields?.length?(g.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),g.value.fields):[]),v={mounted:C=>C.focus()},y=t.ref({});function A(){const C=Object.keys(y.value);if(C.length)for(let x in C){const N=w.value.filter(R=>R.name==x);if(N&&N[0]){let R=y.value[x];Object.keys(R).forEach(b=>{N[0].show||(N[0].show={}),N[0].show.list||(N[0].show.list={}),b=="showIndex"?N[0].show.list.index=R[b]:b=="showWidth"?N[0].show.list.width=R[b]:b=="fixed"?N[0].show.list.fixed=R[b]:b=="align"?N[0].show.list.align=R[b]:N[0][b]=R[b]})}}y.value={}}function V(C,x){A();const N={};x=="showIndex"?N[x]=C.show?.list?.index:x=="showWidth"?N[x]=C.show?.list?.width:x=="fixed"?N[x]=C.show?.list?.fixed:x=="align"?N[x]=C.show?.list?.align:N[x]=C[x]||"",y.value[C.name]=N}function k(C,x){if(!C||!x){y.value={};return}const N=y.value[C.name][x];C.show||(C.show={}),C.show.list||(C.show.list={}),x=="showIndex"?C.show.list.index=N:x=="showWidth"?C.show.list.width=N:x=="fixed"?C.show.list.fixed=N:x=="align"?C.show.list.align=N:C[x]=N,y.value={}}function p(C,x){return x=="showIndex"?C.show?.list?.index:x=="showWidth"?C.show?.list?.width:x=="fixed"?C.show?.list?.fixed:x=="align"?C.show?.list?.align:C[x]}function S(C,x){w.value.filter(R=>R.name==C.name).forEach(R=>{R[x]=!R[x]})}const _=t.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const x=_.value.options.filter(N=>N.value==C);return x[0]?x[0].label:C}});return(C,x)=>{const N=t.resolveComponent("a-divider"),R=t.resolveComponent("CloseOutlined"),b=t.resolveComponent("a-button"),B=t.resolveComponent("PlusOutlined"),F=t.resolveComponent("a-input"),E=t.resolveComponent("a-form-item"),M=t.resolveComponent("a-col"),P=t.resolveComponent("a-input-number"),T=t.resolveComponent("a-checkbox"),W=t.resolveComponent("a-row"),L=t.resolveComponent("a-select"),O=t.resolveComponent("ToolOutlined"),te=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Tr,[t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[8]||(x[8]=[t.createTextVNode("工具设置")])),_:1}),t.createElementVNode("div",Ir,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size,ref_for:!0},D.props||{},{onClick:K=>r("left",D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(K=>d("left",D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(b,{class:t.normalizeClass(["btn","tool-add"]),size:"small",onClick:x[0]||(x[0]=D=>c("left"))},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),t.createVNode(b,{class:t.normalizeClass(["btn","tool-add","right"]),onClick:x[1]||(x[1]=D=>c("right")),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn","right",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size,ref_for:!0},D.props||{},{onClick:K=>r("right",D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"bool-del",onClick:t.withModifiers(K=>d("right",D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[9]||(x[9]=[t.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(t.openBlock(),t.createBlock(W,{key:0},{default:t.withCtx(()=>[t.createVNode(M,{span:7},{default:t.withCtx(()=>[t.createVNode(E,{label:"操作标题"},{default:t.withCtx(()=>[t.createVNode(F,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:5},{default:t.withCtx(()=>[t.createVNode(E,{label:"显示宽度",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode(P,{value:i.value.configs.operation.width,"onUpdate:value":x[2]||(x[2]=D=>i.value.configs.operation.width=D)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:6},{default:t.withCtx(()=>[t.createVNode(E,{label:"显示按钮数量",labelCol:{span:9}},{default:t.withCtx(()=>[t.createVNode(P,{value:i.value.configs.operation.count,"onUpdate:value":x[3]||(x[3]=D=>i.value.configs.operation.count=D)},null,8,["value"])]),_:1})]),_:1}),t.createVNode(M,{span:5},{default:t.withCtx(()=>[t.createVNode(E,{label:"是否显示"},{default:t.withCtx(()=>[t.createVNode(T,{checked:i.value.configs.operation.visible,"onUpdate:checked":x[4]||(x[4]=D=>i.value.configs.operation.visible=D)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[10]||(x[10]=[t.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(t.openBlock(),t.createElementBlock("div",Dr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value.configs.operation.btns,D=>(t.openBlock(),t.createBlock(b,t.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"small",ref_for:!0},D.props||{},{onClick:K=>f(D)}),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(D.title)+" ",1),D.visible?(t.openBlock(),t.createBlock(R,{key:0,class:"btn-del",onClick:t.withModifiers(K=>m(D),["stop"])},null,8,["onClick"])):t.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),t.createVNode(b,{class:t.normalizeClass(["btn","btn-add"]),onClick:x[5]||(x[5]=D=>u()),size:"small"},{default:t.withCtx(()=>[t.createVNode(B)]),_:1})])):t.createCommentVNode("",!0),t.createVNode(N,{orientation:"left"},{default:t.withCtx(()=>x[11]||(x[11]=[t.createTextVNode("表头设置")])),_:1}),x[12]||(x[12]=t.createTextVNode(" 数据模型:")),t.createVNode(L,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":x[6]||(x[6]=D=>i.value.dataModel=D)},null,8,["options","value"]),t.createVNode(te,{columns:n.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:D})=>[["showIndex","showWidth","align","fixed"].includes(D.key)?(t.openBlock(),t.createElementBlock("span",$r,[t.createVNode(O),t.createTextVNode(" "+t.toDisplayString(D.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:D,record:K})=>[["showIndex","showWidth"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!y.value[K.name]||!Object.keys(y.value[K.name]).includes(D.dataIndex))&&!p(K,D.dataIndex)&&"empty"]),onClick:ue=>V(K,D.dataIndex)},[y.value[K.name]&&Object.keys(y.value[K.name]).includes(D.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(P,{key:0,value:y.value[K.name][D.dataIndex],"onUpdate:value":ue=>y.value[K.name][D.dataIndex]=ue,onBlur:ue=>k(K,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[v]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p(K,D.dataIndex)),1)],64))],10,Pr)):["isList","isQuery","isSort"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",Lr,[t.createVNode(T,{checked:K[D.dataIndex],onClick:ue=>S(K,D.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(D.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!y.value[K.name]||!Object.keys(y.value[K.name]).includes(D.dataIndex))&&!p(K,D.dataIndex)&&"empty"]),onClick:ue=>V(K,D.dataIndex)},[y.value[K.name]&&Object.keys(y.value[K.name]).includes(D.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(L,{key:0,value:K.show.list[D.dataIndex],"onUpdate:value":ue=>K.show.list[D.dataIndex]=ue,allowClear:!0,options:D.options,onBlur:x[7]||(x[7]=ue=>k())},null,8,["value","onUpdate:value","options"])),[[v]]):(t.openBlock(),t.createElementBlock("span",jr,t.toDisplayString(D.showLabel(D.options,p(K,D.dataIndex))),1))],10,Ur)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(xn,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),qr={class:"unione-table-tools"},Qr={class:"unione-table-data"},Wr={key:0,class:"unione-table-opts"},Ll=oe(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:n}){const i=$e(),l=a,o=t.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=t.computed(()=>o.value.props||{}),r=t.computed(()=>o.value.rowKey||l.rowKey||"id"),c=t.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),d=t.computed(()=>{const B=l.dataList||[];return!B.length&&c.value?c.value.data().body||[]:B}),h=t.computed(()=>{if(o.value.operation==!1||!Array.isArray(o.value.operation?.btns))return{visible:!1};const B=q.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),F=[];let E=(o.value.operation?.btns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M));if(E.forEach(M=>{F.push(M.name)}),F.includes("edit")||E.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),F.includes("view")||E.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),F.includes("delete")||E.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const M=E.filter(T=>T.name=="edit")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const T=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",W=l.editor.model.value;M.action.link=i.editPageUrl+"?psn="+T+"&model="+W+"&id={row."+l.rowKey+"}"}const P=E.filter(T=>T.name=="view")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const T=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";P.action.link=i.viewPageUrl+"?psn="+T+"&model=view&id={row."+l.rowKey+"}"}}return E=E.filter(M=>M.visible!=!1).sort((M,P)=>{const T=M.index||1,W=P.index||1;return T-W}),B.count&&(E.length>B.count+1?(B.btns=E.slice(0,B.count),B.more.items=E.slice(B.count,E.length),B.more.visible=!0):(B.btns=E,B.more.visible=!1)),B}),f=t.computed(()=>{let B=[];o.value.columns?.length&&(B=[...o.value.columns]);const F=[];B.forEach((M,P)=>{M.dataIndex=M.name,M.convert&&(M.dataIndex=M.name+"Label",M.convertObj=new Ke(M.convert),M.customCell=(T,W,L)=>{const O=q.utils.obj.getValue(T,L.name);M.convertObj&&(T[L.dataIndex]==null||T[L.dataIndex]==null)&&O!=null&&O!=null&&(O+"").length>0&&(T[L.dataIndex]=O,M.convertObj.convert(O).then(te=>{te&&q.utils.obj.setValue(T,L.dataIndex,te)}))}),M.sort?.enable&&(M.sorter=!0,M.sort.multiple&&(M.sorter={},M.sorter.multiple=M.sort.multiple),M.sort.defoult&&(M.defaultSortOrder=M.sort.asc?"ascend":"descend")),M.customRender=({record:T,column:W})=>q.utils.obj.getValue(T,W.dataIndex)||"--",M.fkey?.enable&&(M.fkey.labelName&&(M.dataIndex=mi(M.fkey.labelName)),M.fkey.labelTitle&&(M.title=M.fkey.labelTitle),M.customRender=({record:T,column:W})=>T&&T[W.name+"FEntry"]&&T[W.name+"FEntry"][W.dataIndex]||"--",M.fkey.fields?.forEach((T,W)=>{if(!T.name)return;const L=mi(T.name),O={fkName:M.name,title:T.title,name:L,dataIndex:T.name,width:T.width,index:T.index||P+W+1,customRender:({record:te,column:D})=>{if(te&&te[D.fkName+"FEntry"]){const K=te[D.fkName+"FEntry"][D.name];if(K)return T.convertObj&&T.convertObj.convert(K)||K}return"--"}};T.convert&&(T.convertObj=new Ke(T.convert)),F.push(O)}))}),F.forEach(M=>{B.splice(M.index,0,M)});const E=q.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return E&&E.visible!=!1&&(E.customRender=M=>V.value?(V.value.current-1)*V.value.pageSize+M.index+1:M.index,B=[E,...B]),h.value&&h.value.visible!=!1&&B.push({fixed:"right",align:"center",...h.value,name:"operation"}),B}),u=t.computed(()=>{if(o.value.leftBtns===!1||!Array.isArray(o.value.leftBtns))return[];const B=[],F=[];if((o.value.leftBtns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M)).forEach(M=>{M.visible!=!1&&B.push(M),F.push(M.name),M.name=="delBatch"&&!k.value&&(M.visible=!1)}),!F.includes("add")){const M={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};B.splice(0,0,M)}if(!F.includes("delBatch")&&k.value){const M={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};B.splice(1,0,M)}if(l.editor&&l.editor.type.value!="code"){const M=B.filter(P=>P.name=="add")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",T=l.editor.model.value;M.action.link=i.addPageUrl+"?psn="+P+"&model="+T}}return B});function m({btn:B,event:F}){if(i.isDebug&&console.log("unione table left btn click",B,F),B.name=="delBatch"){if(!p.value.selectedRowKeys.length){se.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(p.value.selectedRowKeys).then(()=>{R(),N(!0)});return}se.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+p.value.selectedRowKeys.length+")数据",onOk:()=>{_("delBatch",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("leftBtnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}_(B.name,{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("leftBtnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const g=t.computed(()=>{if(o.value.rightBtns===!1||!Array.isArray(o.value.rightBtns))return[];const B=[],F=[];if((o.value.rightBtns||[]).map(M=>(typeof M=="string"&&(M={name:M,visible:!1}),M)).forEach(M=>{M.visible!=!1&&B.push(M),F.push(M.name)}),!F.includes("impData")){const M={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};B.splice(1,0,M)}if(!F.includes("expData")){const M={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};B.splice(2,0,M)}if(!F.includes("downTmpl")){const M={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};B.splice(3,0,M)}return B});function w({btn:B,event:F}){i.isDebug&&console.log("unione table right btn click",B,F),_(B.name,{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("rightBtnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:F,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}const v=t.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),y=t.ref({}),A=t.ref(null),V=t.computed(()=>q.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:B=>"共"+B+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),k=t.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),p=t.ref({selectedRowKeys:[],selectedRowList:[],onChange:(B,F)=>{p.value.selectedRowKeys=B,p.value.selectedRowList=F},getCheckboxProps:B=>({disabled:B.checkable})}),S=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],_=n;function C({btn:B,event:F},E){if(i.isDebug&&console.log("unione table opt btn click",B,F),B.name=="delete"){if(c.value){c.value.deleteByIds([E[r.value]]).then(()=>{R(),p.value.selectedRowKeys=p.value.selectedRowKeys.filter(M=>M!=E[r.value]),p.value.selectedRowList=p.value.selectedRowList.filter(M=>M[r.value]!=E[r.value])});return}se.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{_(B.name,{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("optBtnClick",{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}});return}_(B.name,{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("optBtnClick",{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}),_("btnClick",{btn:B,event:F,row:E,keys:p.value.selectedRowKeys,rows:p.value.selectedRowList})}function x(B,F,E,M){console.log("tableChanged",B,F,E,M),A.value={page:B.current,pageSize:B.pageSize},E&&(Array.isArray(E)?(A.value.sorts=[],E.forEach(P=>{A.value.sorts.push({name:P.column.name,asc:P.order=="ascend"})})):E.column&&(A.value.sorts=[{name:E.column.name,asc:E.order=="ascend"}])),R(),_("change",{pagination:B,filters:F,sorter:E,event:M})}function N(B=!1){B?(p.value.selectedRowKeys=[],p.value.selectedRowList=[]):se.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${p.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{p.value.selectedRowKeys=[],p.value.selectedRowList=[]}})}function R(){if(c.value){const B={page:V.value.current,pageSize:V.value.pageSize,keywords:y.value.keywords,body:y.value.params||{}};A.value?.page&&(B.page=A.value.page),A.value?.pageSize&&(B.pageSize=A.value.pageSize),A.value?.sorts&&(B.sorts=A.value.sorts),console.log("dataStorage find params",B),c.value.find(B)}}t.onMounted(()=>{f.value?.forEach(B=>{B.sort?.enable&&B.sort.defoult&&(A.value||(A.value={},A.value.sorts||(A.value.sorts=[]),A.value.sorts.push({name:B.name,asc:B.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",B=>{console.log("table-list-search",B),y.value=B||{},R()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),y.value={},R(),N(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),R()})});function b(){return{keys:p.value.selectedRowKeys,rows:p.value.selectedRowList}}return e({getSelected:b,clearSelected:N}),(B,F)=>{const E=t.resolveComponent("unione-btn"),M=t.resolveComponent("DownOutlined"),P=t.resolveComponent("a-button"),T=t.resolveComponent("a-dropdown"),W=t.resolveComponent("a-table");return t.openBlock(),t.createBlock(ut,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",qr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,L=>(t.openBlock(),t.createBlock(E,{key:L.name,class:"btn",widget:L,editor:a.editor,onClick:m,preset:S,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),p.value.selectedRowKeys.length?(t.openBlock(),t.createElementBlock("span",{key:0,class:"selected-info",onClick:F[0]||(F[0]=L=>N())},"当前选中记录("+t.toDisplayString(p.value.selectedRowKeys.length)+")",1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,L=>(t.openBlock(),t.createBlock(E,{key:L.name,class:"btn right",widget:L,editor:a.editor,onClick:w,preset:S,ctx:{sltKeys:p.value.selectedRowKeys,sltRows:p.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),t.createElementVNode("div",Qr,[f.value&&f.value.length?(t.openBlock(),t.createBlock(W,t.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":d.value,"row-selection":k.value?p.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:V.value,onChange:x},v.value),{bodyCell:t.withCtx(({column:L,record:O})=>[L.name==="operation"?(t.openBlock(),t.createElementBlock("div",Wr,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.btns,te=>(t.openBlock(),t.createBlock(E,{key:te.name,class:"opt",widget:te,editor:a.editor,onClick:D=>C(D,O),preset:S,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(t.openBlock(),t.createBlock(T,{key:0,trigger:[h.value.more.trigger||"hover"],class:t.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.more.items,te=>(t.openBlock(),t.createBlock(E,{key:te.name,class:"item",widget:te,editor:a.editor,onClick:D=>C(D,O),type:"text",preset:S,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:t.withCtx(()=>[t.createVNode(P,null,{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h.value.more.title)+" ",1),t.createVNode(M)]),_: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(zr,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-e29dc519"]]);class ze{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:n,onClose:i,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(me.EDITOR_COMPONENT,me.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(me.EDITOR_COMPONENT,me.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const d=document.createElement("div");d.classList.add("dialog-title");const h=document.createElement("span");h.append(document.createTextNode(e));const f=document.createElement("i");f.onclick=()=>{i&&i(),this._dispose()},d.append(h),d.append(f),c.append(d);const u=document.createElement("div");u.classList.add("dialog-option");for(let v=0;v<n.length;v++){const y=n[v],A=document.createElement("div");if(A.classList.add("dialog-option__item"),y.label){const k=document.createElement("span");k.append(document.createTextNode(y.label)),A.append(k),y.required&&k.classList.add("dialog-option__item--require")}let V;y.type==="select"?(V=document.createElement("select"),y.options?.forEach(k=>{const p=document.createElement("option");p.value=k.value,p.label=k.label,V.append(p)})):y.type==="textarea"?V=document.createElement("textarea"):(V=document.createElement("input"),V.type=y.type),y.width&&(V.style.width=`${y.width}px`),y.height&&(V.style.height=`${y.height}px`),V.name=y.name,V.value=y.value||"",V instanceof HTMLSelectElement||(V.placeholder=y.placeholder||""),A.append(V),u.append(A),this.inputList.push(V)}c.append(u);const m=document.createElement("div");m.classList.add("dialog-menu");const g=document.createElement("button");g.classList.add("dialog-menu__cancel"),g.append(document.createTextNode("取消")),g.type="button",g.onclick=()=>{l&&l(),this._dispose()},m.append(g);const w=document.createElement("button");w.append(document.createTextNode("确定")),w.type="submit",w.onclick=()=>{if(o){const v=this.inputList.map(y=>({name:y.name,value:y.value}));o(v)}this._dispose()},m.append(w),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Kr(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 Yr(a){const e=[];function n(i){for(let l=0;l<i.length;l++){const o=i[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))n(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...Kr(s)})}}}return n(a),e}const Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",lc="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==",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",xc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",Cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",Sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",Bc="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",Nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",Vc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",Rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",Ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",Oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",Ul="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",_c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",jl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",zl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",Mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",Fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",Tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",Ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",Dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",$c="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",Pc=["title"],Lc=["title"],Uc={class:"options"},jc=["title"],zc={class:"options"},qc={class:"options"},Qc=["title"],Wc=["title"],Kc=["title"],Yc=["title"],Hc=["title"],Gc={class:"options"},Jc={class:"options"},Xc={class:"options"},Zc={class:"options"},ed={class:"options"},td={class:"menu-item__search__collapse__search"},nd={class:"arrow-left"},id={class:"arrow-right"},ld=oe(t.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const n=a,i=t.ref(),l=t.computed(()=>{let R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return n.items&&(n.items.length>1?R=n.items:n.items[0]=="simple"&&(R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),R});function o(){return i.value?.clientHeight}function s(){return i.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(R,b){console.log("exec cmd "+R+",params:",b),R!="Separator"&&Array.isArray(b)?n.editor?.command["execute"+R](b[0],b[1]):n.editor?.command["execute"+R](b)}function d(R,b){const B=b.target.getBoundingClientRect(),F=i.value.querySelector("."+R+" .options");F.classList.toggle("visible"),F.style.top=B.height+B.top+"px"}let h=!0,f;function u(){h?(h=!1,f=window.setTimeout(()=>{h=!0,n.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(f)}function m(){h=!0,window.clearTimeout(f),n.editor?.command.executePainter({isDblclick:!0})}function g(){new ze({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:R=>{const b=R.find(B=>B.name==="value")?.value;b&&n.editor?.command.executeInsertElementList([{type:me.ElementType.LATEX,value:b}])}})}function w(R){n.editor?.command.executeInsertElementList([{type:R,checkbox:{value:!1},value:""}])}function v(R,b){const B=b.target.getBoundingClientRect(),F=i.value.querySelector("."+R+" .options");F.classList.toggle("visible"),F.style.top=B.height+B.top+"px";const E=Ba();F.firstChild.childNodes.forEach(M=>{const P=M.attributes.getNamedItem("label-format").value;M.innerText=E.format(P),M.onclick=()=>{n.editor?.command.executeInsertElementList([{type:me.ElementType.DATE,dateFormat:M.attributes.getNamedItem("data-format").value,valueList:[{value:M.innerText.trim()}]}])}})}function y(){new ze({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:R=>{const b=R.find(W=>W.name==="type")?.value;if(!b)return;const B=R.find(W=>W.name==="width")?.value,F=R.find(W=>W.name==="height")?.value;if(!F)return;const E=R.find(W=>W.name==="src")?.value,M=R.find(W=>W.name==="srcdoc")?.value,P={type:b};if(P.type===me.BlockType.IFRAME){if(!E&&!M)return;P.iframeBlock={src:E,srcdoc:M}}else if(P.type===me.BlockType.VIDEO){if(!E)return;P.videoBlock={src:E}}const T={type:me.ElementType.BLOCK,value:"",height:Number(F),block:P};B&&(T.width=Number(B)),n.editor?.command.executeInsertElementList([T])}})}function A(R){const b=R.target.getBoundingClientRect(),B=i.value.querySelector(".menu-item__table__collapse");B.style.display="block",B.style.top=b.height+b.top+"px",B.style.left=b.left-270/2+"px";const F=i.value.querySelector(".menu-item__table__collapse .table-close"),E=i.value.querySelector(".menu-item__table__collapse .table-select"),M=i.value.querySelector(".menu-item__table__collapse .table-panel"),P=[];i.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(L=>{P.push(L.childNodes)});let T=0,W=0;M.onmousemove=L=>{const{offsetX:K,offsetY:ue}=L;P.forEach(j=>{j.forEach(I=>{I.classList.remove("active")})}),T=Math.ceil(K/22)||1,W=Math.ceil(ue/26)||1,P.forEach((j,I)=>{j.forEach((Z,Y)=>{Y<T&&I<W&&Z.classList.add("active")})}),E.innerText=`${W}×${T}`},M.onclick=()=>{B.style.display="none",n.editor?.command.executeInsertTable(W,T)},F.onclick=L=>{L.stopPropagation(),B.style.display="none"}}function V(){const R=i.value.querySelector(".menu-item__image .image");R.click(),R.onchange=function(){const b=R.files[0],B=new FileReader;B.readAsDataURL(b),B.onload=function(){const F=new Image,E=B.result;F.src=E,F.onload=function(){n.editor?.command.executeImage({value:E,width:F.width,height:F.height}),R.value=""}}}}function k(){new ze({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:n.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:R=>{const b=R.find(F=>F.name==="name")?.value;if(!b)return;const B=R.find(F=>F.name==="url")?.value;B&&n.editor?.command.executeHyperlink({type:me.ElementType.HYPERLINK,value:"",url:B,valueList:me.splitText(b).map(F=>({value:F,size:16}))})}})}function p(R){R==="add"?new ze({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:b=>{if(~b.findIndex(M=>!M.value))return;const F=b.reduce((M,P)=>(M[P.name]=P.value,M),{}),E=F.repeat==="1";n.editor?.command.executeAddWatermark({data:F.data,color:F.color,size:Number(F.size),opacity:Number(F.opacity),repeat:E,gap:E&&F.horizontalGap&&F.verticalGap?[Number(F.horizontalGap),Number(F.verticalGap)]:void 0})}}):n.editor?.command.executeDeleteWatermark()}function S(){new ze({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:R=>{const b=R.find(M=>M.name==="codeblock")?.value;if(!b)return;const B=Ml.tokenize(b,Ml.languages.javascript),F=Yr(B),E=[];for(let M=0;M<F.length;M++){const P=F[M],T=me.splitText(P.content);for(let W=0;W<T.length;W++){const O={value:T[W]};P.color&&(O.color=P.color),P.bold&&(O.bold=!0),P.italic&&(O.italic=!0),E.push(O)}}E.unshift({value:`
|
|
2
|
+
`}),n.editor?.command.executeInsertElementList(E)}})}function _(R){const b=R.target.getBoundingClientRect(),B=i.value.querySelector(".menu-item__search__collapse");B.style.display="block",B.style.top=b.height+b.top+"px",B.style.left=b.left-260/2+"px";const F=i.value.querySelector(".menu-item__search__collapse__search input"),E=i.value.querySelector(".menu-item__search__collapse__replace input"),M=B.querySelector(".search-result");F.focus();const P=()=>{const T=n.editor?.command.getSearchNavigateInfo();if(T){const{index:W,count:L}=T;M.innerText=`${W}/${L}`}else M.innerText=""};B.querySelector("span").onclick=()=>{B.style.display="none",F.value="",E.value="",n.editor?.command.executeSearch(null),P()},F.oninput=()=>{n.editor?.command.executeSearch(F.value||null),P()},F.onkeydown=T=>{T.key==="Enter"&&(n.editor?.command.executeSearch(F.value||null),P())},B.querySelector("button").onclick=()=>{const T=F.value,W=E.value;T&&W&&T!==W&&n.editor?.command.executeReplace(W)},B.querySelector(".arrow-left").onclick=()=>{n.editor?.command.executeSearchNavigatePre(),P()},B.querySelector(".arrow-right").onclick=()=>{n.editor?.command.executeSearchNavigateNext(),P()}}function C(){const R=i.value.querySelector(".menu-item__color .input-color");R.oninput=function(){n.editor?.command.executeColor(R.value)},R.click()}function x(){const R=i.value.querySelector(".menu-item__highlight .input-highlight");R.oninput=function(){n.editor?.command.executeHighlight(R.value)},R.click()}function N(R){switch(R){case me.ControlType.TEXT:new ze({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:b=>{const B=b.find(E=>E.name==="placeholder")?.value;if(!B)return;const F=b.find(E=>E.name==="value")?.value||"";n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,value:F?[{value:F}]:null,placeholder:B}})}});break;case me.ControlType.SELECT:new ze({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:b=>{const B=b.find(M=>M.name==="placeholder")?.value;if(!B)return;const
|
|
6
|
+
}]`}],onConfirm:b=>{const B=b.find(M=>M.name==="placeholder")?.value;if(!B)return;const F=b.find(M=>M.name==="valueSets")?.value;if(!F)return;const E=b.find(M=>M.name==="code")?.value;n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,code:E,value:null,placeholder:B,valueSets:JSON.parse(F)}})}});break;case me.ControlType.CHECKBOX:new ze({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:b=>{const B=b.find(E=>E.name==="valueSets")?.value;if(!B)return;const
|
|
10
|
+
}]`}],onConfirm:b=>{const B=b.find(E=>E.name==="valueSets")?.value;if(!B)return;const F=b.find(E=>E.name==="code")?.value;n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,code:F,value:null,valueSets:JSON.parse(B)}})}});break;case me.ControlType.RADIO:new ze({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:b=>{const B=b.find(E=>E.name==="valueSets")?.value;if(!B)return;const T=b.find(E=>E.name==="code")?.value;n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,code:T,value:null,valueSets:JSON.parse(B)}})}});break;case me.ControlType.DATE:new je({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:b=>{const B=b.find(M=>M.name==="placeholder")?.value;if(!B)return;const T=b.find(M=>M.name==="value")?.value||"",E=b.find(M=>M.name==="dateFormat")?.value||"";n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,dateFormat:E,value:T?[{value:T}]:null,placeholder:B}})}});break;case me.ControlType.NUMBER:new je({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:b=>{const B=b.find(E=>E.name==="placeholder")?.value;if(!B)return;const T=b.find(E=>E.name==="value")?.value||"";n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,value:T?[{value:T}]:null,placeholder:B}})}});break}}return t.onMounted(()=>{window.addEventListener("click",R=>{const b=i.value?.querySelector(".visible");!b||b.contains(R.target)||b.classList.remove("visible")},{capture:!0}),n.editor&&(n.editor.listener.rangeStyleChange=R=>{t.nextTick(()=>{if(R.type===me.ElementType.TEXT){const b=i.value,B=b.querySelector(".menu-item__font .select");B&&(B.textContent=R.font);const T=b.querySelector(".menu-item__size .select");if(T){const D={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};T.textContent=D[R.size]||"小四"}const E=b.querySelector(".menu-item__bold");E&&E.classList.toggle("active",R.bold);const M=b.querySelector(".menu-item__italic");M&&M.classList.toggle("active",R.italic);const P=b.querySelector(".menu-item__underline");P&&P.classList.toggle("active",R.underline);const F=b.querySelector(".menu-item__strikeout");F&&F.classList.toggle("active",R.strikeout);const q=b.querySelector(".menu-item__color span");q&&(q.style.backgroundColor=R.color||"#000000");const L=b.querySelector(".menu-item__highlight span");L&&(L.style.backgroundColor=R.highlight);const O=b.querySelector(".menu-item__title .select");if(O){const D={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};O.textContent=D[R.level]||"正文"}["left","center","right","alignment","justify"].forEach(D=>{const K=b.querySelector(`.menu-item__${D}`);K&&K.classList.toggle("active",R.rowFlex===D)})}})})}),e({getHeight:o,getWidth:s}),(R,b)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"dom",ref:i,class:"unione-rich-toolbar menu","editor-component":"menu"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(B,T)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[B=="Undo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__undo",key:B,title:`撤销(${t.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:b[0]||(b[0]=E=>c("Undo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Yr)})`})},null,4)],8,$c)):t.createCommentVNode("",!0),B=="Redo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__redo",key:B,title:`重做(${t.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:b[1]||(b[1]=E=>c("Redo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Hr)})`})},null,4)],8,Pc)):t.createCommentVNode("",!0),B=="Painter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__painter",key:B,title:"格式刷(双击可连续使用)",onClick:u,onDblclick:m},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Gr)})`})},null,4)],32)):t.createCommentVNode("",!0),B=="Format"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__format",key:B,title:"清除格式",onClick:b[2]||(b[2]=E=>c("Format")),"data-item":"Format"},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Jr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Divider"?(t.openBlock(),t.createElementBlock("div",{class:"menu-divider",key:B+T,"data-item":"Divider"})):t.createCommentVNode("",!0),B=="Font"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__font",onClick:b[19]||(b[19]=E=>d("menu-item__font",E)),style:{display:"none"},key:B},[b[99]||(b[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:b[3]||(b[3]=E=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),t.createElementVNode("li",{onClick:b[4]||(b[4]=E=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),t.createElementVNode("li",{onClick:b[5]||(b[5]=E=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),t.createElementVNode("li",{onClick:b[6]||(b[6]=E=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),t.createElementVNode("li",{onClick:b[7]||(b[7]=E=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:b[8]||(b[8]=E=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),t.createElementVNode("li",{onClick:b[9]||(b[9]=E=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:b[10]||(b[10]=E=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),t.createElementVNode("li",{onClick:b[11]||(b[11]=E=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),t.createElementVNode("li",{onClick:b[12]||(b[12]=E=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),t.createElementVNode("li",{onClick:b[13]||(b[13]=E=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),t.createElementVNode("li",{onClick:b[14]||(b[14]=E=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),t.createElementVNode("li",{onClick:b[15]||(b[15]=E=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),t.createElementVNode("li",{onClick:b[16]||(b[16]=E=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),t.createElementVNode("li",{onClick:b[17]||(b[17]=E=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),t.createElementVNode("li",{onClick:b[18]||(b[18]=E=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):t.createCommentVNode("",!0),B=="Size"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size",onClick:b[36]||(b[36]=E=>d("menu-item__size",E)),key:B},[b[100]||(b[100]=t.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),t.createElementVNode("div",Lc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:b[20]||(b[20]=E=>c("Size",56))},"初号"),t.createElementVNode("li",{onClick:b[21]||(b[21]=E=>c("Size",48))},"小初"),t.createElementVNode("li",{onClick:b[22]||(b[22]=E=>c("Size",34))},"一号"),t.createElementVNode("li",{onClick:b[23]||(b[23]=E=>c("Size",32))},"小一"),t.createElementVNode("li",{onClick:b[24]||(b[24]=E=>c("Size",29))},"二号"),t.createElementVNode("li",{onClick:b[25]||(b[25]=E=>c("Size",24))},"小二"),t.createElementVNode("li",{onClick:b[26]||(b[26]=E=>c("Size",21))},"三号"),t.createElementVNode("li",{onClick:b[27]||(b[27]=E=>c("Size",20))},"小三"),t.createElementVNode("li",{onClick:b[28]||(b[28]=E=>c("Size",18))},"四号"),t.createElementVNode("li",{onClick:b[29]||(b[29]=E=>c("Size",16))},"小四"),t.createElementVNode("li",{onClick:b[30]||(b[30]=E=>c("Size",14))},"五号"),t.createElementVNode("li",{onClick:b[31]||(b[31]=E=>c("Size",12))},"小五"),t.createElementVNode("li",{onClick:b[32]||(b[32]=E=>c("Size",10))},"六号"),t.createElementVNode("li",{onClick:b[33]||(b[33]=E=>c("Size",8))},"小六"),t.createElementVNode("li",{onClick:b[34]||(b[34]=E=>c("Size",7))},"七号"),t.createElementVNode("li",{onClick:b[35]||(b[35]=E=>c("Size",6))},"八号")])])])):t.createCommentVNode("",!0),B=="SizeAdd"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:b[37]||(b[37]=E=>c("SizeAdd")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Xr)})`})},null,4)])):t.createCommentVNode("",!0),B=="SizeMinus"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:b[38]||(b[38]=E=>c("SizeMinus")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Zr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Bold"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:b[39]||(b[39]=E=>c("Bold")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ec)})`})},null,4)])):t.createCommentVNode("",!0),B=="Italic"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:b[40]||(b[40]=E=>c("Italic")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(tc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Underline"?(t.openBlock(),t.createElementBlock("div",{title:`下划线(${t.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:b[46]||(b[46]=E=>d("menu-item__underline",E)),"data-item":"Underline",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(nc)})`})},null,4),b[101]||(b[101]=t.createElementVNode("span",{class:"select"},null,-1)),t.createElementVNode("div",jc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-decoration-style":"solid",onClick:b[41]||(b[41]=E=>c("Underline",{style:"solid"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"double",onClick:b[42]||(b[42]=E=>c("Underline",{style:"double"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Oc)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dashed",onClick:b[43]||(b[43]=E=>c("Underline",{style:"dashed"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dotted",onClick:b[44]||(b[44]=E=>c("Underline",{style:"dotted"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(jl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"wavy",onClick:b[45]||(b[45]=E=>c("Underline",{style:"wavy"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(_c)})`})},null,4)])])])],8,Uc)):t.createCommentVNode("",!0),B=="Strikeout"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:b[47]||(b[47]=E=>c("Strikeout")),"data-item":"Strikeout",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ic)})`})},null,4)])):t.createCommentVNode("",!0),B=="Superscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:b[48]||(b[48]=E=>c("Superscript")),"data-item":"Superscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(lc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Subscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:b[49]||(b[49]=E=>c("Subscript")),"data-item":"Subscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(oc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Color"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:C,"data-item":"Color",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(sc)})`})},null,4),b[102]||(b[102]=t.createElementVNode("span",null,null,-1)),b[103]||(b[103]=t.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):t.createCommentVNode("",!0),B=="Highlight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:x,"data-item":"Highlight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ac)})`})},null,4),b[104]||(b[104]=t.createElementVNode("span",null,null,-1)),b[105]||(b[105]=t.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):t.createCommentVNode("",!0),B=="Title"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__title",onClick:b[57]||(b[57]=E=>d("menu-item__title",E)),"data-item":"Title",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(rc)})`})},null,4),b[106]||(b[106]=t.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),t.createElementVNode("div",zc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{style:{"font-size":"16px"},onClick:b[50]||(b[50]=E=>c("Title",null))},"正文"),t.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:b[51]||(b[51]=E=>c("Title","first"))},"标题1"),t.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:b[52]||(b[52]=E=>c("Title","second"))},"标题2"),t.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:b[53]||(b[53]=E=>c("Title","third"))},"标题3"),t.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:b[54]||(b[54]=E=>c("Title","fourth"))},"标题4"),t.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:b[55]||(b[55]=E=>c("Title","fifth"))},"标题5"),t.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:b[56]||(b[56]=E=>c("Title","sixth"))},"标题6")])])])):t.createCommentVNode("",!0),B=="RowFlexLeft"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__left",onClick:b[58]||(b[58]=E=>c("RowFlex","left")),title:`左对齐(${t.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(cc)})`})},null,4)],8,qc)):t.createCommentVNode("",!0),B=="RowFlexCenter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__center",onClick:b[59]||(b[59]=E=>c("RowFlex","center")),title:`居中对齐(${t.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(dc)})`})},null,4)],8,Qc)):t.createCommentVNode("",!0),B=="RowFlexRight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__right",onClick:b[60]||(b[60]=E=>c("RowFlex","right")),title:`右对齐(${t.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(hc)})`})},null,4)],8,Wc)):t.createCommentVNode("",!0),B=="RowFlexAlignment"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:b[61]||(b[61]=E=>c("RowFlex","alignment")),title:`两端对齐(${t.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(fc)})`})},null,4)],8,Kc)):t.createCommentVNode("",!0),B=="RowFlexJustify"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:b[62]||(b[62]=E=>c("RowFlex","justify")),title:`分散对齐(${t.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(uc)})`})},null,4)],8,Yc)):t.createCommentVNode("",!0),B=="RowMargin"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:b[71]||(b[71]=E=>d("menu-item__row-margin",E)),"data-item":"RowMargin",key:B},[t.createElementVNode("i",{title:"行间距",style:t.normalizeStyle({backgroundImage:`url(${t.unref(pc)})`})},null,4),t.createElementVNode("div",Hc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-rowmargin":"1",onClick:b[63]||(b[63]=E=>c("RowMargin",1))},"1"),t.createElementVNode("li",{"data-rowmargin":"1.25",onClick:b[64]||(b[64]=E=>c("RowMargin",1.25))},"1.25"),t.createElementVNode("li",{"data-rowmargin":"1.5",onClick:b[65]||(b[65]=E=>c("RowMargin",1.5))},"1.5"),t.createElementVNode("li",{"data-rowmargin":"1.75",onClick:b[66]||(b[66]=E=>c("RowMargin",1.75))},"1.75"),t.createElementVNode("li",{"data-rowmargin":"2",onClick:b[67]||(b[67]=E=>c("RowMargin",2))},"2"),t.createElementVNode("li",{"data-rowmargin":"2.5",onClick:b[68]||(b[68]=E=>c("RowMargin",2.5))},"2.5"),t.createElementVNode("li",{"data-rowmargin":"3",onClick:b[69]||(b[69]=E=>c("RowMargin",3))},"3"),t.createElementVNode("li",{"data-rowmargin":"5",onClick:b[70]||(b[70]=E=>c("RowMargin",5))},"5")])])])):t.createCommentVNode("",!0),B=="List"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__list",onClick:b[77]||(b[77]=E=>d("menu-item__list",E)),key:B},[t.createElementVNode("i",{title:"列表",style:t.normalizeStyle({backgroundImage:`url(${t.unref(mc)})`})},null,4),t.createElementVNode("div",Gc,[t.createElementVNode("ul",null,[b[112]||(b[112]=t.createElementVNode("li",null,[t.createElementVNode("label",null,"取消列表")],-1)),t.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:b[72]||(b[72]=E=>c("List",["ol","decimal"]))},b[107]||(b[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:b[73]||(b[73]=E=>c("List",["ul","checkbox"]))},b[108]||(b[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:b[74]||(b[74]=E=>c("List",["ul","disc"]))},b[109]||(b[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:b[75]||(b[75]=E=>c("List",["ul","circle"]))},b[110]||(b[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:b[76]||(b[76]=E=>c("List",["ul","square"]))},b[111]||(b[111]=[t.createElementVNode("label",null,"空心方块列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[t.createElementVNode("li",null,"________")],-1)]))])])])):t.createCommentVNode("",!0),B=="Table"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__table",onClick:A,key:B},[t.createElementVNode("i",{title:"表格",style:t.normalizeStyle({backgroundImage:`url(${t.unref(bc)})`})},null,4),b[113]||(b[113]=t.createStaticVNode('<div class="menu-item__table__collapse" data-v-9be2b83f><div class="table-close" data-v-9be2b83f>×</div><div class="table-title" data-v-9be2b83f><span class="table-select" data-v-9be2b83f>插入</span><span data-v-9be2b83f>表格</span></div><div class="table-panel" data-v-9be2b83f><table data-v-9be2b83f><tbody data-v-9be2b83f><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr></tbody></table></div></div>',1))])):t.createCommentVNode("",!0),B=="Image"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__image",onClick:V,key:B},[t.createElementVNode("i",{title:"图片",style:t.normalizeStyle({backgroundImage:`url(${t.unref(gc)})`})},null,4),b[114]||(b[114]=t.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):t.createCommentVNode("",!0),B=="Hyperlink"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:B},[t.createElementVNode("i",{title:"超链接",style:t.normalizeStyle({backgroundImage:`url(${t.unref(kc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Separator"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:b[84]||(b[84]=E=>d("menu-item__separator",E)),key:B},[t.createElementVNode("i",{title:"分割线",style:t.normalizeStyle({backgroundImage:`url(${t.unref(yc)})`})},null,4),t.createElementVNode("div",Jc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-separator":"0,0",onClick:b[78]||(b[78]=E=>c("Separator",[0,0]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ll)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"1,1",onClick:b[79]||(b[79]=E=>c("Separator",[1,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(jl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"3,1",onClick:b[80]||(b[80]=E=>c("Separator",[3,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"4,4",onClick:b[81]||(b[81]=E=>c("Separator",[4,4]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Mc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:b[82]||(b[82]=E=>c("Separator",[7,3,3,3]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:b[83]||(b[83]=E=>c("Separator",[6,2,2,2,2,2]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Fc)})`})},null,4)])])])])):t.createCommentVNode("",!0),B=="Watermark"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:b[87]||(b[87]=E=>d("menu-item__watermark",E)),key:B},[t.createElementVNode("i",{title:"水印(添加、删除)",style:t.normalizeStyle({backgroundImage:`url(${t.unref(wc)})`})},null,4),t.createElementVNode("div",Xc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-menu":"add",onClick:b[85]||(b[85]=E=>p("add"))},"添加水印"),t.createElementVNode("li",{"data-menu":"delete",onClick:b[86]||(b[86]=E=>p("delete"))},"删除水印")])])])):t.createCommentVNode("",!0),B=="Codeblock"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:S,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ac)})`})},null,4)])):t.createCommentVNode("",!0),B=="PageBreak"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(xc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Control"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__control",onClick:b[94]||(b[94]=E=>d("menu-item__control",E)),key:B},[t.createElementVNode("i",{title:"控件",style:t.normalizeStyle({backgroundImage:`url(${t.unref(vc)})`})},null,4),t.createElementVNode("div",Zc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-control":"text",onClick:b[88]||(b[88]=E=>N("text"))},"文本"),t.createElementVNode("li",{"data-control":"number",onClick:b[89]||(b[89]=E=>N("number"))},"数值"),t.createElementVNode("li",{"data-control":"select",onClick:b[90]||(b[90]=E=>N("select"))},"列举"),t.createElementVNode("li",{"data-control":"date",onClick:b[91]||(b[91]=E=>N("date"))},"日期"),t.createElementVNode("li",{"data-control":"checkbox",onClick:b[92]||(b[92]=E=>N("checkbox"))},"复选框"),t.createElementVNode("li",{"data-control":"radio",onClick:b[93]||(b[93]=E=>N("radio"))},"单选框")])])])):t.createCommentVNode("",!0),B=="Checkbox"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:b[95]||(b[95]=E=>w("checkbox")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Cc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Radio"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:b[96]||(b[96]=E=>w("radio")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Sc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Latex"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:g,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Bc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Date"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__date",onClick:b[97]||(b[97]=E=>v("menu-item__date",E)),key:B},[t.createElementVNode("i",{title:"日期",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Nc)})`})},null,4),b[115]||(b[115]=t.createElementVNode("div",{class:"options"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),t.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):t.createCommentVNode("",!0),B=="Block"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:y,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Vc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Search"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:_,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Rc)})`})},null,4)])):t.createCommentVNode("",!0),B=="SearchCollapse"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:B},[t.createElementVNode("div",ed,[b[116]||(b[116]=t.createElementVNode("input",{type:"text"},null,-1)),b[117]||(b[117]=t.createElementVNode("label",{class:"search-result"},null,-1)),t.createElementVNode("div",td,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ic)})`})},null,4)]),t.createElementVNode("div",nd,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Dc)})`})},null,4)]),b[118]||(b[118]=t.createElementVNode("span",null,"×",-1))]),b[119]||(b[119]=t.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[t.createElementVNode("input",{type:"text"}),t.createElementVNode("button",null,"替换")],-1))])):t.createCommentVNode("",!0),B=="Print"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:b[98]||(b[98]=E=>c("Print")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ec)})`})},null,4)])):t.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-9be2b83f"]]),ld=le(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 n=a,i=t.useModel(a,"value"),l=t.ref(!1),o=t.computed(()=>n.editor?.widget(n.wid)||n.widget||{}),s=t.computed(()=>n.editor?.model.value||n.model);t.computed(()=>o.value.props||{});const r=t.ref(),c=t.ref(),d=t.ref(),h=t.ref();t.onMounted(()=>{t.nextTick(()=>{f()}),window.addEventListener("click",()=>{l.value=!1})});function f(){const u=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;console.log("width:"+u+",height:"+m),s.value!="view"&&(n.options.autoHeight?d.value.style.minHeight=m+2+"px":d.value.style.height=m+2+"px");const g={mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:u,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...JSON.parse(JSON.stringify(n.options))};s.value=="view"&&(g.margins=[0,0,0,0]),h.value=new me.Editor(d.value,[],g),h.value.listener.contentChange=()=>{h.value.command.getValueAsync().then(({data:w})=>{i.value=JSON.stringify(w)})},i.value&&(typeof i.value=="string"?h.value.command.executeSetValue(JSON.parse(i.value)):Object.keys(i.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(i.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}return t.watch(i,()=>{l.value==!1&&i.value&&h.value&&(typeof i.value=="string"?h.value.command.executeSetValue(JSON.parse(i.value)):Object.keys(i.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(i.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}),t.watch(s,()=>{h.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(u,m)=>(t.openBlock(),t.createBlock(ft,{class:"unione-rich-text",model:n.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=t.withModifiers(g=>l.value=!0,["stop"]))},{default:t.withCtx(()=>[(s.value=="edit"||s.value=="run")&&h.value?(t.openBlock(),t.createBlock(id,{key:0,ref_key:"canvasMenuDom",ref:c,editor:h.value,items:a.toolbar},null,8,["editor","items"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"canvasEditorDom",ref:d,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-8ba7910c"]]),od={class:"page-setting-dialog"},xt=t.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const n=a,i=t.computed(()=>n.editor?.model?.value),l=Y.useSession(),o=t.computed(()=>l.getPrincipal()),s=t.ref(!1);t.provide("closeSetting",()=>{n.editor?.save().then(u=>{s.value=!1})});function r(){s.value=!0}function c(){n.editor?.save().then(u=>{console.log("res",u)})}function d(){n.editor?.save().then(u=>{console.log("res",u)})}const h=t.ref("");function f(u){h.value||(h.value=i.value),u?n.editor?.setModel("edit"):n.editor?.setModel(h.value)}return(u,m)=>{const g=t.resolveComponent("SettingOutlined"),w=t.resolveComponent("a-tooltip"),v=t.resolveComponent("SaveOutlined"),y=t.resolveComponent("FormOutlined"),A=t.resolveComponent("StopOutlined"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle},{default:t.withCtx(()=>[t.createVNode(g,{class:"page-setting",onClick:r})]),_:1},8,["title"])):t.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:1,title:"保存页面"},{default:t.withCtx(()=>[t.createVNode(v,{class:"btn-save",onClick:c})]),_:1})):t.createCommentVNode("",!0),i.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:2,title:"编辑页面"},{default:t.withCtx(()=>[t.createVNode(y,{class:"btn-edit",onClick:m[0]||(m[0]=k=>f(!0))})]),_:1})):t.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:3,title:"退出编辑"},{default:t.withCtx(()=>[t.createVNode(A,{class:"btn-edit",onClick:m[1]||(m[1]=k=>f(!1))})]),_:1})):t.createCommentVNode("",!0),t.renderSlot(u.$slots,"default"),i.value=="edit"?(t.openBlock(),t.createBlock(V,{key:4,title:n.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:d},{default:t.withCtx(()=>[t.createElementVNode("div",od,[t.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),sd={class:"unione-props-setting data-field-manage"},ad={key:0},rd={key:1},cd={key:2},dd={key:3},hd={key:4},fd={key:5},ud={key:6},pd=["onClick"],md=["onClick"],gd=["onClick"],bd={key:1},kd=le(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),n=t.useModel(a,"modelValue"),i=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const g=[];n.value.forEach(w=>{!u.includes(w.name)&&i.value.selectedRowKeys.includes(w.name)&&g.push(w.name)}),g.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(w=>!g.includes(w)))})}}),l={mounted:u=>u.focus()},o=t.ref({});function s(){const u=Object.keys(o.value);if(u.length)for(let m in u){const g=n.value.filter(w=>w.name==m);if(g&&g[0]){let w=o.value[m];Object.keys(w).forEach(v=>{g[0][v]=w[v]})}}o.value={}}function r(u,m){s();const g={};g[m]=u[m]||"",o.value[u.name]=g}function c(u,m){if(!u||!m){o.value={};return}const g=o.value[u.name][m];if(m=="name"&&n.value.filter(v=>v[m]==g&&v.name!=u.name).length>0){oe.Modal.warn({title:"提示信息",content:"字段名称["+g+"]已存在"});return}u[m]=g,o.value={}}function d(u,m){n.value.filter(w=>w.name==u.name).forEach(w=>{w[m]=!w[m]})}function h(){if(s(),n.value.filter(g=>g.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};n.value.push(m),o.value[m.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){oe.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}oe.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{n.value=n.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const g=t.resolveComponent("a-button"),w=t.resolveComponent("a-tooltip"),v=t.resolveComponent("a-input"),y=t.resolveComponent("a-input-number"),A=t.resolveComponent("a-select-option"),V=t.resolveComponent("a-select"),k=t.resolveComponent("a-checkbox"),p=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",sd,[t.createVNode(g,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:t.withCtx(()=>m[1]||(m[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(g,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:t.withCtx(()=>m[2]||(m[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(p,{columns:e.value,"data-source":n.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:t.withCtx(({column:S})=>[S.key==="name"?(t.openBlock(),t.createElementBlock("span",ad,[m[3]||(m[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="title"?(t.openBlock(),t.createElementBlock("span",rd,[m[4]||(m[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="descs"?(t.openBlock(),t.createElementBlock("span",cd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataLen"?(t.openBlock(),t.createElementBlock("span",dd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataPrec"?(t.openBlock(),t.createElementBlock("span",hd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="defaultValue"?(t.openBlock(),t.createElementBlock("span",fd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataType"?(t.openBlock(),t.createElementBlock("span",ud,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="isPk"?(t.openBlock(),t.createBlock(w,{key:7,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[m[5]||(m[5]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isFk"?(t.openBlock(),t.createBlock(w,{key:8,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isNull"?(t.openBlock(),t.createBlock(w,{key:9,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="syncDbEnable"?(t.openBlock(),t.createBlock(w,{key:10,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:S,text:_,record:C})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:o.value[C.name][S.dataIndex],"onUpdate:value":x=>o.value[C.name][S.dataIndex]=x,onBlur:x=>c(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_||" "),1)],64))],10,pd)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[C.name][S.dataIndex],"onUpdate:value":x=>o.value[C.name][S.dataIndex]=x,onBlur:x=>c(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_||" "),1)],64))],10,md)):["dataType"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(V,{key:0,value:C[S.dataIndex],"onUpdate:value":x=>C[S.dataIndex]=x,onBlur:m[0]||(m[0]=x=>c())},{default:t.withCtx(()=>[t.createVNode(A,{key:"String",value:"String"}),t.createVNode(A,{key:"Long",value:"Long"}),t.createVNode(A,{key:"Short",value:"Short"}),t.createVNode(A,{key:"Integer",value:"Integer"}),t.createVNode(A,{key:"Float",value:"Float"}),t.createVNode(A,{key:"Double",value:"Double"}),t.createVNode(A,{key:"Date",value:"Date"}),t.createVNode(A,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",bd,t.toDisplayString(_),1))],10,gd)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:3,checked:C[S.dataIndex],onClick:x=>d(C,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:4,checked:!C[S.dataIndex],onClick:x=>d(C,S.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),yd={class:"unione-props-setting data-field-setting"},wd={key:0},Ad=["onClick"],xd={class:"field-txt"},vd=["onClick"],Cd={key:1,class:"field-txt"},Sd=["onClick"],Bd={key:1},Nd=["onClick"],Vd={key:0,class:"field-txt"},Rd={key:4,class:"edit-field"},Ed={key:0},Od=["onClick"],_d=le(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:y})=>y+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.useModel(a,"modelValue"),i={mounted:y=>y.focus()},l=t.ref({});function o(){const y=Object.keys(l.value);if(y.length)for(let A in y){const V=n.value.filter(k=>k.name==A);if(V&&V[0]){let k=l.value[A];Object.keys(k).forEach(p=>{p=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=k[p]):V[0][p]=k[p]})}}l.value={}}function s(y,A){o();const V={};A=="convertName"?(y.convert||(y.convert={}),V[A]=y.convert?.type):V[A]=y[A]||"",l.value[y.name]=V}function r(y,A){{l.value={};return}}function c(y,A){n.value.filter(k=>k.name==y.name).forEach(k=>{k[A]=!k[A]})}const d=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function h(y,A){const V=n.value.filter(p=>p.name==y.name);V.forEach(p=>{A!="isSort"?p[A]=!0:p[A]=!p[A]});const k=V[0];if(!(!k||A=="isSort")){switch(d.value.prop=A,d.value.field=y,k.show||(k.show={}),A){case"isQuery":k.show.query||(k.show.query={}),d.value.show=k.show.query,d.value.title=`查询设置/${y.title}(${y.name})`;break;case"isForm":k.show.form||(k.show.form={}),d.value.show=k.show.form,d.value.title=`表单设置/${y.title}(${y.name})`;break;case"isView":k.show.view||(k.show.view={}),d.value.show=k.show.view,d.value.title=`详情设置/${y.title}(${y.name})`;break;case"isList":k.show.list||(k.show.list={}),d.value.show=k.show.list,d.value.title=`列头设置/${y.title}(${y.name})`;break}d.value.visible=!0}}const f=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:y=>{const A=f.value.options.filter(V=>V.value==y);return A[0]?A[0].label:y}}),u=t.ref({visible:!1,field:{},props:{},showInfo:y=>{let A="";return y.rules&&(A=y.rules.filter(V=>V.enable).length||""),A&&(A="("+A+")"),A},toSetting:()=>{const y=u.value.props,A={name:"range",trigger:y.trigger,whitespace:y.whitespace,message:y.rangeMessage};y.rangeMin!=null&&y.rangeMin!=null&&(A.min=y.rangeMin,A.enable=!0),y.rangeMax!=null&&y.rangeMax!=null&&(A.max=y.rangeMax,A.enable=!0);const V={name:"reg",trigger:y.trigger,whitespace:y.whitespace,message:y.regMessage};y.regExpress&&(V.pattern=y.regExpress,V.enable=!0),u.value.field.rules=[A,V],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(y){u.value.visible=!0,u.value.field=y;const A=y.rules||[],V={trigger:"change",whitespace:!0};A.forEach(k=>{k.name=="reg"&&(V.trigger=k.trigger,V.whitespace=k.whitespace,V.regExpress=k.pattern,V.regMessage=k.message),k.name=="range"&&(V.rangeMin=k.min,V.rangeMax=k.max,V.rangeMessage=k.message)}),u.value.props=V}const g=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:y=>{const A=g.value.widgets.filter(V=>V.value==y);return A[0]?A[0].label:y},toSetting:()=>{}}),w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(y,A)=>{w.value.convert.options.splice(y,1)},toSetting:()=>{w.value.visible=!1}});function v(y){w.value.visible=!0,w.value.field=y,w.value.convert=y.convert||{}}return(y,A)=>{const V=t.resolveComponent("ToolOutlined"),k=t.resolveComponent("a-button"),p=t.resolveComponent("a-select"),S=t.resolveComponent("a-checkbox"),_=t.resolveComponent("a-table"),C=t.resolveComponent("a-input-number"),x=t.resolveComponent("a-form-item"),N=t.resolveComponent("a-input"),R=t.resolveComponent("a-form"),b=t.resolveComponent("a-modal"),B=t.resolveComponent("a-col"),T=t.resolveComponent("a-row"),E=t.resolveComponent("a-select-option"),M=t.resolveComponent("a-divider"),P=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createElementBlock("div",yd,[t.createVNode(_,{columns:e.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:F})=>[["widget","queryType","rules","convertName"].includes(F.key)?(t.openBlock(),t.createElementBlock("span",wd,[t.createVNode(V),t.createTextVNode(" "+t.toDisplayString(F.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:F,text:q,record:L})=>[["rules"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!u.value.showInfo(L)&&"empty"]),onClick:O=>m(L)},[t.createElementVNode("span",xd,t.toDisplayString(u.value.showInfo(L)),1),u.value.showInfo(L)?(t.openBlock(),t.createBlock(k,{key:0,type:"link"},{default:t.withCtx(()=>A[22]||(A[22]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,Ad)):["widget"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(F.dataIndex))&&!q&&"empty"]),onClick:O=>s(L,F.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L[F.dataIndex],"onUpdate:value":O=>L[F.dataIndex]=O,allowClear:!0,options:g.value.widgets,onBlur:A[0]||(A[0]=O=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(t.openBlock(),t.createElementBlock("span",Cd,t.toDisplayString(g.value.widgetName(q)),1))],10,vd)):["queryType"].includes(F.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(F.dataIndex))&&!q&&"empty"]),onClick:O=>s(L,F.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L[F.dataIndex],"onUpdate:value":O=>L[F.dataIndex]=O,allowClear:!0,options:f.value.options,onBlur:A[1]||(A[1]=O=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(t.openBlock(),t.createElementBlock("span",Bd,t.toDisplayString(f.value.showLabel(q)),1))],10,Sd)):t.createCommentVNode("",!0)],64)):["convertName"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(F.dataIndex))&&!L.convert?.type&&"empty"]),onClick:O=>s(L,F.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(F.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L.convert.type,"onUpdate:value":O=>L.convert.type=O,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:A[2]||(A[2]=O=>r())},null,8,["value","onUpdate:value"])),[[i]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[L.convert?.type?(t.openBlock(),t.createElementBlock("span",Vd,t.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),L.convert?.type?(t.openBlock(),t.createBlock(k,{key:1,type:"link",onClick:t.withModifiers(O=>v(L),["stop"])},{default:t.withCtx(()=>A[23]||(A[23]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Nd)):["isQuery","isForm","isView","isList","isSort"].includes(F.dataIndex)?(t.openBlock(),t.createElementBlock("div",Rd,[t.createVNode(S,{checked:L[F.dataIndex],onClick:O=>c(L,F.dataIndex)},null,8,["checked","onClick"]),t.createVNode(k,{type:"link",onClick:O=>h(L,F.dataIndex)},{default:t.withCtx(()=>A[24]||(A[24]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(b,{visible:d.value.visible,"onUpdate:visible":A[9]||(A[9]=F=>d.value.visible=F),title:d.value.title,onOk:d.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(x,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(C,{value:d.value.show.index,"onUpdate:value":A[3]||(A[3]=F=>d.value.show.index=F)},null,8,["value"])]),_:1}),["isQuery"].includes(d.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.width,"onUpdate:value":A[4]||(A[4]=F=>d.value.show.width=F)},null,8,["value"])]),_:1})),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.labelWidth,"onUpdate:value":A[5]||(A[5]=F=>d.value.show.labelWidth=F)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.valueWidth,"onUpdate:value":A[6]||(A[6]=F=>d.value.show.valueWidth=F)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.fixed,"onUpdate:value":A[7]||(A[7]=F=>d.value.show.fixed=F),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.align,"onUpdate:value":A[8]||(A[8]=F=>d.value.show.align=F),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(b,{visible:w.value.visible,"onUpdate:visible":A[11]||(A[11]=F=>w.value.visible=F),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",Ed,[t.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>A[25]||(A[25]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(_,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:F,text:q,record:L,index:O})=>[F.dataIndex==="label"?(t.openBlock(),t.createBlock(N,{key:0,value:L.label,"onUpdate:value":ee=>L.label=ee,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),F.dataIndex==="value"?(t.openBlock(),t.createBlock(N,{key:1,value:L.value,"onUpdate:value":ee=>L.value=ee,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),F.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:ee=>w.value.toDelOption(O,L)},"删除",8,Od)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(R,{key:1,model:w.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(T,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(B,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(x,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(N,{value:w.value.convert.dict,"onUpdate:value":A[10]||(A[10]=F=>w.value.convert.dict=F)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(b,{visible:g.value.visible,"onUpdate:visible":A[13]||(A[13]=F=>g.value.visible=F),title:"控件设置",onOk:g.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:g.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[g.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(x,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(p,{value:g.value.props.mode,"onUpdate:value":A[12]||(A[12]=F=>g.value.props.mode=F),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(E,{value:"multiple"},{default:t.withCtx(()=>A[26]||(A[26]=[t.createTextVNode("多选")])),_:1}),t.createVNode(E,{value:"tags"},{default:t.withCtx(()=>A[27]||(A[27]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(b,{visible:u.value.visible,"onUpdate:visible":A[21]||(A[21]=F=>u.value.visible=F),title:"规则设置",onOk:u.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[28]||(A[28]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(x,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(P,{value:u.value.props.trigger,"onUpdate:value":A[14]||(A[14]=F=>u.value.props.trigger=F),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(S,{value:u.value.props.whitespace,"onUpdate:value":A[15]||(A[15]=F=>u.value.props.whitespace=F),checked:u.value.props.whitespace},{default:t.withCtx(()=>A[29]||(A[29]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[30]||(A[30]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(x,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":A[16]||(A[16]=F=>u.value.props.rangeMin=F)},null,8,["value"]),A[31]||(A[31]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":A[17]||(A[17]=F=>u.value.props.rangeMax=F)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":A[18]||(A[18]=F=>u.value.props.rangeMessage=F)},null,8,["value"])]),_:1}),t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[32]||(A[32]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(x,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":A[19]||(A[19]=F=>u.value.props.regExpress=F)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":A[20]||(A[20]=F=>u.value.props.regMessage=F)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Md={class:"unione-props-setting data-field"},Td=le(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(n,i)=>{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",Md,[t.createVNode(r,null,{default:t.withCtx(()=>[t.createVNode(o,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(l),i[2]||(i[2]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(kd,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),t.createVNode(o,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(s),i[3]||(i[3]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(_d,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Fd={key:0,class:"data-model-list"},Id=["onClick"],Dd=le(t.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const n=t.computed(()=>l.editor.dataModels()),i=t.ref({sn:"new_",title:"新建数据",fields:[]});t.onMounted(()=>{n.value&&n.value[0]&&(i.value=n.value[0])});const l=a;function o(f){i.value=f}function s(){if(n.value.length>=l.limit){oe.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=Ba.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=t.ref(),d=t.inject("closeSetting");function h(){c.value.validate().then(f=>{d&&d()})}return e({toSaving:h}),(f,u)=>{const m=t.resolveComponent("a-input"),g=t.resolveComponent("a-form-item"),w=t.resolveComponent("a-textarea"),v=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",Fd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,y=>(t.openBlock(),t.createElementBlock("div",{key:y.sn,class:t.normalizeClass(["title",i.value&&i.value.sn==y.sn&&"slt"]),onClick:A=>o(y)},t.toDisplayString(y.title),11,Id))),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(v,{ref_key:"formObj",ref:c,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:t.withCtx(()=>[t.createVNode(g,{label:"数据标题",name:"title",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=y=>i.value.title=y)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"数据名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=y=>i.value.name=y)},null,8,["value"])]),_:1}),t.createVNode(g,{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:i.value.url,"onUpdate:value":u[2]||(u[2]=y=>i.value.url=y)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"数据说明",name:"descs"},{default:t.withCtx(()=>[t.createVNode(w,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=y=>i.value.descs=y)},null,8,["value"])]),_:1})]),_:1},8,["model"]),t.createVNode(Td,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=y=>i.value.fields=y)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),$d={class:"unione-props-setting unione-page-setting"},vt=le(t.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,n=t.ref({});return t.onMounted(()=>{n.value=e.editor.define.value}),(i,l)=>{const o=t.resolveComponent("a-form-item"),s=t.resolveComponent("a-input"),r=t.resolveComponent("a-switch"),c=t.resolveComponent("a-textarea"),d=t.resolveComponent("a-form"),h=t.resolveComponent("a-tab-pane"),f=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",$d,[t.createVNode(f,{type:"card"},{default:t.withCtx(()=>[t.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:t.withCtx(()=>[t.createVNode(d,{model:n.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[n.value.sn&&n.value.sn!="new_"?(t.openBlock(),t.createBlock(o,{key:0,label:"页面编码"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.sn)+"/V"+t.toDisplayString(n.value.vers),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(o,{label:"页面标题",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.title,"onUpdate:value":l[0]||(l[0]=u=>n.value.title=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"页面组件",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.component,"onUpdate:value":l[1]||(l[1]=u=>n.value.component=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"icon图标"},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.icon,"onUpdate:value":l[2]||(l[2]=u=>n.value.icon=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"是否全局"},{default:t.withCtx(()=>[t.createVNode(r,{checked:n.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>n.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"是否模版"},{default:t.withCtx(()=>[t.createVNode(r,{checked:n.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>n.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"页面备注"},{default:t.withCtx(()=>[t.createVNode(c,{value:n.value.descs,"onUpdate:value":l[5]||(l[5]=u=>n.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),t.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:t.withCtx(()=>[t.createVNode(Dd,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),zl=le(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,n={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new lt,l=t.computed(()=>i.$widgetList.value||[]);t.watch(()=>e.pageDefine,s=>{s&&i.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),i.setModel("run"),i.load(o.value,e.pageDefine||n)}),(s,r)=>(t.openBlock(),t.createBlock(xt,{class:"unione-page-view","setting-title":"页面设置",editor:t.unref(i)},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(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[t.unref(i)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Pd={class:"form-btns"},ql=t.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1},storage:{type:Object,required:!1},fields:{type:Array,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1},setting:{type:Object,required:!1}},emits:["submit","save","reset","back","btnClick"],setup(a,{expose:e,emit:n}){const i=t.inject("router"),l=Y.useDialog(),o=a,s=n,r={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-form"};function c(){if(o.fields?.length){const V={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields,setting:o.setting||{}};r.configs.widgets=[V]}o.storage&&(r.configs.dsnList=["primary"],d.dataManager().use("primary","form").store(o.storage)),r.configs.btns=o.btns||[],o.btns==!1&&(r.configs.btns=!1),r.configs.event=o.event||{}}const d=new lt,h=t.computed(()=>d.$widgetList.value||[]),f=t.ref({}),u=t.computed(()=>{const V=d.define.value?.configs?.btns||[],k=V.map(p=>p.name);if(!k.includes("save")){const p={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};V.splice(p.index,0,p)}if(!k.includes("submit")){const p={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let S=p.index||1;V.splice(S,0,p)}if(!k.includes("reset")){const p={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};V.splice(p.index,0,p)}if(!k.includes("back")){const p={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};V.splice(p.index,0,p)}return d.model.value=="view"&&V.filter(p=>["save","submit","reset"].includes(p.name)).forEach(p=>{p.visible=!1}),V});async function m({btn:V,event:k}){if(V.name=="save"){const S=await w();S.success&&S.body&&(f.value.id=S.body),s("save",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value});return}if(V.name=="reset"){v(),s("reset",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="back"){y(),s("back",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="submit"){l.confirm({content:"提交当前表单吗?",onOk:async()=>{const S=await w();S.success&&S.body&&(f.value.id=S.body),s("submit",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value})}});return}const p=await g();s("btnClick",{btn:V,event:k,formData:p})}async function g(){const V=d.dataManager().primary().data(),k=d.dataManager().form();f.value={...V};for(let p in k){const S=d.dataManager().data(p).data();d.dataManager().psn()!=p&&(f.value[p]={...S})}return f.value}async function w(){const V=d.dataManager().form();f.value={};for(let k in V){const p=await V[k].validate();d.dataManager().psn()==k?f.value=p:f.value[k]=p}return d.dataManager().primary().save({data:f.value,params:d.dataManager().params})}function v(V){d.dataManager().primary().reset(V)}function y(){i.back()}t.watch(()=>o.pageDefine,V=>{V&&d.load(A.value,V)});const A=t.ref("new_");return t.onMounted(()=>{const V=t.inject("route");console.log("unione page form route",V),A.value=o.psn||V?.query?.psn||V?.meta?.psn||"new_",console.log("unione page form,psn:"+A.value),d.setModel(V?.query?.model||V?.meta?.model||"run");const k={...o.params||{},...V?.query||{},...V?.params||{}};d.dataManager().params(k),c(),d.load(A.value,o.pageDefine||r)}),e({save:w,toReset:v,toBack:y}),(V,k)=>{const p=t.resolveComponent("unione-btn");return t.openBlock(),t.createBlock(xt,{class:"unione-page-form","setting-title":"页面设置",editor:t.unref(d)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,S=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.widget),{key:S.wid,wid:S.wid,widget:S,editor:t.unref(d)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Pd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.name},[S.visible!=!1?(t.openBlock(),t.createBlock(p,{key:0,widget:S,editor:t.unref(d),ctx:{formData:f.value},onClick:m},null,8,["widget","editor","ctx"])):t.createCommentVNode("",!0)],64))),128))])]),_:2},[t.unref(d)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(d)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ld=["onMouseover"],Ud={key:0,class:"node-opts"},jd={key:2,class:"tree-empty"},zd={class:"form-warp"},qd={class:"form-btns"},Ql=le(t.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:n}){const i=Y.useDialog(),l=t.inject("router"),o=a,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function r(){if(o.fields?.length){const $={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields};s.configs.widgets=[$]}s.configs.dsnList=["primary"],c.dataManager().use("primary","form").store(o.storage),s.configs.btns=o.btns||[],o.btns==!1&&(s.configs.btns=!1),s.configs.opts=o.opts||[],o.opts==!1&&(s.configs.opts=!1),s.configs.event=o.event||{},s.configs.setting=o.setting||{}}const c=new lt,d=t.ref(!1),h=t.ref([]),f=t.ref({}),u=t.ref(null),m=t.ref(null),g=t.ref([]),w=t.ref([]),v=t.ref(0),y=t.computed(()=>{const $={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,autoselect:!1,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...o.setting?.tree||{}};return c.define.value?.configs?.tree||$}),A=t.computed(()=>y.value.searchEnable),V=t.computed(()=>{const $=c.define.value?.configs?.opts;if(typeof $=="boolean"&&$==!1)return!1;const W=($||[]).map(j=>typeof j=="string"?{name:j,visible:!1}:j),X=[];return W.forEach(j=>{X.push(j.name)}),console.log("opts addBtn",W),W.filter(j=>j.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),k=t.computed(()=>{const $=c.define.value?.configs?.opts;if(typeof $=="boolean"&&$==!1)return[];const W=($||[]).map(te=>typeof te=="string"?{name:te,visible:!1}:te),X=[],j=[];return W.forEach(te=>{j.push(te.name),te.name!="add"&&X.push(te)}),j.includes("delete")||X.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),j.includes("child")||X.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",X),X});function p($,W){const{btn:X,event:j}=$;j.stopPropagation();const te=f.value[W[y.value.idField]];if(console.log("onTreeMenuClick,btn:",X),console.log("onTreeMenuClick,node:",W),console.log("onTreeMenuClick,curentNode:",te),X.name=="child"){if(M.value.preCreate&&M.value.preCreate(te)==!1)return;const ue=f.value[te[y.value.idField]];ue.isLeaf=!1,u.value={},u.value[y.value.pidField]=ue[y.value.idField],u.value[y.value.labelField]="新建...",u.value[y.value.idField]="new_"+v.value,u.value.parentNode=ue,v.value=v.value+1,ue.children||(ue.children=[],w.value.push(ue[y.value.idField])),M.value.createNode&&M.value.createNode(u.value,ue,c.dataManager().params()),f.value[u.value[y.value.idField]]=u.value,ue.children.push(u.value),g.value=[u.value[y.value.idField]],c.dataManager().primary().setValue(u.value)}X.name=="delete"&&I(te),q("btnClick",{...$,node:te})}function S($,{expanded:W,node:X}){W&&(u.value=X.dataRef,c.dataManager().primary().setValue(u.value),T())}function _($,W){W.selected?(u.value=W.node.dataRef,c.dataManager().primary().setValue(u.value)):u.value&&(g.value=[u.value[y.value.idField]]),q("treeClick",{keys:$,event:W}),q("select",{keys:$,event:W})}const C=t.computed(()=>{if(o.storage?.orderBy){const $=o.storage.orderBy.split(" ");return[{name:$[0],asc:$[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>o.params,()=>{d.value&&(h.value=[],f.value={},u.value=null,g.value=[],w.value=[],v.value=0,c.dataManager().params(o.params||{}),console.log("params changed props.params",o.params),T())}),t.watch(()=>u.value,()=>{console.log("active node changed",u.value),N(!u.value)});const x=t.ref(null);t.watch(x,()=>{x.value&&u.value&&c.dataManager().primary().setValue(u.value)});function N($=!0){const W=c.dataManager().form();for(let X in W)W[X].setDisabled($)}function R(){if(!(M.value.preCreate&&M.value.preCreate()==!1)){if(u.value={},u.value[y.value.pidField]=-1,u.value[y.value.labelField]="新建...",u.value[y.value.idField]="new_"+v.value,v.value=v.value+1,M.value.createNode&&M.value.createNode(u.value,null,c.dataManager().params()),u.value[y.value.pidField]==-1)h.value.push(u.value);else{const $=f.value[u.value[y.value.pidField]];$?($.children||($.children=[]),$.children.push(u.value)):h.value.push(u.value)}g.value=[u.value[y.value.idField]],f.value[u.value[y.value.idField]]=u.value,c.dataManager().primary().setValue(u.value)}}const b=t.ref(""),B=ut($=>{c.dataManager().primary().find({page:1,pageSize:9999,keywords:$||b.value,needCount:!1,body:y.value.async==!1?null:{},sorts:C.value}).then(W=>{if(f.value={},h.value=[],W.body?.length){const X={};W.body.forEach(j=>{X[j[y.value.idField]]=j}),W.body.forEach(j=>{const te=X[j[y.value.pidField]];te?(te.children||(te.children=[],te.isLeaf=!1),te.children.push(j)):h.value.push(j)})}})},400);function T(){return new Promise(($,W)=>{const X={};if(X[y.value.pidField]=o.params[y.value.pidField]||-1,u.value){if(u.value.children?.length||y.value.async==!1){$(u.value.children);return}X[y.value.pidField]=u.value[y.value.idField],c.dataManager().primary().find({page:1,pageSize:999,body:X,sorts:C.value}).then(j=>{u.value.children=j.body||[],u.value.children.forEach(te=>{te.isLeaf=!!te[y.value.leafField],f.value[te[y.value.idField]]=te,te.parentNode=f.value[te[y.value.pidField]]}),$(j.body)})}else{const j=y.value.async==!1?null:{page:1,pageSize:999,body:X,sorts:C.value};c.dataManager().primary().find(j).then(te=>{if(y.value.async==!1){if(h.value=[],te.body?.length){const ue={};te.body.forEach(We=>{ue[We[y.value.idField]]=We}),te.body.forEach(We=>{const Tt=ue[We[y.value.pidField]];Tt?(Tt.children||(Tt.children=[],Tt.isLeaf=!1),Tt.children.push(We)):h.value.push(We)})}$(te.body)}else h.value=te.body||[],h.value.forEach(ue=>{ue.isLeaf=!!ue[y.value.leafField],f.value[ue[y.value.idField]]=ue}),$(te.body)})}})}const E=t.computed(()=>c.$widgetList.value||[]),M=t.computed(()=>{const $={...c.define.value?.configs?.event||{}};for(const W in $)$[W]&&typeof $[W]!="function"&&$[W].enable&&$[W].scriptText&&(W=="createNode"&&($[W]=new Function("node","parent","params",$[W].scriptText)),W=="preCreate"?$[W]=new Function("parent",$[W].scriptText):$[W]=new Function("data","event",$[W].scriptText));return $}),P=t.computed(()=>c.define.value?.configs?.setting||o.setting||{});t.provide("pageSetting",P.value);const F=t.computed(()=>{const $=c.define.value?.configs?.btns;if(typeof $=="boolean"&&$==!1)return[];const W=(c.define.value?.configs?.btns||[]).map(j=>typeof j=="string"?{name:j,visible:!1}:{size:"default",...j}),X=W.map(j=>j.name);if(!X.includes("save")){const j={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};W.splice(j.index,0,j)}if(!X.includes("reset")){const j={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};W.splice(j.index,0,j)}if(!X.includes("back")){const j={title:"返回",type:"default",index:W.length,visible:!0,size:"default",name:"back"};W.splice(j.index,0,j)}return c.model.value=="view"&&W.filter(j=>["save","submit","reset"].includes(j.name)).forEach(j=>{j.visible=!1}),W}),q=n;function L($){const{btn:W,event:X}=$;W.name=="save"&&O({btn:W,event:X}),W.name=="reset",W.name=="back"&&D(),q("btnClick",$)}async function O($){const W=c.dataManager().form();let X={...u.value};for(let j in W){const te=await W[j].validate();if(c.dataManager().psn()==j)for(let ue in te)X[ue]=te[ue];else X[j]=te}if(X[y.value.pidField]&&(X[y.value.pidField]+"").startsWith("new_")){i.error({content:"请先保存父节点!"});return}X[y.value.idField]&&(X[y.value.idField]+"").startsWith("new_")&&delete X[y.value.idField],delete X.parentNode,delete X.children,X[y.value.leafField]=X[y.value.leafField]?1:0,M.value.preSave&&M.value.preSave(X,$),console.log("=======form data=====",X),c.dataManager().primary().save({data:X}).then(j=>{console.log("save result:",j),u.value[y.value.idField]=j.body,g.value=[j.body],f.value[j.body]=u.value,u.value.children?.forEach(te=>{te[y.value.pidField]=j.body}),M.value.postSaved&&M.value.postSaved(X,$)})}function ee(){}function D(){l.back()}function K(){return c.dataManager().primary()}function fe($){f.value[$[y.value.idField]]={...f.value[$[y.value.idField]],...$}}function U($){return f.value[$]}function I($){M.value.preDelete&&M.value.preDelete($)==!1||($[y.value.idField]&&($[y.value.idField]+"").startsWith("new_")?($.parentNode?$.parentNode.children=$.parentNode.children.filter(W=>W[y.value.idField]!=$[y.value.idField]):h.value=h.value.filter(W=>W[y.value.idField]!=$[y.value.idField]),delete f.value[$[y.value.idField]]):c.dataManager().primary().deleteByIds([$[y.value.idField]]).then(()=>{if($.parentNode){const W=f.value[$[y.value.pidField]];W.children=W.children.filter(X=>X[y.value.idField]!=$[y.value.idField])}else h.value=h.value.filter(W=>W[y.value.idField]!=$[y.value.idField]);delete f.value[$[y.value.idField]]}))}function Z(){h.value=[],f.value={},u.value=null,m.value=null,g.value=[],w.value=[],v.value=0,T().then($=>{if($&&$[0]&&y.value.selectable&&y.value.autoselect){const W={...$[0],dataRef:$[0]};g.value=[$[0].id],q("select",{keys:g.value,event:{node:W}})}})}const Q=t.ref("new_");return t.onMounted(()=>{const $=t.inject("route");console.log("unione page tree route",$),Q.value=o.psn||$?.query?.psn||$?.meta?.psn||"new_",console.log("unione page tree,psn:"+Q.value),c.setModel($?.query?.model||$?.meta?.model||"run");const W={...o.params||{},...$?.query||{},...$?.params||{}};c.dataManager().params(W),r(),c.load(Q.value,s),t.nextTick(()=>{N(!0)}),T().then(X=>{if(X&&X[0]&&y.value.selectable&&y.value.autoselect){const j={...X[0],dataRef:X[0]};g.value=[X[0].id],q("select",{keys:g.value,event:{node:j}})}}),d.value=!0}),e({storage:K,save:O,toBack:D,toReset:ee,setNode:fe,getNode:U,delNode:I,reload:Z}),($,W)=>{const X=t.resolveComponent("SearchOutlined"),j=t.resolveComponent("a-input"),te=t.resolveComponent("unione-btn"),ue=t.resolveComponent("a-badge"),We=t.resolveComponent("a-tree"),Tt=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(xt,{class:"unione-page-tree","setting-title":"页面设置",editor:t.unref(c)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"tree-warp",onContextmenu:W[4]||(W[4]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot($.$slots,"tree-top",{},void 0,!0),A.value?(t.openBlock(),t.createBlock(j,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:b.value,"onUpdate:value":W[0]||(W[0]=pe=>b.value=pe),onChange:t.unref(B),onPressEnter:t.unref(B)},{suffix:t.withCtx(()=>[t.createVNode(X)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),V.value?(t.openBlock(),t.createBlock(te,{key:1,widget:V.value,onClick:R},null,8,["widget"])):t.createCommentVNode("",!0),t.createVNode(We,{"show-line":y.value.showLine,"show-icon":y.value.showIcon,disabled:y.value.disabled,blockNode:!0,draggable:y.value.draggable,multiple:y.value.multiple,selectable:y.value.selectable,checkable:y.value.checkable,fieldNames:{title:y.value.labelField,key:y.value.idField},selectedKeys:g.value,"onUpdate:selectedKeys":W[2]||(W[2]=pe=>g.value=pe),expandedKeys:w.value,"onUpdate:expandedKeys":W[3]||(W[3]=pe=>w.value=pe),"tree-data":h.value,onExpand:S,onSelect:_},t.createSlots({icon:t.withCtx(({dataRef:pe})=>[pe[y.value.iconField]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(pe[y.value.iconField]),{key:0,class:"node-icon"})):t.createCommentVNode("",!0)]),_:2},[k.value?.length?{name:"title",fn:t.withCtx(({dataRef:pe})=>[t.createElementVNode("div",{class:"node-label",onMouseover:()=>m.value=pe,onMouseleave:W[1]||(W[1]=()=>m.value=null)},[t.createVNode(ue,{dot:pe[y.value.badgeDot],count:pe[y.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(pe[y.value.labelField]),1)]),_:2},1032,["dot","count"]),u.value&&u.value[y.value.idField]==pe[y.value.idField]||m.value&&m.value[y.value.idField]==pe[y.value.idField]?(t.openBlock(),t.createElementBlock("div",Ud,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,Ol=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!M.value.btnVisible||M.value.btnVisible(Ol,pe)?(t.openBlock(),t.createBlock(te,{key:Ol.name,widget:Ol,ctx:{node:pe},onClick:Qp=>p(Qp,pe)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],40,Ld)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"]),!h.value||!h.value.length?(t.openBlock(),t.createElementBlock("div",jd,[t.renderSlot($.$slots,"tree-empty",{},()=>[t.createVNode(Tt)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",zd,[t.renderSlot($.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,pe=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(pe.widget),{key:pe.wid,wid:pe.wid,widget:pe,editor:t.unref(c)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",qd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(F.value,pe=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:pe.name},[pe.visible!=!1?(t.openBlock(),t.createBlock(te,{key:0,widget:pe,editor:t.unref(c),disabled:!u.value,ctx:{formData:u.value},onClick:L},null,8,["widget","editor","disabled","ctx"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(c)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(c)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-1d6ecb5e"]]),Qd={class:"left-list"},Wd=["onMouseover","onClick"],Kd={class:"index"},Yd={class:"label"},Hd={key:0,class:"node-opts"},Gd={key:2,class:"left-empty"},Jd={class:"form-warp"},Xd={class:"form-btns"},Wl=le(t.defineComponent({__name:"left",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:n}){Y.useDialog();const i=t.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-left"};function s(){if(l.fields?.length){const U={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[U]}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([]),h=t.ref({}),f=t.ref(null),u=t.ref(null),m=t.ref(0),g=t.computed(()=>{const U={searchEnable:!0,disabled:!1,idField:"id",labelField:"title",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...l.setting?.model||{}};return r.define.value?.configs?.model||U}),w=t.computed(()=>g.value.searchEnable),v=t.computed(()=>{const U=r.define.value?.configs?.opts;if(typeof U=="boolean"&&U==!1)return!1;const I=(U||[]).map(Q=>typeof Q=="string"?{name:Q,visible:!1}:Q),Z=[];return I.forEach(Q=>{Z.push(Q.name)}),console.log("opts addBtn",I),I.filter(Q=>Q.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),y=t.computed(()=>{const U=r.define.value?.configs?.opts;if(typeof U=="boolean"&&U==!1)return[];const I=(U||[]).map($=>typeof $=="string"?{name:$,visible:!1}:$),Z=[],Q=[];return I.forEach($=>{Q.push($.name),$.name!="add"&&Z.push($)}),Q.includes("delete")||Z.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),console.log("opts menuBtn",Z),Z});function A(U,I){const{btn:Z,event:Q}=U;f.value&&(Q.stopPropagation(),V(Q,I),Z.name=="delete"&&D(f.value),E("btnClick",{...U,node:f.value}))}function V(U,I){f.value=I,r.dataManager().primary().setValue(f.value),E("select",{node:f.value,event:U})}const k=t.computed(()=>{if(l.storage?.orderBy){const U=l.storage.orderBy.split(" ");return[{name:U[0],asc:U[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>l.params,()=>{c.value&&(d.value=[],f.value=null,m.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),N())}),t.watch(()=>f.value,()=>{console.log("active node changed",f.value),S(!f.value)});const p=t.ref(null);t.watch(p,()=>{p.value&&f.value&&r.dataManager().primary().setValue(f.value)});function S(U=!0){const I=r.dataManager().form();for(let Z in I)I[Z].setDisabled(U)}function _(U){b.value.preCreate&&b.value.preCreate()==!1||(f.value={},f.value[g.value.labelField]="新建...",m.value=m.value+1,b.value.createNode&&b.value.createNode(f.value,null,r.dataManager().params()),r.dataManager().primary().setValue(f.value),E("btnClick",U))}const C=t.ref(""),x=ut(()=>{N()},400);function N(){return h.value={},new Promise((U,I)=>{const Z={};r.dataManager().primary().find({page:1,pageSize:999,body:Z,keywords:C.value||"",sorts:k.value}).then(Q=>{d.value=Q.body||[],d.value.forEach($=>{h.value[$[g.value.idField]]=$}),U(Q.body)})})}const R=t.computed(()=>r.$widgetList.value||[]),b=t.computed(()=>{const U={...r.define.value?.configs?.event||{}};for(const I in U)U[I]&&typeof U[I]!="function"&&U[I].enable&&U[I].scriptText&&(I=="createNode"&&(U[I]=new Function("node","parent","params",U[I].scriptText)),I=="preCreate"?U[I]=new Function("parent",U[I].scriptText):U[I]=new Function("data","event",U[I].scriptText));return U}),B=t.computed(()=>r.define.value?.configs?.setting||l.setting||{});t.provide("pageSetting",B.value);const T=t.computed(()=>{const U=r.define.value?.configs?.btns;if(typeof U=="boolean"&&U==!1)return[];const I=(r.define.value?.configs?.btns||[]).map(Q=>typeof Q=="string"?{name:Q,visible:!1}:{size:"default",...Q}),Z=I.map(Q=>Q.name);if(!Z.includes("save")){const Q={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};I.splice(Q.index,0,Q)}if(!Z.includes("reset")){const Q={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};I.splice(Q.index,0,Q)}if(!Z.includes("back")){const Q={title:"返回",type:"default",index:I.length,visible:!0,size:"default",name:"back"};I.splice(Q.index,0,Q)}return r.model.value=="view"&&I.filter(Q=>["save","submit","reset"].includes(Q.name)).forEach(Q=>{Q.visible=!1}),I}),E=n;function M(U){const{btn:I,event:Z}=U;I.name=="save"&&P({btn:I,event:Z}),I.name=="reset",I.name=="back"&&q(),E("btnClick",U)}async function P(U){const I=r.dataManager().form();let Z={...f.value};for(let Q in I){const $=await I[Q].validate();if(r.dataManager().psn()==Q)for(let W in $)Z[W]=$[W];else Z[Q]=$}Z[g.value.idField]&&(Z[g.value.idField]+"").startsWith("new_")&&delete Z[g.value.idField],b.value.preSave&&b.value.preSave(Z,U),console.log("=======form data=====",Z),r.dataManager().primary().save({data:Z}).then(Q=>{console.log("save result:",Q),f.value[g.value.idField]=Q.body,Z[g.value.idField]=Q.body,b.value.postSaved&&b.value.postSaved(Z,U)})}function F(){}function q(){i.back()}function L(){return r.dataManager().primary()}function O(U){h.value[U[g.value.idField]]={...h.value[U[g.value.idField]],...U}}function ee(U){return h.value[U]}function D(U){b.value.preDelete&&b.value.preDelete(U)==!1||(U[g.value.idField]&&(U[g.value.idField]+"").startsWith("new_")?(d.value=d.value.filter(I=>I[g.value.idField]!=U[g.value.idField]),delete h.value[U[g.value.idField]]):r.dataManager().primary().deleteByIds([U[g.value.idField]]).then(()=>{d.value=d.value.filter(I=>I[g.value.idField]!=U[g.value.idField]),delete h.value[U[g.value.idField]]}))}function K(){d.value=[],h.value={},f.value=null,u.value=null,m.value=0,N().then(U=>{if(U&&U[0]&&g.value.selectable&&g.value.autoselect){const I={...U[0],dataRef:U[0]};E("select",{node:I})}})}const fe=t.ref("new_");return t.onMounted(()=>{const U=t.inject("route");console.log("unione page tree route",U),fe.value=l.psn||U?.query?.psn||U?.meta?.psn||"new_",console.log("unione page tree,psn:"+fe.value),r.setModel(U?.query?.model||U?.meta?.model||"run");const I={...l.params||{},...U?.query||{},...U?.params||{}};r.dataManager().params(I),s(),r.load(fe.value,o),t.nextTick(()=>{S(!0)}),N().then(Z=>{if(Z&&Z[0]&&g.value.selectable&&g.value.autoselect){const Q={...Z[0],dataRef:Z[0]};E("select",{node:Q})}}),c.value=!0}),e({storage:L,save:P,toBack:q,toReset:F,setNode:O,getNode:ee,delNode:D,reload:K}),(U,I)=>{const Z=t.resolveComponent("SearchOutlined"),Q=t.resolveComponent("a-input"),$=t.resolveComponent("unione-btn"),W=t.resolveComponent("a-badge"),X=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(xt,{class:"unione-page-left","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"left-warp",onContextmenu:I[2]||(I[2]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot(U.$slots,"left-top",{},void 0,!0),w.value?(t.openBlock(),t.createBlock(Q,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:C.value,"onUpdate:value":I[0]||(I[0]=j=>C.value=j),onChange:t.unref(x),onPressEnter:t.unref(x)},{suffix:t.withCtx(()=>[t.createVNode(Z)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock($,{key:1,widget:v.value,onClick:_},null,8,["widget"])):t.createCommentVNode("",!0),t.createElementVNode("div",Qd,[t.renderSlot(U.$slots,"left-list",{},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(j,te)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-item",(f.value&&f.value[g.value.idField]==j[g.value.idField]||u.value&&u.value[g.value.idField]==j[g.value.idField])&&"active"]),key:j[g.value.idField],onMouseover:()=>u.value=j,onMouseleave:I[1]||(I[1]=()=>u.value=null),onClick:ue=>V(ue,j)},[t.createElementVNode("span",Kd,t.toDisplayString(te+1)+"、",1),t.createVNode(W,{dot:j[g.value.badgeDot],count:j[g.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",Yd,t.toDisplayString(j[g.value.labelField]),1)]),_:2},1032,["dot","count"]),f.value&&f.value[g.value.idField]==j[g.value.idField]||u.value&&u.value[g.value.idField]==j[g.value.idField]?(t.openBlock(),t.createElementBlock("div",Hd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,ue=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!b.value.btnVisible||b.value.btnVisible(ue,j)?(t.openBlock(),t.createBlock($,{key:ue.name,widget:ue,ctx:{node:j},onClick:We=>A(We,j)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],42,Wd))),128))],!0)]),!d.value||!d.value.length?(t.openBlock(),t.createElementBlock("div",Gd,[t.renderSlot(U.$slots,"left-empty",{},()=>[t.createVNode(X)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",Jd,[t.renderSlot(U.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,j=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(j.widget),{key:j.wid,wid:j.wid,widget:j,editor:t.unref(r)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Xd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,j=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:j.name},[j.visible!=!1?(t.openBlock(),t.createBlock($,{key:0,widget:j,editor:t.unref(r),disabled:!f.value,ctx:{formData:f.value},onClick:M},null,8,["widget","editor","disabled","ctx"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-127f0c13"]]),Kl=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:n}){const i=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(i.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=i.fields.filter(V=>V.isQuery),o.configs.widgets[0].btns=i.queryBtns||[],o.configs.widgets[0].params=i.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const A=i.fields.filter(V=>V.isPk)[0];A&&A.name&&(o.configs.widgets[1].dataKey=A.name),o.configs.widgets[1].columns=i.fields.filter(V=>V.hidden!=!0),o.configs.widgets[1].operation=i.operation,i.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=i.leftBtns==!1?!1:i.leftBtns||[],o.configs.widgets[1].rightBtns=i.rightBtns==!1?!1:i.rightBtns||[],r.dataManager().use("primary","list").store(i.storage)}}const r=new lt,c=t.computed(()=>r.$widgetList.value||[]),d=n;function h(A){d("btnClick",A)}const f=t.ref("new_");t.onMounted(()=>{const A=t.inject("route");console.log("unione page view route",A),f.value=i.psn||A?.query?.psn||A?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),r.setModel(A?.query?.model||A?.meta?.model||"run");const V={...i.params||{},...A?.query||{},...A?.params||{}};r.dataManager().params(V),s(),r.load(f.value,o)});function u(){return r.dataManager().use("primary","list")}function m(A){A?r.ebus.$emit("table-list-search",A):r.ebus.$emit("table-list-reload")}function g(A){r.dataManager().params(A),r.ebus.$emit("query-form-params",A),r.ebus.$emit("table-list-search",{params:A})}function w(){return l.value?l.value[0]:null}function v(){return l.value?l.value[0].getSelected():null}function y(){l.value&&l.value[0].clearSelected()}return e({storage:u,editor:r,reload:m,setParams:g,getTable:w,getSelected:v,clearSelected:y}),(A,V)=>(t.openBlock(),t.createBlock(xt,{class:"unione-page-list","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.wid},[k.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),Yl=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:n}){const i=Y.useDialog(),l=Y.useSession(),o=new Ke({types:"dict",dictName:"FLOWLITETASKSTATUS"}),s=a,r=t.ref(null),c=t.ref(null),d=t.ref(null),h={sn:"new_",title:"我的待办",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"primary",primary:!0,fields:[{title:"接收时间",name:"time",widget:"a-range-picker",props:{showTime:!0,format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss",placeholder:["开始时间","结束时间"]}}]},{widget:"unione-table",dsn:"primary",columns:[{title:"流程类别",name:"instance.category",convert:{types:"dict",dictName:"FLOWLITECATEGORY"}},{title:"流程名称",name:"instance.title"},{title:"提交人",name:"instance.commitUserName"},{title:"提交时间",name:"instance.commitTime"},{title:"节点名称",name:"title"},{title:"接收时间",name:"created"},{title:"处理状态",name:"handleStatus",customCell:(x,N,R)=>{o.convert(x.status).then(b=>{const B=[];b&&B.push(b),x.handleUserId&&B.push("已签收"),B.length>0&&(x[R.dataIndex]=B.join("/"))})}}],leftBtns:["delBatch","add",{title:"批量审核",name:"auditBatch",type:"primary",props:{danger:!0}},{title:"批量签收",name:"signBatch",type:"primary"},{title:"批量放弃",name:"waiveBatch",type:"primary"}],rightBtns:["impData","downTmpl"],operation:{title:"操作",width:250,btns:["edit","delete",{title:"签收",name:"sign",event:{visible:x=>!x.row.handleUserId}},{title:"放弃",name:"waive",props:{danger:!0},event:{visible:x=>!!x.row.handleUserId}},{title:"意见",name:"opinion"},{title:"审核",name:"audit",type:"primary"}],count:4,more:{layout:"vertical"}}}],dsnList:["primary"]},component:"unione-flow-todo"};function f(){Y.axios.flow({url:`/api/engine/profile/${s.flowKey}${s.flowVers?"/"+s.flowVers:""}`,method:"post"}).then(x=>{if(console.log("loaded flow tmpl info",x),x.success){const N=x.body.busiField;N&&N.forEach(R=>{R.visible!=!1&&(R.index!=null&&R.index!=null?h.configs.widgets[1].columns.splice(R.index,0,{title:R.title,name:"instance.busiData."+R.name}):h.configs.widgets[1].columns.push({title:R.title,name:"instance.busiData."+R.name}))}),l.setStorage("page-define-flow-todo:"+s.flowKey,JSON.stringify(h.configs)),u.load(A.value,h)}})}const u=new lt,m=t.computed(()=>u.$widgetList.value||[]),g=n;function w(x){const{btn:N,row:R,keys:b}=x;if(N.name=="audit"&&c.value.open(R?R.id:b,{flowKey:R?.instance?.sn,nodeKey:R?.sn,nodeTitle:R?.title}),N.name=="auditBatch"&&c.value.open(b,{nodeTitle:"批量审核"}),N.name=="sign"&&v(R.id),N.name=="signBatch"){if(b.length==0){i.warning("请选择要签收的任务");return}v(b)}if(N.name=="waive"&&y(R.id),N.name=="waiveBatch"){if(b.length==0){i.warning("请选择要放弃的任务");return}y(b)}N.name=="opinion"&&d.value.open({busiKey:R.instance.busiKey}),g("btnClick",x)}function v(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,i.confirm({content:"确定签收吗?",onOk:()=>{Y.axios.flow({url:"/api/engine/task/sign",method:"post",data:N}).then(R=>{R.success?(i.success("签收成功"),k()):i.error(R.msg)})}})}function y(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,i.confirm({content:"确定签收吗?",onOk:()=>{Y.axios.flow({url:"/api/engine/task/waive",method:"post",data:N}).then(R=>{R.success?(i.success("操作成功"),k()):i.error(R.msg)})}})}const A=t.ref("new_");t.onMounted(()=>{const x=t.inject("route");console.log("unione flow todo route",x),A.value=s.psn||x?.query?.psn||x?.meta?.psn||"new_",console.log("unione flow todo psn:"+A.value),u.setModel(x?.query?.model||x?.meta?.model||"run");const N={...s.params||{},...x?.query||{},...x?.params||{}};u.dataManager().params(N),s.leftBtns&&Array.isArray(s.leftBtns)&&(h.configs.widgets[1].leftBtns=[...h.configs.widgets[1].leftBtns,...s.leftBtns]),s.rightBtns&&Array.isArray(s.rightBtns)&&(h.configs.widgets[1].rightBtns=[...h.configs.widgets[1].rightBtns,...s.rightBtns]),s.operation&&typeof s.operation=="object"&&(h.configs.widgets[1].operation={...h.configs.widgets[1].operation,...s.operation}),u.dataManager().use("primary","list").store({ctx:"flow",controller:"/api/engine/task",findUrl:"/todo",findParams:[{name:"flowSn",value:s.flowKey}]}),s.flowKey?f():u.load(A.value,h)});function V(){return u.dataManager().use("primary","list")}function k(x){C(),x?u.ebus.$emit("table-list-search",x):u.ebus.$emit("table-list-reload")}function p(x){u.dataManager().params(x),u.ebus.$emit("query-form-params",x),u.ebus.$emit("table-list-search",{params:x})}function S(){return r.value?r.value[0]:null}function _(){return r.value?r.value[0].getSelected():null}function C(){r.value&&r.value[0].clearSelected(!0)}return e({storage:V,editor:u,reload:k,setParams:p,getTable:S,getSelected:_,clearSelected:C}),(x,N)=>{const R=t.resolveComponent("UnioneFlowAudit"),b=t.resolveComponent("UnioneFlowOpinion");return t.openBlock(),t.createBlock(xt,{class:"unione-flow-todo","setting-title":"页面设置",editor:t.unref(u)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,B=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:B.wid},[B.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:0,wid:B.wid,widget:B,editor:t.unref(u),onBtnClick:w,ref_for:!0,ref_key:"table",ref:r},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:1,wid:B.wid,widget:B,editor:t.unref(u),onBtnClick:w},null,40,["wid","widget","editor"]))],64))),128)),t.createVNode(R,{ref_key:"audit",ref:c,onSuccess:N[0]||(N[0]=B=>k())},null,512),t.createVNode(b,{ref_key:"opinion",ref:d},null,512)]),_:2},[t.unref(u)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(vt,{editor:t.unref(u)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Zd={class:"handel-opinion"},eh={key:0,class:"preset-opinions"},th={class:"ok"},nh={class:"reject"},ih=t.defineComponent({name:"FlowAudit",__name:"audit",props:{vars:{type:Object,required:!1}},emits:["success"],setup(a,{expose:e,emit:n}){const i=Y.useDialog(),l=a,o=n,s=t.ref("审核"),r=t.ref(!1),c=t.ref(),d=t.ref({flowKey:"",nodeKey:""}),h=t.ref([]),f=t.ref(),u=t.ref({data:{handelOpinion:""},rules:{handelOpinion:[{required:!0,message:"请输入处理意见"}]}});function m(){r.value=!1}function g(A,{flowKey:V,nodeKey:k,nodeTitle:p}={}){if(c.value=A,s.value=p||"审核",!A){i.error("任务id不能为空");return}r.value=!0,d.value.flowKey=V,d.value.nodeKey=k,u.value.data.handelOpinion="",w()}function w(){const{flowKey:A,nodeKey:V}=d.value;Y.axios.flow({url:`/api/engine/opinion/preset/${A||"-1"}/${V||"-1"}`,method:"post"}).then(k=>{h.value=k.body})}function v(A){u.value.data.handelOpinion=A.optxt}function y(A){const V=s.value;f.value.validate().then(()=>{i.confirm({content:`确定提交${V},并${A?"同意":"拒绝"}该申请么?`,onOk:()=>{const k={result:A,opinion:u.value.data.handelOpinion,vars:l.vars};Array.isArray(c.value)?k.taskIds=c.value:k.taskId=c.value,Y.axios.flow({url:"/api/engine/task/submit",method:"post",data:k}).then(p=>{p.success?(i.success(`提交${V}成功`),m(),o("success")):i.error(p.msg)})}})})}return e({open:g}),(A,V)=>{const k=t.resolveComponent("a-textarea"),p=t.resolveComponent("a-form-item"),S=t.resolveComponent("a-tag"),_=t.resolveComponent("a-form"),C=t.resolveComponent("a-button"),x=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(x,{title:s.value,visible:r.value,"onUpdate:visible":V[3]||(V[3]=N=>r.value=N),width:600,rootClassName:"flow-audit-drawer"},{footer:t.withCtx(()=>[t.createVNode(C,{type:"primary",onClick:V[1]||(V[1]=N=>y(!0))},{default:t.withCtx(()=>V[4]||(V[4]=[t.createTextVNode("同意")])),_:1}),t.createVNode(C,{type:"primary",danger:"",onClick:V[2]||(V[2]=N=>y(!1))},{default:t.withCtx(()=>V[5]||(V[5]=[t.createTextVNode("拒绝")])),_:1})]),default:t.withCtx(()=>[t.createVNode(_,{layout:"vertical",model:u.value.data,rules:u.value.rules,ref_key:"formRef",ref:f},{default:t.withCtx(()=>[t.createElementVNode("div",Zd,[t.createVNode(p,{label:"处理意见:",name:"handelOpinion"},{default:t.withCtx(()=>[t.createVNode(k,{value:u.value.data.handelOpinion,"onUpdate:value":V[0]||(V[0]=N=>u.value.data.handelOpinion=N),autoSize:"",rows:10,placeholder:"请输入处理意见"},null,8,["value"])]),_:1})]),h.value&&h.value.length?(t.openBlock(),t.createElementBlock("div",eh,[t.createVNode(p,{label:"预设意见:"},{default:t.withCtx(()=>[t.createElementVNode("div",th,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==1),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"success",onClick:R=>v(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))]),t.createElementVNode("div",nh,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==2),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"orange",onClick:R=>v(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))])]),_:1})])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])]),_:1},8,["title","visible"])}}}),lh={key:0,class:"flow-options"},oh={class:"flow-task"},sh={class:"node"},ah={class:"user"},rh={class:"time"},ch={class:"content"},dh={key:1,class:"flow-options"},hh={class:"flow-task"},fh={class:"user"},uh={class:"time"},ph={class:"content"},mh={key:0,class:"flow-title"},gh={class:"flow-task"},bh={class:"node"},kh={class:"user"},yh={class:"time"},wh={class:"content"},Ah=t.defineComponent({name:"FlowOpinion",__name:"opinion",props:t.mergeModels({busiKey:{type:String,required:!1},flowId:{type:String,required:!1},taskId:{type:String,required:!1}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a,{expose:e}){const n=a,i=t.ref(!0),l=t.ref([]),o=t.ref({}),s=t.ref([]),r=t.useModel(a,"visible"),c=t.ref({busiKey:"",flowId:"",taskId:""}),d=t.computed(()=>({busiKey:c.value.busiKey||n.busiKey,flowId:c.value.flowId||n.flowId,taskId:c.value.taskId||n.taskId}));function h(){r.value=!1}function f({busiKey:m,flowId:g,taskId:w}={}){c.value.busiKey=m,c.value.flowId=g,c.value.taskId=w,r.value=!0,i.value=!0,u()}function u(){if(l.value=[],o.value={},s.value=[],!d.value.busiKey&&!d.value.flowId&&!d.value.taskId)return;let m="",g="";d.value.busiKey?(m="/api/engine/opinion/busiKey/"+d.value.busiKey,g="busiKey"):d.value.flowId?(m="/api/engine/opinion/flow/"+d.value.flowId,g="flow"):d.value.taskId&&(m="/api/engine/opinion/task/"+d.value.taskId,g="task"),Y.axios.flow({url:m,method:"post"}).then(w=>{if(w.success)if(g=="busiKey"){s.value=w.body;for(let v=0;v<s.value.length&&i.value;v++)if(s.value[v].tasks?.length){for(let y=0;y<s.value[v].tasks.length;y++)if(s.value[v].tasks[y].opinions?.length){i.value=!1;break}}}else if(g=="flow"){if(l.value=w.body,l.value?.length){for(let v=0;v<l.value.length;v++)if(l.value[v].opinions?.length){i.value=!1;break}}}else g=="task"&&(o.value=w.body,o.value.opinions?.length&&(i.value=!1))})}return t.watch(n,()=>{u()}),t.onMounted(()=>{u()}),e({open:f,close:h}),(m,g)=>{const w=t.resolveComponent("a-timeline-item"),v=t.resolveComponent("a-timeline"),y=t.resolveComponent("a-empty"),A=t.resolveComponent("a-button"),V=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(V,{title:"处理意见",visible:r.value,"onUpdate:visible":g[0]||(g[0]=k=>r.value=k),width:600,rootClassName:"flow-opinion-drawer"},{footer:t.withCtx(()=>[t.createVNode(A,{onClick:h,class:"btn-close"},{default:t.withCtx(()=>g[1]||(g[1]=[t.createTextVNode("关闭")])),_:1})]),default:t.withCtx(()=>[l.value?.length?(t.openBlock(),t.createElementBlock("div",lh,[t.createElementVNode("div",oh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.opinions,p=>(t.openBlock(),t.createBlock(w,{key:p.id},{default:t.withCtx(()=>[t.createElementVNode("div",sh,"节点:"+t.toDisplayString(k.title),1),t.createElementVNode("div",ah,"处理人:"+t.toDisplayString(p.userName),1),t.createElementVNode("div",rh,"处理时间:"+t.toDisplayString(p.handleTime),1),t.createElementVNode("div",ch,"处理意见:"+t.toDisplayString(p.optxt),1)]),_:2},1024))),128))],64))),128))]),_:1})])])):t.createCommentVNode("",!0),o.value?.id?(t.openBlock(),t.createElementBlock("div",dh,[t.createElementVNode("div",hh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.opinions,k=>(t.openBlock(),t.createBlock(w,{key:k.id},{default:t.withCtx(()=>[t.createElementVNode("div",fh,"处理人:"+t.toDisplayString(k.userName),1),t.createElementVNode("div",uh,"处理时间:"+t.toDisplayString(k.handleTime),1),t.createElementVNode("div",ph,"处理意见:"+t.toDisplayString(k.optxt),1)]),_:2},1024))),128))]),_:1})])])):t.createCommentVNode("",!0),s.value?.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(s.value,k=>(t.openBlock(),t.createElementBlock("div",{class:"flow-options",key:k.id},[s.value.length>1?(t.openBlock(),t.createElementBlock("div",mh,t.toDisplayString(k.title)+",提交时间:"+t.toDisplayString(k.commitTime)+t.toDisplayString(k.completeTime?",完成时间:"+k.completeTime:""),1)):t.createCommentVNode("",!0),t.createElementVNode("div",gh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.tasks,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.opinions,S=>(t.openBlock(),t.createBlock(w,{key:S.id},{default:t.withCtx(()=>[t.createElementVNode("div",bh,"节点:"+t.toDisplayString(p.title),1),t.createElementVNode("div",kh,"处理人:"+t.toDisplayString(S.userName),1),t.createElementVNode("div",yh,"处理时间:"+t.toDisplayString(S.handleTime),1),t.createElementVNode("div",wh,"处理意见:"+t.toDisplayString(S.optxt),1)]),_:2},1024))),128))],64))),128))]),_:2},1024)])]))),128)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(y,{key:3})):t.createCommentVNode("",!0)]),_:1},8,["visible"])}}}),Ct={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})}},xh={class:"unione-page unione-list-page data-define-list"},vh=le(t.defineComponent({__name:"list",setup(a){const e=De(),n=Y.useDialog(),i=t.inject("router"),l=t.ref({fields:[{title:"状态",name:"status",control:"unione-select-box",convert:{types:"dict",dictName:"PUBLISHSTATUS"}},{title:"类别",name:"category",control:"unione-select-box",convert:{types:"dict",dictName:"DATACATEGORY"}}]}),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",convert:{types:"dict",dictName:"PUBLISHSTATUS"}}],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,Ct.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(k=>{s.value.data=k.body,s.value.pagination.total=k.total*1}).finally(()=>{s.value.loading=!1})}function c(k){s.value.pagination.current=k.pagination.current,s.value.pagination.pageSize=k.pagination.pageSize,r()}function d({params:k,keywords:p}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=p,r()}function h({btn:k,event:p,row:S}){console.log("table btn click",k,p,S),(k.name=="add"||k.name=="edit")&&i.push({path:"/dev/data/define/edit",query:S?{id:S.id}:{}}),k.name=="impFromDb"&&(u.value=!0),k.name=="release"&&f(S),k.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(k){n.confirm({content:"确定要发布当前数据么?",onOk:()=>{Ct.release([k.id]).then(p=>{p.success?(n.success({title:"发布成功",content:p.body}),r()):n.error({title:"发布失败",content:p.body})})}})}const u=t.ref(!1),m=t.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),g=t.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),w=t.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(k){!k||!Object.keys(k).length||!k.dsId||(oe.message.loading("数据加载中..."),w.value.params=k,w.value.loading=!0,Ct.loadFromDb(k).then(p=>{w.value.loading=!1,oe.message.destroy(),p.success?(p.body.forEach(S=>{S.checkable=!!S.id}),w.value.data=p.body,w.value.pagination.total=p.body.length):oe.message.error(p.message)}))}function y(k){w.value.pagination.current=k.pagination.current,w.value.pagination.pageSize=k.pagination.pageSize}const A=t.ref();function V({btn:k}){if(k.name!="imp")return;const p=A.value.getSelected();p?.keys?.length?n.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{oe.message.loading("数据导入中..."),Ct.impFromDb({dsId:w.value.params.dsId,tables:p.keys.join()}).then(S=>{oe.message.destroy(),S.success?(n.success({content:S.message}),s.value.pagination.current=1,r()):n.error({context:S.message})})}}):n.error({content:"请选择目标记录!"})}return(k,p)=>{const S=t.resolveComponent("UnioneQuery"),_=t.resolveComponent("UnioneTable"),C=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",xh,[t.createVNode(S,{widget:l.value,onQuery:d,onReset:d},null,8,["widget"]),t.createVNode(_,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),t.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=x=>u.value=x),placement:"left"},{default:t.withCtx(()=>[t.createVNode(S,{widget:m.value,onQuery:v,onReset:v,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),t.createVNode(_,{widget:g.value,dataList:w.value.data,loading:w.value.loading,pagination:w.value.pagination,onChange:y,rowKey:"name",ref_key:"loadTableObj",ref:A},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-f4684c55"]]),Ch={class:"unione-props-setting data-field-manage"},Sh={key:0},Bh={key:1},Nh=["onClick"],Vh=["onClick"],Rh=["onClick"],Eh={key:1},Oh=le(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"}]),n=t.useModel(a,"modelValue"),i=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(g=>{i.value.selectedRowKeys.includes(g)||i.value.selectedRowKeys.push(g);const w=[];n.value.forEach(v=>{!m.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&w.push(v.name)}),w.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!w.includes(v)))})}}),l={mounted:m=>m.focus()},o=t.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let g in m){const w=n.value.filter(v=>v.name==g);if(w&&w[0]){let v=o.value[g];Object.keys(v).forEach(y=>{w[0][y]=v[y]})}}o.value={}}function r(m,g){s();const w={};w[g]=m[g]||"",o.value[m.name]=w}function c(m,g){if(!m||!g){o.value={};return}const w=o.value[m.name][g];if(g=="name"&&n.value.filter(y=>y[g]==w&&y.name!=m.name).length>0){oe.Modal.warn({title:"提示信息",content:"字段名称["+w+"]已存在"});return}m[g]=w,o.value={}}function d(m,g){const w=n.value.filter(v=>v.name==m.name)[0];return g=="isFk"?w.configs?.fkey?.enable:w[g]==1}function h(m,g){const w=n.value.filter(v=>v.name==m.name)[0];g=="isFk"?(w.configs||(w.configs={}),w.configs.fkey||(w.configs.fkey={}),w.configs.fkey.enable=!w.configs.fkey.enable):w[g]!=1?w[g]=1:w[g]=0}function f(){if(s(),n.value.filter(w=>w.name=="new_").length>0){o.value.new_={name:"new_"};return}const g={title:"",name:"new_",dataType:"String",isPk:0};n.value.push(g),o.value[g.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){oe.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}oe.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{n.value=n.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,g)=>{const w=t.resolveComponent("a-button"),v=t.resolveComponent("a-tooltip"),y=t.resolveComponent("a-input"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-select-option"),k=t.resolveComponent("a-select"),p=t.resolveComponent("a-checkbox"),S=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Ch,[t.createVNode(w,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:t.withCtx(()=>g[1]||(g[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(w,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:t.withCtx(()=>g[2]||(g[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(S,{columns:e.value,"data-source":n.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:_})=>[["name","title"].includes(_.key)?(t.openBlock(),t.createElementBlock("span",Sh,[g[3]||(g[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(_.title),1)])):t.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(_.key)?(t.openBlock(),t.createElementBlock("span",Bh,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(_.title),1)])):t.createCommentVNode("",!0),_.key==="isPk"?(t.openBlock(),t.createBlock(v,{key:2,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[g[4]||(g[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="isFk"?(t.openBlock(),t.createBlock(v,{key:3,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="isNull"?(t.openBlock(),t.createBlock(v,{key:4,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="syncEnable"?(t.openBlock(),t.createBlock(v,{key:5,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:_,text:C,record:x})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[x.name][_.dataIndex],"onUpdate:value":N=>o.value[x.name][_.dataIndex]=N,onBlur:N=>c(x,_.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,Nh)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(A,{key:0,value:o.value[x.name][_.dataIndex],"onUpdate:value":N=>o.value[x.name][_.dataIndex]=N,onBlur:N=>c(x,_.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,Vh)):["dataType"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(k,{key:0,value:x[_.dataIndex],"onUpdate:value":N=>x[_.dataIndex]=N,onBlur:g[0]||(g[0]=N=>c())},{default:t.withCtx(()=>[t.createVNode(V,{key:"String",value:"String"}),t.createVNode(V,{key:"Long",value:"Long"}),t.createVNode(V,{key:"Short",value:"Short"}),t.createVNode(V,{key:"Integer",value:"Integer"}),t.createVNode(V,{key:"Float",value:"Float"}),t.createVNode(V,{key:"Double",value:"Double"}),t.createVNode(V,{key:"Date",value:"Date"}),t.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",Eh,t.toDisplayString(C),1))],10,Rh)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(t.openBlock(),t.createBlock(p,{key:3,checked:d(x,_.dataIndex),onClick:N=>h(x,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(t.openBlock(),t.createBlock(p,{key:4,checked:!d(x,_.dataIndex),onClick:N=>h(x,_.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Hl=1024;let _h=0,mi=class{constructor(e,n){this.from=e,this.to=n}};class ae{constructor(e={}){this.id=_h++,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=_e.match(e)),n=>{let i=e(n);return i===void 0?null:[this,i]}}}ae.closedBy=new ae({deserialize:a=>a.split(" ")}),ae.openedBy=new ae({deserialize:a=>a.split(" ")}),ae.group=new ae({deserialize:a=>a.split(" ")}),ae.isolate=new ae({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),ae.contextHash=new ae({perNode:!0}),ae.lookAhead=new ae({perNode:!0}),ae.mounted=new ae({perNode:!0});class xn{constructor(e,n,i){this.tree=e,this.overlay=n,this.parser=i}static get(e){return e&&e.props&&e.props[ae.mounted.id]}}const Mh=Object.create(null);class _e{constructor(e,n,i,l=0){this.name=e,this.props=n,this.id=i,this.flags=l}static define(e){let n=e.props&&e.props.length?Object.create(null):Mh,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new _e(e.name||"",n,e.id,i);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");n[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 n=this.prop(ae.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let i in e)for(let l of i.split(" "))n[l]=e[i];return i=>{for(let l=i.prop(ae.group),o=-1;o<(l?l.length:0);o++){let s=n[o<0?i.name:l[o]];if(s)return s}}}}_e.none=new _e("",Object.create(null),0,8);class gi{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let i of this.types){let l=null;for(let o of e){let s=o(i);s&&(l||(l=Object.assign({},i.props)),l[s[0].id]=s[1])}n.push(l?new _e(i.name,l,i.id,i.flags):i)}return new gi(n)}}const vn=new WeakMap,Gl=new WeakMap;var xe;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(xe||(xe={}));class ye{constructor(e,n,i,l,o){if(this.type=e,this.children=n,this.positions=i,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=xn.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let i of this.children){let l=i.toString();l&&(n&&(n+=","),n+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new yi(this.topNode,e)}cursorAt(e,n=0,i=0){let l=vn.get(this)||this.topNode,o=new yi(l);return o.moveTo(e,n),vn.set(this,o._tree),o}get topNode(){return new $e(this,0,0,null)}resolve(e,n=0){let i=en(vn.get(this)||this.topNode,e,n,!1);return vn.set(this,i),i}resolveInner(e,n=0){let i=en(Gl.get(this)||this.topNode,e,n,!0);return Gl.set(this,i),i}resolveStack(e,n=0){return Ih(this,e,n)}iterate(e){let{enter:n,leave:i,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&xe.IncludeAnonymous)>0;for(let c=this.cursor(s|xe.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&i&&(r||!c.type.isAnonymous)&&i(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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Ai(_e.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,l)=>new ye(this.type,n,i,l,this.propValues),e.makeTree||((n,i,l)=>new ye(_e.none,n,i,l)))}static build(e){return Dh(e)}}ye.empty=new ye(_e.none,[],[],0);class bi{constructor(e,n){this.buffer=e,this.index=n}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 bi(this.buffer,this.index)}}class pt{constructor(e,n,i){this.buffer=e,this.length=n,this.set=i}get type(){return _e.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],i=this.buffer[e+3],l=this.set.types[n],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,i==e)return o;let s=[];for(;e<i;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,i,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=n&&!(Jl(o,l,s[c+1],s[c+2])&&(r=c,i>0));c=s[c+3]);return r}slice(e,n,i){let l=this.buffer,o=new Uint16Array(n-e),s=0;for(let r=e,c=0;r<n;){o[c++]=l[r++],o[c++]=l[r++]-i;let d=o[c++]=l[r++]-i;o[c++]=l[r++]-e,s=Math.max(s,d)}return new pt(o,s,this.set)}}function Jl(a,e,n,i){switch(a){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function en(a,e,n,i){for(var l;a.from==a.to||(n<1?a.from>=e:a.from>e)||(n>-1?a.to<=e:a.to<e);){let s=!i&&a instanceof $e&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=i?0:xe.IgnoreOverlays;if(i)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof $e&&s.index<0&&((l=r.enter(e,n,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,n,o);if(!s)return a;a=s}}class Xl{cursor(e=0){return new yi(this,e)}getChild(e,n=null,i=null){let l=Zl(this,e,n,i);return l.length?l[0]:null}getChildren(e,n=null,i=null){return Zl(this,e,n,i)}resolve(e,n=0){return en(this,e,n,!1)}resolveInner(e,n=0){return en(this,e,n,!0)}matchContext(e){return ki(this,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),i=this;for(;n;){let l=n.lastChild;if(!l||l.to!=n.to)break;l.type.isError&&l.from==l.to?(i=n,n=l.prevSibling):n=l}return i}get node(){return this}get next(){return this.parent}}class $e extends Xl{constructor(e,n,i,l){super(),this._tree=e,this.from=n,this.index=i,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,n,i,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,d=n>0?r.length:-1;e!=d;e+=n){let h=r[e],f=c[e]+s.from;if(Jl(l,i,f,f+h.length)){if(h instanceof pt){if(o&xe.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,n,i-f,l);if(u>-1)return new mt(new Th(s,h,e,f),null,u)}else if(o&xe.IncludeAnonymous||!h.type.isAnonymous||wi(h)){let u;if(!(o&xe.IgnoreMounts)&&(u=xn.get(h))&&!u.overlay)return new $e(u.tree,f,e,s);let m=new $e(h,f,e,s);return o&xe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?h.children.length-1:0,n,i,l)}}}if(o&xe.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<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,n,i=0){let l;if(!(i&xe.IgnoreOverlays)&&(l=xn.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((n>0?s<=o:s<o)&&(n<0?r>=o:r>o))return new $e(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,i)}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 Zl(a,e,n,i){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=l.type.is(n),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function ki(a,e,n=e.length-1){for(let i=a.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class Th{constructor(e,n,i,l){this.parent=e,this.buffer=n,this.index=i,this.start=l}}class mt extends Xl{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,n,i){super(),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,n,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new mt(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,n,i=0){if(i&xe.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new mt(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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new mt(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new mt(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let s=i.buffer[this.index+1];e.push(i.slice(l,o,s)),n.push(0)}return new ye(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function eo(a){if(!a.length)return null;let e=0,n=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let i=n instanceof $e&&n.index<0?null:n.parent,l=a.slice();return i?l[e]=i:l.splice(e,1),new Fh(l,n)}class Fh{constructor(e,n){this.heads=e,this.node=n}get next(){return eo(this.heads)}}function Ih(a,e,n){let i=a.resolveInner(e,n),l=null;for(let o=i instanceof $e?i:i.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[i])).push(s.resolve(e,n)),o=s}else{let s=xn.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new $e(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(en(r,e,n,!1))}}return l?eo(l):i}class yi{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof $e)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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,n){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=n||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof $e?(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,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,n-this.buffer.start,i);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,n,i=this.mode){return this.buffer?i&xe.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&xe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&xe.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:n}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(n.findChild(l,this.index,-1,0,4))}else{let l=n.buffer[this.index+3];if(l<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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 n,i,{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:n,parent:i}=l)}else({index:n,_parent:i}=this._tree);for(;i;{index:n,_parent:i}=i)if(n>-1)for(let o=n+e,s=e<0?-1:i._tree.children.length;o!=s;o+=e){let r=i._tree.children[o];if(this.mode&xe.IncludeAnonymous||r instanceof pt||!r.type.isAnonymous||wi(r))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,i=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;n=s,i=o+1;break e}l=this.stack[--o]}for(let l=i;l<this.stack.length;l++)n=new mt(this.buffer,n,this.stack[l]);return this.bufferNode=new mt(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&n&&n(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return ki(this.node,e);let{buffer:n}=this.buffer,{types:i}=n.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return ki(this.node,e,l);let s=i[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function wi(a){return a.children.some(e=>e instanceof pt||!e.type.isAnonymous||wi(e))}function Dh(a){var e;let{buffer:n,nodeSet:i,maxBufferLength:l=Hl,reused:o=[],minRepeatType:s=i.types.length}=a,r=Array.isArray(n)?new bi(n,n.length):n,c=i.types,d=0,h=0;function f(p,S,_,C,x,N){let{id:R,start:b,end:B,size:T}=r,E=h;for(;T<0;)if(r.next(),T==-1){let L=o[R];_.push(L),C.push(b-p);return}else if(T==-3){d=R;return}else if(T==-4){h=R;return}else throw new RangeError(`Unrecognized record size: ${T}`);let M=c[R],P,F,q=b-p;if(B-b<=l&&(F=v(r.pos-S,x))){let L=new Uint16Array(F.size-F.skip),O=r.pos-F.size,ee=L.length;for(;r.pos>O;)ee=y(F.start,L,ee);P=new pt(L,B-F.start,i),q=F.start-p}else{let L=r.pos-T;r.next();let O=[],ee=[],D=R>=s?R:-1,K=0,fe=B;for(;r.pos>L;)D>=0&&r.id==D&&r.size>=0?(r.end<=fe-l&&(g(O,ee,b,K,r.end,fe,D,E),K=O.length,fe=r.end),r.next()):N>2500?u(b,L,O,ee):f(b,L,O,ee,D,N+1);if(D>=0&&K>0&&K<O.length&&g(O,ee,b,K,b,fe,D,E),O.reverse(),ee.reverse(),D>-1&&K>0){let U=m(M);P=Ai(M,O,ee,0,O.length,0,B-b,U,U)}else P=w(M,O,ee,B-b,E-B)}_.push(P),C.push(q)}function u(p,S,_,C){let x=[],N=0,R=-1;for(;r.pos>S;){let{id:b,start:B,end:T,size:E}=r;if(E>4)r.next();else{if(R>-1&&B<R)break;R<0&&(R=T-l),x.push(b,B,T),N++,r.next()}}if(N){let b=new Uint16Array(N*4),B=x[x.length-2];for(let T=x.length-3,E=0;T>=0;T-=3)b[E++]=x[T],b[E++]=x[T+1]-B,b[E++]=x[T+2]-B,b[E++]=E;_.push(new pt(b,x[2]-B,i)),C.push(B-p)}}function m(p){return(S,_,C)=>{let x=0,N=S.length-1,R,b;if(N>=0&&(R=S[N])instanceof ye){if(!N&&R.type==p&&R.length==C)return R;(b=R.prop(ae.lookAhead))&&(x=_[N]+R.length+b)}return w(p,S,_,C,x)}}function g(p,S,_,C,x,N,R,b){let B=[],T=[];for(;p.length>C;)B.push(p.pop()),T.push(S.pop()+_-x);p.push(w(i.types[R],B,T,N-x,b-N)),S.push(x-_)}function w(p,S,_,C,x=0,N){if(d){let R=[ae.contextHash,d];N=N?[R].concat(N):[R]}if(x>25){let R=[ae.lookAhead,x];N=N?[R].concat(N):[R]}return new ye(p,S,_,C,N)}function v(p,S){let _=r.fork(),C=0,x=0,N=0,R=_.end-l,b={size:0,start:0,skip:0};e:for(let B=_.pos-p;_.pos>B;){let T=_.size;if(_.id==S&&T>=0){b.size=C,b.start=x,b.skip=N,N+=4,C+=4,_.next();continue}let E=_.pos-T;if(T<0||E<B||_.start<R)break;let M=_.id>=s?4:0,P=_.start;for(_.next();_.pos>E;){if(_.size<0)if(_.size==-3)M+=4;else break e;else _.id>=s&&(M+=4);_.next()}x=P,C+=T,N+=M}return(S<0||C==p)&&(b.size=C,b.start=x,b.skip=N),b.size>4?b:void 0}function y(p,S,_){let{id:C,start:x,end:N,size:R}=r;if(r.next(),R>=0&&C<s){let b=_;if(R>4){let B=r.pos-(R-4);for(;r.pos>B;)_=y(p,S,_)}S[--_]=b,S[--_]=N-p,S[--_]=x-p,S[--_]=C}else R==-3?d=C:R==-4&&(h=C);return _}let A=[],V=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,A,V,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:A.length?V[0]+A[0].length:0;return new ye(c[a.topID],A.reverse(),V.reverse(),k)}const to=new WeakMap;function Cn(a,e){if(!a.isAnonymous||e instanceof pt||e.type!=a)return 1;let n=to.get(e);if(n==null){n=1;for(let i of e.children){if(i.type!=a||!(i instanceof ye)){n=1;break}n+=Cn(a,i)}to.set(e,n)}return n}function Ai(a,e,n,i,l,o,s,r,c){let d=0;for(let g=i;g<l;g++)d+=Cn(a,e[g]);let h=Math.ceil(d*1.5/8),f=[],u=[];function m(g,w,v,y,A){for(let V=v;V<y;){let k=V,p=w[V],S=Cn(a,g[V]);for(V++;V<y;V++){let _=Cn(a,g[V]);if(S+_>=h)break;S+=_}if(V==k+1){if(S>h){let _=g[k];m(_.children,_.positions,0,_.children.length,w[k]+A);continue}f.push(g[k])}else{let _=w[V-1]+g[V-1].length-p;f.push(Ai(a,g,w,k,V,p,_,null,c))}u.push(p+A-o)}}return m(e,n,i,l,0),(r||c)(f,u,s)}class St{constructor(e,n,i,l,o=!1,s=!1){this.from=e,this.to=n,this.tree=i,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,n=[],i=!1){let l=[new St(0,e.length,e,0,!1,i)];for(let o of n)o.to>e.length&&l.push(o);return l}static applyChanges(e,n,i=128){if(!n.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,d=0;;r++){let h=r<n.length?n[r]:null,f=h?h.fromA:1e9;if(f-c>=i)for(;s&&s.from<f;){let u=s;if(c>=u.from||f<=u.to||d){let m=Math.max(u.from,c)-d,g=Math.min(u.to,f)-d;u=m>=g?null:new St(m,g,u.tree,u.offset+d,r>0,!!h)}if(u&&l.push(u),s.to>f)break;s=o<e.length?e[o++]:null}if(!h)break;c=h.toA,d=h.toA-h.toB}return l}}class no{startParse(e,n,i){return typeof e=="string"&&(e=new $h(e)),i=i?i.length?i.map(l=>new mi(l.from,l.to)):[new mi(0,0)]:[new mi(0,e.length)],this.createParse(e,n||[],i)}parse(e,n,i){let l=this.startParse(e,n,i);for(;;){let o=l.advance();if(o)return o}}}class $h{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new ae({perNode:!0});class Sn{constructor(e,n,i,l,o,s,r,c,d,h=0,f){this.p=e,this.stack=n,this.state=i,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,i=0){let l=e.parser.context;return new Sn(e,[],n,i,i,0,[],0,l?new io(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let i=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),i==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-(i-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[l])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let f=c?this.stack[c-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,d,m,u+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,n,i,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(n==i)return;if(s.buffer[r-2]>=n){s.buffer[r-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,n,i,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]>i;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>i;)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]=n,this.buffer[s+2]=i,this.buffer[s+3]=l}}shift(e,n,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||n<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,i),this.shiftContext(n,i),n<=s.maxNode&&this.buffer.push(n,i,l,4)}}apply(e,n,i,l){e&65536?this.reduce(e):this.shift(e,n,i,l)}useNode(e,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(n,l),this.buffer.push(i,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,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let i=e.buffer.slice(n),l=e.bufferBase+n;for(;e&&l==e.bufferBase;)e=e.parent;return new Sn(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Ph(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(n[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<n.length;o+=2){let s=n[o+1];l.some((r,c)=>c&1&&r==s)||l.push(n[o],s)}n=l}let i=[];for(let l=0;l<n.length&&i.length<4;l+=2){let o=n[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(n[l],this.pos),s.reducePos=this.pos,s.score-=200,i.push(s)}return i}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let i=n>>19,l=n&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],i=(l,o)=>{if(!n.includes(l))return n.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=i(s,o+1);if(r!=null)return r}})};return i(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 n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}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 n=new io(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}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 io{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Ph{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=l}}class Bn{constructor(e,n,i){this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Bn(e,n,n-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 Bn(this.stack,this.pos,this.index)}}function Nn(a,e=Uint16Array){if(typeof a!="string")return a;let n=null;for(let i=0,l=0;i<a.length;){let o=0;for(;;){let s=a.charCodeAt(i++),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}n?n[l++]=o:n=new e(o)}return n}class Vn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lo=new Vn;class Lh{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lo,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let i=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<i.from;){if(!l)return null;let s=this.ranges[--l];o-=i.from-s.to,i=s}for(;n<0?o>i.to:o>=i.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-i.to,i=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,i,l;if(n>=0&&n<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(i=o,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>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,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=lo,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,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let i="";for(let l of this.ranges){if(l.from>=n)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,n)))}return i}}class Ft{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:i}=n.p;Uh(this.data,e,n,this.id,i.data,i.tokenPrecTable)}}Ft.prototype.contextual=Ft.prototype.fallback=Ft.prototype.extend=!1,Ft.prototype.fallback=Ft.prototype.extend=!1;function Uh(a,e,n,i,l,o){let s=0,r=1<<i,{dialect:c}=n.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 g=a[m];if(c.allows(g)&&(e.token.value==-1||e.token.value==g||jh(g,e.token.value,l,o))){e.acceptToken(g);break}}let h=e.next,f=0,u=a[s+2];if(e.next<0&&u>f&&a[d+u*3-3]==65535){s=a[d+u*3-1];continue e}for(;f<u;){let m=f+u>>1,g=d+m+(m<<1),w=a[g],v=a[g+1]||65536;if(h<w)u=m;else if(h>=v)f=m+1;else{s=a[g+2],e.advance();continue e}}break}}function oo(a,e,n){for(let i=e,l;(l=a[i])!=65535;i++)if(l==n)return i-e;return-1}function jh(a,e,n,i){let l=oo(n,i,e);return l<0||oo(n,i,a)<l}const Te=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let xi=null;function so(a,e,n){let i=a.cursor(xe.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(a.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:a.length}}class zh{constructor(e,n){this.fragments=e,this.nodeSet=n,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?so(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?so(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 n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let i=this.trees[n],l=this.index[n];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[l],s=this.start[n]+i.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof ye){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(ae.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class qh{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Vn)}getActions(e){let n=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if(!(1<<d&s))continue;let h=o[d],f=this.tokens[d];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=s||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=s,f.context=r),f.lookAhead>f.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let u=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!h.extend&&(i=f,n>u))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!i&&e.pos==this.stream.end&&(i=new Vn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,n=this.addActions(e,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Vn,{pos:i,p:l}=e;return n.start=i,n.end=Math.min(i+1,l.stream.end),n.value=i==l.stream.end?l.parser.eofTerm:0,n}updateCachedToken(e,n,i){let l=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.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),i);if(r>=0&&i.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,n,i,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=n,this.actions[l++]=i,l}addActions(e,n,i,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=ot(r,d+2);else{l==0&&r[d+1]==2&&(l=this.putAction(ot(r,d+2),n,i,l));break}r[d]==n&&(l=this.putAction(ot(r,d+1),n,i,l))}return l}}class Qh{constructor(e,n,i,l){this.parser=e,this.input=n,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 Lh(n,l),this.tokens=new qh(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[Sn.start(this,e.top[0],o)],this.fragments=i.length&&this.stream.end-o>e.bufferLength*4?new zh(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,i=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>n)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!i.length){let s=l&&Kh(l);if(s)return Te&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Te&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);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,i);if(s)return Te&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(i.length>s)for(i.sort((r,c)=>c.score-r.score);i.length>s;)i.pop();i.some(r=>r.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let s=0;s<i.length-1;s++){let r=i[s];for(let c=s+1;c<i.length;c++){let d=i[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)i.splice(c--,1);else{i.splice(s--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let s=1;s<i.length;s++)i[s].pos<this.minStackPos&&(this.minStackPos=i[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,n,i){let l=e.pos,{parser:o}=this,s=Te?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!d||(f.prop(ae.contextHash)||0)==h))return e.useNode(f,u),Te&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof ye)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof ye&&f.positions[0]==0)f=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Te&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let h=c[d++],f=c[d++],u=c[d++],m=d==c.length||!i,g=m?e:e.split(),w=this.tokens.mainToken;if(g.apply(h,f,w?w.start:g.pos,u),Te&&console.log(s+this.stackID(g)+` (via ${h&65536?`reduce of ${o.getName(h&65535)}`:"shift"} for ${o.getName(f)} @ ${l}${g==e?"":", split"})`),m)return!0;g.pos>l?n.push(g):i.push(g)}return!1}advanceFully(e,n){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ao(e,n),!0}}runRecovery(e,n,i){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=n[s<<1],d=n[(s<<1)+1],h=Te?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Te&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=h;for(let m=0;f.forceReduce()&&m<10&&(Te&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Te&&(u=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(c))Te&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(d==r.pos&&(d++,c=0),r.recoverByDelete(c,d),Te&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),ao(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),ye.build({buffer:Bn.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 n=(xi||(xi=new WeakMap)).get(e);return n||xi.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function ao(a,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==a.pos&&i.sameState(a)){e[n].score<a.score&&(e[n]=a);return}}e.push(a)}class Wh{constructor(e,n,i){this.source=e,this.flags=n,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class Rn extends no{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let r=0;r<e.repeatNodeCount;r++)n.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<n.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=ae[c]);for(let d=1;d<r.length;){let h=r[d++];if(h>=0)o(h,c,r[d++]);else{let f=r[d+-h];for(let u=-h;u>0;u--)o(r[d++],c,f);d++}}}this.nodeSet=new gi(n.map((r,c)=>_e.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:i.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=Hl;let s=Nn(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(ro),this.states=Nn(e.states,Uint32Array),this.data=Nn(e.stateData),this.goto=Nn(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new Ft(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,n,i){let l=new Qh(this,e,n,i);for(let o of this.wrappers)l=o(l,e,n,i);return l}getGoto(e,n,i=!1){let l=this.goto;if(n>=l[0])return-1;for(let o=l[n+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&i)return c;for(let d=o+(s>>1);o<d;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,n){let i=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=i[o])==65535)if(i[o+1]==1)s=i[o=ot(i,o+2)];else{if(i[o+1]==2)return ot(i,o+2);break}if(s==n||s==0)return ot(i,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,i=>i==n?!0:null)}allActions(e,n){let i=this.stateSlot(e,4),l=i?n(i):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=ot(this.data,o+2);else break;l=n(ot(this.data,o+1))}return l}nextStates(e){let n=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ot(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];n.some((o,s)=>s&1&&o==l)||n.push(this.data[i],l)}}return n}configure(e){let n=Object.assign(Object.create(Rn.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=i}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(r=>r.from==i.external);if(!o)return i;let s=Object.assign(Object.assign({},i),{external:o.to});return n.specializers[l]=ro(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}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 n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(e)for(let o of e.split(" ")){let s=n.indexOf(o);s>=0&&(i[s]=!0)}let l=null;for(let o=0;o<n.length;o++)if(!i[o])for(let s=this.dialects[n[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Wh(e,i,l)}static deserialize(e){return new Rn(e)}}function ot(a,e){return a[e]|a[e+1]<<16}function Kh(a){let e=null;for(let n of a){let i=n.p.stoppedAt;(n.pos==n.p.stream.end||i!=null&&n.pos>i)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function ro(a){if(a.external){let e=a.extend?1:0;return(n,i)=>a.external(n,i)<<1|e}return a.get}let Yh=0;class Pe{constructor(e,n,i,l){this.name=e,this.set=n,this.base=i,this.modified=l,this.id=Yh++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let i=typeof e=="string"?e:"?";if(e instanceof Pe&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let l=new Pe(i,[],null,[]);if(l.set.push(l),n)for(let o of n.set)l.set.push(o);return l}static defineModifier(e){let n=new En(e);return i=>i.modified.indexOf(n)>-1?i:En.get(i.base||i,i.modified.concat(n).sort((l,o)=>l.id-o.id))}}let Hh=0;class En{constructor(e){this.name=e,this.instances=[],this.id=Hh++}static get(e,n){if(!n.length)return e;let i=n[0].instances.find(r=>r.base==e&&Gh(n,r.modified));if(i)return i;let l=[],o=new Pe(e.name,l,e,n);for(let r of n)r.instances.push(o);let s=Jh(n);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(En.get(r,c));return o}}function Gh(a,e){return a.length==e.length&&a.every((n,i)=>n==e[i])}function Jh(a){let e=[[]];for(let n=0;n<a.length;n++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(a[n]));return e.sort((n,i)=>i.length-n.length)}function co(a){let e=Object.create(null);for(let n in a){let i=a[n];Array.isArray(i)||(i=[i]);for(let l of n.split(" "))if(l){let o=[],s=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){s=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(o.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+l);let h=new vi(i,s,c>0?o.slice(0,c):null);e[d]=h.sort(e[d])}}return Xh.add(e)}const Xh=new ae;class vi{constructor(e,n,i,l){this.tags=e,this.mode=n,this.context=i,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}}vi.empty=new vi([],2,null);function ho(a,e){let n=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:i,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let d=n[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:i}}const H=Pe.define,On=H(),gt=H(),fo=H(gt),uo=H(gt),bt=H(),_n=H(bt),Ci=H(bt),Ye=H(),Bt=H(Ye),He=H(),Ge=H(),Si=H(),tn=H(Si),Mn=H(),z={comment:On,lineComment:H(On),blockComment:H(On),docComment:H(On),name:gt,variableName:H(gt),typeName:fo,tagName:H(fo),propertyName:uo,attributeName:H(uo),className:H(gt),labelName:H(gt),namespace:H(gt),macroName:H(gt),literal:bt,string:_n,docString:H(_n),character:H(_n),attributeValue:H(_n),number:Ci,integer:H(Ci),float:H(Ci),bool:H(bt),regexp:H(bt),escape:H(bt),color:H(bt),url:H(bt),keyword:He,self:H(He),null:H(He),atom:H(He),unit:H(He),modifier:H(He),operatorKeyword:H(He),controlKeyword:H(He),definitionKeyword:H(He),moduleKeyword:H(He),operator:Ge,derefOperator:H(Ge),arithmeticOperator:H(Ge),logicOperator:H(Ge),bitwiseOperator:H(Ge),compareOperator:H(Ge),updateOperator:H(Ge),definitionOperator:H(Ge),typeOperator:H(Ge),controlOperator:H(Ge),punctuation:Si,separator:H(Si),bracket:tn,angleBracket:H(tn),squareBracket:H(tn),paren:H(tn),brace:H(tn),content:Ye,heading:Bt,heading1:H(Bt),heading2:H(Bt),heading3:H(Bt),heading4:H(Bt),heading5:H(Bt),heading6:H(Bt),contentSeparator:H(Ye),list:H(Ye),quote:H(Ye),emphasis:H(Ye),strong:H(Ye),link:H(Ye),monospace:H(Ye),strikethrough:H(Ye),inserted:H(),deleted:H(),changed:H(),invalid:H(),meta:Mn,documentMeta:H(Mn),annotation:H(Mn),processingInstruction:H(Mn),definition:Pe.defineModifier("definition"),constant:Pe.defineModifier("constant"),function:Pe.defineModifier("function"),standard:Pe.defineModifier("standard"),local:Pe.defineModifier("local"),special:Pe.defineModifier("special")};for(let a in z){let e=z[a];e instanceof Pe&&(e.name=a)}ho([{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 Zh=co({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),ef=Rn.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Zh],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let Bi=[],po=[];(()=>{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,n=0;e<a.length;e++)(e%2?po:Bi).push(n=n+a[e])})();function tf(a){if(a<768)return!1;for(let e=0,n=Bi.length;;){let i=e+n>>1;if(a<Bi[i])n=i;else if(a>=po[i])e=i+1;else return!0;if(e==n)return!1}}function mo(a){return a>=127462&&a<=127487}const go=8205;function nf(a,e,n=!0,i=!0){return(n?bo:lf)(a,e,i)}function bo(a,e,n){if(e==a.length)return e;e&&ko(a.charCodeAt(e))&&yo(a.charCodeAt(e-1))&&e--;let i=Ni(a,e);for(e+=wo(i);e<a.length;){let l=Ni(a,e);if(i==go||l==go||n&&tf(l))e+=wo(l),i=l;else if(mo(l)){let o=0,s=e-2;for(;s>=0&&mo(Ni(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function lf(a,e,n){for(;e>0;){let i=bo(a,e-2,n);if(i<e)return i;e--}return 0}function Ni(a,e){let n=a.charCodeAt(e);if(!yo(n)||e+1==a.length)return n;let i=a.charCodeAt(e+1);return ko(i)?(n-55296<<10)+(i-56320)+65536:n}function ko(a){return a>=56320&&a<57344}function yo(a){return a>=55296&&a<56320}function wo(a){return a<65536?1:2}class se{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,n,i){[e,n]=It(this,e,n);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(n,this.length,l,1),Je.from(l,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=It(this,e,n);let i=[];return this.decompose(e,n,i,0),Je.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new nn(this),o=new nn(e);for(let s=n,r=n;;){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>=i)return!0}}iter(e=1){return new nn(this,e)}iterRange(e,n=this.length){return new xo(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new vo(i)}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]?se.empty:e.length<=32?new ke(e):Je.from(ke.split(e,[]))}}class ke extends se{constructor(e,n=of(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((n?i:r)>=e)return new sf(l,r,i,s);l=r+1,i++}}decompose(e,n,i,l){let o=e<=0&&n>=this.length?this:new ke(Ao(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(l&1){let s=i.pop(),r=Tn(o.text,s.text.slice(),0,o.length);if(r.length<=32)i.push(new ke(r,s.length+o.length));else{let c=r.length>>1;i.push(new ke(r.slice(0,c)),new ke(r.slice(c)))}}else i.push(o)}replace(e,n,i){if(!(i instanceof ke))return super.replace(e,n,i);[e,n]=It(this,e,n);let l=Tn(this.text,Tn(i.text,Ao(this.text,0,e)),n),o=this.length+i.length-(n-e);return l.length<=32?new ke(l,o):Je.from(ke.split(l,[]),o)}sliceString(e,n=this.length,i=`
|
|
15
|
-
`){[e,n]=
|
|
16
|
-
`){[e,n]=
|
|
17
|
-
`,this;e--}else if(l instanceof ke){let c=l.text[s+(n<0?-1:0)];if(this.offsets[i]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof ke?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 xo{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new nn(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*n,this.value=l.length<=i?l:n<0?l.slice(l.length-i):l.slice(0,i),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 vo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:l}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(se.prototype[Symbol.iterator]=function(){return this.iter()},nn.prototype[Symbol.iterator]=xo.prototype[Symbol.iterator]=vo.prototype[Symbol.iterator]=function(){return this});class sf{constructor(e,n,i,l){this.from=e,this.to=n,this.number=i,this.text=l}get length(){return this.to-this.from}}function It(a,e,n){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,n))]}function st(a,e,n=!0,i=!0){return nf(a,e,n,i)}const Vi=/\r\n?|\n/;var Fe=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Fe||(Fe={}));class at{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,l=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(i,l,o),l+=o):l+=s,i+=o}}iterChangedRanges(e,n=!1){Ri(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],l=this.sections[n++];l<0?e.push(i,l):e.push(l,i)}return new at(e)}composeDesc(e){return this.empty?e:e.empty?this:Co(this,e)}mapDesc(e,n=!1){return e.empty?this:Ei(this,e,n)}mapPos(e,n=-1,i=Fe.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(i!=Fe.Simple&&d>=e&&(i==Fe.TrackDel&&l<e&&d>e||i==Fe.TrackBefore&&l<e||i==Fe.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!r)return e==l||n<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,n=e){for(let i=0,l=0;i<this.sections.length&&l<=n;){let o=this.sections[i++],s=this.sections[i++],r=l+o;if(s>=0&&l<=n&&r>=e)return l<e&&r>n?"cover":!0;l=r}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],l=this.sections[n++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new at(e)}static create(e){return new at(e)}}class ve extends at{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ri(this,(n,i,l,o,s)=>e=e.replace(l,l+(i-n),s),!1),e}mapDesc(e,n=!1){return Ei(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let l=0,o=0;l<n.length;l+=2){let s=n[l],r=n[l+1];if(r>=0){n[l]=r,n[l+1]=s;let c=l>>1;for(;i.length<c;)i.push(se.empty);i.push(s?e.slice(o,o+s):se.empty)}o+=s}return new ve(n,i)}compose(e){return this.empty?e:e.empty?this:Co(this,e,!0)}map(e,n=!1){return e.empty?this:Ei(this,e,n,!0)}iterChanges(e,n=!1){Ri(this,e,n)}get desc(){return at.create(this.sections)}filter(e){let n=[],i=[],l=[],o=new ln(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let h=Math.min(o.len,c-r);Ne(l,h,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;Ne(n,h,f),f>0&&kt(i,n,o.text),o.forward(h),r+=h}let d=e[s++];for(;r<d;){if(o.done)break e;let h=Math.min(o.len,d-r);Ne(n,h,-1),Ne(l,h,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(h),r+=h}}return{changes:new ve(n,i),filtered:at.create(l)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],l=this.sections[n+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let l=[],o=[],s=0,r=null;function c(h=!1){if(!h&&!l.length)return;s<n&&Ne(l,n-s,-1);let f=new ve(l,o);r=r?r.compose(f.map(r)):f,l=[],o=[],s=0}function d(h){if(Array.isArray(h))for(let f of h)d(f);else if(h instanceof ve){if(h.length!=n)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${n})`);c(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:m}=h;if(f>u||f<0||u>n)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${n})`);let g=m?typeof m=="string"?se.of(m.split(i||Vi)):m:se.empty,w=g.length;if(f==u&&w==0)return;f<s&&c(),f>s&&Ne(l,f-s,-1),Ne(l,u-f,w),kt(o,l,g),s=u}}return d(e),c(!r),r}static empty(e){return new ve(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")n.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)n.push(o[0],0);else{for(;i.length<l;)i.push(se.empty);i[l]=se.of(o.slice(1)),n.push(o[0],i[l].length)}}}return new ve(n,i)}static createSet(e,n){return new ve(e,n)}}function Ne(a,e,n,i=!1){if(e==0&&n<=0)return;let l=a.length-2;l>=0&&n<=0&&n==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=n:i?(a[l]+=e,a[l+1]+=n):a.push(e,n)}function kt(a,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<a.length)a[a.length-1]=a[a.length-1].append(n);else{for(;a.length<i;)a.push(se.empty);a.push(n)}}function Ri(a,e,n){let i=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let d=l,h=o,f=se.empty;for(;d+=r,h+=c,c&&i&&(f=f.append(i[s-2>>1])),!(n||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,d,o,h,f),l=d,o=h}}}function Ei(a,e,n,i=!1){let l=[],o=i?[]:null,s=new ln(a),r=new ln(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);Ne(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&&!n))){let d=r.len;for(Ne(l,r.ins,-1);d;){let h=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=h&&(Ne(l,0,s.ins),o&&kt(o,l,s.text),c=s.i),s.forward(h),d-=h}r.next()}else if(s.ins>=0){let d=0,h=s.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);d+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;Ne(l,d,c<s.i?s.ins:0),o&&c<s.i&&kt(o,l,s.text),c=s.i,s.forward(s.len-h)}else{if(s.done&&r.done)return o?ve.createSet(l,o):at.create(l);throw new Error("Mismatched change set lengths")}}}function Co(a,e,n=!1){let i=[],l=n?[]:null,o=new ln(a),s=new ln(e);for(let r=!1;;){if(o.done&&s.done)return l?ve.createSet(i,l):at.create(i);if(o.ins==0)Ne(i,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ne(i,0,s.ins,r),l&&kt(l,i,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=i.length;if(o.ins==-1){let h=s.ins==-1?-1:s.off?0:s.ins;Ne(i,c,h,r),l&&h&&kt(l,i,s.text)}else s.ins==-1?(Ne(i,o.off?0:o.len,c,r),l&&kt(l,i,o.textBit(c))):(Ne(i,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&kt(l,i,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||i.length>d),o.forward2(c),s.forward(c)}}}}class ln{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,n=this.i-2>>1;return n>=e.length?se.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?se.empty:n[i].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 Nt{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}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,n=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Nt(i,l,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return J.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return J.range(this.anchor,i)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!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 J.range(e.anchor,e.head)}static create(e,n,i){return new Nt(e,n,i)}}class J{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:J.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new J([this.main],0)}addRange(e,n=!0){return J.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,J.create(i,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 J(e.ranges.map(n=>Nt.fromJSON(n)),e.main)}static single(e,n=e){return new J([J.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=i:o.from<i)return J.normalized(e.slice(),n);i=o.to}return new J(e,n)}static cursor(e,n=0,i,l){return Nt.create(e,e,(n==0?0:n<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,n,i,l){let o=(i??16777215)<<6|(l==null?7:Math.min(6,l));return n<e?Nt.create(n,e,48|o):Nt.create(e,n,(n>e?8:0)|o)}static normalized(e,n=0){let i=e[n];e.sort((l,o)=>l.from-o.from),n=e.indexOf(i);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<=n&&n--,e.splice(--l,2,o.anchor>o.head?J.range(c,r):J.range(r,c))}}return new J(e,n)}}function So(a,e){for(let n of a.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Oi=0;class ne{constructor(e,n,i,l,o){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=l,this.id=Oi++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new ne(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:_i),!!e.static,e.enables)}of(e){return new Fn([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fn(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function _i(a,e){return a==e||a.length==e.length&&a.every((n,i)=>n===e[i])}class Fn{constructor(e,n,i,l){this.dependencies=e,this.facet=n,this.type=i,this.value=l,this.id=Oi++}dynamicSlot(e){var n;let i=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,d=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?d=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||h.push(e[f.id]);return{create(f){return f.values[s]=i(f),1},update(f,u){if(c&&u.docChanged||d&&(u.docChanged||u.selection)||Mi(f,h)){let m=i(f);if(r?!Bo(m,f.values[s],l):!l(m,f.values[s]))return f.values[s]=m,1}return 0},reconfigure:(f,u)=>{let m,g=u.config.address[o];if(g!=null){let w=Pn(u,g);if(this.dependencies.every(v=>v instanceof ne?u.facet(v)===f.facet(v):v instanceof Vt?u.field(v,!1)==f.field(v,!1):!0)||(r?Bo(m=i(f),w,l):l(m=i(f),w)))return f.values[s]=w,0}else m=i(f);return f.values[s]=m,1}}}}function Bo(a,e,n){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!n(a[i],e[i]))return!1;return!0}function Mi(a,e){let n=!1;for(let i of e)sn(a,i)&1&&(n=!0);return n}function af(a,e,n){let i=n.map(c=>a[c.id]),l=n.map(c=>c.type),o=i.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let d=[];for(let h=0;h<i.length;h++){let f=Pn(c,i[h]);if(l[h]==2)for(let u of f)d.push(u);else d.push(f)}return e.combine(d)}return{create(c){for(let d of i)sn(c,d);return c.values[s]=r(c),1},update(c,d){if(!Mi(c,o))return 0;let h=r(c);return e.compare(h,c.values[s])?0:(c.values[s]=h,1)},reconfigure(c,d){let h=Mi(c,i),f=d.config.facets[e.id],u=d.facet(e);if(f&&!h&&_i(n,f))return c.values[s]=u,0;let m=r(c);return e.compare(m,u)?(c.values[s]=u,0):(c.values[s]=m,1)}}}const In=ne.define({static:!0});class Vt{constructor(e,n,i,l,o){this.id=e,this.createF=n,this.updateF=i,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let n=new Vt(Oi++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(In).find(i=>i.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,l)=>{let o=i.values[n],s=this.updateF(o,l);return this.compareF(o,s)?0:(i.values[n]=s,1)},reconfigure:(i,l)=>{let o=i.facet(In),s=l.facet(In),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(i.values[n]=r.create(i),1):l.config.address[this.id]!=null?(i.values[n]=l.field(this),0):(i.values[n]=this.create(i),1)}}}init(e){return[this,In.of({field:this,create:e})]}get extension(){return this}}const Rt={lowest:4,low:3,default:2,high:1,highest:0};function on(a){return e=>new No(e,a)}const rf={highest:on(Rt.highest),high:on(Rt.high),default:on(Rt.default),low:on(Rt.low),lowest:on(Rt.lowest)};class No{constructor(e,n){this.inner=e,this.prec=n}}class Dn{of(e){return new Ti(this,e)}reconfigure(e){return Dn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ti{constructor(e,n){this.compartment=e,this.inner=n}}class $n{constructor(e,n,i,l,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let l=[],o=Object.create(null),s=new Map;for(let u of cf(e,n,s))u instanceof Vt?l.push(u):(o[u.facet.id]||(o[u.facet.id]=[])).push(u);let r=Object.create(null),c=[],d=[];for(let u of l)r[u.id]=d.length<<1,d.push(m=>u.slot(m));let h=i?.config.facets;for(let u in o){let m=o[u],g=m[0].facet,w=h&&h[u]||[];if(m.every(v=>v.type==0))if(r[g.id]=c.length<<1|1,_i(w,m))c.push(i.facet(g));else{let v=g.combine(m.map(y=>y.value));c.push(i&&g.compare(v,i.facet(g))?i.facet(g):v)}else{for(let v of m)v.type==0?(r[v.id]=c.length<<1|1,c.push(v.value)):(r[v.id]=d.length<<1,d.push(y=>v.dynamicSlot(y)));r[g.id]=d.length<<1,d.push(v=>af(v,g,m))}}let f=d.map(u=>u(r));return new $n(e,s,f,r,c,o)}}function cf(a,e,n){let i=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let d=i[c].indexOf(s);d>-1&&i[c].splice(d,1),s instanceof Ti&&n.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let d of s)o(d,r);else if(s instanceof Ti){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(s.compartment)||s.inner;n.set(s.compartment,d),o(d,r)}else if(s instanceof No)o(s.inner,s.prec);else if(s instanceof Vt)i[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Fn)i[r].push(s),s.facet.extensions&&o(s.facet.extensions,Rt.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,Rt.default),i.reduce((s,r)=>s.concat(r))}function sn(a,e){if(e&1)return 2;let n=e>>1,i=a.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;a.status[n]=4;let l=a.computeSlot(a,a.config.dynamicSlots[n]);return a.status[n]=2|l}function Pn(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const Vo=ne.define(),Fi=ne.define({combine:a=>a.some(e=>e),static:!0}),Ro=ne.define({combine:a=>a.length?a[0]:void 0,static:!0}),Eo=ne.define(),Oo=ne.define(),_o=ne.define(),Mo=ne.define({combine:a=>a.length?a[0]:!1});class Dt{constructor(e,n){this.type=e,this.value=n}static define(){return new df}}class df{of(e){return new Dt(this,e)}}class hf{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Ae(this.type,n)}is(e){return this.type==e}static define(e={}){return new hf(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(n);o&&i.push(o)}return i}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Ve{constructor(e,n,i,l,o,s){this.startState=e,this.changes=n,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&So(i,n.newLength),o.some(r=>r.type==Ve.time)||(this.annotations=o.concat(Ve.time.of(Date.now())))}static create(e,n,i,l,o,s){return new Ve(e,n,i,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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Ve.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Ve.time=Dt.define(),Ve.userEvent=Dt.define(),Ve.addToHistory=Dt.define(),Ve.remote=Dt.define();function ff(a,e){let n=[];for(let i=0,l=0;;){let o,s;if(i<a.length&&(l==e.length||e[l]>=a[i]))o=a[i++],s=a[i++];else if(l<e.length)o=e[l++],s=e[l++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function To(a,e,n){var i;let l,o,s;return n?(l=e.changes,o=ve.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):(i=a.selection)===null||i===void 0?void 0:i.map(l),effects:Ae.mapEffects(a.effects,l).concat(Ae.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Ii(a,e,n){let i=e.selection,l=$t(e.annotations);return e.userEvent&&(l=l.concat(Ve.userEvent.of(e.userEvent))),{changes:e.changes instanceof ve?e.changes:ve.of(e.changes||[],n,a.facet(Ro)),selection:i&&(i instanceof J?i:J.single(i.anchor,i.head)),effects:$t(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Fo(a,e,n){let i=Ii(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;i=To(i,Ii(a,e[o],s?i.changes.newLength:a.doc.length),s)}let l=Ve.create(a,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return pf(n?uf(l):l)}function uf(a){let e=a.startState,n=!0;for(let l of e.facet(Eo)){let o=l(a);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:ff(n,o))}if(n!==!0){let l,o;if(n===!1)o=a.changes.invertedDesc,l=ve.empty(e.doc.length);else{let s=a.changes.filter(n);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=Ve.create(e,l,a.selection&&a.selection.map(o),Ae.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let i=e.facet(Oo);for(let l=i.length-1;l>=0;l--){let o=i[l](a);o instanceof Ve?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ve?a=o[0]:a=Fo(e,$t(o),!1)}return a}function pf(a){let e=a.startState,n=e.facet(_o),i=a;for(let l=n.length-1;l>=0;l--){let o=n[l](a);o&&Object.keys(o).length&&(i=To(i,Ii(e,o,a.changes.newLength),!0))}return i==a?a:Ve.create(e,a.changes,a.selection,i.effects,i.annotations,i.scrollIntoView)}const mf=[];function $t(a){return a==null?mf:Array.isArray(a)?a:[a]}var rt=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(rt||(rt={}));const gf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Di;try{Di=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function bf(a){if(Di)return Di.test(a);for(let e=0;e<a.length;e++){let n=a[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||gf.test(n)))return!0}return!1}function kf(a){return e=>{if(!/\S/.test(e))return rt.Space;if(bf(e))return rt.Word;for(let n=0;n<a.length;n++)if(e.indexOf(a[n])>-1)return rt.Word;return rt.Other}}class ce{constructor(e,n,i,l,o,s){this.config=e,this.doc=n,this.selection=i,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++)sn(this,r<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return sn(this,i),Pn(this,i)}update(...e){return Fo(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:l}=n;for(let r of e.effects)r.is(Dn.reconfigure)?(n&&(l=new Map,n.compartments.forEach((c,d)=>l.set(d,c)),n=null),l.set(r.value.compartment,r.value.extension)):r.is(Ae.reconfigure)?(n=null,i=r.value):r.is(Ae.appendConfig)&&(n=null,i=$t(i).concat(r.value));let o;n?o=e.startState.values.slice():(n=$n.resolve(i,l,this),o=new ce(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(Fi)?e.newSelection:e.newSelection.asSingle();new ce(n,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:J.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),l=this.changes(i.changes),o=[i.range],s=$t(i.effects);for(let r=1;r<n.ranges.length;r++){let c=e(n.ranges[r]),d=this.changes(c.changes),h=d.map(l);for(let u=0;u<r;u++)o[u]=o[u].map(h);let f=l.mapDesc(d,!0);o.push(c.range.map(f)),l=l.compose(h),s=Ae.mapEffects(s,h).concat(Ae.mapEffects($t(c.effects),f))}return{changes:l,selection:J.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof ve?e:ve.of(e,this.doc.length,this.facet(ce.lineSeparator))}toText(e){return se.of(e.split(this.facet(ce.lineSeparator)||Vi))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(sn(this,n),Pn(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof Vt&&this.config.address[l.id]!=null&&(n[i]=l.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let o in i)if(Object.prototype.hasOwnProperty.call(e,o)){let s=i[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return ce.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:n.extensions?l.concat([n.extensions]):l})}static create(e={}){let n=$n.resolve(e.extensions||[],new Map),i=e.doc instanceof se?e.doc:se.of((e.doc||"").split(n.staticFacet(ce.lineSeparator)||Vi)),l=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return So(l,i.length),n.staticFacet(Fi)||(l=l.asSingle()),new ce(n,i,l,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(ce.tabSize)}get lineBreak(){return this.facet(ce.lineSeparator)||`
|
|
18
|
-
`}get readOnly(){return this.facet(Mo)}phrase(e,...n){for(let i of this.facet(ce.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>n.length?i:n[o-1]})),e}languageDataAt(e,n,i=-1){let l=[];for(let o of this.facet(Vo))for(let s of o(this,n,i))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return kf(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-i,r=e-i;for(;s>0;){let c=st(n,s,!1);if(o(n.slice(c,s))!=rt.Word)break;s=c}for(;r<l;){let c=st(n,r);if(o(n.slice(r,c))!=rt.Word)break;r=c}return s==r?null:J.range(s+i,r+i)}}ce.allowMultipleSelections=Fi,ce.tabSize=ne.define({combine:a=>a.length?a[0]:4}),ce.lineSeparator=Ro,ce.readOnly=Mo,ce.phrases=ne.define({compare(a,e){let n=Object.keys(a),i=Object.keys(e);return n.length==i.length&&n.every(l=>a[l]==e[l])}}),ce.languageData=Vo,ce.changeFilter=Eo,ce.transactionFilter=Oo,ce.transactionExtender=_o,Dn.reconfigure=Ae.define();class Pt{eq(e){return this==e}range(e,n=e){return an.create(e,n,this)}}Pt.prototype.startSide=Pt.prototype.endSide=0,Pt.prototype.point=!1,Pt.prototype.mapMode=Fe.TrackDel;class an{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new an(e,n,i)}}function $i(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Pi{constructor(e,n,i,l){this.from=e,this.to=n,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,l=0){let o=i?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||(i?this.value[c].endSide:this.value[c].startSide)-n;if(c==s)return d>=0?s:r;d>=0?r=c:s=c+1}}between(e,n,i,l){for(let o=this.findIndex(n,-1e9,!0),s=this.findIndex(i,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,n){let i=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let d=this.value[c],h=this.from[c]+e,f=this.to[c]+e,u,m;if(h==f){let g=n.mapPos(h,d.startSide,d.mapMode);if(g==null||(u=m=g,d.startSide!=d.endSide&&(m=n.mapPos(h,d.endSide),m<u)))continue}else if(u=n.mapPos(h,d.startSide),m=n.mapPos(f,d.endSide),u>m||u==m&&d.startSide>0&&d.endSide<=0)continue;(m-u||d.endSide-d.startSide)<0||(s<0&&(s=u),d.point&&(r=Math.max(r,m-u)),i.push(d),l.push(u-s),o.push(m-s))}return{mapped:i.length?new Pi(l,o,i,r):null,pos:s}}}class ge{constructor(e,n,i,l){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=l}static create(e,n,i,l){return new ge(e,n,i,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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(n.length==0&&!s)return this;if(i&&(n=n.slice().sort($i)),this.isEmpty)return n.length?ge.of(n):this;let r=new Do(this,null,-1).goto(0),c=0,d=[],h=new Ln;for(;r.value||c<n.length;)if(c<n.length&&(r.from-n[c].from||r.startSide-n[c].value.startSide)>=0){let f=n[c++];h.addInner(f.from,f.to,f.value)||d.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(r.chunkIndex)<n[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||d.push(an.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?ge.empty:this.nextLayer.update({add:d,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],i=[],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),n.push(c),i.push(e.mapPos(r));else if(d===!0){let{mapped:h,pos:f}=c.map(r,e);h&&(l=Math.max(l,h.maxPoint),n.push(h),i.push(f))}}let o=this.nextLayer.map(e);return n.length==0?o:new ge(i,n,o||ge.empty,l)}between(e,n,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(n>=o&&e<=o+s.length&&s.between(o,e-o,n-o,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return rn.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return rn.from(e).goto(n)}static compare(e,n,i,l,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),r=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),c=Io(s,r,i),d=new cn(s,c,o),h=new cn(r,c,o);i.iterGaps((f,u,m)=>$o(d,f,h,u,m,l)),i.empty&&i.length==0&&$o(d,0,h,0,0,l)}static eq(e,n,i=0,l){l==null&&(l=999999999);let o=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),s=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=Io(o,s),c=new cn(o,r,0).goto(i),d=new cn(s,r,0).goto(i);for(;;){if(c.to!=d.to||!Ui(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,n,i,l,o=-1){let s=new cn(e,null,o).goto(n),r=n,c=s.openStart;for(;;){let d=Math.min(s.to,i);if(s.point){let h=s.activeForPoint(s.to),f=s.pointFrom<n?h.length+1:s.point.startSide<0?h.length:Math.min(h.length,c);l.point(r,d,s.point,h,f,s.pointRank),c=Math.min(s.openEnd(d),h.length)}else d>r&&(l.span(r,d,s.active,c),c=s.openEnd(d));if(s.to>i)return c+(s.point&&s.to>i?1:0);r=s.to,s.next()}}static of(e,n=!1){let i=new Ln;for(let l of e instanceof an?[e]:n?yf(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return ge.empty;let n=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=ge.empty;l=l.nextLayer)n=new ge(l.chunkPos,l.chunk,n,Math.max(l.maxPoint,n.maxPoint));return n}}ge.empty=new ge([],[],null,-1);function yf(a){if(a.length>1)for(let e=a[0],n=1;n<a.length;n++){let i=a[n];if($i(e,i)>0)return a.slice().sort($i);e=i}return a}ge.empty.nextLayer=ge.empty;class Ln{finishChunk(e){this.chunks.push(new Pi(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,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new Ln)).add(e,n,i)}addInner(e,n,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.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(n-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+e,this.lastTo=n.to[i]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Io(a,e,n){let i=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&i.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=i.get(o.chunk[s]);r!=null&&(n?n.mapPos(r):r)==o.chunkPos[s]&&!n?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class Do{constructor(e,n,i,l=0){this.layer=e,this.skip=n,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,i){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++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],i=e+n.from[this.rangeIndex];if(this.from=i,this.to=e+n.to[this.rangeIndex],this.value=n.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 rn{constructor(e){this.heap=e}static from(e,n=null,i=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&l.push(new Do(s,n,i,o));return l.length==1?l[0]:new rn(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let i of this.heap)i.goto(e,n);for(let i=this.heap.length>>1;i>=0;i--)Li(this.heap,i);return this.next(),this}forward(e,n){for(let i of this.heap)i.forward(e,n);for(let i=this.heap.length>>1;i>=0;i--)Li(this.heap,i);(this.to-e||this.value.endSide-n)<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(),Li(this.heap,0)}}}function Li(a,e){for(let n=a[e];;){let i=(e<<1)+1;if(i>=a.length)break;let l=a[i];if(i+1<a.length&&l.compare(a[i+1])>=0&&(l=a[i+1],i++),n.compare(l)<0)break;a[i]=n,a[e]=l,e=i}}class cn{constructor(e,n,i){this.minPoint=i,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=rn.from(e,n,i)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Un(this.active,e),Un(this.activeTo,e),Un(this.activeRank,e),this.minActive=Po(this.active,this.activeTo)}addActive(e){let n=0,{value:i,to:l,rank:o}=this.cursor;for(;n<this.activeRank.length&&(o-this.activeRank[n]||l-this.activeTo[n])>0;)n++;jn(this.active,n,i),jn(this.activeTo,n,l),jn(this.activeRank,n,o),e&&jn(e,n,this.cursor.from),this.minActive=Po(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let i=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),i&&Un(i,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(i),this.cursor.next();else if(n&&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(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(e){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)n++;return n}}function $o(a,e,n,i,l,o){a.goto(e),n.goto(i);let s=i+l,r=i,c=i-e;for(;;){let d=a.to+c-n.to,h=d||a.endSide-n.endSide,f=h<0?a.to+c:n.to,u=Math.min(f,s);if(a.point||n.point?a.point&&n.point&&(a.point==n.point||a.point.eq(n.point))&&Ui(a.activeForPoint(a.to),n.activeForPoint(n.to))||o.comparePoint(r,u,a.point,n.point):u>r&&!Ui(a.active,n.active)&&o.compareRange(r,u,a.active,n.active),f>s)break;(d||a.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(f),r=f,h<=0&&a.next(),h>=0&&n.next()}}function Ui(a,e){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(a[n]!=e[n]&&!a[n].eq(e[n]))return!1;return!0}function Un(a,e){for(let n=e,i=a.length-1;n<i;n++)a[n]=a[n+1];a.pop()}function jn(a,e,n){for(let i=a.length-1;i>=e;i--)a[i+1]=a[i];a[e]=n}function Po(a,e){let n=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||a[l].endSide-a[n].endSide)<0&&(n=l,i=e[l]);return n}function wf(a,e,n,i){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?n-o%n:1,l=st(a,l)}return i===!0?-1:a.length}const ji="ͼ",Lo=typeof Symbol>"u"?"__"+ji:Symbol.for(ji),zi=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Uo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class yt{constructor(e,n){this.rules=[];let{finish:i}=n||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,d){let h=[],f=/^@(\w+)\b/.exec(s[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return c.push(s[0]+";");for(let m in r){let g=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(w=>s.map(v=>w.replace(/&/,v))).reduce((w,v)=>w.concat(v)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),g,h,u)}else g!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+g+";")}(h.length||u)&&c.push((i&&!f&&!d?s.map(i):s).join(", ")+" {"+h.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
|
|
19
|
-
`)}static newName(){let e=Uo
|
|
20
|
-
`;this.styleTag.textContent=s;let r=n.head||n;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Lt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},qi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ce=0;Ce<10;Ce++)Lt[48+Ce]=Lt[96+Ce]=String(Ce);for(var Ce=1;Ce<=24;Ce++)Lt[Ce+111]="F"+Ce;for(var Ce=65;Ce<=90;Ce++)Lt[Ce]=String.fromCharCode(Ce+32),qi[Ce]=String.fromCharCode(Ce);for(var Qi in Lt)qi.hasOwnProperty(Qi)||(qi[Qi]=Lt[Qi]);function dn(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Wi(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function zn(a,e){if(!e.anchorNode)return!1;try{return Wi(a,e.anchorNode)}catch{return!1}}function hn(a){return a.nodeType==3?Ot(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function fn(a,e,n,i){return n?zo(a,e,n,i,-1)||zo(a,e,n,i,1):!1}function Et(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function qn(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function zo(a,e,n,i,l){for(;;){if(a==n&&e==i)return!0;if(e==(l<0?0:Xe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=Et(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?Xe(a):0}else return!1}}function Xe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Qn(a,e){let n=e?a.left:a.right;return{left:n,right:n,top:a.top,bottom:a.bottom}}function xf(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 qo(a,e){let n=e.width/a.offsetWidth,i=e.height/a.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-a.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-a.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function vf(a,e,n,i,l,o,s,r){let c=a.ownerDocument,d=c.defaultView||window;for(let h=a,f=!1;h&&!f;)if(h.nodeType==1){let u,m=h==c.body,g=1,w=1;if(m)u=xf(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let A=h.getBoundingClientRect();({scaleX:g,scaleY:w}=qo(h,A)),u={left:A.left,right:A.left+h.clientWidth*g,top:A.top,bottom:A.top+h.clientHeight*w}}let v=0,y=0;if(l=="nearest")e.top<u.top?(y=e.top-(u.top+s),n>0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+s)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+s,n<0&&e.top-y<u.top&&(y=e.top-(u.top+s)));else{let A=e.bottom-e.top,V=u.bottom-u.top;y=(l=="center"&&A<=V?e.top+A/2-V/2:l=="start"||l=="center"&&n<0?e.top-s:e.bottom-V+s)-u.top}if(i=="nearest"?e.left<u.left?(v=e.left-(u.left+o),n>0&&e.right>u.right+v&&(v=e.right-u.right+o)):e.right>u.right&&(v=e.right-u.right+o,n<0&&e.left<u.left+v&&(v=e.left-(u.left+o))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-o:e.right-(u.right-u.left)+o)-u.left,v||y)if(m)d.scrollBy(v,y);else{let A=0,V=0;if(y){let k=h.scrollTop;h.scrollTop+=y/w,V=(h.scrollTop-k)*w}if(v){let k=h.scrollLeft;h.scrollLeft+=v/g,A=(h.scrollLeft-k)*g}e={left:e.left-A,top:e.top-V,right:e.right-A,bottom:e.bottom-V},A&&Math.abs(A-v)<1&&(i="nearest"),V&&Math.abs(V-y)<1&&(l="nearest")}if(m)break;(e.top<u.top||e.bottom>u.bottom||e.left<u.left||e.right>u.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Cf(a){let e=a.ownerDocument,n,i;for(let l=a.parentNode;l&&!(l==e.body||n&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!n&&l.scrollWidth>l.clientWidth&&(n=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:n,y:i}}class Sf{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:n,focusNode:i}=e;this.set(n,Math.min(e.anchorOffset,n?Xe(n):0),i,Math.min(e.focusOffset,i?Xe(i):0))}set(e,n,i,l){this.anchorNode=e,this.anchorOffset=n,this.focusNode=i,this.focusOffset=l}}let Ut=null;function Qo(a){if(a.setActive)return a.setActive();if(Ut)return a.focus(Ut);let e=[];for(let n=a;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(a.focus(Ut==null?{get preventScroll(){return Ut={preventScroll:!0},!0}}:void 0),!Ut){Ut=!1;for(let n=0;n<e.length;){let i=e[n++],l=e[n++],o=e[n++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=o&&(i.scrollLeft=o)}}}let Wo;function Ot(a,e,n=e){let i=Wo||(Wo=document.createRange());return i.setEnd(a,n),i.setStart(a,e),i}function jt(a,e,n,i){let l={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);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 Bf(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Ko(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function Nf(a,e){let n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,Xe(n));;)if(i){if(n.nodeType!=1)return!1;let l=n.childNodes[i-1];l.contentEditable=="false"?i--:(n=l,i=Xe(n))}else{if(n==a)return!0;i=Et(n),n=n.parentNode}}function Yo(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Ho(a,e){for(let n=a,i=e;;){if(n.nodeType==3&&i>0)return{node:n,offset:i};if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=Xe(n)}else if(n.parentNode&&!qn(n))i=Et(n),n=n.parentNode;else return null}}function Go(a,e){for(let n=a,i=e;;){if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!qn(n))i=Et(n)+1,n=n.parentNode;else return null}}class Re{constructor(e,n,i=!0){this.node=e,this.offset=n,this.precise=i}static before(e,n){return new Re(e.parentNode,Et(e),n)}static after(e,n){return new Re(e.parentNode,Et(e)+1,n)}}const Ki=[];class de{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 n=this.posAtStart;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let i=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:i.firstChild)){let r=de.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,n),s.flags&=-8}if(o=l?l.nextSibling:i.firstChild,n&&!n.written&&n.node==i&&o!=s.dom&&(n.written=!0),s.dom.parentNode==i)for(;o&&o!=s.dom;)o=Jo(o);else i.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:i.firstChild,o&&n&&n.node==i&&(n.written=!0);o;)o=Jo(o)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,n),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let i;if(e==this.dom)i=this.dom.childNodes[n];else{let l=Xe(e)==0?0:n==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?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!de.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==i)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,n,i=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,d=i,h=i;c<this.children.length;c++){let f=this.children[c],u=d+f.length;if(d<e&&u>n)return f.domBoundsAround(e,n,d);if(u>=e&&l==-1&&(l=c,o=d),d>n&&f.dom.parentNode==this.dom){s=c,r=h;break}h=u,d=u+f.breakAfter}return{from:o,to:r<0?i+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 n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.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 n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,i=Ki){this.markDirty();for(let l=e;l<n;l++){let o=this.children[l];o.parent==this&&i.indexOf(o)<0&&o.destroy()}i.length<250?this.children.splice(e,n-e,...i):this.children=[].concat(this.children.slice(0,e),i,this.children.slice(n));for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Xo(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}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,n,i,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}}de.prototype.breakAfter=0;function Jo(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Xo{constructor(e,n,i){this.children=e,this.pos=n,this.i=i,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Zo(a,e,n,i,l,o,s,r,c){let{children:d}=a,h=d.length?d[e]:null,f=o.length?o[o.length-1]:null,u=f?f.breakAfter:s;if(!(e==i&&h&&!s&&!u&&o.length<2&&h.merge(n,l,o.length?f:null,n==0,r,c))){if(i<d.length){let m=d[i];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&f&&m.merge(0,l,f,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(f?f.breakAfter=1:s=1),i++}for(h&&(h.breakAfter=s,n>0&&(!s&&o.length&&h.merge(n,h.length,o[0],!1,r,0)?h.breakAfter=o.shift().breakAfter:(n<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(n,h.length,null,!1,r,0),e++));e<i&&o.length;)if(d[i-1].become(o[o.length-1]))i--,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&&i<d.length&&!d[e-1].breakAfter&&d[i].merge(0,0,d[e-1],!1,r,c)&&e--,(e<i||o.length)&&a.replaceChildren(e,i,o)}}function es(a,e,n,i,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(n,1),{i:d,off:h}=s.findPos(e,-1),f=e-n;for(let u of i)f+=u.length;a.length+=f,Zo(a,d,h,r,c,i,0,l,o)}let Me=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Yi=typeof document<"u"?document:{documentElement:{style:{}}};const Hi=/Edge\/(\d+)/.exec(Me.userAgent),ts=/MSIE \d/.test(Me.userAgent),Gi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Me.userAgent),Wn=!!(ts||Gi||Hi),ns=!Wn&&/gecko\/(\d+)/i.test(Me.userAgent),Ji=!Wn&&/Chrome\/(\d+)/.exec(Me.userAgent),is="webkitFontSmoothing"in Yi.documentElement.style,ls=!Wn&&/Apple Computer/.test(Me.vendor),os=ls&&(/Mobile\/\w+/.test(Me.userAgent)||Me.maxTouchPoints>2);var G={mac:os||/Mac/.test(Me.platform),windows:/Win/.test(Me.platform),linux:/Linux|X11/.test(Me.platform),ie:Wn,ie_version:ts?Yi.documentMode||6:Gi?+Gi[1]:Hi?+Hi[1]:0,gecko:ns,gecko_version:ns?+(/Firefox\/(\d+)/.exec(Me.userAgent)||[0,0])[1]:0,chrome:!!Ji,chrome_version:Ji?+Ji[1]:0,ios:os,android:/Android\b/.test(Me.userAgent),webkit:is,safari:ls,webkit_version:is?+(/\bAppleWebKit\/(\d+)/.exec(Me.userAgent)||[0,0])[1]:0,tabSize:Yi.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Vf=256;class ze extends de{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,i){return this.flags&8||i&&(!(i instanceof ze)||this.length-(n-e)+i.length>Vf||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new ze(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Re(this.dom,e)}domBoundsAround(e,n,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return Rf(this.dom,e,n)}}class ct extends de{constructor(e,n=[],i=0){super(),this.mark=e,this.children=n,this.length=i;for(let l of n)l.setParent(this)}setAttrs(e){if(Ko(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);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,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,i,l,o,s){return i&&(!(i instanceof ct&&i.mark.eq(this.mark))||e&&o<=0||n<this.length&&s<=0)?!1:(es(this,e,n,i?i.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let n=[],i=0,l=-1,o=0;for(let r of this.children){let c=i+r.length;c>e&&n.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=o),i=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new ct(this.mark,n,s)}domAtPos(e){return ss(this,e)}coordsAt(e,n){return rs(this,e,n)}}function Rf(a,e,n){let i=a.nodeValue.length;e>i&&(e=i);let l=e,o=e,s=0;e==0&&n<0||e==i&&n>=0?G.chrome||G.gecko||(e?(l--,s=1):o<i&&(o++,s=-1)):n<0?l--:o<i&&o++;let r=Ot(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:n>=0)?0:r.length-1];return G.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,d=>d.width)||c),s?Qn(c,s<0):c||null}class _t extends de{static create(e,n,i){return new _t(e,n,i)}constructor(e,n,i){super(),this.widget=e,this.length=n,this.side=i,this.prevWidget=null}split(e){let n=_t.create(this.widget,this.length-e,this.side);return this.length-=e,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"))}getSide(){return this.side}merge(e,n,i,l,o,s){return i&&(!(i instanceof _t)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}become(e){return e instanceof _t&&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 se.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,i=n&&n.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):se.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Re.before(this.dom):Re.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;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 Qn(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class zt extends de{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof zt&&e.side==this.side}split(){return new zt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Re.before(this.dom):Re.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return se.empty}get isHidden(){return!0}}ze.prototype.children=_t.prototype.children=zt.prototype.children=Ki;function ss(a,e){let n=a.dom,{children:i}=a,l=0;for(let o=0;l<i.length;l++){let s=i[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==n)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=i[o-1];if(s.dom.parentNode==n)return s.domAtPos(s.length)}for(let o=l;o<i.length;o++){let s=i[o];if(s.dom.parentNode==n)return s.domAtPos(0)}return new Re(n,0)}function as(a,e,n){let i,{children:l}=a;n>0&&e instanceof ct&&l.length&&(i=l[l.length-1])instanceof ct&&i.mark.eq(e.mark)?as(i,e.children[0],n-1):(l.push(e),e.setParent(a)),a.length+=e.length}function rs(a,e,n){let i=null,l=-1,o=null,s=-1;function r(d,h){for(let f=0,u=0;f<d.children.length&&u<=h;f++){let m=d.children[f],g=u+m.length;g>=h&&(m.children.length?r(m,h-u):(!o||o.isHidden&&(n>0||Of(o,m)))&&(g>h||u==g&&m.getSide()>0)?(o=m,s=h-u):(u<h||u==g&&m.getSide()<0&&!m.isHidden)&&(i=m,l=h-u)),u=g}}r(a,e);let c=(n<0?i:o)||i||o;return c?c.coordsAt(Math.max(0,c==i?l:s),n):Ef(a)}function Ef(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let n=hn(e);return n[n.length-1]||null}function Of(a,e){let n=a.coordsAt(0,1),i=e.coordsAt(0,1);return n&&i&&i.top<n.bottom}function Xi(a,e){for(let n in a)n=="class"&&e.class?e.class+=" "+a.class:n=="style"&&e.style?e.style+=";"+a.style:e[n]=a[n];return e}const cs=Object.create(null);function Kn(a,e,n){if(a==e)return!0;a||(a=cs),e||(e=cs);let i=Object.keys(a),l=Object.keys(e);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=l.length-(n&&l.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Zi(a,e,n){let i=!1;if(e)for(let l in e)n&&l in n||(i=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(n)for(let l in n)e&&e[l]==n[l]||(i=!0,l=="style"?a.style.cssText=n[l]:a.setAttribute(l,n[l]));return i}function _f(a){let e=Object.create(null);for(let n=0;n<a.attributes.length;n++){let i=a.attributes[n];e[i.name]=i.value}return e}class el{eq(e){return!1}updateDOM(e,n){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,n,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ze=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Ze||(Ze={}));class Ee extends Pt{constructor(e,n,i,l){super(),this.startSide=e,this.endSide=n,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new un(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return n+=i&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new wt(e,n,n,i,e.widget||null,!1)}static replace(e){let n=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:s}=ds(e,n);i=(o?n?-3e8:-1:5e8)-1,l=(s?n?2e8:1:-6e8)+1}return new wt(e,i,l,n,e.widget||null,!0)}static line(e){return new pn(e)}static set(e,n=!1){return ge.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ee.none=ge.empty;class un extends Ee{constructor(e){let{start:n,end:i}=ds(e);super(n?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,i;return this==e||e instanceof un&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Kn(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}un.prototype.point=!1;class pn extends Ee{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof pn&&this.spec.class==e.spec.class&&Kn(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}pn.prototype.mapMode=Fe.TrackBefore,pn.prototype.point=!0;class wt extends Ee{constructor(e,n,i,l,o,s){super(n,i,o,e),this.block=l,this.isReplace=s,this.mapMode=l?n<=0?Fe.TrackBefore:Fe.TrackAfter:Fe.TrackDel}get type(){return this.startSide!=this.endSide?Ze.WidgetRange:this.startSide<=0?Ze.WidgetBefore:Ze.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof wt&&Mf(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}wt.prototype.point=!0;function ds(a,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=a;return n==null&&(n=a.inclusive),i==null&&(i=a.inclusive),{start:n??e,end:i??e}}function Mf(a,e){return a==e||!!(a&&e&&a.compare(e))}function Yn(a,e,n,i=0){let l=n.length-1;l>=0&&n[l]+i>=a?n[l]=Math.max(n[l],e):n.push(a,e)}class we extends de{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,i,l,o,s){if(i){if(!(i instanceof we))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),es(this,e,n,i?i.children.slice():[],o,s),!0}split(e){let n=new we;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i,off:l}=this.childPos(e);l&&(n.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let o=i;o<this.children.length;o++)n.append(this.children[o],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,n}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){Kn(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){as(this,e,n)}addLineDeco(e){let n=e.spec.attributes,i=e.spec.class;n&&(this.attrs=Xi(n,this.attrs||{})),i&&(this.attrs=Xi({class:i},this.attrs||{}))}domAtPos(e){return ss(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var i;this.dom?this.flags&4&&(Ko(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&&(Zi(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let l=this.dom.lastChild;for(;l&&de.get(l)instanceof ct;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=de.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!G.ios||!this.children.some(o=>o instanceof ze))){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,n;for(let i of this.children){if(!(i instanceof ze)||/[^ -~]/.test(i.text))return null;let l=hn(i.dom);if(l.length!=1)return null;e+=l[0].width,n=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let i=rs(this,e,n);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=i.bottom-i.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:i.top+s,bottom:i.bottom-s,left:i.left,right:i.left}}}return i}become(e){return e instanceof we&&this.children.length==0&&e.children.length==0&&Kn(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let i=0,l=0;i<e.children.length;i++){let o=e.children[i],s=l+o.length;if(s>=n){if(o instanceof we)return o;if(s>n)break}l=s+o.breakAfter}return null}}class dt extends de{constructor(e,n,i){super(),this.widget=e,this.length=n,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,n,i,l,o,s){return i&&(!(i instanceof dt)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Re.before(this.dom):Re.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let i=new dt(this.widget,n,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return Ki}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):se.empty}domBoundsAround(){return null}become(e){return e instanceof dt&&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,n){let i=this.widget.coordsAt(this.dom,e,n);return i||(this.widget instanceof tl?null:Qn(this.dom.getBoundingClientRect(),this.length?e==0:n<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:i}=this.deco;return n==i?!1:e<0?n<0:i>0}}class tl extends el{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class mn{constructor(e,n,i,l){this.doc=e,this.pos=n,this.end=i,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=n}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 dt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new we),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Hn(new zt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof dt)&&this.getLine()}buildText(e,n,i){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(n.slice(n.length-i)),this.getLine().append(Hn(new ze(this.text.slice(this.textOff,this.textOff+l)),n),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,n,i,l){this.buildText(n-e,i,l),this.pos=n,this.openStart<0&&(this.openStart=l)}point(e,n,i,l,o,s){if(this.disallowBlockEffectsFor[s]&&i instanceof wt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=n-e;if(i instanceof wt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new dt(i.widget||qt.block,r,i));else{let c=_t.create(i.widget||qt.inline,r,r?0:i.startSide),d=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<n||i.startSide>0),h=!c.isEditable&&(e<n||o>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),d&&(f.append(Hn(new zt(1),l),o),o=l.length+Math.max(0,o-l.length)),f.append(Hn(c,l),o),this.atCursorPos=h,this.pendingBuffer=h?e<n||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);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=n),this.openStart<0&&(this.openStart=o)}static build(e,n,i,l,o){let s=new mn(e,n,i,o);return s.openEnd=ge.spans(l,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Hn(a,e){for(let n of e)a=new ct(n,[a],a.length);return a}class qt extends el{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}qt.inline=new qt("span"),qt.block=new qt("div");var Se=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(Se||(Se={}));const Mt=Se.LTR,nl=Se.RTL;function hs(a){let e=[];for(let n=0;n<a.length;n++)e.push(1<<+a[n]);return e}const Tf=hs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ff=hs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),il=Object.create(null),et=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),n=a.charCodeAt(1);il[e]=n,il[n]=-e}function fs(a){return a<=247?Tf[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Ff[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const If=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class At{get dir(){return this.level%2?nl:Mt}constructor(e,n,i){this.from=e,this.to=n,this.level=i}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,i,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=n&&r.to>=n){if(r.level==i)return s;(o<0||(l!=0?l<0?r.from<n:r.to>n:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function us(a,e){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++){let i=a[n],l=e[n];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!us(i.inner,l.inner))return!1}return!0}const he=[];function Df(a,e,n,i,l){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:e,r=o<i.length?i[o].from:n,c=o?256:l;for(let d=s,h=c,f=c;d<r;d++){let u=fs(a.charCodeAt(d));u==512?u=h:u==8&&f==4&&(u=16),he[d]=u==4?2:u,u&7&&(f=u),h=u}for(let d=s,h=c,f=c;d<r;d++){let u=he[d];if(u==128)d<r-1&&h==he[d+1]&&h&24?u=he[d]=h:he[d]=256;else if(u==64){let m=d+1;for(;m<r&&he[m]==64;)m++;let g=d&&h==8||m<n&&he[m]==8?f==1?1:8:256;for(let w=d;w<m;w++)he[w]=g;d=m-1}else u==8&&f==1&&(he[d]=1);h=u,u&7&&(f=u)}}}function $f(a,e,n,i,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=i.length;s++){let d=s?i[s-1].to:e,h=s<i.length?i[s].from:n;for(let f=d,u,m,g;f<h;f++)if(m=il[u=a.charCodeAt(f)])if(m<0){for(let w=r-3;w>=0;w-=3)if(et[w+1]==-m){let v=et[w+2],y=v&2?l:v&4?v&1?o:l:0;y&&(he[f]=he[et[w]]=y),r=w;break}}else{if(et.length==189)break;et[r++]=f,et[r++]=u,et[r++]=c}else if((g=he[f])==2||g==1){let w=g==l;c=w?0:1;for(let v=r-3;v>=0;v-=3){let y=et[v+2];if(y&2)break;if(w)et[v+2]|=2;else{if(y&4)break;et[v+2]|=4}}}}}function Pf(a,e,n,i){for(let l=0,o=i;l<=n.length;l++){let s=l?n[l-1].to:a,r=l<n.length?n[l].from:e;for(let c=s;c<r;){let d=he[c];if(d==256){let h=c+1;for(;;)if(h==r){if(l==n.length)break;h=n[l++].to,r=l<n.length?n[l].from:e}else if(he[h]==256)h++;else break;let f=o==1,u=(h<e?he[h]:i)==1,m=f==u?f?1:2:i;for(let g=h,w=l,v=w?n[w-1].to:a;g>c;)g==v&&(g=n[--w].from,v=w?n[w-1].to:a),he[--g]=m;c=h}else o=d,c++}}}function ll(a,e,n,i,l,o,s){let r=i%2?2:1;if(i%2==l%2)for(let c=e,d=0;c<n;){let h=!0,f=!1;if(d==o.length||c<o[d].from){let w=he[c];w!=r&&(h=!1,f=w==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,g=c;e:for(;;)if(d<o.length&&g==o[d].from){if(f)break e;let w=o[d];if(!h)for(let v=w.to,y=d+1;;){if(v==n)break e;if(y<o.length&&o[y].from==v)v=o[y++].to;else{if(he[v]==r)break e;break}}if(d++,u)u.push(w);else{w.from>c&&s.push(new At(c,w.from,m));let v=w.direction==Mt!=!(m%2);ol(a,v?i+1:i,l,w.inner,w.from,w.to,s),c=w.to}g=w.to}else{if(g==n||(h?he[g]!=r:he[g]==r))break;g++}u?ll(a,c,g,i+1,l,u,s):c<g&&s.push(new At(c,g,m)),c=g}else for(let c=n,d=o.length;c>e;){let h=!0,f=!1;if(!d||c>o[d-1].to){let w=he[c-1];w!=r&&(h=!1,f=w==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,g=c;e:for(;;)if(d&&g==o[d-1].to){if(f)break e;let w=o[--d];if(!h)for(let v=w.from,y=d;;){if(v==e)break e;if(y&&o[y-1].to==v)v=o[--y].from;else{if(he[v-1]==r)break e;break}}if(u)u.push(w);else{w.to<c&&s.push(new At(w.to,c,m));let v=w.direction==Mt!=!(m%2);ol(a,v?i+1:i,l,w.inner,w.from,w.to,s),c=w.from}g=w.from}else{if(g==e||(h?he[g-1]!=r:he[g-1]==r))break;g--}u?ll(a,g,c,i+1,l,u,s):g<c&&s.push(new At(g,c,m)),c=g}}function ol(a,e,n,i,l,o,s){let r=e%2?2:1;Df(a,l,o,i,r),$f(a,l,o,i,r),Pf(l,o,i,r),ll(a,l,o,e,n,i,s)}function Lf(a,e,n){if(!a)return[new At(0,0,e==nl?1:0)];if(e==Mt&&!n.length&&!If.test(a))return ps(a.length);if(n.length)for(;a.length>he.length;)he[he.length]=256;let i=[],l=e==Mt?0:1;return ol(a,l,l,n,0,a.length,i),i}function ps(a){return[new At(0,a,0)]}let ms="";function Uf(a,e,n,i,l){var o;let s=i.head-a.from,r=At.find(e,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),c=e[r],d=c.side(l,n);if(s==d){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;c=e[r=u],s=c.side(!l,n),d=c.side(l,n)}let h=st(a.text,s,c.forward(l,n));(h<c.from||h>c.to)&&(h=d),ms=a.text.slice(Math.min(s,h),Math.max(s,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==d&&f.level+(l?0:1)<c.level?J.cursor(f.side(!l,n)+a.from,f.forward(l,n)?1:-1,f.level):J.cursor(h+a.from,c.forward(l,n)?-1:1,c.level)}function jf(a,e,n){for(let i=e;i<n;i++){let l=fs(a.charCodeAt(i));if(l==1)return Mt;if(l==2||l==4)return nl}return Mt}const gs=ne.define(),bs=ne.define(),ks=ne.define(),ys=ne.define(),sl=ne.define(),ws=ne.define(),As=ne.define(),al=ne.define(),rl=ne.define(),xs=ne.define({combine:a=>a.some(e=>e)}),zf=ne.define({combine:a=>a.some(e=>e)}),vs=ne.define();class Qt{constructor(e,n="nearest",i="nearest",l=5,o=5,s=!1){this.range=e,this.y=n,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Qt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Qt(J.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Gn=Ae.define({map:(a,e)=>a.map(e)}),Cs=Ae.define();function tt(a,e,n){let i=a.facet(ys);i.length?i[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const ht=ne.define({combine:a=>a.length?a[0]:!0});let qf=0;const Wt=ne.define({combine(a){return a.filter((e,n)=>{for(let i=0;i<n;i++)if(a[i].plugin==e.plugin)return!1;return!0})}});class Kt{constructor(e,n,i,l,o){this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Wt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Wt.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:i,eventObservers:l,provide:o,decorations:s}=n||{};return new Kt(qf++,e,i,l,r=>{let c=[];return s&&c.push(gn.of(d=>{let h=d.plugin(r);return h?s(h):Ee.none})),o&&c.push(o(r)),c})}static fromClass(e,n){return Kt.define((i,l)=>new e(i,l),n)}}class cl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(tt(n.state,i,"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(n){tt(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){tt(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ss=ne.define(),dl=ne.define(),gn=ne.define(),Bs=ne.define(),hl=ne.define(),Ns=ne.define();function Vs(a,e){let n=a.state.facet(Ns);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(a):o),l=[];return ge.spans(i,e.from,e.to,{point(){},span(o,s,r,c){let d=o-e.from,h=s-e.from,f=l;for(let u=r.length-1;u>=0;u--,c--){let m=r[u].spec.bidiIsolate,g;if(m==null&&(m=jf(e.text,d,h)),c>0&&f.length&&(g=f[f.length-1]).to==d&&g.direction==m)g.to=h,f=g.inner;else{let w={from:d,to:h,direction:m,inner:[]};f.push(w),f=w.inner}}}}),l}const Rs=ne.define();function Es(a){let e=0,n=0,i=0,l=0;for(let o of a.state.facet(Rs)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(n=Math.max(n,s.right)),s.top!=null&&(i=Math.max(i,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:n,top:i,bottom:l}}const bn=ne.define();class Le{constructor(e,n,i,l){this.fromA=e,this.toA=n,this.fromB=i,this.toB=l}join(e){return new Le(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 n=e.length,i=this;for(;n>0;n--){let l=e[n-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(n-1,1)}}return e.splice(n,0,i),e}static extendWithRanges(e,n){if(n.length==0)return e;let i=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],d=s-r,h=c?c.fromB:1e9;for(;o<n.length&&n[o]<h;){let f=n[o],u=n[o+1],m=Math.max(r,f),g=Math.min(h,u);if(m<=g&&new Le(m+d,g+d,m,g).addToSet(i),u>h)break;o+=2}if(!c)return i;new Le(c.fromA,c.toA,c.fromB,c.toB).addToSet(i),s=c.toA,r=c.toB}}}class Jn{constructor(e,n,i){this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ve.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new Le(o,s,r,c))),this.changedRanges=l}static create(e,n,i){return new Jn(e,n,i)}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 Os extends de{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=Ee.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 we],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Le(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?l=this.domChanged.newSel.head:!Jf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Wf(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;i=new Le(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(G.ie||G.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=Hf(s,r,e.changes);return i=Le.extendWithRanges(i,c),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,i);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=G.chrome||G.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 dt&&s.widget instanceof tl&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,n,i){let l=i?i.range.addToSet(e.slice()):e,o=this.childCursor(n);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:d,fromB:h,toB:f}=r,u,m,g,w;if(i&&i.range.fromB<f&&i.range.toB>h){let k=mn.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=mn.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,g=k.openStart,w=p.openEnd;let S=this.compositionView(i);p.breakAtStart?S.breakAfter=1:p.content.length&&S.merge(S.length,S.length,p.content[0],!1,p.openStart,0)&&(S.breakAfter=p.content[0].breakAfter,p.content.shift()),k.content.length&&S.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),u=k.content.concat(S).concat(p.content)}else({content:u,breakAtStart:m,openStart:g,openEnd:w}=mn.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:y}=o.findPos(d,1),{i:A,off:V}=o.findPos(c,-1);Zo(this,A,V,v,y,u,m,g,w)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let i of n.effects)i.is(Cs)&&(this.editContextFormatting=i.value)}compositionView(e){let n=new ze(e.text.nodeValue);n.flags|=8;for(let{deco:l}of e.marks)n=new ct(l,[n],n.length);let i=new we;return i.append(n,0),i}fixCompositionDOM(e){let n=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=de.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];n(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)i=l.childPos(i.off,1),l=l.children[i.i],n(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,o=!l&&!(this.view.state.facet(ht)||this.dom.tabIndex>-1)&&zn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||n||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(G.gecko&&r.empty&&!this.hasComposition&&Qf(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Re(f,0),s=!0}let h=this.view.observer.selectionRange;(s||!h.focusNode||(!fn(c.node,c.offset,h.anchorNode,h.anchorOffset)||!fn(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{G.android&&G.chrome&&this.dom.contains(h.focusNode)&&Gf(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=dn(this.view.root);if(f)if(r.empty){if(G.gecko){let u=Kf(c.node,c.offset);if(u&&u!=3){let m=(u==1?Ho:Go)(c.node,c.offset);m&&(c=new Re(m.node,m.offset))}}f.collapse(c.node,c.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([c,d]=[d,c]),u.setEnd(d.node,d.offset),u.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(u)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Re(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Re(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&fn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,i=dn(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let s=we.find(this,n.head);if(!s)return;let r=s.posAtStart;if(n.head==r||n.head==r+s.length)return;let c=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc);i.collapse(h.node,h.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&i.collapse(l,o)}moveToLine(e){let n=this.dom,i;if(e.node!=n)return e;for(let l=e.offset;!i&&l<n.childNodes.length;l++){let o=de.get(n.childNodes[l]);o instanceof we&&(i=o.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let o=de.get(n.childNodes[l]);o instanceof we&&(i=o.domAtPos(o.length))}return i?new Re(i.node,i.offset,!0):e}nearest(e){for(let n=e;n;){let i=de.get(n);if(i&&i.rootView==this)return i;n=n.parentNode}return null}posFromDOM(e,n){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,n)+i.posAtStart}domAtPos(e){let{i:n,off:i}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let l=this.children[n];if(i<l.length||l instanceof we)break;n++,i=0}return this.children[n].domAtPos(i)}coordsAt(e,n){let i=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))&&(!i||r instanceof we&&!(i instanceof we&&n>=0)))i=r,l=d;else if(i&&d==e&&c==e&&r instanceof dt&&Math.abs(n)<2){if(r.deco.startSide<0)break;s&&(i=null)}o=d}return i?i.coordsAt(e-l,n):null}coordsForChar(e){let{i:n,off:i}=this.childPos(e,1),l=this.children[n];if(!(l instanceof we))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=c}if(!(l instanceof ze))return null;let o=st(l.text,i);if(o==i)return null;let s=Ot(l.dom,i,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 n=[],{from:i,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==Se.LTR;for(let d=0,h=0;h<this.children.length;h++){let f=this.children[h],u=d+f.length;if(u>l)break;if(d>=i){let m=f.dom.getBoundingClientRect();if(n.push(m.height),s){let g=f.dom.lastChild,w=g?hn(g):[];if(w.length){let v=w[w.length-1],y=c?v.right-m.left:m.right-v.left;y>r&&(r=y,this.minWidth=o,this.minWidthFrom=d,this.minWidthTo=u)}}}d=u+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Se.RTL:Se.LTR}measureTextSize(){for(let o of this.children)if(o instanceof we){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),n,i,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=hn(e.firstChild)[0];n=e.getBoundingClientRect().height,i=o?o.width/27:7,l=o?o.height:n,e.remove()}),{lineHeight:n,charWidth:i,textHeight:l}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new Xo(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let i=0,l=0;;l++){let o=l==n.viewports.length?null:n.viewports[l],s=o?o.from-1:this.length;if(s>i){let r=(n.lineBlockAt(s).bottom-n.lineBlockAt(i).top)/this.view.scaleY;e.push(Ee.replace({widget:new tl(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return Ee.set(e)}updateDeco(){let e=1,n=this.view.state.facet(gn).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(Bs).map((o,s)=>{let r=typeof o=="function";return r&&(i=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,n.push(ge.join(l))),this.decorations=[this.editContextFormatting,...n,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(vs))try{if(d(this.view,e.range,e))return!0}catch(h){tt(this.view.state,h,"scroll handler")}let{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),l;if(!i)return;!n.empty&&(l=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=Es(this.view),s={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;vf(this.view.scrollDOM,s,n.head<n.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==Se.LTR)}}function Qf(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 _s(a,e){let n=a.observer.selectionRange;if(!n.focusNode)return null;let i=Ho(n.focusNode,n.focusOffset),l=Go(n.focusNode,n.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let r=de.get(l.node);if(!r||r instanceof ze&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=de.get(i.node);!c||c instanceof ze&&c.text!=i.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Wf(a,e,n){let i=_s(a,n);if(!i)return null;let{node:l,from:o,to:s}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(i.from,i.to)!=r)return null;let c=e.invertedDesc,d=new Le(c.mapPos(o),c.mapPos(s),o,s),h=[];for(let f=l.parentNode;;f=f.parentNode){let u=de.get(f);if(u instanceof ct)h.push({node:f,deco:u.mark});else{if(u instanceof we||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:d,text:l,marks:h,line:f};if(f!=a.contentDOM)h.push({node:f,deco:new un({inclusive:!0,attributes:_f(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Kf(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 Yf=class{constructor(){this.changes=[]}compareRange(e,n){Yn(e,n,this.changes)}comparePoint(e,n){Yn(e,n,this.changes)}boundChange(e){Yn(e,e,this.changes)}};function Hf(a,e,n){let i=new Yf;return ge.compare(a,e,n,i),i.changes}function Gf(a,e){for(let n=a;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Jf(a,e){let n=!1;return e&&a.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(n=!0)}),n}function Xf(a,e,n=1){let i=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return J.cursor(e);o==0?n=1:o==l.length&&(n=-1);let s=o,r=o;n<0?s=st(l.text,o,!1):r=st(l.text,o);let c=i(l.text.slice(s,r));for(;s>0;){let d=st(l.text,s,!1);if(i(l.text.slice(d,s))!=c)break;s=d}for(;r<l.length;){let d=st(l.text,r);if(i(l.text.slice(r,d))!=c)break;r=d}return J.range(s+l.from,r+l.from)}function Zf(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function eu(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function fl(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function Ms(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function Ts(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ul(a,e,n){let i,l,o,s,r=!1,c,d,h,f;for(let g=a.firstChild;g;g=g.nextSibling){let w=hn(g);for(let v=0;v<w.length;v++){let y=w[v];l&&fl(l,y)&&(y=Ms(Ts(y,l.bottom),l.top));let A=Zf(e,y),V=eu(n,y);if(A==0&&V==0)return g.nodeType==3?Fs(g,e,n):ul(g,e,n);(!i||s>V||s==V&&o>A)&&(i=g,l=y,o=A,s=V,r=A?e<y.left?v>0:v<w.length-1:!0),A==0?n>y.bottom&&(!h||h.bottom<y.bottom)?(c=g,h=y):n<y.top&&(!f||f.top>y.top)&&(d=g,f=y):h&&fl(h,y)?h=Ts(h,y.bottom):f&&fl(f,y)&&(f=Ms(f,y.top))}}if(h&&h.bottom>=n?(i=c,l=h):f&&f.top<=n&&(i=d,l=f),!i)return{node:a,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return Fs(i,u,n);if(r&&i.contentEditable!="false")return ul(i,u,n);let m=Array.prototype.indexOf.call(a.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function Fs(a,e,n){let i=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<i;r++){let c=Ot(a,r,r+1).getClientRects();for(let d=0;d<c.length;d++){let h=c[d];if(h.top==h.bottom)continue;s||(s=e-h.left);let f=(h.top>n?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<o){let u=e>=(h.left+h.right)/2,m=u;if((G.chrome||G.gecko)&&Ot(a,r).getBoundingClientRect().left==h.right&&(m=!u),f<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=f}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function Is(a,e,n,i=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:d}=a.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>d)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,p=!1;c=a.elementAtHeight(u),c.type!=Ze.Text;)for(;u=i>0?c.bottom+k:c.top-k,!(u>=0&&u<=d);){if(p)return n?null:0;p=!0,i=-i}f=r+u;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:n?null:Ds(a,s,c,h,f);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:n?null:Ds(a,s,c,h,f);let g=a.dom.ownerDocument,w=a.root.elementFromPoint?a.root:g,v=w.elementFromPoint(h,f);v&&!a.contentDOM.contains(v)&&(v=null),v||(h=Math.max(s.left+1,Math.min(s.right-1,h)),v=w.elementFromPoint(h,f),v&&!a.contentDOM.contains(v)&&(v=null));let y,A=-1;if(v&&((l=a.docView.nearest(v))===null||l===void 0?void 0:l.isEditable)!=!1){if(g.caretPositionFromPoint){let k=g.caretPositionFromPoint(h,f);k&&({offsetNode:y,offset:A}=k)}else if(g.caretRangeFromPoint){let k=g.caretRangeFromPoint(h,f);k&&({startContainer:y,startOffset:A}=k,(!a.contentDOM.contains(y)||G.safari&&tu(y,A,h)||G.chrome&&nu(y,A,h))&&(y=void 0))}y&&(A=Math.min(Xe(y),A))}if(!y||!a.docView.dom.contains(y)){let k=we.find(a.docView,m);if(!k)return u>c.top+c.height/2?c.to:c.from;({node:y,offset:A}=ul(k.dom,h,f))}let V=a.docView.nearest(y);if(!V)return null;if(V.isWidget&&((o=V.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=V.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(y,A)+V.posAtStart}function Ds(a,e,n,i,l){let o=Math.round((i-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&n.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-n.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(n.from,n.to);return n.from+wf(s,o,a.state.tabSize)}function tu(a,e,n){let i,l=a;if(a.nodeType!=3||e!=(i=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 Ot(a,i-1,i).getBoundingClientRect().right>n}function nu(a,e,n){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 i=a.nodeType==1?a.getBoundingClientRect():Ot(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}function iu(a,e,n){let i=a.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Ze.Text&&(l.type!=o.type||(n<0?o.from<e:o.to>e)))&&(l=o)}}return l||i}return i}function lu(a,e,n,i){let l=iu(a,e.head,e.assoc||-1),o=!i||l.type!=Ze.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:n==(r==Se.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return J.cursor(c,n?-1:1)}return J.cursor(n?l.to:l.from,n?-1:1)}function $s(a,e,n,i){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=Uf(l,o,s,r,n),h=ms;if(!d){if(l.number==(n?a.state.doc.lines:1))return r;h=`
|
|
21
|
-
`,l=a.state.doc.line(l.number+(n?1:-1)),o=a.bidiSpans(l),d=a.visualLineSide(l,!n)}if(c){if(!c(h))return r}else{if(!i)return d;c=i(h)}r=d}}function
|
|
22
|
-
`&&a.lineWrapping&&(i&&(i=J.single(i.main.anchor-1,i.main.head-1)),n={from:l.from,to:l.to,insert:se.of([" "])}),n)return ml(a,n,i,o);if(i&&!i.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:i,scrollIntoView:s,userEvent:r}),!0}else return!1}function ml(a,e,n,i=-1){if(G.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(G.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&jt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&jt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&jt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=du(a,e,n));return a.state.facet(ws).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function du(a,e,n){let i,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&&(!n||n.main.empty&&n.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):"";i=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=n&&n.main.to<=r.newLength?n.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let d=a.state.sliceDoc(e.from,e.to),h,f=n&&_s(a,n.main.head);if(f){let g=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-g}}else h=a.state.doc.lineAt(o.head);let u=o.to-e.to,m=o.to-o.from;i=l.changeByRange(g=>{if(g.from==o.from&&g.to==o.to)return{changes:r,range:c||g.map(r)};let w=g.to-u,v=w-d.length;if(g.to-g.from!=m||a.state.sliceDoc(v,w)!=d||g.to>=h.from&&g.from<=h.to)return{range:g};let y=l.changes({from:v,to:w,insert:e.insert}),A=g.to-o.to;return{changes:y,range:c?J.range(Math.max(0,c.anchor+A),Math.max(0,c.head+A)):g.map(y)}})}else i={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(i,{userEvent:s,scrollIntoView:!0})}function hu(a,e,n,i){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(i=="end"){let c=Math.max(0,o-Math.min(s,r));n-=s+c-o}if(s<o&&a.length<e.length){let c=n<=o&&n>=s?o-n:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=n<=o&&n>=r?o-n:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function fu(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:l,focusOffset:o}=a.observer.selectionRange;return n&&(e.push(new Ps(n,i)),(l!=n||o!=i)&&e.push(new Ps(l,o))),e}function uu(a,e){if(a.length==0)return null;let n=a[0].pos,i=a.length==2?a[1].pos:n;return n>-1&&i>-1?J.single(n+e,i+e):null}class pu{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,G.safari&&e.contentDOM.addEventListener("input",()=>null),G.gecko&&Ou(e.contentDOM.ownerDocument)}handleEvent(e){!vu(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,n){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,n);for(let l of i.handlers){if(n.defaultPrevented)break;if(l(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=mu(e),i=this.handlers,l=this.view.contentDOM;for(let o in n)if(o!="scroll"){let s=!n[o].handlers.length,r=i[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 i)o!="scroll"&&!n[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=n}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&&bu.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),G.android&&G.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return G.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=js.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||gu.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,jt(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:G.safari&&!G.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 Us(a,e){return(n,i)=>{try{return e.call(a,i,n)}catch(l){tt(n.state,l)}}}function mu(a){let e=Object.create(null);function n(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of a){let l=i.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&n(r).handlers.push(Us(i.value,c))}if(s)for(let r in s){let c=s[r];c&&n(r).observers.push(Us(i.value,c))}}for(let i in qe)n(i).handlers.push(qe[i]);for(let i in Ue)n(i).observers.push(Ue[i]);return e}const js=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gu="dthko",bu=[16,17,18,20,91,92,224,225],Zn=6;function ei(a){return Math.max(0,a)*.7+8}function ku(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class yu{constructor(e,n,i,l){this.view=e,this.startEvent=n,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Cf(e.contentDOM),this.atoms=e.state.facet(hl).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ce.allowMultipleSelections)&&wu(e,n),this.dragging=xu(e,n)&&Js(n)==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&&ku(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=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=Es(this.view);e.clientX-c.left<=l+Zn?n=-ei(l-e.clientX):e.clientX+c.right>=s-Zn&&(n=ei(e.clientX-s)),e.clientY-c.top<=o+Zn?i=-ei(o-e.clientY):e.clientY+c.bottom>=r-Zn&&(i=ei(e.clientY-r)),this.setScrollSpeed(n,i)}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,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],o=null;if(l.empty){let s=Xn(this.atoms,l.from,0);s!=l.from&&(o=J.cursor(s,-1))}else{let s=Xn(this.atoms,l.from,-1),r=Xn(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=J.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(n||(n=e.ranges.slice()),n[i]=o)}return n?J.create(n,e.mainIndex):e}select(e){let{view:n}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function wu(a,e){let n=a.state.facet(gs);return n.length?n[0](e):G.mac?e.metaKey:e.ctrlKey}function Au(a,e){let n=a.state.facet(bs);return n.length?n[0](e):G.mac?!e.altKey:!e.ctrlKey}function xu(a,e){let{main:n}=a.state.selection;if(n.empty)return!1;let i=dn(a.root);if(!i||i.rangeCount==0)return!0;let l=i.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 vu(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,i;n!=a.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=de.get(n))&&i.ignoreEvent(e))return!1;return!0}const qe=Object.create(null),Ue=Object.create(null),zs=G.ie&&G.ie_version<15||G.ios&&G.webkit_version<604;function Cu(a){let e=a.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{a.focus(),n.remove(),qs(a,n.value)},50)}function ti(a,e,n){for(let i of a.facet(e))n=i(n,a);return n}function qs(a,e){e=ti(a.state,al,e);let{state:n}=a,i,l=1,o=n.toText(e),s=o.lines==n.selection.ranges.length;if(gl!=null&&n.selection.ranges.every(c=>c.empty)&&gl==o.toString()){let c=-1;i=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let f=n.toText((s?o.line(l++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:f},range:J.cursor(d.from+f.length)}})}else s?i=n.changeByRange(c=>{let d=o.line(l++);return{changes:{from:c.from,to:c.to,insert:d.text},range:J.cursor(c.from+d.length)}}):i=n.replaceSelection(o);a.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ue.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},qe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Ue.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Ue.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},qe.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of a.state.facet(ks))if(n=i(a,e),n)break;if(!n&&e.button==0&&(n=Nu(a,e)),n){let i=!a.hasFocus;a.inputState.startMouseSelection(new yu(a,e,n,i)),i&&a.observer.ignore(()=>{Qo(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 Qs(a,e,n,i){if(i==1)return J.cursor(e,n);if(i==2)return Xf(a.state,e,n);{let l=we.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++,J.range(s,r)}}let Ws=(a,e,n)=>e>=n.top&&e<=n.bottom&&a>=n.left&&a<=n.right;function Su(a,e,n,i){let l=we.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&&Ws(n,i,s))return-1;let r=l.coordsAt(o,1);return r&&Ws(n,i,r)?1:s&&s.bottom>=i?-1:1}function Ks(a,e){let n=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Su(a,n,e.clientX,e.clientY)}}const Bu=G.ie&&G.ie_version<=11;let Ys=null,Hs=0,Gs=0;function Js(a){if(!Bu)return a.detail;let e=Ys,n=Gs;return Ys=a,Gs=Date.now(),Hs=!e||n>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Hs+1)%3:1}function Nu(a,e){let n=Ks(a,e),i=Js(e),l=a.state.selection;return{update(o){o.docChanged&&(n.pos=o.changes.mapPos(n.pos),l=l.map(o.changes))},get(o,s,r){let c=Ks(a,o),d,h=Qs(a,c.pos,c.bias,i);if(n.pos!=c.pos&&!s){let f=Qs(a,n.pos,n.bias,i),u=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=u<h.from?J.range(u,m):J.range(m,u)}return s?l.replaceRange(l.main.extend(h.from,h.to)):r&&i==1&&l.ranges.length>1&&(d=Vu(l,c.pos))?d:r?l.addRange(h):J.create([h])}}}function Vu(a,e){for(let n=0;n<a.ranges.length;n++){let{from:i,to:l}=a.ranges[n];if(i<=e&&l>=e)return J.create(a.ranges.slice(0,n).concat(a.ranges.slice(n+1)),a.mainIndex==n?0:a.mainIndex-(a.mainIndex>n?1:0))}return null}qe.dragstart=(a,e)=>{let{selection:{main:n}}=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>=n.to||s<=n.from)&&(n=J.range(o,s))}}let{inputState:i}=a;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",ti(a.state,rl,a.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},qe.dragend=a=>(a.inputState.draggedContent=null,!1);function Xs(a,e,n,i){if(n=ti(a.state,al,n),!n)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=i&&o&&Au(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:n},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}qe.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),l=0,o=()=>{++l==n.length&&Xs(a,e,i.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[s]=r.result),o()},r.readAsText(n[s])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Xs(a,e,i,!0),!0}return!1},qe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let n=zs?null:e.clipboardData;return n?(qs(a,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Cu(a),!1)};function Ru(a,e){let n=a.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),a.focus()},50)}function Eu(a){let e=[],n=[],i=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),n.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),n.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}i=!0}return{text:ti(a,rl,e.join(a.lineBreak)),ranges:n,linewise:i}}let gl=null;qe.copy=qe.cut=(a,e)=>{let{text:n,ranges:i,linewise:l}=Eu(a.state);if(!n&&!l)return!1;gl=l?n:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=zs?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(Ru(a,n),!1)};const Zs=Dt.define();function ea(a,e){let n=[];for(let i of a.facet(As)){let l=i(a,e);l&&n.push(l)}return n.length?a.update({effects:n,annotations:Zs.of(!0)}):null}function ta(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let n=ea(a.state,e);n?a.dispatch(n):a.update([])}},10)}Ue.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),ta(a)},Ue.blur=a=>{a.observer.clearSelectionRange(),ta(a)},Ue.compositionstart=Ue.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Ue.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,G.chrome&&G.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Ue.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},qe.beforeinput=(a,e)=>{var n,i;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),d=a.posAtDOM(r.endContainer,r.endOffset);return ml(a,{from:c,to:d,insert:a.state.toText(o)},null),!0}}let l;if(G.chrome&&G.android&&(l=js.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.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 G.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),G.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Ue.compositionend(a,e),20),!1};const na=new Set;function Ou(a){na.has(a)||(na.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const ia=["pre-wrap","normal","pre-line","break-spaces"];let Yt=!1;function la(){Yt=!1}class _u{constructor(e){this.lineWrapping=e,this.doc=se.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 ia.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(n=!0,this.heightSamples[Math.floor(l*10)]=!0)}return n}refresh(e,n,i,l,o,s){let r=ia.indexOf(e)>-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=n,this.charWidth=i,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let d=0;d<s.length;d++){let h=s[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Mu{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class nt{constructor(e,n,i,l,o){this.from=e,this.length=n,this.top=i,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Ze.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 wt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new nt(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var be=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(be||(be={}));const ni=.001;class Oe{constructor(e,n,i=2){this.length=e,this.height=n,this.flags=i}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)>ni&&(Yt=!0),this.height=e)}replace(e,n,i){return Oe.of(i)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,i,l){let o=this,s=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:d,fromB:h,toB:f}=l[r],u=o.lineAt(c,be.ByPosNoHeight,i.setDoc(n),0,0),m=u.to>=d?u:o.lineAt(d,be.ByPosNoHeight,i,0,0);for(f+=m.to-d,d=m.to;r>0&&u.from<=l[r-1].toA;)c=l[r-1].fromA,h=l[r-1].fromB,r--,c<u.from&&(u=o.lineAt(c,be.ByPosNoHeight,i,0,0));h+=u.from-c,c=u.from;let g=bl.build(i.setDoc(s),e,h,f);o=ii(o,o.replace(c,d,g))}return o.updateHeight(i,0)}static empty(){return new Ie(0,0)}static of(e){if(e.length==1)return e[0];let n=0,i=e.length,l=0,o=0;for(;;)if(n==i)if(l>o*2){let r=e[n-1];r.break?e.splice(--n,1,r.left,null,r.right):e.splice(--n,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(o>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[n++];r&&(l+=r.size)}else{let r=e[--i];r&&(o+=r.size)}let s=0;return e[n-1]==null?(s=1,n--):e[n]==null&&(s=1,i++),new Tu(Oe.of(e.slice(0,n)),s,Oe.of(e.slice(i)))}}function ii(a,e){return a==e?a:(a.constructor!=e.constructor&&(Yt=!0),e)}Oe.prototype.size=1;class oa extends Oe{constructor(e,n,i){super(e,n),this.deco=i}blockAt(e,n,i,l){return new nt(l,this.length,i,this.height,this.deco||0)}lineAt(e,n,i,l,o){return this.blockAt(0,i,l,o)}forEachLine(e,n,i,l,o,s){e<=o+this.length&&n>=o&&s(this.blockAt(0,i,l,o))}updateHeight(e,n=0,i=!1,l){return l&&l.from<=n&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ie extends oa{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,i,l){return new nt(l,this.length,i,this.height,this.breaks)}replace(e,n,i){let l=i[0];return i.length==1&&(l instanceof Ie||l instanceof Be&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Be?l=new Ie(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Oe.of(i)}updateHeight(e,n=0,i=!1,l){return l&&l.from<=n&&l.more?this.setHeight(l.heights[l.index++]):(i||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 Be extends Oe{constructor(e){super(e,0)}heightMetrics(e,n){let i=e.doc.lineAt(n).number,l=e.doc.lineAt(n+this.length).number,o=l-i+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:i,lastLine:l,perLine:s,perChar:r}}blockAt(e,n,i,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(n,l);if(n.lineWrapping){let d=l+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=n.doc.lineAt(d),f=r+h.length*c,u=Math.max(i,e-f/2);return new nt(h.from,h.length,u,f,0)}else{let d=Math.max(0,Math.min(s-o,Math.floor((e-i)/r))),{from:h,length:f}=n.doc.line(o+d);return new nt(h,f,i+r*d,r,0)}}lineAt(e,n,i,l,o){if(n==be.ByHeight)return this.blockAt(e,i,l,o);if(n==be.ByPosNoHeight){let{from:m,to:g}=i.doc.lineAt(e);return new nt(m,g-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(i,o),d=i.doc.lineAt(e),h=r+d.length*c,f=d.number-s,u=l+r*f+c*(d.from-o-f);return new nt(d.from,d.length,Math.max(l,Math.min(u,l+this.height-h)),h,0)}forEachLine(e,n,i,l,o,s){e=Math.max(e,o),n=Math.min(n,o+this.length);let{firstLine:r,perLine:c,perChar:d}=this.heightMetrics(i,o);for(let h=e,f=l;h<=n;){let u=i.doc.lineAt(h);if(h==e){let g=u.number-r;f+=c*g+d*(e-o-g)}let m=c+d*u.length;s(new nt(u.from,u.length,f,m,0)),f+=m,h=u.to+1}}replace(e,n,i){let l=this.length-n;if(l>0){let o=i[i.length-1];o instanceof Be?i[i.length-1]=new Be(o.length+l):i.push(null,new Be(l-1))}if(e>0){let o=i[0];o instanceof Be?i[0]=new Be(e+o.length):i.unshift(new Be(e-1),null)}return Oe.of(i)}decomposeLeft(e,n){n.push(new Be(e-1),null)}decomposeRight(e,n){n.push(null,new Be(this.length-e-1))}updateHeight(e,n=0,i=!1,l){let o=n+this.length;if(l&&l.from<=n+this.length&&l.more){let s=[],r=Math.max(n,l.from),c=-1;for(l.from>n&&s.push(new Be(l.from-n-1).updateHeight(e,n));r<=o&&l.more;){let h=e.doc.lineAt(r).length;s.length&&s.push(null);let f=l.heights[l.index++];c==-1?c=f:Math.abs(f-c)>=ni&&(c=-2);let u=new Ie(h,f);u.outdated=!1,s.push(u),r+=h+1}r<=o&&s.push(null,new Be(o-r).updateHeight(e,r));let d=Oe.of(s);return(c<0||Math.abs(d.height-this.height)>=ni||Math.abs(c-this.heightMetrics(e,n).perLine)>=ni)&&(Yt=!0),ii(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Tu extends Oe{constructor(e,n,i){super(e.length+n+i.length,e.height+i.height,n|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,n,i,l){let o=i+this.left.height;return e<o?this.left.blockAt(e,n,i,l):this.right.blockAt(e,n,o,l+this.left.length+this.break)}lineAt(e,n,i,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=n==be.ByHeight?e<s:e<r,d=c?this.left.lineAt(e,n,i,l,o):this.right.lineAt(e,n,i,s,r);if(this.break||(c?d.to<r:d.from>r))return d;let h=n==be.ByPosNoHeight?be.ByPosNoHeight:be.ByPos;return c?d.join(this.right.lineAt(r,h,i,s,r)):this.left.lineAt(r,h,i,l,o).join(d)}forEachLine(e,n,i,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,n,i,l,o,s),n>=c&&this.right.forEachLine(e,n,i,r,c,s);else{let d=this.lineAt(c,be.ByPos,i,l,o);e<d.from&&this.left.forEachLine(e,d.from-1,i,l,o,s),d.to>=e&&d.from<=n&&s(d),n>d.to&&this.right.forEachLine(d.to+1,n,i,r,c,s)}}replace(e,n,i){let l=this.left.length+this.break;if(n<l)return this.balanced(this.left.replace(e,n,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,n-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of i)o.push(r);if(e>0&&sa(o,s-1),n<this.length){let r=o.length;this.decomposeRight(n,o),sa(o,r)}return Oe.of(o)}decomposeLeft(e,n){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(i++,e>=i&&n.push(null)),e>i&&this.right.decomposeLeft(e-i,n)}decomposeRight(e,n){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,n);e<i&&this.left.decomposeRight(e,n),this.break&&e<l&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Oe.of(this.break?[e,null,n]:[e,n]):(this.left=ii(this.left,e),this.right=ii(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,i=!1,l){let{left:o,right:s}=this,r=n+o.length+this.break,c=null;return l&&l.from<=n+o.length&&l.more?c=o=o.updateHeight(e,n,i,l):o.updateHeight(e,n,i),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,i,l):s.updateHeight(e,r,i),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 sa(a,e){let n,i;a[e]==null&&(n=a[e-1])instanceof Be&&(i=a[e+1])instanceof Be&&a.splice(e-1,3,new Be(n.length+1+i.length))}const Fu=5;class bl{constructor(e,n){this.pos=e,this.oracle=n,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,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ie?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ie(i-this.pos,-1)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,i){if(e<n||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=n-e;i.block?this.addBlock(new oa(s,l,i)):(s||o||l>=Fu)&&this.addLineDeco(l,o,s)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ie(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let i=new Be(n-e);return this.oracle.doc.lineAt(e).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ie)return e;let n=new Ie(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Ie)&&!this.isCovered?this.nodes.push(new Ie(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Ie&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,n,i,l){let o=new bl(i,e);return ge.spans(n,i,l,o,0),o.finish(i)}}function Iu(a,e,n){let i=new Du;return ge.compare(a,e,n,i,0),i.changes}class Du{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,i,l){(e<n||i&&i.heightRelevant||l&&l.heightRelevant)&&Yn(e,n,this.changes,5)}}function $u(a,e){let n=a.getBoundingClientRect(),i=a.ownerDocument,l=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(l.innerWidth,n.right),r=Math.max(0,n.top),c=Math.min(l.innerHeight,n.bottom);for(let d=a.parentNode;d&&d!=i.body;)if(d.nodeType==1){let h=d,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();o=Math.max(o,u.left),s=Math.min(s,u.right),r=Math.max(r,u.top),c=Math.min(d==a.parentNode?l.innerHeight:c,u.bottom)}d=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:r-(n.top+e),bottom:Math.max(r,c)-(n.top+e)}}function Pu(a){let e=a.getBoundingClientRect(),n=a.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Lu(a,e){let n=a.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class kl{constructor(e,n,i,l){this.from=e,this.to=n,this.size=i,this.displaySize=l}static same(e,n){if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],o=n[i];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,n){return Ee.replace({widget:new Uu(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class Uu extends el{constructor(e,n){super(),this.size=e,this.vertical=n}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 aa{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=ra,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Se.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(dl).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new _u(n),this.stateDeco=e.facet(gn).filter(i=>typeof i!="function"),this.heightMap=Oe.empty().applyChanges(this.stateDeco,se.empty,this.heightOracle.setDoc(e.doc),[new Le(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ee.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let l=i?n.head:n.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new li(o,s))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ra:new yl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(yn(e,this.scaler))})}update(e,n=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(gn).filter(h=>typeof h!="function");let l=e.changedRanges,o=Le.extendWithRanges(l,Iu(i,this.stateDeco,e?e.changes:ve.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);la(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Yt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let c=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(zf)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,i=window.getComputedStyle(n),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Se.RTL:Se.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=n.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let d=0,h=0;if(r.width&&r.height){let{scaleX:k,scaleY:p}=qo(n,r);(k>.005&&Math.abs(this.scaleX-k)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=k,this.scaleY=p,d|=16,s=c=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Yo(e.scrollDOM);let g=(this.printing?Lu:$u)(n,this.paddingTop),w=g.top-this.pixelViewport.top,v=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(c=!0)),!this.inView&&!this.scrollTarget&&!Pu(e.dom))return 0;let A=r.width;if((this.contentDOMWidth!=A||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(A-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:S,textHeight:_}=e.docView.measureTextSize();s=p>0&&l.refresh(o,p,S,_,Math.max(5,A/S),k),s&&(e.docView.minWidth=0,d|=16)}w>0&&v>0?h=Math.max(w,v):w<0&&v<0&&(h=Math.min(w,v)),la();for(let p of this.viewports){let S=p.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(p);this.heightMap=(s?Oe.empty().applyChanges(this.stateDeco,se.empty,this.heightOracle,[new Le(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new Mu(p.from,S))}Yt&&(d|=2)}let V=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new li(l.lineAt(s-i*1e3,be.ByHeight,o,0,0).from,l.lineAt(r+(1-i)*1e3,be.ByHeight,o,0,0).to);if(n){let{head:d}=n.range;if(d<c.from||d>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(d,be.ByPos,o,0,0),u;n.y=="center"?u=(f.top+f.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d<c.from?u=f.top:u=f.bottom-h,c=new li(l.lineAt(u-1e3/2,be.ByHeight,o,0,0).from,l.lineAt(u+h+1e3/2,be.ByHeight,o,0,0).to)}}return c}mapViewport(e,n){let i=n.mapPos(e.from,-1),l=n.mapPos(e.to,1);return new li(this.heightMap.lineAt(i,be.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,be.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,be.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(n,be.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=r+Math.max(10,Math.min(i,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let i=[];for(let l of e)n.touchesRange(l.from,l.to)||i.push(new kl(n.mapPos(l.from),n.mapPos(l.to),l.size,l.displaySize));return i}ensureLineGaps(e,n){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=Se.LTR&&!i)return[];let r=[],c=(h,f,u,m)=>{if(f-h<o)return;let g=this.state.selection.main,w=[g.from];g.empty||w.push(g.to);for(let y of w)if(y>h&&y<f){c(h,y-10,u,m),c(y+10,f,u,m);return}let v=zu(e,y=>y.from>=u.from&&y.to<=u.to&&Math.abs(y.from-h)<o&&Math.abs(y.to-f)<o&&!w.some(A=>y.from<A&&y.to>A));if(!v){if(f<u.to&&n&&i&&n.visibleRanges.some(V=>V.from<=f&&V.to>=f)){let V=n.moveToLineBoundary(J.cursor(f),!1,!0).head;V>h&&(f=V)}let y=this.gapSize(u,h,f,m),A=i||y<2e6?y:2e6;v=new kl(h,f,y,A)}r.push(v)},d=h=>{if(h.length<s||h.type!=Ze.Text)return;let f=ju(h.from,h.to,this.stateDeco);if(f.total<s)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,g;if(i){let w=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,y;if(u!=null){let A=si(f,u),V=((this.visibleBottom-this.visibleTop)/2+w)/h.height;v=A-V,y=A+V}else v=(this.visibleTop-h.top-w)/h.height,y=(this.visibleBottom-h.top+w)/h.height;m=oi(f,v),g=oi(f,y)}else{let w=f.total*this.heightOracle.charWidth,v=l*this.heightOracle.charWidth,y=0;if(w>2e6)for(let S of e)S.from>=h.from&&S.from<h.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=S.size-S.displaySize);let A=this.pixelViewport.left+y,V=this.pixelViewport.right+y,k,p;if(u!=null){let S=si(f,u),_=((V-A)/2+v)/w;k=S-_,p=S+_}else k=(A-v)/w,p=(V+v)/w;m=oi(f,k),g=oi(f,p)}m>h.from&&c(h.from,m,h,f),g<h.to&&c(g,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return r}gapSize(e,n,i,l){let o=si(l,i)-si(l,n);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){kl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ee.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let i=[];ge.spans(n,this.viewport.from,this.viewport.to,{span(o,s){i.push({from:o,to:s})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o<i.length&&!(l&8);o++){let s=this.visibleRanges[o],r=i[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=i,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||yn(this.heightMap.lineAt(e,be.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(n=>n.top<=e&&n.bottom>=e)||yn(this.heightMap.lineAt(this.scaler.fromDOM(e),be.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return yn(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 li{constructor(e,n){this.from=e,this.to=n}}function ju(a,e,n){let i=[],l=a,o=0;return ge.spans(n,a,e,{span(){},point(s,r){s>l&&(i.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(i.push({from:l,to:e}),o+=e-l),{total:o,ranges:i}}function oi({total:a,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(a*n);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(i<=r)return o+i;i-=r}}function si(a,e){let n=0;for(let{from:i,to:l}of a.ranges){if(e<=l){n+=e-i;break}n+=l-i}return n/a.total}function zu(a,e){for(let n of a)if(e(n))return n}const ra={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class yl{constructor(e,n,i){let l=0,o=0,s=0;this.viewports=i.map(({from:r,to:c})=>{let d=n.lineAt(r,be.ByPos,e,0,0).top,h=n.lineAt(c,be.ByPos,e,0,0).bottom;return l+=h-d,{from:r,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(n.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 n=0,i=0,l=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.top)return l+(e-i)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);i=o.bottom,l=o.domBottom}}fromDOM(e){for(let n=0,i=0,l=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.domTop)return i+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);i=o.bottom,l=o.domBottom}}eq(e){return e instanceof yl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,i)=>n.from==e.viewports[i].from&&n.to==e.viewports[i].to):!1}}function yn(a,e){if(e.scale==1)return a;let n=e.toDOM(a.top),i=e.toDOM(a.bottom);return new nt(a.from,a.length,n,i-n,Array.isArray(a._content)?a._content.map(l=>yn(l,e)):a._content)}const ai=ne.define({combine:a=>a.join(" ")}),wl=ne.define({combine:a=>a.indexOf(!0)>-1}),Al=yt.newName(),ca=yt.newName(),da=yt.newName(),ha={"&light":"."+ca,"&dark":"."+da};function xl(a,e,n){return new yt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return a;if(!n||!n[l])throw new RangeError(`Unsupported selector: ${l}`);return n[l]}):a+" "+i}})}const qu=xl("."+Al,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ha),Qu={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},vl=G.ie&&G.ie_version<=11;class Wu{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Sf,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(n=>{for(let i of n)this.queue.push(i);(G.ie&&G.ie_version<=11||G.ios&&e.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&G.android&&e.constructor.EDIT_CONTEXT!==!1&&!(G.chrome&&G.chrome_version<126)&&(this.editContext=new Yu(e),e.state.facet(ht)&&(e.contentDOM.editContext=this.editContext.editContext)),vl&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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 n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.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(n=>{n.length>0&&n[n.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((n,i)=>n!=e[i]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(ht)?i.root.activeElement!=this.dom:!zn(this.dom,l))return;let o=l.anchorNode&&i.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(G.ie&&G.ie_version<=11||G.android&&G.chrome)&&!i.state.selection.main.empty&&l.focusNode&&fn(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=dn(e.root);if(!n)return!1;let i=G.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ku(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let l=zn(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Nf(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let i=this.dom;i;)if(i.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=n)i.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,Qu),vl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),vl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var i;if(!this.delayedAndroidKey){let l=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&jt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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 n=-1,i=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),n==-1?{from:n,to:i}=s:(n=Math.min(s.from,n),i=Math.max(s.to,i)))}return{from:n,to:i,typeOver:l}}readChange(){let{from:e,to:n,typeOver:i}=this.processRecords(),l=this.selectionChanged&&zn(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 cu(this.view,e,n,i);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 n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,l=Ls(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let i=fa(n,e.previousSibling||e.target.previousSibling,-1),l=fa(n,e.nextSibling||e.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:l?n.posBefore(l):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.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(ht)!=e.state.facet(ht)&&(e.view.contentDOM.editContext=e.state.facet(ht)?this.editContext.editContext:null))}destroy(){var e,n,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.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 fa(a,e,n){for(;e;){let i=de.get(e);if(i&&i.parent==a)return i;let l=e.parentNode;e=l!=a.dom?l:n>0?e.nextSibling:e.previousSibling}return null}function ua(a,e){let n=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return fn(s.node,s.offset,l,o)&&([n,i,l,o]=[l,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:l,focusOffset:o}}function Ku(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ua(a,l)}let n=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),n=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",i,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",i,!0),n?ua(a,n):null}class Yu{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=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=i=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(i.updateRangeStart),c=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:r,drifted:!1});let d={from:r,to:c,insert:se.of(i.text.split(`
|
|
23
|
-
`))};if(d.from==this.from&&o<this.from?d.from=o:d.to==this.to&&o>this.to&&(d.to=o),d.from==d.to&&!d.insert.length){let h=J.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));h.main.eq(l)||e.dispatch({selection:h,userEvent:"select"});return}if((G.mac||G.android)&&d.from==s-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:r,to:c,insert:se.of([i.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);ml(e,d,J.single(this.toEditorPos(i.selectionStart,h),this.toEditorPos(i.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let s=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.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)}n.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let o of i.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(c<d){let h=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(Ee.mark({attributes:{style:h}}).range(c,d))}}}e.dispatch({effects:Cs.of(Ee.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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=dn(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,d)=>{if(i)return;let h=d.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(d)){l=this.pendingContextChange=null,n+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(o+=n,s+=n,s<=this.from)this.from+=h,this.to+=h;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),d.toString()),this.to+=h}n+=h}),l&&!i&&this.revertPending(e.state),!i}update(e){let n=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),l=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class re{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 n;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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Bf(e.parent)||document,this.viewState=new aa(e.state||ce.create(e)),e.scrollTo&&e.scrollTo.is(Gn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Wt).map(l=>new cl(l));for(let l of this.plugins)l.update(this);this.observer=new Wu(this),this.inputState=new pu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Os(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Ve?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,l,o=this.state;for(let u of e){if(u.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=u.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(u=>u.annotation(Zs))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=ea(o,s),c||(r=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(ce.phrases)!=this.state.facet(ce.phrases))return this.setState(o);l=Jn.create(this,o,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;f=new Qt(m.empty?m:J.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Gn)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=ri.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),n=this.docView.update(l),this.state.facet(bn)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(ai)!=l.state.facet(ai)&&(this.viewState.mustMeasureContent=!0),(n||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(sl))try{u(l)}catch(m){tt(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!Ls(this,h)&&d.force&&jt(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new aa(e),this.plugins=e.facet(Wt).map(i=>new cl(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Os(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Wt),i=e.state.facet(Wt);if(n!=i){let l=[];for(let o of i){let s=n.indexOf(o);if(s<0)l.push(new cl(o));else{let r=this.plugins[s];r.mustUpdate=e,l.push(r)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);n!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(i){tt(this.state,i,"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 n=null,i=this.scrollDOM,l=i.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(Yo(i))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(m=>{try{return m.read(this)}catch(g){return tt(this.state,g),pa}}),f=Jn.create(this,this.state,[]),u=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(h[m]!=pa)try{let g=d[m];g.write&&g.write(h[m],this)}catch(g){tt(this.state,g)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let g=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(g>1||g<-1){l=l+g,i.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let r of this.state.facet(sl))r(n)}get themeClasses(){return Al+" "+(this.state.facet(wl)?da:ca)+" "+this.state.facet(ai)}updateAttrs(){let e=ma(this,Ss,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ht)?"true":"false",class:"cm-content",style:`${G.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),ma(this,dl,n);let i=this.observer.ignore(()=>{let l=Zi(this.contentDOM,this.contentAttrs,n),o=Zi(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=n,i}showAnnouncements(e){let n=!0;for(let i of e)for(let l of i.effects)if(l.is(re.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(bn);let e=this.state.facet(re.cspNonce);yt.mount(this.root,this.styleModules.concat(qu).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(i=>i.plugin==e)||null),n&&n.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,n,i){return pl(this,e,$s(this,e,n,i))}moveByGroup(e,n){return pl(this,e,$s(this,e,n,i=>ou(this,e.head,i)))}visualLineSide(e,n){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=i[n?i.length-1:0];return J.cursor(o.side(n,l)+e.from,o.forward(!n,l)?1:-1)}moveToLineBoundary(e,n,i=!0){return lu(this,e,n,i)}moveVertically(e,n,i){return pl(this,e,su(this,e,n,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),Is(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let i=this.docView.coordsAt(e,n);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[At.find(o,e-l.from,-1,n)];return Qn(i,s.dir==Se.LTR==n>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(xs)||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>Hu)return ps(e.length);let n=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||us(o.isolates,i=Vs(this,e))))return o.order;i||(i=Vs(this,e));let l=Lf(e.text,n,i);return this.bidiCache.push(new ri(e.from,e.to,n,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||G.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Qo(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,n={}){return Gn.of(new Qt(typeof e=="number"?J.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Gn.of(new Qt(J.cursor(i.from),"start","start",i.top-e,n,!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 Kt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Kt.define(()=>({}),{eventObservers:e})}static theme(e,n){let i=yt.newName(),l=[ai.of(i),bn.of(xl(`.${i}`,e))];return n&&n.dark&&l.push(wl.of(!0)),l}static baseTheme(e){return rf.lowest(bn.of(xl("."+Al,e,ha)))}static findFromDOM(e){var n;let i=e.querySelector(".cm-content"),l=i&&de.get(i)||de.get(e);return((n=l?.rootView)===null||n===void 0?void 0:n.view)||null}}re.styleModule=bn,re.inputHandler=ws,re.clipboardInputFilter=al,re.clipboardOutputFilter=rl,re.scrollHandler=vs,re.focusChangeEffect=As,re.perLineTextDirection=xs,re.exceptionSink=ys,re.updateListener=sl,re.editable=ht,re.mouseSelectionStyle=ks,re.dragMovesSelection=bs,re.clickAddsSelectionRange=gs,re.decorations=gn,re.outerDecorations=Bs,re.atomicRanges=hl,re.bidiIsolatedRanges=Ns,re.scrollMargins=Rs,re.darkTheme=wl,re.cspNonce=ne.define({combine:a=>a.length?a[0]:""}),re.contentAttributes=dl,re.editorAttributes=Ss,re.lineWrapping=re.contentAttributes.of({class:"cm-lineWrapping"}),re.announce=Ae.define();const Hu=4096,pa={};class ri{constructor(e,n,i,l,o,s){this.from=e,this.to=n,this.dir=i,this.isolates=l,this.fresh=o,this.order=s}static update(e,n){if(n.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Se.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!n.touchesRange(s.from,s.to)&&i.push(new ri(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return i}}function ma(a,e,n){for(let i=a.state.facet(e),l=i.length-1;l>=0;l--){let o=i[l],s=typeof o=="function"?o(a):o;s&&Xi(s,n)}return n}class Ht extends Pt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ht.prototype.elementClass="",Ht.prototype.toDOM=void 0,Ht.prototype.mapMode=Fe.TrackBefore,Ht.prototype.startSide=Ht.prototype.endSide=-1,Ht.prototype.point=!0;var Cl;const Gt=new ae;function Gu(a){return ne.define({combine:a?e=>e.concat(a):void 0})}const Ju=new ae;class Qe{constructor(e,n,i=[],l=""){this.data=e,this.name=l,ce.prototype.hasOwnProperty("tree")||Object.defineProperty(ce.prototype,"tree",{get(){return Sl(this)}}),this.parser=n,this.extension=[Xt.of(this),ce.languageData.of((o,s,r)=>{let c=ga(o,s,r),d=c.type.prop(Gt);if(!d)return[];let h=o.facet(d),f=c.type.prop(Ju);if(f){let u=c.resolve(s-c.from,r);for(let m of f)if(m.test(u,o)){let g=o.facet(m.facet);return m.type=="replace"?g:g.concat(h)}}return h})].concat(i)}isActiveAt(e,n,i=-1){return ga(e,n,i).type.prop(Gt)==this.data}findRegions(e){let n=e.facet(Xt);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],l=(o,s)=>{if(o.prop(Gt)==this.data){i.push({from:s,to:s+o.length});return}let r=o.prop(ae.mounted);if(r){if(r.tree.prop(Gt)==this.data){if(r.overlay)for(let c of r.overlay)i.push({from:c.from+s,to:c.to+s});else i.push({from:s,to:s+o.length});return}else if(r.overlay){let c=i.length;if(l(r.tree,r.overlay[0].from+s),i.length>c)return}}for(let c=0;c<o.children.length;c++){let d=o.children[c];d instanceof ye&&l(d,o.positions[c]+s)}};return l(Sl(e),0),i}get allowsNesting(){return!0}}Qe.setState=Ae.define();function ga(a,e,n){let i=a.facet(Xt),l=Sl(a).topNode;if(!i||i.allowsNesting)for(let o=l;o;o=o.enter(e,n,xe.ExcludeBuffers))o.type.isTop&&(l=o);return l}class ci extends Qe{constructor(e,n,i){super(e,n,[],i),this.parser=n}static define(e){let n=Gu(e.languageData);return new ci(n,e.parser.configure({props:[Gt.add(i=>i.isTop?n:void 0)]}),e.name)}configure(e,n){return new ci(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Sl(a){let e=a.field(Qe.state,!1);return e?e.tree:ye.empty}class Xu{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,n){let i=this.cursorPos-this.string.length;return e<i||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-i,n-i)}}let wn=null;class di{constructor(e,n,i=[],l,o,s,r,c){this.parser=e,this.state=n,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,i){return new di(e,n,[],ye.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Xu(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ye.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(St.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(St.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=wn;wn=this;try{return e()}finally{wn=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=ba(e,n.from,n.to);return e}changes(e,n){let{fragments:i,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,f,u)=>c.push({fromA:d,toA:h,fromB:f,toB:u})),i=St.applyChanges(i,c),l=ye.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),f=e.mapPos(d.to,-1);h<f&&r.push({from:h,to:f})}}}return new di(this.parser,n,i,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 n=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:l,to:o}=this.skipped[i];l<e.to&&o>e.from&&(this.fragments=ba(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends no{createParse(n,i,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=wn;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 ye(_e.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return wn}}function ba(a,e,n){return St.applyChanges(a,[{fromA:e,toA:n,fromB:e,toB:n}])}class Jt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new Jt(n)}static init(e){let n=Math.min(3e3,e.doc.length),i=di.create(e.facet(Xt).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Jt(i)}}Qe.state=Vt.define({create:Jt.init,update(a,e){for(let n of e.effects)if(n.is(Qe.setState))return n.value;return e.startState.facet(Xt)!=e.state.facet(Xt)?Jt.init(e.state):a.apply(e)}});let ka=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ka=a=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Bl=typeof navigator<"u"&&(!((Cl=navigator.scheduling)===null||Cl===void 0)&&Cl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Zu=Kt.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 n=this.view.state.field(Qe.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Qe.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=ka(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,o=i.field(Qe.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!Bl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&i.doc.length>l+1e3,c=o.context.work(()=>Bl&&Bl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Qe.setState.of(new Jt(o.context))})),this.chunkBudget>0&&!(c&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>tt(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Xt=ne.define({combine(a){return a.length?a[0]:null},enables:a=>[Qe.state,Zu,re.contentAttributes.compute([a],e=>{let n=e.facet(a);return n&&n.name?{"data-language":n.name}:{}})]});class ep{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const tp=new ae;function ya({except:a,units:e=1}={}){return n=>{let i=a&&a.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const np=new ae;function ip(a){let e=a.firstChild,n=a.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?a.to:n.from}:null}class Nl{constructor(e,n){this.specs=e;let i;function l(r){let c=yt.newName();return(i||(i=Object.create(null)))["."+c]=r,c}const o=typeof n.all=="string"?n.all:n.all?l(n.all):void 0,s=n.scope;this.scope=s instanceof Qe?r=>r.prop(Gt)==s.data:s?r=>r==s:void 0,this.style=ho(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=i?new yt(i):null,this.themeType=n.themeType}static define(e,n){return new Nl(e,n||{})}}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 lp=Object.create(null),wa=[_e.none],Aa=[],xa=Object.create(null),op=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"]])op[a]=sp(lp,e);function Vl(a,e){Aa.indexOf(a)>-1||(Aa.push(a),console.warn(e))}function sp(a,e){let n=[];for(let r of e.split(" ")){let c=[];for(let d of r.split(".")){let h=a[d]||z[d];h?typeof h=="function"?c.length?c=c.map(h):Vl(d,`Modifier ${d} used at start of tag`):c.length?Vl(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Vl(d,`Unknown highlighting tag ${d}`)}for(let d of c)n.push(d)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+n.map(r=>r.id),o=xa[l];if(o)return o.id;let s=xa[l]=_e.define({id:wa.length,name:i,props:[co({[i]:n})]});return wa.push(s),s.id}Se.RTL,Se.LTR;const ap=ci.define({name:"json",parser:ef.configure({props:[tp.add({Object:ya({except:/^\s*\}/}),Array:ya({except:/^\s*\]/})}),np.add({"Object Array":ip})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function rp(){return new ep(ap)}const Rl=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function cp(){const a=De();if(a.formRules?.length){const e={};Rl.forEach(i=>{e[i.name]=i});const n=[...Rl];return a.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):n.push(l)}),n}return Rl}const dp={loadAdvances:cp},hp={class:"unione-props-setting data-field-setting"},fp={key:0},up=["onClick"],pp={class:"field-txt"},mp=["onClick"],gp={key:1,class:"field-txt"},bp=["onClick"],kp={key:0,class:"field-txt"},yp={key:3,class:"edit-field"},wp=["onClick"],Ap=le(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([rp()]),n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"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"}]),i=t.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=t.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let p in k){const S=i.value.filter(_=>_.name==p);if(S&&S[0]){let _=o.value[p];Object.keys(_).forEach(C=>{C=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[C]):S[0][C]=_[C]})}}o.value={}}function r(k,p){s();const S={};p=="convertName"?(k.convert||(k.convert={}),S[p]=k.convert?.type):S[p]=k[p]||"",o.value[k.name]=S}function c(k,p){{o.value={};return}}function d(k,p){switch(p){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function h(k,p){switch(p){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 f=t.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(k,p){switch(f.value.prop=p,f.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),p){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),f.value.show=k.configs.query,f.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),f.value.show=k.configs.show.form,f.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),f.value.show=k.configs.show.view,f.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),f.value.show=k.configs.show.list,f.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),f.value.show=k.configs.sort,f.value.title=`排序设置/${k.title}(${k.name})`;break}f.value.visible=!0}const m=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const p=m.value.options.filter(S=>S.value==k);return p[0]?p[0].label:k}}),g=t.ref({visible:!1,field:{},props:{},advances:dp.loadAdvances(),showInfo:k=>{let p=0;if(k.configs?.rule){const S=k.configs.rule;S.advance&&p++,typeof S.rangeMin<"u"&&p++,typeof S.rangeMax<"u"&&p++,typeof S.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const k=g.value.props;g.value.field.configs=Y.utils.obj.ext(g.value.field.configs,{rule:{...k}}),g.value.visible=!1,g.value.props={}}});function w(k){g.value.visible=!0,g.value.field=k,g.value.props=k.configs?.rule||{}}const v=t.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const p=k.configs?.widget?.name,S=v.value.widgets.filter(_=>_.value==p);return S[0]?S[0].label:p},toSetting:(k,p)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=p},toclose:()=>{v.value.visible=!1}});function y(k){v.value.field=k,k.configs=Y.utils.obj.ext(k.configs,{widget:{props:{}}}),v.value.widget=k.configs.widget,v.value.visible=!0}const A=t.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,p="--")=>A.value.types.filter(S=>S.value==k)[0]?.label||p,toAddOption:()=>{A.value.convert.options||(A.value.convert.options=[]),A.value.convert.options.push({label:"",value:""})},toDelOption:(k,p)=>{A.value.convert.options.splice(k,1)},toSetting:()=>{A.value.visible=!1}});function V(k){A.value.visible=!0,A.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),A.value.convert=k.configs.convert}return(k,p)=>{const S=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("a-select"),x=t.resolveComponent("a-checkbox"),N=t.resolveComponent("a-table"),R=t.resolveComponent("a-switch"),b=t.resolveComponent("a-form-item"),B=t.resolveComponent("a-select-option"),T=t.resolveComponent("a-input-number"),E=t.resolveComponent("a-form"),M=t.resolveComponent("a-modal"),P=t.resolveComponent("a-input"),F=t.resolveComponent("unione-select-box"),q=t.resolveComponent("a-checkbox-group"),L=t.resolveComponent("unione-section");return t.openBlock(),t.createElementBlock("div",hp,[t.createVNode(N,{columns:n.value,"data-source":i.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",fp,[t.createVNode(S),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:ee,record:D})=>[["rules"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!g.value.showInfo(D)&&"empty"]),onClick:K=>w(D)},[t.createElementVNode("span",pp,t.toDisplayString(g.value.showInfo(D)),1),g.value.showInfo(D)?(t.openBlock(),t.createBlock(_,{key:0,type:"link"},{default:t.withCtx(()=>p[50]||(p[50]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,up)):["widget"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[D.name]||!Object.keys(o.value[D.name]).includes(O.dataIndex))&&!ee&&"empty"]),onClick:K=>r(D,O.dataIndex)},[o.value[D.name]&&Object.keys(o.value[D.name]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(C,{key:0,value:D.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:K=>v.value.toSetting(D,K),onBlur:p[0]||(p[0]=K=>c())},null,8,["value","options","onChange"])),[[l]]):(t.openBlock(),t.createElementBlock("span",gp,t.toDisplayString(v.value.widgetName(D)),1)),t.createVNode(_,{type:"link",onClick:t.withModifiers(K=>y(D),["stop"])},{default:t.withCtx(()=>p[51]||(p[51]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])],10,mp)):["convertName"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[D.name]||!Object.keys(o.value[D.name]).includes(O.dataIndex))&&!D.convert?.type&&"empty"]),onClick:K=>V(D)},[D.configs?.convert?.types?(t.openBlock(),t.createElementBlock("span",kp,t.toDisplayString(A.value.getTypes(D.configs.convert.types)),1)):t.createCommentVNode("",!0)],10,bp)):["query","form","view","list","sort"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",yp,[t.createVNode(x,{checked:d(D,O.dataIndex),onClick:K=>h(D,O.dataIndex)},null,8,["checked","onClick"]),t.createVNode(_,{type:"link",onClick:K=>u(D,O.dataIndex)},{default:t.withCtx(()=>p[52]||(p[52]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(M,{visible:f.value.visible,"onUpdate:visible":p[14]||(p[14]=O=>f.value.visible=O),width:600,title:f.value.title,onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:t.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:t.withCtx(()=>[t.createVNode(b,{label:"启用状态"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.enable,"onUpdate:checked":p[1]||(p[1]=O=>f.value.show.enable=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(t.openBlock(),t.createBlock(b,{key:0,label:"默认排序"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=O=>f.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="sort"?(t.openBlock(),t.createBlock(b,{key:1,label:"排序方式"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.asc,"onUpdate:checked":p[3]||(p[3]=O=>f.value.show.asc=O),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(t.openBlock(),t.createBlock(b,{key:2,label:"高级查询"})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=O=>f.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.visible,"onUpdate:checked":p[5]||(p[5]=O=>f.value.show.visible=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:5,label:"查询方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.types,"onUpdate:value":p[6]||(p[6]=O=>f.value.show.types=O)},{default:t.withCtx(()=>[t.createVNode(B,{key:"EQ",value:"EQ"},{default:t.withCtx(()=>p[53]||(p[53]=[t.createTextVNode("精确查询")])),_:1}),t.createVNode(B,{key:"LIKE",value:"LIKE"},{default:t.withCtx(()=>p[54]||(p[54]=[t.createTextVNode("模糊查询")])),_:1}),t.createVNode(B,{key:"LLIKE",value:"LLIKE"},{default:t.withCtx(()=>p[55]||(p[55]=[t.createTextVNode("左模糊")])),_:1}),t.createVNode(B,{key:"RLIKE",value:"RLIKE"},{default:t.withCtx(()=>p[56]||(p[56]=[t.createTextVNode("右模糊")])),_:1}),t.createVNode(B,{key:"RANGE",value:"RANGE"},{default:t.withCtx(()=>p[57]||(p[57]=[t.createTextVNode("范围查询")])),_:1}),t.createVNode(B,{key:"ADVANCE",value:"ADVANCE"},{default:t.withCtx(()=>p[58]||(p[58]=[t.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(b,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:t.withCtx(()=>[t.createVNode(T,{value:f.value.show.index,"onUpdate:value":p[7]||(p[7]=O=>f.value.show.index=O)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.width,"onUpdate:value":p[8]||(p[8]=O=>f.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,value:f.value.show.width,"onUpdate:value":p[9]||(p[9]=O=>f.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=O=>f.value.show.labelWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(T,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=O=>f.value.show.valueWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:11,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":p[12]||(p[12]=O=>f.value.show.fixed=O),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:12,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.align,"onUpdate:value":p[13]||(p[13]=O=>f.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(M,{visible:A.value.visible,"onUpdate:visible":p[33]||(p[33]=O=>A.value.visible=O),width:600,title:A.value.getTypes(A.value.convert.types,"转换")+"设置",onOk:A.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:A.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(b,{label:"转换类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:A.value.convert.types,"onUpdate:value":p[15]||(p[15]=O=>A.value.convert.types=O),allowClear:!0,options:A.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:0,label:"是否搜索"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.convert.search,"onUpdate:checked":p[16]||(p[16]=O=>f.value.convert.search=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="option"?(t.openBlock(),t.createBlock(b,{key:1,label:"选项设置"},{default:t.withCtx(()=>[t.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:A.value.toAddOption},{default:t.withCtx(()=>p[59]||(p[59]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(N,{columns:A.value.optionColumn,"data-source":A.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:O,record:ee,index:D})=>[O.dataIndex==="label"?(t.openBlock(),t.createBlock(P,{key:0,value:ee.label,"onUpdate:value":K=>ee.label=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="value"?(t.openBlock(),t.createBlock(P,{key:1,value:ee.value,"onUpdate:value":K=>ee.value=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:K=>A.value.toDelOption(D,ee)},"删除",8,wp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):t.createCommentVNode("",!0),["dbtable","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:2,label:"数据源"},{default:t.withCtx(()=>[t.createVNode(F,{value:A.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=O=>A.value.convert.dsId=O),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:3,label:"table名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=O=>A.value.convert.tableName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:4,label:"table名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=O=>A.value.convert.tableName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:5,label:"主键字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.idField,"onUpdate:value":p[20]||(p[20]=O=>A.value.convert.idField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:6,label:"父级字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=O=>A.value.convert.pidField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:7,label:"value字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=O=>A.value.convert.valueField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:8,label:"label字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=O=>A.value.convert.labelField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=O=>A.value.convert.tableField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=O=>A.value.convert.tableWhere=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=O=>A.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=O=>A.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:13,label:"异步加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=O=>A.value.convert.isAsync=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:14,label:"分页加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=O=>A.value.convert.isPaging=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dict"?(t.openBlock(),t.createBlock(b,{key:15,label:"字典名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=O=>A.value.convert.dictName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.url,"onUpdate:value":p[31]||(p[31]=O=>A.value.convert.url=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:t.withCtx(()=>[t.createVNode(t.unref(Zt.Codemirror),{modelValue:A.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=O=>A.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(M,{visible:v.value.visible,"onUpdate:visible":p[40]||(p[40]=O=>v.value.visible=O),width:600,title:"控件设置",onOk:v.value.toclose},{default:t.withCtx(()=>[t.createVNode(E,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(b,{label:"组件类型"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(C,{value:v.value.widget.name,"onUpdate:value":p[34]||(p[34]=O=>v.value.widget.name=O),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),t.createVNode(b,{label:"输入提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=O=>v.value.widget.placeholder=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"帮助说明"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.help,"onUpdate:value":p[36]||(p[36]=O=>v.value.widget.help=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"提示文本"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=O=>v.value.widget.tooltip=O)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(t.openBlock(),t.createBlock(b,{key:0,label:"显示格式"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=O=>v.value.field.dataFormat=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(t.openBlock(),t.createBlock(b,{key:1,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:v.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=O=>v.value.widget.props.mode=O),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(B,{value:"multiple"},{default:t.withCtx(()=>p[60]||(p[60]=[t.createTextVNode("多选")])),_:1}),t.createVNode(B,{value:"tags"},{default:t.withCtx(()=>p[61]||(p[61]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(M,{visible:g.value.visible,"onUpdate:visible":p[49]||(p[49]=O=>g.value.visible=O),width:600,title:"规则设置",onOk:g.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:g.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(b,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(q,{value:g.value.props.trigger,"onUpdate:value":p[41]||(p[41]=O=>g.value.props.trigger=O),options:["change","blur"]},null,8,["value"])]),_:1}),g.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(b,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(x,{checked:g.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=O=>g.value.props.whitespace=O)},{default:t.withCtx(()=>p[62]||(p[62]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),t.createVNode(b,{label:"预设类型"},{default:t.withCtx(()=>[t.createVNode(C,{options:g.value.advances,fieldNames:{label:"title",value:"name"},value:g.value.props.advance,"onUpdate:value":p[43]||(p[43]=O=>g.value.props.advance=O)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(g.value.field.dataType)?(t.openBlock(),t.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(b,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(T,{value:g.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=O=>g.value.props.rangeMin=O)},null,8,["value"]),p[63]||(p[63]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(T,{value:g.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=O=>g.value.props.rangeMax=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=O=>g.value.props.rangeMessage=O)},null,8,["value"])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(L,{title:"正则验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(b,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=O=>g.value.props.regExpress=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=O=>g.value.props.regMessage=O)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),xp={class:"unione-props-setting data-field-fkey"},vp={key:0},Cp=["onClick"],Sp=["onClick"],Bp=["onClick"],Np=["onClick"],Vp=["onClick"],Rp=["onClick"],Ep=["onClick"],Op=["onClick"],_p=le(t.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=t.useModel(a,"modelValue"),l=t.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),o=t.ref({});function s(){o.value={}}function r(u,m){s();const g={};g[m]=u.configs.fkey[m]||"",o.value[u.name]=g}function c(u,m,g){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=g.name,u.configs.fkey.dsnTitle=g.title,u.configs.fkey.dsnId=g.id}function d(u,m,g,w){u.configs.fkey[m]=g,m=="fieldName"&&(u.configs.fkey.fieldTitle=w.title),m=="labelName"&&(u.configs.fkey.labelTitle=w.title)}function h(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=t.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{f.value.editField[u]=m},onShowFieldChange:(u,m,g)=>{u.name=g.name,u.title=g.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=Y.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,m)=>{const g=t.resolveComponent("FormOutlined"),w=t.resolveComponent("unione-select-box"),v=t.resolveComponent("a-button"),y=t.resolveComponent("a-table"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",xp,[t.createVNode(y,{columns:n.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:t.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(t.openBlock(),t.createElementBlock("span",vp,[t.createVNode(g),t.createTextVNode(" "+t.toDisplayString(k.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:k,record:p})=>[["dsnName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(S,_)=>c(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,Cp)):["dsnTitle"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(S,_)=>c(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,Sp)):t.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,_)=>d(p,"fieldName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,Bp)):["labelName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,_)=>d(p,"labelName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(t.openBlock(),t.createBlock(v,{key:0,type:"link",onClick:t.withModifiers(S=>h(p),["stop"])},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Np)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(V,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>f.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(v,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(y,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:t.withCtx(({column:k,record:p,index:S,text:_})=>[k.dataIndex==="title"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="title"?(t.openBlock(),t.createBlock(w,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>f.value.editField={}),onSelect:(C,x)=>f.value.onShowFieldChange(p,C,x)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Vp)):t.createCommentVNode("",!0),k.dataIndex==="width"?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="width"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[1]||(m[1]=C=>f.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Rp)):t.createCommentVNode("",!0),k.dataIndex==="index"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="index"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[2]||(m[2]=C=>f.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Ep)):t.createCommentVNode("",!0),k.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(S)},"删除",8,Op)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),Mp={class:"unione-props-setting data-filter"},Tp={class:"title"},Fp={class:"name"},Ip={class:"action"},Dp=le(t.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),n=t.useModel(a,"modelValue");function i(){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:()=>{n.value.splice(d,1)}})}const s=t.ref(),r=t.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(d=>{if(r.value.name){const h=n.value.filter(f=>f.name==r.value.name)[0];if(!h){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&n.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(d).forEach(f=>{h[f]=d[f]})}else{if(n.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}n.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(`)
|
|
14
|
+
}]`}],onConfirm:b=>{const B=b.find(E=>E.name==="valueSets")?.value;if(!B)return;const F=b.find(E=>E.name==="code")?.value;n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,code:F,value:null,valueSets:JSON.parse(B)}})}});break;case me.ControlType.DATE:new ze({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:b=>{const B=b.find(M=>M.name==="placeholder")?.value;if(!B)return;const F=b.find(M=>M.name==="value")?.value||"",E=b.find(M=>M.name==="dateFormat")?.value||"";n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,dateFormat:E,value:F?[{value:F}]:null,placeholder:B}})}});break;case me.ControlType.NUMBER:new ze({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:b=>{const B=b.find(E=>E.name==="placeholder")?.value;if(!B)return;const F=b.find(E=>E.name==="value")?.value||"";n.editor?.command.executeInsertControl({type:me.ElementType.CONTROL,value:"",control:{type:R,value:F?[{value:F}]:null,placeholder:B}})}});break}}return t.onMounted(()=>{window.addEventListener("click",R=>{const b=i.value?.querySelector(".visible");!b||b.contains(R.target)||b.classList.remove("visible")},{capture:!0}),n.editor&&(n.editor.listener.rangeStyleChange=R=>{t.nextTick(()=>{if(R.type===me.ElementType.TEXT){const b=i.value,B=b.querySelector(".menu-item__font .select");B&&(B.textContent=R.font);const F=b.querySelector(".menu-item__size .select");if(F){const D={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};F.textContent=D[R.size]||"小四"}const E=b.querySelector(".menu-item__bold");E&&E.classList.toggle("active",R.bold);const M=b.querySelector(".menu-item__italic");M&&M.classList.toggle("active",R.italic);const P=b.querySelector(".menu-item__underline");P&&P.classList.toggle("active",R.underline);const T=b.querySelector(".menu-item__strikeout");T&&T.classList.toggle("active",R.strikeout);const W=b.querySelector(".menu-item__color span");W&&(W.style.backgroundColor=R.color||"#000000");const L=b.querySelector(".menu-item__highlight span");L&&(L.style.backgroundColor=R.highlight);const O=b.querySelector(".menu-item__title .select");if(O){const D={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};O.textContent=D[R.level]||"正文"}["left","center","right","alignment","justify"].forEach(D=>{const K=b.querySelector(`.menu-item__${D}`);K&&K.classList.toggle("active",R.rowFlex===D)})}})})}),e({getHeight:o,getWidth:s}),(R,b)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"dom",ref:i,class:"unione-rich-toolbar menu","editor-component":"menu"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(B,F)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[B=="Undo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__undo",key:B,title:`撤销(${t.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:b[0]||(b[0]=E=>c("Undo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Hr)})`})},null,4)],8,Pc)):t.createCommentVNode("",!0),B=="Redo"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__redo",key:B,title:`重做(${t.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:b[1]||(b[1]=E=>c("Redo"))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Gr)})`})},null,4)],8,Lc)):t.createCommentVNode("",!0),B=="Painter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__painter",key:B,title:"格式刷(双击可连续使用)",onClick:u,onDblclick:m},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Jr)})`})},null,4)],32)):t.createCommentVNode("",!0),B=="Format"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__format",key:B,title:"清除格式",onClick:b[2]||(b[2]=E=>c("Format")),"data-item":"Format"},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Xr)})`})},null,4)])):t.createCommentVNode("",!0),B=="Divider"?(t.openBlock(),t.createElementBlock("div",{class:"menu-divider",key:B+F,"data-item":"Divider"})):t.createCommentVNode("",!0),B=="Font"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__font",onClick:b[19]||(b[19]=E=>d("menu-item__font",E)),style:{display:"none"},key:B},[b[99]||(b[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:b[3]||(b[3]=E=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),t.createElementVNode("li",{onClick:b[4]||(b[4]=E=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),t.createElementVNode("li",{onClick:b[5]||(b[5]=E=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),t.createElementVNode("li",{onClick:b[6]||(b[6]=E=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),t.createElementVNode("li",{onClick:b[7]||(b[7]=E=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:b[8]||(b[8]=E=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),t.createElementVNode("li",{onClick:b[9]||(b[9]=E=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),t.createElementVNode("li",{onClick:b[10]||(b[10]=E=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),t.createElementVNode("li",{onClick:b[11]||(b[11]=E=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),t.createElementVNode("li",{onClick:b[12]||(b[12]=E=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),t.createElementVNode("li",{onClick:b[13]||(b[13]=E=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),t.createElementVNode("li",{onClick:b[14]||(b[14]=E=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),t.createElementVNode("li",{onClick:b[15]||(b[15]=E=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),t.createElementVNode("li",{onClick:b[16]||(b[16]=E=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),t.createElementVNode("li",{onClick:b[17]||(b[17]=E=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),t.createElementVNode("li",{onClick:b[18]||(b[18]=E=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):t.createCommentVNode("",!0),B=="Size"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size",onClick:b[36]||(b[36]=E=>d("menu-item__size",E)),key:B},[b[100]||(b[100]=t.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),t.createElementVNode("div",Uc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{onClick:b[20]||(b[20]=E=>c("Size",56))},"初号"),t.createElementVNode("li",{onClick:b[21]||(b[21]=E=>c("Size",48))},"小初"),t.createElementVNode("li",{onClick:b[22]||(b[22]=E=>c("Size",34))},"一号"),t.createElementVNode("li",{onClick:b[23]||(b[23]=E=>c("Size",32))},"小一"),t.createElementVNode("li",{onClick:b[24]||(b[24]=E=>c("Size",29))},"二号"),t.createElementVNode("li",{onClick:b[25]||(b[25]=E=>c("Size",24))},"小二"),t.createElementVNode("li",{onClick:b[26]||(b[26]=E=>c("Size",21))},"三号"),t.createElementVNode("li",{onClick:b[27]||(b[27]=E=>c("Size",20))},"小三"),t.createElementVNode("li",{onClick:b[28]||(b[28]=E=>c("Size",18))},"四号"),t.createElementVNode("li",{onClick:b[29]||(b[29]=E=>c("Size",16))},"小四"),t.createElementVNode("li",{onClick:b[30]||(b[30]=E=>c("Size",14))},"五号"),t.createElementVNode("li",{onClick:b[31]||(b[31]=E=>c("Size",12))},"小五"),t.createElementVNode("li",{onClick:b[32]||(b[32]=E=>c("Size",10))},"六号"),t.createElementVNode("li",{onClick:b[33]||(b[33]=E=>c("Size",8))},"小六"),t.createElementVNode("li",{onClick:b[34]||(b[34]=E=>c("Size",7))},"七号"),t.createElementVNode("li",{onClick:b[35]||(b[35]=E=>c("Size",6))},"八号")])])])):t.createCommentVNode("",!0),B=="SizeAdd"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:b[37]||(b[37]=E=>c("SizeAdd")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Zr)})`})},null,4)])):t.createCommentVNode("",!0),B=="SizeMinus"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:b[38]||(b[38]=E=>c("SizeMinus")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ec)})`})},null,4)])):t.createCommentVNode("",!0),B=="Bold"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:b[39]||(b[39]=E=>c("Bold")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(tc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Italic"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:b[40]||(b[40]=E=>c("Italic")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(nc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Underline"?(t.openBlock(),t.createElementBlock("div",{title:`下划线(${t.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:b[46]||(b[46]=E=>d("menu-item__underline",E)),"data-item":"Underline",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ic)})`})},null,4),b[101]||(b[101]=t.createElementVNode("span",{class:"select"},null,-1)),t.createElementVNode("div",zc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-decoration-style":"solid",onClick:b[41]||(b[41]=E=>c("Underline",{style:"solid"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"double",onClick:b[42]||(b[42]=E=>c("Underline",{style:"double"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(_c)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dashed",onClick:b[43]||(b[43]=E=>c("Underline",{style:"dashed"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(jl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"dotted",onClick:b[44]||(b[44]=E=>c("Underline",{style:"dotted"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(zl)})`})},null,4)]),t.createElementVNode("li",{"data-decoration-style":"wavy",onClick:b[45]||(b[45]=E=>c("Underline",{style:"wavy"}))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Mc)})`})},null,4)])])])],8,jc)):t.createCommentVNode("",!0),B=="Strikeout"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:b[47]||(b[47]=E=>c("Strikeout")),"data-item":"Strikeout",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(lc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Superscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:b[48]||(b[48]=E=>c("Superscript")),"data-item":"Superscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(oc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Subscript"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:b[49]||(b[49]=E=>c("Subscript")),"data-item":"Subscript",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(sc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Color"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:C,"data-item":"Color",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(ac)})`})},null,4),b[102]||(b[102]=t.createElementVNode("span",null,null,-1)),b[103]||(b[103]=t.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):t.createCommentVNode("",!0),B=="Highlight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:x,"data-item":"Highlight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(rc)})`})},null,4),b[104]||(b[104]=t.createElementVNode("span",null,null,-1)),b[105]||(b[105]=t.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):t.createCommentVNode("",!0),B=="Title"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__title",onClick:b[57]||(b[57]=E=>d("menu-item__title",E)),"data-item":"Title",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(cc)})`})},null,4),b[106]||(b[106]=t.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),t.createElementVNode("div",qc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{style:{"font-size":"16px"},onClick:b[50]||(b[50]=E=>c("Title",null))},"正文"),t.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:b[51]||(b[51]=E=>c("Title","first"))},"标题1"),t.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:b[52]||(b[52]=E=>c("Title","second"))},"标题2"),t.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:b[53]||(b[53]=E=>c("Title","third"))},"标题3"),t.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:b[54]||(b[54]=E=>c("Title","fourth"))},"标题4"),t.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:b[55]||(b[55]=E=>c("Title","fifth"))},"标题5"),t.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:b[56]||(b[56]=E=>c("Title","sixth"))},"标题6")])])])):t.createCommentVNode("",!0),B=="RowFlexLeft"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__left",onClick:b[58]||(b[58]=E=>c("RowFlex","left")),title:`左对齐(${t.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(dc)})`})},null,4)],8,Qc)):t.createCommentVNode("",!0),B=="RowFlexCenter"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__center",onClick:b[59]||(b[59]=E=>c("RowFlex","center")),title:`居中对齐(${t.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(hc)})`})},null,4)],8,Wc)):t.createCommentVNode("",!0),B=="RowFlexRight"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__right",onClick:b[60]||(b[60]=E=>c("RowFlex","right")),title:`右对齐(${t.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(fc)})`})},null,4)],8,Kc)):t.createCommentVNode("",!0),B=="RowFlexAlignment"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:b[61]||(b[61]=E=>c("RowFlex","alignment")),title:`两端对齐(${t.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(uc)})`})},null,4)],8,Yc)):t.createCommentVNode("",!0),B=="RowFlexJustify"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:b[62]||(b[62]=E=>c("RowFlex","justify")),title:`分散对齐(${t.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(pc)})`})},null,4)],8,Hc)):t.createCommentVNode("",!0),B=="RowMargin"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:b[71]||(b[71]=E=>d("menu-item__row-margin",E)),"data-item":"RowMargin",key:B},[t.createElementVNode("i",{title:"行间距",style:t.normalizeStyle({backgroundImage:`url(${t.unref(mc)})`})},null,4),t.createElementVNode("div",Gc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-rowmargin":"1",onClick:b[63]||(b[63]=E=>c("RowMargin",1))},"1"),t.createElementVNode("li",{"data-rowmargin":"1.25",onClick:b[64]||(b[64]=E=>c("RowMargin",1.25))},"1.25"),t.createElementVNode("li",{"data-rowmargin":"1.5",onClick:b[65]||(b[65]=E=>c("RowMargin",1.5))},"1.5"),t.createElementVNode("li",{"data-rowmargin":"1.75",onClick:b[66]||(b[66]=E=>c("RowMargin",1.75))},"1.75"),t.createElementVNode("li",{"data-rowmargin":"2",onClick:b[67]||(b[67]=E=>c("RowMargin",2))},"2"),t.createElementVNode("li",{"data-rowmargin":"2.5",onClick:b[68]||(b[68]=E=>c("RowMargin",2.5))},"2.5"),t.createElementVNode("li",{"data-rowmargin":"3",onClick:b[69]||(b[69]=E=>c("RowMargin",3))},"3"),t.createElementVNode("li",{"data-rowmargin":"5",onClick:b[70]||(b[70]=E=>c("RowMargin",5))},"5")])])])):t.createCommentVNode("",!0),B=="List"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__list",onClick:b[77]||(b[77]=E=>d("menu-item__list",E)),key:B},[t.createElementVNode("i",{title:"列表",style:t.normalizeStyle({backgroundImage:`url(${t.unref(gc)})`})},null,4),t.createElementVNode("div",Jc,[t.createElementVNode("ul",null,[b[112]||(b[112]=t.createElementVNode("li",null,[t.createElementVNode("label",null,"取消列表")],-1)),t.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:b[72]||(b[72]=E=>c("List",["ol","decimal"]))},b[107]||(b[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:b[73]||(b[73]=E=>c("List",["ul","checkbox"]))},b[108]||(b[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:b[74]||(b[74]=E=>c("List",["ul","disc"]))},b[109]||(b[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:b[75]||(b[75]=E=>c("List",["ul","circle"]))},b[110]||(b[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:b[76]||(b[76]=E=>c("List",["ul","square"]))},b[111]||(b[111]=[t.createElementVNode("label",null,"空心方块列表:",-1),t.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[t.createElementVNode("li",null,"________")],-1)]))])])])):t.createCommentVNode("",!0),B=="Table"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__table",onClick:A,key:B},[t.createElementVNode("i",{title:"表格",style:t.normalizeStyle({backgroundImage:`url(${t.unref(kc)})`})},null,4),b[113]||(b[113]=t.createStaticVNode('<div class="menu-item__table__collapse" data-v-9be2b83f><div class="table-close" data-v-9be2b83f>×</div><div class="table-title" data-v-9be2b83f><span class="table-select" data-v-9be2b83f>插入</span><span data-v-9be2b83f>表格</span></div><div class="table-panel" data-v-9be2b83f><table data-v-9be2b83f><tbody data-v-9be2b83f><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr><tr class="table-row" data-v-9be2b83f><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td><td class="table-cel" data-v-9be2b83f></td></tr></tbody></table></div></div>',1))])):t.createCommentVNode("",!0),B=="Image"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__image",onClick:V,key:B},[t.createElementVNode("i",{title:"图片",style:t.normalizeStyle({backgroundImage:`url(${t.unref(bc)})`})},null,4),b[114]||(b[114]=t.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):t.createCommentVNode("",!0),B=="Hyperlink"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:B},[t.createElementVNode("i",{title:"超链接",style:t.normalizeStyle({backgroundImage:`url(${t.unref(yc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Separator"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:b[84]||(b[84]=E=>d("menu-item__separator",E)),key:B},[t.createElementVNode("i",{title:"分割线",style:t.normalizeStyle({backgroundImage:`url(${t.unref(wc)})`})},null,4),t.createElementVNode("div",Xc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-separator":"0,0",onClick:b[78]||(b[78]=E=>c("Separator",[0,0]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ul)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"1,1",onClick:b[79]||(b[79]=E=>c("Separator",[1,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(zl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"3,1",onClick:b[80]||(b[80]=E=>c("Separator",[3,1]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(jl)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"4,4",onClick:b[81]||(b[81]=E=>c("Separator",[4,4]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Fc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:b[82]||(b[82]=E=>c("Separator",[7,3,3,3]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Tc)})`})},null,4)]),t.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:b[83]||(b[83]=E=>c("Separator",[6,2,2,2,2,2]))},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ic)})`})},null,4)])])])])):t.createCommentVNode("",!0),B=="Watermark"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:b[87]||(b[87]=E=>d("menu-item__watermark",E)),key:B},[t.createElementVNode("i",{title:"水印(添加、删除)",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ac)})`})},null,4),t.createElementVNode("div",Zc,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-menu":"add",onClick:b[85]||(b[85]=E=>p("add"))},"添加水印"),t.createElementVNode("li",{"data-menu":"delete",onClick:b[86]||(b[86]=E=>p("delete"))},"删除水印")])])])):t.createCommentVNode("",!0),B=="Codeblock"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:S,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(xc)})`})},null,4)])):t.createCommentVNode("",!0),B=="PageBreak"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(vc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Control"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__control",onClick:b[94]||(b[94]=E=>d("menu-item__control",E)),key:B},[t.createElementVNode("i",{title:"控件",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Cc)})`})},null,4),t.createElementVNode("div",ed,[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-control":"text",onClick:b[88]||(b[88]=E=>N("text"))},"文本"),t.createElementVNode("li",{"data-control":"number",onClick:b[89]||(b[89]=E=>N("number"))},"数值"),t.createElementVNode("li",{"data-control":"select",onClick:b[90]||(b[90]=E=>N("select"))},"列举"),t.createElementVNode("li",{"data-control":"date",onClick:b[91]||(b[91]=E=>N("date"))},"日期"),t.createElementVNode("li",{"data-control":"checkbox",onClick:b[92]||(b[92]=E=>N("checkbox"))},"复选框"),t.createElementVNode("li",{"data-control":"radio",onClick:b[93]||(b[93]=E=>N("radio"))},"单选框")])])])):t.createCommentVNode("",!0),B=="Checkbox"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:b[95]||(b[95]=E=>w("checkbox")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Sc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Radio"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:b[96]||(b[96]=E=>w("radio")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Bc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Latex"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:g,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Nc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Date"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__date",onClick:b[97]||(b[97]=E=>v("menu-item__date",E)),key:B},[t.createElementVNode("i",{title:"日期",style:t.normalizeStyle({backgroundImage:`url(${t.unref(Vc)})`})},null,4),b[115]||(b[115]=t.createElementVNode("div",{class:"options"},[t.createElementVNode("ul",null,[t.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),t.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):t.createCommentVNode("",!0),B=="Block"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:y,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Rc)})`})},null,4)])):t.createCommentVNode("",!0),B=="Search"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:_,key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Ec)})`})},null,4)])):t.createCommentVNode("",!0),B=="SearchCollapse"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:B},[t.createElementVNode("div",td,[b[116]||(b[116]=t.createElementVNode("input",{type:"text"},null,-1)),b[117]||(b[117]=t.createElementVNode("label",{class:"search-result"},null,-1)),t.createElementVNode("div",nd,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Dc)})`})},null,4)]),t.createElementVNode("div",id,[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref($c)})`})},null,4)]),b[118]||(b[118]=t.createElementVNode("span",null,"×",-1))]),b[119]||(b[119]=t.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[t.createElementVNode("input",{type:"text"}),t.createElementVNode("button",null,"替换")],-1))])):t.createCommentVNode("",!0),B=="Print"?(t.openBlock(),t.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:b[98]||(b[98]=E=>c("Print")),key:B},[t.createElementVNode("i",{style:t.normalizeStyle({backgroundImage:`url(${t.unref(Oc)})`})},null,4)])):t.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-9be2b83f"]]),od=oe(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 n=a,i=t.useModel(a,"value"),l=t.ref(!1),o=t.computed(()=>n.editor?.widget(n.wid)||n.widget||{}),s=t.computed(()=>n.editor?.model.value||n.model);t.computed(()=>o.value.props||{});const r=t.ref(),c=t.ref(),d=t.ref(),h=t.ref();t.onMounted(()=>{t.nextTick(()=>{f()}),window.addEventListener("click",()=>{l.value=!1})});function f(){const u=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;console.log("width:"+u+",height:"+m),s.value!="view"&&(n.options.autoHeight?d.value.style.minHeight=m+2+"px":d.value.style.height=m+2+"px");const g={mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:u,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...JSON.parse(JSON.stringify(n.options))};s.value=="view"&&(g.margins=[0,0,0,0]),h.value=new me.Editor(d.value,[],g),h.value.listener.contentChange=()=>{h.value.command.getValueAsync().then(({data:w})=>{i.value=JSON.stringify(w)})},i.value&&(typeof i.value=="string"?h.value.command.executeSetValue(JSON.parse(i.value)):Object.keys(i.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(i.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}return t.watch(i,()=>{l.value==!1&&i.value&&h.value&&(typeof i.value=="string"?h.value.command.executeSetValue(JSON.parse(i.value)):Object.keys(i.value).length?h.value.command.executeSetValue(JSON.parse(JSON.stringify(i.value))):h.value.command.executeSetValue({header:[],main:[],footer:[]}))}),t.watch(s,()=>{h.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(u,m)=>(t.openBlock(),t.createBlock(ut,{class:"unione-rich-text",model:n.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=t.withModifiers(g=>l.value=!0,["stop"]))},{default:t.withCtx(()=>[(s.value=="edit"||s.value=="run")&&h.value?(t.openBlock(),t.createBlock(ld,{key:0,ref_key:"canvasMenuDom",ref:c,editor:h.value,items:a.toolbar},null,8,["editor","items"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"canvasEditorDom",ref:d,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-8ba7910c"]]),sd={class:"page-setting-dialog"},vt=t.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const n=a,i=t.computed(()=>n.editor?.model?.value),l=q.useSession(),o=t.computed(()=>l.getPrincipal()),s=t.ref(!1);t.provide("closeSetting",()=>{n.editor?.save().then(u=>{s.value=!1})});function r(){s.value=!0}function c(){n.editor?.save().then(u=>{console.log("res",u)})}function d(){n.editor?.save().then(u=>{console.log("res",u)})}const h=t.ref("");function f(u){h.value||(h.value=i.value),u?n.editor?.setModel("edit"):n.editor?.setModel(h.value)}return(u,m)=>{const g=t.resolveComponent("SettingOutlined"),w=t.resolveComponent("a-tooltip"),v=t.resolveComponent("SaveOutlined"),y=t.resolveComponent("FormOutlined"),A=t.resolveComponent("StopOutlined"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:0,title:a.settingTitle},{default:t.withCtx(()=>[t.createVNode(g,{class:"page-setting",onClick:r})]),_:1},8,["title"])):t.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:1,title:"保存页面"},{default:t.withCtx(()=>[t.createVNode(v,{class:"btn-save",onClick:c})]),_:1})):t.createCommentVNode("",!0),i.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:2,title:"编辑页面"},{default:t.withCtx(()=>[t.createVNode(y,{class:"btn-edit",onClick:m[0]||(m[0]=k=>f(!0))})]),_:1})):t.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(t.openBlock(),t.createBlock(w,{key:3,title:"退出编辑"},{default:t.withCtx(()=>[t.createVNode(A,{class:"btn-edit",onClick:m[1]||(m[1]=k=>f(!1))})]),_:1})):t.createCommentVNode("",!0),t.renderSlot(u.$slots,"default"),i.value=="edit"?(t.openBlock(),t.createBlock(V,{key:4,title:n.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:d},{default:t.withCtx(()=>[t.createElementVNode("div",sd,[t.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):t.createCommentVNode("",!0)],2)}}}),ad={class:"unione-props-setting data-field-manage"},rd={key:0},cd={key:1},dd={key:2},hd={key:3},fd={key:4},ud={key:5},pd={key:6},md=["onClick"],gd=["onClick"],bd=["onClick"],kd={key:1},yd=oe(t.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),n=t.useModel(a,"modelValue"),i=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const g=[];n.value.forEach(w=>{!u.includes(w.name)&&i.value.selectedRowKeys.includes(w.name)&&g.push(w.name)}),g.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(w=>!g.includes(w)))})}}),l={mounted:u=>u.focus()},o=t.ref({});function s(){const u=Object.keys(o.value);if(u.length)for(let m in u){const g=n.value.filter(w=>w.name==m);if(g&&g[0]){let w=o.value[m];Object.keys(w).forEach(v=>{g[0][v]=w[v]})}}o.value={}}function r(u,m){s();const g={};g[m]=u[m]||"",o.value[u.name]=g}function c(u,m){if(!u||!m){o.value={};return}const g=o.value[u.name][m];if(m=="name"&&n.value.filter(v=>v[m]==g&&v.name!=u.name).length>0){se.Modal.warn({title:"提示信息",content:"字段名称["+g+"]已存在"});return}u[m]=g,o.value={}}function d(u,m){n.value.filter(w=>w.name==u.name).forEach(w=>{w[m]=!w[m]})}function h(){if(s(),n.value.filter(g=>g.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};n.value.push(m),o.value[m.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){se.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}se.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{n.value=n.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const g=t.resolveComponent("a-button"),w=t.resolveComponent("a-tooltip"),v=t.resolveComponent("a-input"),y=t.resolveComponent("a-input-number"),A=t.resolveComponent("a-select-option"),V=t.resolveComponent("a-select"),k=t.resolveComponent("a-checkbox"),p=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",ad,[t.createVNode(g,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:t.withCtx(()=>m[1]||(m[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(g,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:t.withCtx(()=>m[2]||(m[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(p,{columns:e.value,"data-source":n.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:t.withCtx(({column:S})=>[S.key==="name"?(t.openBlock(),t.createElementBlock("span",rd,[m[3]||(m[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="title"?(t.openBlock(),t.createElementBlock("span",cd,[m[4]||(m[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="descs"?(t.openBlock(),t.createElementBlock("span",dd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataLen"?(t.openBlock(),t.createElementBlock("span",hd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataPrec"?(t.openBlock(),t.createElementBlock("span",fd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="defaultValue"?(t.openBlock(),t.createElementBlock("span",ud,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="dataType"?(t.openBlock(),t.createElementBlock("span",pd,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(S.title),1)])):t.createCommentVNode("",!0),S.key==="isPk"?(t.openBlock(),t.createBlock(w,{key:7,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[m[5]||(m[5]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isFk"?(t.openBlock(),t.createBlock(w,{key:8,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="isNull"?(t.openBlock(),t.createBlock(w,{key:9,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0),S.key==="syncDbEnable"?(t.openBlock(),t.createBlock(w,{key:10,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(S.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:S,text:_,record:C})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(v,{key:0,value:o.value[C.name][S.dataIndex],"onUpdate:value":x=>o.value[C.name][S.dataIndex]=x,onBlur:x=>c(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_||" "),1)],64))],10,md)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[C.name][S.dataIndex],"onUpdate:value":x=>o.value[C.name][S.dataIndex]=x,onBlur:x=>c(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_||" "),1)],64))],10,gd)):["dataType"].includes(S.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:x=>r(C,S.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(S.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(V,{key:0,value:C[S.dataIndex],"onUpdate:value":x=>C[S.dataIndex]=x,onBlur:m[0]||(m[0]=x=>c())},{default:t.withCtx(()=>[t.createVNode(A,{key:"String",value:"String"}),t.createVNode(A,{key:"Long",value:"Long"}),t.createVNode(A,{key:"Short",value:"Short"}),t.createVNode(A,{key:"Integer",value:"Integer"}),t.createVNode(A,{key:"Float",value:"Float"}),t.createVNode(A,{key:"Double",value:"Double"}),t.createVNode(A,{key:"Date",value:"Date"}),t.createVNode(A,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",kd,t.toDisplayString(_),1))],10,bd)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:3,checked:C[S.dataIndex],onClick:x=>d(C,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(t.openBlock(),t.createBlock(k,{key:4,checked:!C[S.dataIndex],onClick:x=>d(C,S.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),wd={class:"unione-props-setting data-field-setting"},Ad={key:0},xd=["onClick"],vd={class:"field-txt"},Cd=["onClick"],Sd={key:1,class:"field-txt"},Bd=["onClick"],Nd={key:1},Vd=["onClick"],Rd={key:0,class:"field-txt"},Ed={key:4,class:"edit-field"},Od={key:0},_d=["onClick"],Md=oe(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:y})=>y+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=t.useModel(a,"modelValue"),i={mounted:y=>y.focus()},l=t.ref({});function o(){const y=Object.keys(l.value);if(y.length)for(let A in y){const V=n.value.filter(k=>k.name==A);if(V&&V[0]){let k=l.value[A];Object.keys(k).forEach(p=>{p=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=k[p]):V[0][p]=k[p]})}}l.value={}}function s(y,A){o();const V={};A=="convertName"?(y.convert||(y.convert={}),V[A]=y.convert?.type):V[A]=y[A]||"",l.value[y.name]=V}function r(y,A){{l.value={};return}}function c(y,A){n.value.filter(k=>k.name==y.name).forEach(k=>{k[A]=!k[A]})}const d=t.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function h(y,A){const V=n.value.filter(p=>p.name==y.name);V.forEach(p=>{A!="isSort"?p[A]=!0:p[A]=!p[A]});const k=V[0];if(!(!k||A=="isSort")){switch(d.value.prop=A,d.value.field=y,k.show||(k.show={}),A){case"isQuery":k.show.query||(k.show.query={}),d.value.show=k.show.query,d.value.title=`查询设置/${y.title}(${y.name})`;break;case"isForm":k.show.form||(k.show.form={}),d.value.show=k.show.form,d.value.title=`表单设置/${y.title}(${y.name})`;break;case"isView":k.show.view||(k.show.view={}),d.value.show=k.show.view,d.value.title=`详情设置/${y.title}(${y.name})`;break;case"isList":k.show.list||(k.show.list={}),d.value.show=k.show.list,d.value.title=`列头设置/${y.title}(${y.name})`;break}d.value.visible=!0}}const f=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:y=>{const A=f.value.options.filter(V=>V.value==y);return A[0]?A[0].label:y}}),u=t.ref({visible:!1,field:{},props:{},showInfo:y=>{let A="";return y.rules&&(A=y.rules.filter(V=>V.enable).length||""),A&&(A="("+A+")"),A},toSetting:()=>{const y=u.value.props,A={name:"range",trigger:y.trigger,whitespace:y.whitespace,message:y.rangeMessage};y.rangeMin!=null&&y.rangeMin!=null&&(A.min=y.rangeMin,A.enable=!0),y.rangeMax!=null&&y.rangeMax!=null&&(A.max=y.rangeMax,A.enable=!0);const V={name:"reg",trigger:y.trigger,whitespace:y.whitespace,message:y.regMessage};y.regExpress&&(V.pattern=y.regExpress,V.enable=!0),u.value.field.rules=[A,V],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(y){u.value.visible=!0,u.value.field=y;const A=y.rules||[],V={trigger:"change",whitespace:!0};A.forEach(k=>{k.name=="reg"&&(V.trigger=k.trigger,V.whitespace=k.whitespace,V.regExpress=k.pattern,V.regMessage=k.message),k.name=="range"&&(V.rangeMin=k.min,V.rangeMax=k.max,V.rangeMessage=k.message)}),u.value.props=V}const g=t.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:y=>{const A=g.value.widgets.filter(V=>V.value==y);return A[0]?A[0].label:y},toSetting:()=>{}}),w=t.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(y,A)=>{w.value.convert.options.splice(y,1)},toSetting:()=>{w.value.visible=!1}});function v(y){w.value.visible=!0,w.value.field=y,w.value.convert=y.convert||{}}return(y,A)=>{const V=t.resolveComponent("ToolOutlined"),k=t.resolveComponent("a-button"),p=t.resolveComponent("a-select"),S=t.resolveComponent("a-checkbox"),_=t.resolveComponent("a-table"),C=t.resolveComponent("a-input-number"),x=t.resolveComponent("a-form-item"),N=t.resolveComponent("a-input"),R=t.resolveComponent("a-form"),b=t.resolveComponent("a-modal"),B=t.resolveComponent("a-col"),F=t.resolveComponent("a-row"),E=t.resolveComponent("a-select-option"),M=t.resolveComponent("a-divider"),P=t.resolveComponent("a-checkbox-group");return t.openBlock(),t.createElementBlock("div",wd,[t.createVNode(_,{columns:e.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:T})=>[["widget","queryType","rules","convertName"].includes(T.key)?(t.openBlock(),t.createElementBlock("span",Ad,[t.createVNode(V),t.createTextVNode(" "+t.toDisplayString(T.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:T,text:W,record:L})=>[["rules"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!u.value.showInfo(L)&&"empty"]),onClick:O=>m(L)},[t.createElementVNode("span",vd,t.toDisplayString(u.value.showInfo(L)),1),u.value.showInfo(L)?(t.openBlock(),t.createBlock(k,{key:0,type:"link"},{default:t.withCtx(()=>A[22]||(A[22]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,xd)):["widget"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(T.dataIndex))&&!W&&"empty"]),onClick:O=>s(L,T.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L[T.dataIndex],"onUpdate:value":O=>L[T.dataIndex]=O,allowClear:!0,options:g.value.widgets,onBlur:A[0]||(A[0]=O=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(t.openBlock(),t.createElementBlock("span",Sd,t.toDisplayString(g.value.widgetName(W)),1))],10,Cd)):["queryType"].includes(T.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(T.dataIndex))&&!W&&"empty"]),onClick:O=>s(L,T.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L[T.dataIndex],"onUpdate:value":O=>L[T.dataIndex]=O,allowClear:!0,options:f.value.options,onBlur:A[1]||(A[1]=O=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(t.openBlock(),t.createElementBlock("span",Nd,t.toDisplayString(f.value.showLabel(W)),1))],10,Bd)):t.createCommentVNode("",!0)],64)):["convertName"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(T.dataIndex))&&!L.convert?.type&&"empty"]),onClick:O=>s(L,T.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(T.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(p,{key:0,value:L.convert.type,"onUpdate:value":O=>L.convert.type=O,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:A[2]||(A[2]=O=>r())},null,8,["value","onUpdate:value"])),[[i]]):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[L.convert?.type?(t.openBlock(),t.createElementBlock("span",Rd,t.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):t.createCommentVNode("",!0),L.convert?.type?(t.openBlock(),t.createBlock(k,{key:1,type:"link",onClick:t.withModifiers(O=>v(L),["stop"])},{default:t.withCtx(()=>A[23]||(A[23]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Vd)):["isQuery","isForm","isView","isList","isSort"].includes(T.dataIndex)?(t.openBlock(),t.createElementBlock("div",Ed,[t.createVNode(S,{checked:L[T.dataIndex],onClick:O=>c(L,T.dataIndex)},null,8,["checked","onClick"]),t.createVNode(k,{type:"link",onClick:O=>h(L,T.dataIndex)},{default:t.withCtx(()=>A[24]||(A[24]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(b,{visible:d.value.visible,"onUpdate:visible":A[9]||(A[9]=T=>d.value.visible=T),title:d.value.title,onOk:d.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(x,{label:"显示顺序"},{default:t.withCtx(()=>[t.createVNode(C,{value:d.value.show.index,"onUpdate:value":A[3]||(A[3]=T=>d.value.show.index=T)},null,8,["value"])]),_:1}),["isQuery"].includes(d.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"显示宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.width,"onUpdate:value":A[4]||(A[4]=T=>d.value.show.width=T)},null,8,["value"])]),_:1})),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:1,label:"标题宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.labelWidth,"onUpdate:value":A[5]||(A[5]=T=>d.value.show.labelWidth=T)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isForm","isView"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:2,label:"控件宽度"},{default:t.withCtx(()=>[t.createVNode(N,{value:d.value.show.valueWidth,"onUpdate:value":A[6]||(A[6]=T=>d.value.show.valueWidth=T)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:3,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.fixed,"onUpdate:value":A[7]||(A[7]=T=>d.value.show.fixed=T),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["isList"].includes(d.value.prop)?(t.openBlock(),t.createBlock(x,{key:4,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(p,{value:d.value.show.align,"onUpdate:value":A[8]||(A[8]=T=>d.value.show.align=T),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(b,{visible:w.value.visible,"onUpdate:visible":A[11]||(A[11]=T=>w.value.visible=T),title:w.value.convert.type=="dict"?"字典设置":"选项设置",onOk:w.value.toSetting},{default:t.withCtx(()=>[w.value.convert.type!="dict"?(t.openBlock(),t.createElementBlock("div",Od,[t.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:t.withCtx(()=>A[25]||(A[25]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(_,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:T,text:W,record:L,index:O})=>[T.dataIndex==="label"?(t.openBlock(),t.createBlock(N,{key:0,value:L.label,"onUpdate:value":te=>L.label=te,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),T.dataIndex==="value"?(t.openBlock(),t.createBlock(N,{key:1,value:L.value,"onUpdate:value":te=>L.value=te,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),T.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:te=>w.value.toDelOption(O,L)},"删除",8,_d)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):t.createCommentVNode("",!0),w.value.convert.type=="dict"?(t.openBlock(),t.createBlock(R,{key:1,model:w.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:t.withCtx(()=>[t.createVNode(F,{type:"flex",style:{width:"100%"}},{default:t.withCtx(()=>[t.createVNode(B,{span:24,order:1},{default:t.withCtx(()=>[t.createVNode(x,{label:"字典名称:"},{default:t.withCtx(()=>[t.createVNode(N,{value:w.value.convert.dict,"onUpdate:value":A[10]||(A[10]=T=>w.value.convert.dict=T)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):t.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),t.createVNode(b,{visible:g.value.visible,"onUpdate:visible":A[13]||(A[13]=T=>g.value.visible=T),title:"控件设置",onOk:g.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:g.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:t.withCtx(()=>[g.value.field.widget=="a-select"?(t.openBlock(),t.createBlock(x,{key:0,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(p,{value:g.value.props.mode,"onUpdate:value":A[12]||(A[12]=T=>g.value.props.mode=T),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(E,{value:"multiple"},{default:t.withCtx(()=>A[26]||(A[26]=[t.createTextVNode("多选")])),_:1}),t.createVNode(E,{value:"tags"},{default:t.withCtx(()=>A[27]||(A[27]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(b,{visible:u.value.visible,"onUpdate:visible":A[21]||(A[21]=T=>u.value.visible=T),title:"规则设置",onOk:u.value.toSetting},{default:t.withCtx(()=>[t.createVNode(R,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[28]||(A[28]=[t.createTextVNode("基本设置")])),_:1}),t.createVNode(x,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(P,{value:u.value.props.trigger,"onUpdate:value":A[14]||(A[14]=T=>u.value.props.trigger=T),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(x,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(S,{value:u.value.props.whitespace,"onUpdate:value":A[15]||(A[15]=T=>u.value.props.whitespace=T),checked:u.value.props.whitespace},{default:t.withCtx(()=>A[29]||(A[29]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[30]||(A[30]=[t.createTextVNode("数值区间")])),_:1}),t.createVNode(x,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":A[16]||(A[16]=T=>u.value.props.rangeMin=T)},null,8,["value"]),A[31]||(A[31]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":A[17]||(A[17]=T=>u.value.props.rangeMax=T)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.rangeMessage,"onUpdate:value":A[18]||(A[18]=T=>u.value.props.rangeMessage=T)},null,8,["value"])]),_:1}),t.createVNode(M,{orientation:"left"},{default:t.withCtx(()=>A[32]||(A[32]=[t.createTextVNode("正则验证")])),_:1}),t.createVNode(x,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.regExpress,"onUpdate:value":A[19]||(A[19]=T=>u.value.props.regExpress=T)},null,8,["value"])]),_:1}),t.createVNode(x,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(N,{value:u.value.props.regMessage,"onUpdate:value":A[20]||(A[20]=T=>u.value.props.regMessage=T)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Fd={class:"unione-props-setting data-field"},Td=oe(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(n,i)=>{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",Fd,[t.createVNode(r,null,{default:t.withCtx(()=>[t.createVNode(o,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(l),i[2]||(i[2]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(yd,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),t.createVNode(o,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(s),i[3]||(i[3]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(Md,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Id={key:0,class:"data-model-list"},Dd=["onClick"],$d=oe(t.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const n=t.computed(()=>l.editor.dataModels()),i=t.ref({sn:"new_",title:"新建数据",fields:[]});t.onMounted(()=>{n.value&&n.value[0]&&(i.value=n.value[0])});const l=a;function o(f){i.value=f}function s(){if(n.value.length>=l.limit){se.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=Na.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=t.ref(),d=t.inject("closeSetting");function h(){c.value.validate().then(f=>{d&&d()})}return e({toSaving:h}),(f,u)=>{const m=t.resolveComponent("a-input"),g=t.resolveComponent("a-form-item"),w=t.resolveComponent("a-textarea"),v=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",Id,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,y=>(t.openBlock(),t.createElementBlock("div",{key:y.sn,class:t.normalizeClass(["title",i.value&&i.value.sn==y.sn&&"slt"]),onClick:A=>o(y)},t.toDisplayString(y.title),11,Dd))),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(v,{ref_key:"formObj",ref:c,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:t.withCtx(()=>[t.createVNode(g,{label:"数据标题",name:"title",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=y=>i.value.title=y)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"数据名称",name:"name",required:""},{default:t.withCtx(()=>[t.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=y=>i.value.name=y)},null,8,["value"])]),_:1}),t.createVNode(g,{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:i.value.url,"onUpdate:value":u[2]||(u[2]=y=>i.value.url=y)},null,8,["value"])]),_:1}),t.createVNode(g,{label:"数据说明",name:"descs"},{default:t.withCtx(()=>[t.createVNode(w,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=y=>i.value.descs=y)},null,8,["value"])]),_:1})]),_:1},8,["model"]),t.createVNode(Td,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=y=>i.value.fields=y)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Pd={class:"unione-props-setting unione-page-setting"},Ct=oe(t.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,n=t.ref({});return t.onMounted(()=>{n.value=e.editor.define.value}),(i,l)=>{const o=t.resolveComponent("a-form-item"),s=t.resolveComponent("a-input"),r=t.resolveComponent("a-switch"),c=t.resolveComponent("a-textarea"),d=t.resolveComponent("a-form"),h=t.resolveComponent("a-tab-pane"),f=t.resolveComponent("a-tabs");return t.openBlock(),t.createElementBlock("div",Pd,[t.createVNode(f,{type:"card"},{default:t.withCtx(()=>[t.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:t.withCtx(()=>[t.createVNode(d,{model:n.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[n.value.sn&&n.value.sn!="new_"?(t.openBlock(),t.createBlock(o,{key:0,label:"页面编码"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.sn)+"/V"+t.toDisplayString(n.value.vers),1)]),_:1})):t.createCommentVNode("",!0),t.createVNode(o,{label:"页面标题",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.title,"onUpdate:value":l[0]||(l[0]=u=>n.value.title=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"页面组件",required:""},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.component,"onUpdate:value":l[1]||(l[1]=u=>n.value.component=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"icon图标"},{default:t.withCtx(()=>[t.createVNode(s,{value:n.value.icon,"onUpdate:value":l[2]||(l[2]=u=>n.value.icon=u)},null,8,["value"])]),_:1}),t.createVNode(o,{label:"是否全局"},{default:t.withCtx(()=>[t.createVNode(r,{checked:n.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>n.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"是否模版"},{default:t.withCtx(()=>[t.createVNode(r,{checked:n.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>n.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),t.createVNode(o,{label:"页面备注"},{default:t.withCtx(()=>[t.createVNode(c,{value:n.value.descs,"onUpdate:value":l[5]||(l[5]=u=>n.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),t.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:t.withCtx(()=>[t.createVNode($d,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),ql=oe(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,n={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new lt,l=t.computed(()=>i.$widgetList.value||[]);t.watch(()=>e.pageDefine,s=>{s&&i.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),i.setModel("run"),i.load(o.value,e.pageDefine||n)}),(s,r)=>(t.openBlock(),t.createBlock(vt,{class:"unione-page-view","setting-title":"页面设置",editor:t.unref(i)},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(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[t.unref(i)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Ld={class:"form-btns"},Ql=t.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1},storage:{type:Object,required:!1},fields:{type:Array,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1},setting:{type:Object,required:!1}},emits:["submit","save","reset","back","btnClick"],setup(a,{expose:e,emit:n}){const i=t.inject("router"),l=q.useDialog(),o=a,s=n,r={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-form"};function c(){if(o.fields?.length){const V={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields,setting:o.setting||{}};r.configs.widgets=[V]}o.storage&&(r.configs.dsnList=["primary"],d.dataManager().use("primary","form").store(o.storage)),r.configs.btns=o.btns||[],o.btns==!1&&(r.configs.btns=!1),r.configs.event=o.event||{}}const d=new lt,h=t.computed(()=>d.$widgetList.value||[]),f=t.ref({}),u=t.computed(()=>{const V=d.define.value?.configs?.btns||[],k=V.map(p=>p.name);if(!k.includes("save")){const p={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};V.splice(p.index,0,p)}if(!k.includes("submit")){const p={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let S=p.index||1;V.splice(S,0,p)}if(!k.includes("reset")){const p={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};V.splice(p.index,0,p)}if(!k.includes("back")){const p={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};V.splice(p.index,0,p)}return d.model.value=="view"&&V.filter(p=>["save","submit","reset"].includes(p.name)).forEach(p=>{p.visible=!1}),V});async function m({btn:V,event:k}){if(V.name=="save"){const S=await w();S.success&&S.body&&(f.value.id=S.body),s("save",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value});return}if(V.name=="reset"){v(),s("reset",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="back"){y(),s("back",{btn:V,event:k}),s("btnClick",{btn:V,event:k});return}if(V.name=="submit"){l.confirm({content:"提交当前表单吗?",onOk:async()=>{const S=await w();S.success&&S.body&&(f.value.id=S.body),s("submit",{btn:V,event:k,formData:f.value}),s("btnClick",{btn:V,event:k,formData:f.value})}});return}const p=await g();s("btnClick",{btn:V,event:k,formData:p})}async function g(){const V=d.dataManager().primary().data(),k=d.dataManager().form();f.value={...V};for(let p in k){const S=d.dataManager().data(p).data();d.dataManager().psn()!=p&&(f.value[p]={...S})}return f.value}async function w(){const V=d.dataManager().form();f.value={};for(let k in V){const p=await V[k].validate();d.dataManager().psn()==k?f.value=p:f.value[k]=p}return d.dataManager().primary().save({data:f.value,params:d.dataManager().params})}function v(V){d.dataManager().primary().reset(V)}function y(){i.back()}t.watch(()=>o.pageDefine,V=>{V&&d.load(A.value,V)});const A=t.ref("new_");return t.onMounted(()=>{const V=t.inject("route");console.log("unione page form route",V),A.value=o.psn||V?.query?.psn||V?.meta?.psn||"new_",console.log("unione page form,psn:"+A.value),d.setModel(V?.query?.model||V?.meta?.model||"run");const k={...o.params||{},...V?.query||{},...V?.params||{}};d.dataManager().params(k),c(),d.load(A.value,o.pageDefine||r)}),e({save:w,toReset:v,toBack:y}),(V,k)=>{const p=t.resolveComponent("unione-btn");return t.openBlock(),t.createBlock(vt,{class:"unione-page-form","setting-title":"页面设置",editor:t.unref(d)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value,S=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(S.widget),{key:S.wid,wid:S.wid,widget:S,editor:t.unref(d)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Ld,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value,S=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:S.name},[S.visible!=!1?(t.openBlock(),t.createBlock(p,{key:0,widget:S,editor:t.unref(d),ctx:{formData:f.value},onClick:m},null,8,["widget","editor","ctx"])):t.createCommentVNode("",!0)],64))),128))])]),_:2},[t.unref(d)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(d)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Ud=["onMouseover"],jd={key:0,class:"node-opts"},zd={key:2,class:"tree-empty"},qd={class:"form-warp"},Qd={class:"form-btns"},Wl=oe(t.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:n}){const i=q.useDialog(),l=t.inject("router"),o=a,s={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function r(){if(o.fields?.length){const $={widget:"unione-form",dsn:"primary",primary:!0,widgets:o.fields};s.configs.widgets=[$]}s.configs.dsnList=["primary"],c.dataManager().use("primary","form").store(o.storage),s.configs.btns=o.btns||[],o.btns==!1&&(s.configs.btns=!1),s.configs.opts=o.opts||[],o.opts==!1&&(s.configs.opts=!1),s.configs.event=o.event||{},s.configs.setting=o.setting||{}}const c=new lt,d=t.ref(!1),h=t.ref([]),f=t.ref({}),u=t.ref(null),m=t.ref(null),g=t.ref([]),w=t.ref([]),v=t.ref(0),y=t.computed(()=>{const $={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,autoselect:!1,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...o.setting?.tree||{}};return c.define.value?.configs?.tree||$}),A=t.computed(()=>y.value.searchEnable),V=t.computed(()=>{const $=c.define.value?.configs?.opts;if(typeof $=="boolean"&&$==!1)return!1;const U=($||[]).map(G=>typeof G=="string"?{name:G,visible:!1}:G),z=[];return U.forEach(G=>{z.push(G.name)}),console.log("opts addBtn",U),U.filter(G=>G.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),k=t.computed(()=>{const $=c.define.value?.configs?.opts;if(typeof $=="boolean"&&$==!1)return[];const U=($||[]).map(ee=>typeof ee=="string"?{name:ee,visible:!1}:ee),z=[],G=[];return U.forEach(ee=>{G.push(ee.name),ee.name!="add"&&z.push(ee)}),G.includes("delete")||z.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),G.includes("child")||z.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",z),z});function p($,U){const{btn:z,event:G}=$;G.stopPropagation();const ee=f.value[U[y.value.idField]];if(console.log("onTreeMenuClick,btn:",z),console.log("onTreeMenuClick,node:",U),console.log("onTreeMenuClick,curentNode:",ee),z.name=="child"){if(/^new_.*/.test(ee[y.value.idField])||M.value.preCreate&&M.value.preCreate(ee)==!1)return;const ke=f.value[ee[y.value.idField]];ke.isLeaf=!1,u.value={},u.value[y.value.pidField]=ke[y.value.idField],u.value[y.value.labelField]="新建...",u.value[y.value.idField]="new_"+v.value,u.value.parentNode=ke,v.value=v.value+1,ke.children||(ke.children=[],w.value.push(ke[y.value.idField])),M.value.createNode&&M.value.createNode(u.value,ke,c.dataManager().params()),f.value[u.value[y.value.idField]]=u.value,ke.children.push(u.value),g.value=[u.value[y.value.idField]],c.dataManager().primary().setValue(u.value)}z.name=="delete"&&Z(ee),W("btnClick",{...$,node:ee})}function S($,{expanded:U,node:z}){U&&(u.value=z.dataRef,c.dataManager().primary().setValue(u.value),F())}function _($,U){U.selected?(u.value=U.node.dataRef,c.dataManager().primary().setValue(u.value)):u.value&&(g.value=[u.value[y.value.idField]]),W("treeClick",{keys:$,event:U}),W("select",{keys:$,event:U})}const C=t.computed(()=>{if(o.storage?.orderBy){const $=o.storage.orderBy.split(" ");return[{name:$[0],asc:$[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>o.params,()=>{d.value&&(h.value=[],f.value={},u.value=null,g.value=[],w.value=[],v.value=0,c.dataManager().params(o.params||{}),console.log("params changed props.params",o.params),F())}),t.watch(()=>u.value,()=>{console.log("active node changed",u.value),N(!u.value)});const x=t.ref(null);t.watch(x,()=>{x.value&&u.value&&c.dataManager().primary().setValue(u.value)});function N($=!0){const U=c.dataManager().form();for(let z in U)U[z].setDisabled($)}function R(){if(!(M.value.preCreate&&M.value.preCreate()==!1)){if(u.value={},u.value[y.value.pidField]=-1,u.value[y.value.labelField]="新建...",u.value[y.value.idField]="new_"+v.value,v.value=v.value+1,M.value.createNode&&M.value.createNode(u.value,null,c.dataManager().params()),u.value[y.value.pidField]==-1)h.value.push(u.value);else{const $=f.value[u.value[y.value.pidField]];$?($.children||($.children=[]),$.children.push(u.value)):h.value.push(u.value)}g.value=[u.value[y.value.idField]],f.value[u.value[y.value.idField]]=u.value,c.dataManager().primary().setValue(u.value)}}const b=t.ref(""),B=pt($=>{c.dataManager().primary().find({page:1,pageSize:9999,keywords:$||b.value,needCount:!1,body:y.value.async==!1?null:{},sorts:C.value}).then(U=>{if(f.value={},h.value=[],U.body?.length){const z={};U.body.forEach(G=>{z[G[y.value.idField]]=G}),U.body.forEach(G=>{const ee=z[G[y.value.pidField]];ee?(ee.children||(ee.children=[],ee.isLeaf=!1),ee.children.push(G)):h.value.push(G)})}})},400);function F(){return new Promise(($,U)=>{const z={};if(z[y.value.pidField]=o.params[y.value.pidField]||-1,u.value){if(u.value.children?.length||y.value.async==!1){$(u.value.children);return}z[y.value.pidField]=u.value[y.value.idField],c.dataManager().primary().find({page:1,pageSize:999,body:z,sorts:C.value}).then(G=>{u.value.children=G.body||[],u.value.children.forEach(ee=>{ee.isLeaf=!!ee[y.value.leafField],f.value[ee[y.value.idField]]=ee,ee.parentNode=f.value[ee[y.value.pidField]]}),$(G.body)})}else{const G=y.value.async==!1?null:{page:1,pageSize:999,body:z,sorts:C.value};c.dataManager().primary().find(G).then(ee=>{if(y.value.async==!1){if(h.value=[],ee.body?.length){const ke={};ee.body.forEach(ft=>{ke[ft[y.value.idField]]=ft}),ee.body.forEach(ft=>{const Tt=ke[ft[y.value.pidField]];Tt?(Tt.children||(Tt.children=[],Tt.isLeaf=!1),Tt.children.push(ft)):h.value.push(ft)})}$(ee.body)}else h.value=ee.body||[],h.value.forEach(ke=>{ke.isLeaf=!!ke[y.value.leafField],f.value[ke[y.value.idField]]=ke}),$(ee.body)})}})}const E=t.computed(()=>c.$widgetList.value||[]),M=t.computed(()=>{const $={...c.define.value?.configs?.event||{}};for(const U in $)$[U]&&typeof $[U]!="function"&&$[U].enable&&$[U].scriptText&&(U=="createNode"&&($[U]=new Function("node","parent","params",$[U].scriptText)),U=="preCreate"?$[U]=new Function("parent",$[U].scriptText):$[U]=new Function("data","event",$[U].scriptText));return $}),P=t.computed(()=>c.define.value?.configs?.setting||o.setting||{});t.provide("pageSetting",P.value);const T=t.computed(()=>{const $=c.define.value?.configs?.btns;if(typeof $=="boolean"&&$==!1)return[];const U=(c.define.value?.configs?.btns||[]).map(G=>typeof G=="string"?{name:G,visible:!1}:{size:"default",...G}),z=U.map(G=>G.name);if(!z.includes("save")){const G={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};U.splice(G.index,0,G)}if(!z.includes("reset")){const G={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};U.splice(G.index,0,G)}if(!z.includes("back")){const G={title:"返回",type:"default",index:U.length,visible:!0,size:"default",name:"back"};U.splice(G.index,0,G)}return c.model.value=="view"&&U.filter(G=>["save","submit","reset"].includes(G.name)).forEach(G=>{G.visible=!1}),U}),W=n;function L($){const{btn:U,event:z}=$;U.name=="save"&&O({btn:U,event:z}),U.name=="reset",U.name=="back"&&D(),W("btnClick",$)}async function O($){const U=c.dataManager().form();let z={...u.value};for(let G in U){const ee=await U[G].validate();if(c.dataManager().psn()==G)for(let ke in ee)z[ke]=ee[ke];else z[G]=ee}if(z[y.value.pidField]&&(z[y.value.pidField]+"").startsWith("new_")){i.error({content:"请先保存父节点!"});return}z[y.value.idField]&&(z[y.value.idField]+"").startsWith("new_")&&delete z[y.value.idField],delete z.parentNode,delete z.children,z[y.value.leafField]=z[y.value.leafField]?1:0,M.value.preSave&&M.value.preSave(z,$),console.log("=======form data=====",z),c.dataManager().primary().save({data:z}).then(G=>{console.log("save result:",G),u.value[y.value.idField]=G.body,g.value=[G.body],f.value[G.body]=u.value,u.value.children?.forEach(ee=>{ee[y.value.pidField]=G.body}),M.value.postSaved&&M.value.postSaved(z,$)})}function te(){}function D(){l.back()}function K(){return c.dataManager().primary()}function ue($,U){if($&&U){const z=f.value[$];$!=U[y.value.idField]&&(z[y.value.idField]=U[y.value.idField],f.value[U[y.value.idField]]=z),Object.keys(U).forEach(G=>{z[G]=q.utils.obj.ext(z[G],U[G])})}else if($&&!U){U=$;const z=f.value[U[y.value.idField]];z&&Object.keys(U).forEach(G=>{z[G]=q.utils.obj.ext(z[G],U[G])})}}function j($){u.value&&(u.value[y.value.idField]!=$[y.value.idField]&&(u.value[y.value.idField]==$[y.value.idField],g.value=[$[y.value.idField]],f.value[$[y.value.idField]]=u.value),Object.keys($).forEach(U=>{u.value[U]=q.utils.obj.ext(u.value[U],$[U])}))}function I($){return f.value[$]}function Z($){M.value.preDelete&&M.value.preDelete($)==!1||($[y.value.idField]&&($[y.value.idField]+"").startsWith("new_")?($.parentNode?$.parentNode.children=$.parentNode.children.filter(U=>U[y.value.idField]!=$[y.value.idField]):h.value=h.value.filter(U=>U[y.value.idField]!=$[y.value.idField]),delete f.value[$[y.value.idField]]):c.dataManager().primary().deleteByIds([$[y.value.idField]]).then(()=>{if($.parentNode){const U=f.value[$[y.value.pidField]];U.children=U.children.filter(z=>z[y.value.idField]!=$[y.value.idField])}else h.value=h.value.filter(U=>U[y.value.idField]!=$[y.value.idField]);delete f.value[$[y.value.idField]]}))}function Y(){h.value=[],f.value={},u.value=null,m.value=null,g.value=[],w.value=[],v.value=0,F().then($=>{if($&&$[0]&&y.value.selectable&&y.value.autoselect){const U={...$[0],dataRef:$[0]};g.value=[$[0].id],W("select",{keys:g.value,event:{node:U}})}})}const ie=t.ref("new_");return t.onMounted(()=>{const $=t.inject("route");console.log("unione page tree route",$),ie.value=o.psn||$?.query?.psn||$?.meta?.psn||"new_",console.log("unione page tree,psn:"+ie.value),c.setModel($?.query?.model||$?.meta?.model||"run");const U={...o.params||{},...$?.query||{},...$?.params||{}};c.dataManager().params(U),r(),c.load(ie.value,s),t.nextTick(()=>{N(!0)}),F().then(z=>{if(z&&z[0]&&y.value.selectable&&y.value.autoselect){const G={...z[0],dataRef:z[0]};g.value=[z[0].id],W("select",{keys:g.value,event:{node:G}})}}),d.value=!0}),e({storage:K,save:O,toBack:D,toReset:te,setNode:ue,setActiveNode:j,getNode:I,delNode:Z,reload:Y}),($,U)=>{const z=t.resolveComponent("SearchOutlined"),G=t.resolveComponent("a-input"),ee=t.resolveComponent("unione-btn"),ke=t.resolveComponent("a-badge"),ft=t.resolveComponent("a-tree"),Tt=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(vt,{class:"unione-page-tree","setting-title":"页面设置",editor:t.unref(c)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"tree-warp",onContextmenu:U[4]||(U[4]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot($.$slots,"tree-top",{},void 0,!0),A.value?(t.openBlock(),t.createBlock(G,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:b.value,"onUpdate:value":U[0]||(U[0]=pe=>b.value=pe),onChange:t.unref(B),onPressEnter:t.unref(B)},{suffix:t.withCtx(()=>[t.createVNode(z)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),V.value?(t.openBlock(),t.createBlock(ee,{key:1,widget:V.value,onClick:R},null,8,["widget"])):t.createCommentVNode("",!0),t.createVNode(ft,{"show-line":y.value.showLine,"show-icon":y.value.showIcon,disabled:y.value.disabled,blockNode:!0,draggable:y.value.draggable,multiple:y.value.multiple,selectable:y.value.selectable,checkable:y.value.checkable,fieldNames:{title:y.value.labelField,key:y.value.idField},selectedKeys:g.value,"onUpdate:selectedKeys":U[2]||(U[2]=pe=>g.value=pe),expandedKeys:w.value,"onUpdate:expandedKeys":U[3]||(U[3]=pe=>w.value=pe),"tree-data":h.value,onExpand:S,onSelect:_},t.createSlots({icon:t.withCtx(({dataRef:pe})=>[pe[y.value.iconField]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(pe[y.value.iconField]),{key:0,class:"node-icon"})):t.createCommentVNode("",!0)]),_:2},[k.value?.length?{name:"title",fn:t.withCtx(({dataRef:pe})=>[t.createElementVNode("div",{class:"node-label",onMouseover:()=>m.value=pe,onMouseleave:U[1]||(U[1]=()=>m.value=null)},[t.createVNode(ke,{dot:pe[y.value.badgeDot],count:pe[y.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(pe[y.value.labelField]),1)]),_:2},1032,["dot","count"]),u.value&&u.value[y.value.idField]==pe[y.value.idField]||m.value&&m.value[y.value.idField]==pe[y.value.idField]?(t.openBlock(),t.createElementBlock("div",jd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,_l=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!M.value.btnVisible||M.value.btnVisible(_l,pe)?(t.openBlock(),t.createBlock(ee,{key:_l.name,widget:_l,ctx:{node:pe},onClick:Wp=>p(Wp,pe)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],40,Ud)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"]),!h.value||!h.value.length?(t.openBlock(),t.createElementBlock("div",zd,[t.renderSlot($.$slots,"tree-empty",{},()=>[t.createVNode(Tt)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",qd,[t.renderSlot($.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:x},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(E.value,pe=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(pe.widget),{key:pe.wid,wid:pe.wid,widget:pe,editor:t.unref(c)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Qd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.value,pe=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:pe.name},[pe.visible!=!1?(t.openBlock(),t.createBlock(ee,{key:0,widget:pe,editor:t.unref(c),disabled:!u.value,ctx:{formData:u.value},onClick:L},null,8,["widget","editor","disabled","ctx"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(c)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(c)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-3ad1630b"]]),Wd={class:"left-list"},Kd=["onMouseover","onClick"],Yd={class:"index"},Hd={class:"label"},Gd={key:0,class:"node-opts"},Jd={key:2,class:"left-empty"},Xd={class:"form-warp"},Zd={class:"form-btns"},Kl=oe(t.defineComponent({__name:"left",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick","select"],setup(a,{expose:e,emit:n}){q.useDialog();const i=t.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-left"};function s(){if(l.fields?.length){const j={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[j]}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([]),h=t.ref({}),f=t.ref(null),u=t.ref(null),m=t.ref(0),g=t.computed(()=>{const j={searchEnable:!0,disabled:!1,idField:"id",labelField:"title",iconField:"iconName",badgeDot:"badgeDot",badgeCount:"badgeCount",...l.setting?.model||{}};return r.define.value?.configs?.model||j}),w=t.computed(()=>g.value.searchEnable),v=t.computed(()=>{const j=r.define.value?.configs?.opts;if(typeof j=="boolean"&&j==!1)return!1;const I=(j||[]).map(Y=>typeof Y=="string"?{name:Y,visible:!1}:Y),Z=[];return I.forEach(Y=>{Z.push(Y.name)}),console.log("opts addBtn",I),I.filter(Y=>Y.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),y=t.computed(()=>{const j=r.define.value?.configs?.opts;if(typeof j=="boolean"&&j==!1)return[];const I=(j||[]).map(ie=>typeof ie=="string"?{name:ie,visible:!1}:ie),Z=[],Y=[];return I.forEach(ie=>{Y.push(ie.name),ie.name!="add"&&Z.push(ie)}),Y.includes("delete")||Z.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),console.log("opts menuBtn",Z),Z});function A(j,I){const{btn:Z,event:Y}=j;f.value&&(Y.stopPropagation(),V(Y,I),Z.name=="delete"&&D(f.value),E("btnClick",{...j,node:f.value}))}function V(j,I){f.value=I,r.dataManager().primary().setValue(f.value),E("select",{node:f.value,event:j})}const k=t.computed(()=>{if(l.storage?.orderBy){const j=l.storage.orderBy.split(" ");return[{name:j[0],asc:j[1].toLowerCase()=="asc"}]}return[]});t.watch(()=>l.params,()=>{c.value&&(d.value=[],f.value=null,m.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),N())}),t.watch(()=>f.value,()=>{console.log("active node changed",f.value),S(!f.value)});const p=t.ref(null);t.watch(p,()=>{p.value&&f.value&&r.dataManager().primary().setValue(f.value)});function S(j=!0){const I=r.dataManager().form();for(let Z in I)I[Z].setDisabled(j)}function _(j){b.value.preCreate&&b.value.preCreate()==!1||(f.value={},f.value[g.value.labelField]="新建...",m.value=m.value+1,b.value.createNode&&b.value.createNode(f.value,null,r.dataManager().params()),r.dataManager().primary().setValue(f.value),E("btnClick",j))}const C=t.ref(""),x=pt(()=>{N()},400);function N(){return h.value={},new Promise((j,I)=>{const Z={};r.dataManager().primary().find({page:1,pageSize:999,body:Z,keywords:C.value||"",sorts:k.value}).then(Y=>{d.value=Y.body||[],d.value.forEach(ie=>{h.value[ie[g.value.idField]]=ie}),j(Y.body)})})}const R=t.computed(()=>r.$widgetList.value||[]),b=t.computed(()=>{const j={...r.define.value?.configs?.event||{}};for(const I in j)j[I]&&typeof j[I]!="function"&&j[I].enable&&j[I].scriptText&&(I=="createNode"&&(j[I]=new Function("node","parent","params",j[I].scriptText)),I=="preCreate"?j[I]=new Function("parent",j[I].scriptText):j[I]=new Function("data","event",j[I].scriptText));return j}),B=t.computed(()=>r.define.value?.configs?.setting||l.setting||{});t.provide("pageSetting",B.value);const F=t.computed(()=>{const j=r.define.value?.configs?.btns;if(typeof j=="boolean"&&j==!1)return[];const I=(r.define.value?.configs?.btns||[]).map(Y=>typeof Y=="string"?{name:Y,visible:!1}:{size:"default",...Y}),Z=I.map(Y=>Y.name);if(!Z.includes("save")){const Y={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};I.splice(Y.index,0,Y)}if(!Z.includes("reset")){const Y={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};I.splice(Y.index,0,Y)}if(!Z.includes("back")){const Y={title:"返回",type:"default",index:I.length,visible:!0,size:"default",name:"back"};I.splice(Y.index,0,Y)}return r.model.value=="view"&&I.filter(Y=>["save","submit","reset"].includes(Y.name)).forEach(Y=>{Y.visible=!1}),I}),E=n;function M(j){const{btn:I,event:Z}=j;I.name=="save"&&P({btn:I,event:Z}),I.name=="reset",I.name=="back"&&W(),E("btnClick",j)}async function P(j){const I=r.dataManager().form();let Z={...f.value};for(let Y in I){const ie=await I[Y].validate();if(r.dataManager().psn()==Y)for(let $ in ie)Z[$]=ie[$];else Z[Y]=ie}Z[g.value.idField]&&(Z[g.value.idField]+"").startsWith("new_")&&delete Z[g.value.idField],b.value.preSave&&b.value.preSave(Z,j),console.log("=======form data=====",Z),r.dataManager().primary().save({data:Z}).then(Y=>{console.log("save result:",Y),f.value[g.value.idField]=Y.body,Z[g.value.idField]=Y.body,b.value.postSaved&&b.value.postSaved(Z,j)})}function T(){}function W(){i.back()}function L(){return r.dataManager().primary()}function O(j){h.value[j[g.value.idField]]={...h.value[j[g.value.idField]],...j}}function te(j){return h.value[j]}function D(j){b.value.preDelete&&b.value.preDelete(j)==!1||(j[g.value.idField]&&(j[g.value.idField]+"").startsWith("new_")?(d.value=d.value.filter(I=>I[g.value.idField]!=j[g.value.idField]),delete h.value[j[g.value.idField]]):r.dataManager().primary().deleteByIds([j[g.value.idField]]).then(()=>{d.value=d.value.filter(I=>I[g.value.idField]!=j[g.value.idField]),delete h.value[j[g.value.idField]]}))}function K(){d.value=[],h.value={},f.value=null,u.value=null,m.value=0,N().then(j=>{if(j&&j[0]&&g.value.selectable&&g.value.autoselect){const I={...j[0],dataRef:j[0]};E("select",{node:I})}})}const ue=t.ref("new_");return t.onMounted(()=>{const j=t.inject("route");console.log("unione page tree route",j),ue.value=l.psn||j?.query?.psn||j?.meta?.psn||"new_",console.log("unione page tree,psn:"+ue.value),r.setModel(j?.query?.model||j?.meta?.model||"run");const I={...l.params||{},...j?.query||{},...j?.params||{}};r.dataManager().params(I),s(),r.load(ue.value,o),t.nextTick(()=>{S(!0)}),N().then(Z=>{if(Z&&Z[0]&&g.value.selectable&&g.value.autoselect){const Y={...Z[0],dataRef:Z[0]};E("select",{node:Y})}}),c.value=!0}),e({storage:L,save:P,toBack:W,toReset:T,setNode:O,getNode:te,delNode:D,reload:K}),(j,I)=>{const Z=t.resolveComponent("SearchOutlined"),Y=t.resolveComponent("a-input"),ie=t.resolveComponent("unione-btn"),$=t.resolveComponent("a-badge"),U=t.resolveComponent("a-empty");return t.openBlock(),t.createBlock(vt,{class:"unione-page-left","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",{class:"left-warp",onContextmenu:I[2]||(I[2]=t.withModifiers(()=>{},["prevent"]))},[t.renderSlot(j.$slots,"left-top",{},void 0,!0),w.value?(t.openBlock(),t.createBlock(Y,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:C.value,"onUpdate:value":I[0]||(I[0]=z=>C.value=z),onChange:t.unref(x),onPressEnter:t.unref(x)},{suffix:t.withCtx(()=>[t.createVNode(Z)]),_:1},8,["value","onChange","onPressEnter"])):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(ie,{key:1,widget:v.value,onClick:_},null,8,["widget"])):t.createCommentVNode("",!0),t.createElementVNode("div",Wd,[t.renderSlot(j.$slots,"left-list",{},()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(z,G)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-item",(f.value&&f.value[g.value.idField]==z[g.value.idField]||u.value&&u.value[g.value.idField]==z[g.value.idField])&&"active"]),key:z[g.value.idField],onMouseover:()=>u.value=z,onMouseleave:I[1]||(I[1]=()=>u.value=null),onClick:ee=>V(ee,z)},[t.createElementVNode("span",Yd,t.toDisplayString(G+1)+"、",1),t.createVNode($,{dot:z[g.value.badgeDot],count:z[g.value.badgeCount]},{default:t.withCtx(()=>[t.createElementVNode("span",Hd,t.toDisplayString(z[g.value.labelField]),1)]),_:2},1032,["dot","count"]),f.value&&f.value[g.value.idField]==z[g.value.idField]||u.value&&u.value[g.value.idField]==z[g.value.idField]?(t.openBlock(),t.createElementBlock("div",Gd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.value,ee=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[!b.value.btnVisible||b.value.btnVisible(ee,z)?(t.openBlock(),t.createBlock(ie,{key:ee.name,widget:ee,ctx:{node:z},onClick:ke=>A(ke,z)},null,8,["widget","ctx","onClick"])):t.createCommentVNode("",!0)],64))),256))])):t.createCommentVNode("",!0)],42,Kd))),128))],!0)]),!d.value||!d.value.length?(t.openBlock(),t.createElementBlock("div",Jd,[t.renderSlot(j.$slots,"left-empty",{},()=>[t.createVNode(U)],!0)])):t.createCommentVNode("",!0)],32),t.createElementVNode("div",Xd,[t.renderSlot(j.$slots,"form-warp",{},()=>[t.createElementVNode("div",{ref_key:"formWarp",ref:p},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,z=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(z.widget),{key:z.wid,wid:z.wid,widget:z,editor:t.unref(r)},null,8,["wid","widget","editor"]))),128)),t.createElementVNode("div",Zd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(F.value,z=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:z.name},[z.visible!=!1?(t.openBlock(),t.createBlock(ie,{key:0,widget:z,editor:t.unref(r),disabled:!f.value,ctx:{formData:f.value},onClick:M},null,8,["widget","editor","disabled","ctx"])):t.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-127f0c13"]]),Yl=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:n}){const i=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(i.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=i.fields.filter(V=>V.isQuery),o.configs.widgets[0].btns=i.queryBtns||[],o.configs.widgets[0].params=i.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const A=i.fields.filter(V=>V.isPk)[0];A&&A.name&&(o.configs.widgets[1].dataKey=A.name),o.configs.widgets[1].columns=i.fields.filter(V=>V.hidden!=!0),o.configs.widgets[1].operation=i.operation,i.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=i.leftBtns==!1?!1:i.leftBtns||[],o.configs.widgets[1].rightBtns=i.rightBtns==!1?!1:i.rightBtns||[],r.dataManager().use("primary","list").store(i.storage)}}const r=new lt,c=t.computed(()=>r.$widgetList.value||[]),d=n;function h(A){d("btnClick",A)}const f=t.ref("new_");t.onMounted(()=>{const A=t.inject("route");console.log("unione page view route",A),f.value=i.psn||A?.query?.psn||A?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),r.setModel(A?.query?.model||A?.meta?.model||"run");const V={...i.params||{},...A?.query||{},...A?.params||{}};r.dataManager().params(V),s(),r.load(f.value,o)});function u(){return r.dataManager().use("primary","list")}function m(A){A?r.ebus.$emit("table-list-search",A):r.ebus.$emit("table-list-reload")}function g(A){r.dataManager().params(A),r.ebus.$emit("query-form-params",A),r.ebus.$emit("table-list-search",{params:A})}function w(){return l.value?l.value[0]:null}function v(){return l.value?l.value[0].getSelected():null}function y(){l.value&&l.value[0].clearSelected()}return e({storage:u,editor:r,reload:m,setParams:g,getTable:w,getSelected:v,clearSelected:y}),(A,V)=>(t.openBlock(),t.createBlock(vt,{class:"unione-page-list","setting-title":"页面设置",editor:t.unref(r)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.wid},[k.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:t.unref(r),onBtnClick:h},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[t.unref(r)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),Hl=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:n}){const i=q.useDialog(),l=q.useSession(),o=new Ke({types:"dict",dictName:"FLOWLITETASKSTATUS"}),s=a,r=t.ref(null),c=t.ref(null),d=t.ref(null),h={sn:"new_",title:"我的待办",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"primary",primary:!0,fields:[{title:"接收时间",name:"time",widget:"a-range-picker",props:{showTime:!0,format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss",placeholder:["开始时间","结束时间"]}}]},{widget:"unione-table",dsn:"primary",columns:[{title:"流程类别",name:"instance.category",convert:{types:"dict",dictName:"FLOWLITECATEGORY"}},{title:"流程名称",name:"instance.title"},{title:"提交人",name:"instance.commitUserName"},{title:"提交时间",name:"instance.commitTime"},{title:"节点名称",name:"title"},{title:"接收时间",name:"created"},{title:"处理状态",name:"handleStatus",customCell:(x,N,R)=>{o.convert(x.status).then(b=>{const B=[];b&&B.push(b),x.handleUserId&&B.push("已签收"),B.length>0&&(x[R.dataIndex]=B.join("/"))})}}],leftBtns:["delBatch","add",{title:"批量审核",name:"auditBatch",type:"primary",props:{danger:!0}},{title:"批量签收",name:"signBatch",type:"primary"},{title:"批量放弃",name:"waiveBatch",type:"primary"}],rightBtns:["impData","downTmpl"],operation:{title:"操作",width:250,btns:["edit","delete",{title:"签收",name:"sign",event:{visible:x=>!x.row.handleUserId}},{title:"放弃",name:"waive",props:{danger:!0},event:{visible:x=>!!x.row.handleUserId}},{title:"意见",name:"opinion"},{title:"审核",name:"audit",type:"primary"}],count:4,more:{layout:"vertical"}}}],dsnList:["primary"]},component:"unione-flow-todo"};function f(){q.axios.flow({url:`/api/engine/profile/${s.flowKey}${s.flowVers?"/"+s.flowVers:""}`,method:"post"}).then(x=>{if(console.log("loaded flow tmpl info",x),x.success){const N=x.body.busiField;N&&N.forEach(R=>{R.visible!=!1&&(R.index!=null&&R.index!=null?h.configs.widgets[1].columns.splice(R.index,0,{title:R.title,name:"instance.busiData."+R.name}):h.configs.widgets[1].columns.push({title:R.title,name:"instance.busiData."+R.name}))}),l.setStorage("page-define-flow-todo:"+s.flowKey,JSON.stringify(h.configs)),u.load(A.value,h)}})}const u=new lt,m=t.computed(()=>u.$widgetList.value||[]),g=n;function w(x){const{btn:N,row:R,keys:b}=x;if(N.name=="audit"&&c.value.open(R?R.id:b,{flowKey:R?.instance?.sn,nodeKey:R?.sn,nodeTitle:R?.title}),N.name=="auditBatch"&&c.value.open(b,{nodeTitle:"批量审核"}),N.name=="sign"&&v(R.id),N.name=="signBatch"){if(b.length==0){i.warning("请选择要签收的任务");return}v(b)}if(N.name=="waive"&&y(R.id),N.name=="waiveBatch"){if(b.length==0){i.warning("请选择要放弃的任务");return}y(b)}N.name=="opinion"&&d.value.open({busiKey:R.instance.busiKey}),g("btnClick",x)}function v(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,i.confirm({content:"确定签收吗?",onOk:()=>{q.axios.flow({url:"/api/engine/task/sign",method:"post",data:N}).then(R=>{R.success?(i.success("签收成功"),k()):i.error(R.msg)})}})}function y(x){const N={};Array.isArray(x)?N.taskIds=x:N.taskId=x,i.confirm({content:"确定签收吗?",onOk:()=>{q.axios.flow({url:"/api/engine/task/waive",method:"post",data:N}).then(R=>{R.success?(i.success("操作成功"),k()):i.error(R.msg)})}})}const A=t.ref("new_");t.onMounted(()=>{const x=t.inject("route");console.log("unione flow todo route",x),A.value=s.psn||x?.query?.psn||x?.meta?.psn||"new_",console.log("unione flow todo psn:"+A.value),u.setModel(x?.query?.model||x?.meta?.model||"run");const N={...s.params||{},...x?.query||{},...x?.params||{}};u.dataManager().params(N),s.leftBtns&&Array.isArray(s.leftBtns)&&(h.configs.widgets[1].leftBtns=[...h.configs.widgets[1].leftBtns,...s.leftBtns]),s.rightBtns&&Array.isArray(s.rightBtns)&&(h.configs.widgets[1].rightBtns=[...h.configs.widgets[1].rightBtns,...s.rightBtns]),s.operation&&typeof s.operation=="object"&&(h.configs.widgets[1].operation={...h.configs.widgets[1].operation,...s.operation}),u.dataManager().use("primary","list").store({ctx:"flow",controller:"/api/engine/task",findUrl:"/todo",findParams:[{name:"flowSn",value:s.flowKey}]}),s.flowKey?f():u.load(A.value,h)});function V(){return u.dataManager().use("primary","list")}function k(x){C(),x?u.ebus.$emit("table-list-search",x):u.ebus.$emit("table-list-reload")}function p(x){u.dataManager().params(x),u.ebus.$emit("query-form-params",x),u.ebus.$emit("table-list-search",{params:x})}function S(){return r.value?r.value[0]:null}function _(){return r.value?r.value[0].getSelected():null}function C(){r.value&&r.value[0].clearSelected(!0)}return e({storage:V,editor:u,reload:k,setParams:p,getTable:S,getSelected:_,clearSelected:C}),(x,N)=>{const R=t.resolveComponent("UnioneFlowAudit"),b=t.resolveComponent("UnioneFlowOpinion");return t.openBlock(),t.createBlock(vt,{class:"unione-flow-todo","setting-title":"页面设置",editor:t.unref(u)},t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,B=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:B.wid},[B.widget=="unione-table"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:0,wid:B.wid,widget:B,editor:t.unref(u),onBtnClick:w,ref_for:!0,ref_key:"table",ref:r},null,40,["wid","widget","editor"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(B.widget),{key:1,wid:B.wid,widget:B,editor:t.unref(u),onBtnClick:w},null,40,["wid","widget","editor"]))],64))),128)),t.createVNode(R,{ref_key:"audit",ref:c,onSuccess:N[0]||(N[0]=B=>k())},null,512),t.createVNode(b,{ref_key:"opinion",ref:d},null,512)]),_:2},[t.unref(u)?{name:"page-setting",fn:t.withCtx(()=>[t.createVNode(Ct,{editor:t.unref(u)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),eh={class:"handel-opinion"},th={key:0,class:"preset-opinions"},nh={class:"ok"},ih={class:"reject"},lh=t.defineComponent({name:"FlowAudit",__name:"audit",props:{vars:{type:Object,required:!1}},emits:["success"],setup(a,{expose:e,emit:n}){const i=q.useDialog(),l=a,o=n,s=t.ref("审核"),r=t.ref(!1),c=t.ref(),d=t.ref({flowKey:"",nodeKey:""}),h=t.ref([]),f=t.ref(),u=t.ref({data:{handelOpinion:""},rules:{handelOpinion:[{required:!0,message:"请输入处理意见"}]}});function m(){r.value=!1}function g(A,{flowKey:V,nodeKey:k,nodeTitle:p}={}){if(c.value=A,s.value=p||"审核",!A){i.error("任务id不能为空");return}r.value=!0,d.value.flowKey=V,d.value.nodeKey=k,u.value.data.handelOpinion="",w()}function w(){const{flowKey:A,nodeKey:V}=d.value;q.axios.flow({url:`/api/engine/opinion/preset/${A||"-1"}/${V||"-1"}`,method:"post"}).then(k=>{h.value=k.body})}function v(A){u.value.data.handelOpinion=A.optxt}function y(A){const V=s.value;f.value.validate().then(()=>{i.confirm({content:`确定提交${V},并${A?"同意":"拒绝"}该申请么?`,onOk:()=>{const k={result:A,opinion:u.value.data.handelOpinion,vars:l.vars};Array.isArray(c.value)?k.taskIds=c.value:k.taskId=c.value,q.axios.flow({url:"/api/engine/task/submit",method:"post",data:k}).then(p=>{p.success?(i.success(`提交${V}成功`),m(),o("success")):i.error(p.msg)})}})})}return e({open:g}),(A,V)=>{const k=t.resolveComponent("a-textarea"),p=t.resolveComponent("a-form-item"),S=t.resolveComponent("a-tag"),_=t.resolveComponent("a-form"),C=t.resolveComponent("a-button"),x=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(x,{title:s.value,visible:r.value,"onUpdate:visible":V[3]||(V[3]=N=>r.value=N),width:600,rootClassName:"flow-audit-drawer"},{footer:t.withCtx(()=>[t.createVNode(C,{type:"primary",onClick:V[1]||(V[1]=N=>y(!0))},{default:t.withCtx(()=>V[4]||(V[4]=[t.createTextVNode("同意")])),_:1}),t.createVNode(C,{type:"primary",danger:"",onClick:V[2]||(V[2]=N=>y(!1))},{default:t.withCtx(()=>V[5]||(V[5]=[t.createTextVNode("拒绝")])),_:1})]),default:t.withCtx(()=>[t.createVNode(_,{layout:"vertical",model:u.value.data,rules:u.value.rules,ref_key:"formRef",ref:f},{default:t.withCtx(()=>[t.createElementVNode("div",eh,[t.createVNode(p,{label:"处理意见:",name:"handelOpinion"},{default:t.withCtx(()=>[t.createVNode(k,{value:u.value.data.handelOpinion,"onUpdate:value":V[0]||(V[0]=N=>u.value.data.handelOpinion=N),autoSize:"",rows:10,placeholder:"请输入处理意见"},null,8,["value"])]),_:1})]),h.value&&h.value.length?(t.openBlock(),t.createElementBlock("div",th,[t.createVNode(p,{label:"预设意见:"},{default:t.withCtx(()=>[t.createElementVNode("div",nh,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==1),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"success",onClick:R=>v(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))]),t.createElementVNode("div",ih,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.value.filter(N=>N.types==2),N=>(t.openBlock(),t.createBlock(S,{key:N.id,color:"orange",onClick:R=>v(N)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.title),1)]),_:2},1032,["onClick"]))),128))])]),_:1})])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])]),_:1},8,["title","visible"])}}}),oh={key:0,class:"flow-options"},sh={class:"flow-task"},ah={class:"node"},rh={class:"user"},ch={class:"time"},dh={class:"content"},hh={key:1,class:"flow-options"},fh={class:"flow-task"},uh={class:"user"},ph={class:"time"},mh={class:"content"},gh={key:0,class:"flow-title"},bh={class:"flow-task"},kh={class:"node"},yh={class:"user"},wh={class:"time"},Ah={class:"content"},xh=t.defineComponent({name:"FlowOpinion",__name:"opinion",props:t.mergeModels({busiKey:{type:String,required:!1},flowId:{type:String,required:!1},taskId:{type:String,required:!1}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a,{expose:e}){const n=a,i=t.ref(!0),l=t.ref([]),o=t.ref({}),s=t.ref([]),r=t.useModel(a,"visible"),c=t.ref({busiKey:"",flowId:"",taskId:""}),d=t.computed(()=>({busiKey:c.value.busiKey||n.busiKey,flowId:c.value.flowId||n.flowId,taskId:c.value.taskId||n.taskId}));function h(){r.value=!1}function f({busiKey:m,flowId:g,taskId:w}={}){c.value.busiKey=m,c.value.flowId=g,c.value.taskId=w,r.value=!0,i.value=!0,u()}function u(){if(l.value=[],o.value={},s.value=[],!d.value.busiKey&&!d.value.flowId&&!d.value.taskId)return;let m="",g="";d.value.busiKey?(m="/api/engine/opinion/busiKey/"+d.value.busiKey,g="busiKey"):d.value.flowId?(m="/api/engine/opinion/flow/"+d.value.flowId,g="flow"):d.value.taskId&&(m="/api/engine/opinion/task/"+d.value.taskId,g="task"),q.axios.flow({url:m,method:"post"}).then(w=>{if(w.success)if(g=="busiKey"){s.value=w.body;for(let v=0;v<s.value.length&&i.value;v++)if(s.value[v].tasks?.length){for(let y=0;y<s.value[v].tasks.length;y++)if(s.value[v].tasks[y].opinions?.length){i.value=!1;break}}}else if(g=="flow"){if(l.value=w.body,l.value?.length){for(let v=0;v<l.value.length;v++)if(l.value[v].opinions?.length){i.value=!1;break}}}else g=="task"&&(o.value=w.body,o.value.opinions?.length&&(i.value=!1))})}return t.watch(n,()=>{u()}),t.onMounted(()=>{u()}),e({open:f,close:h}),(m,g)=>{const w=t.resolveComponent("a-timeline-item"),v=t.resolveComponent("a-timeline"),y=t.resolveComponent("a-empty"),A=t.resolveComponent("a-button"),V=t.resolveComponent("a-drawer");return t.openBlock(),t.createBlock(V,{title:"处理意见",visible:r.value,"onUpdate:visible":g[0]||(g[0]=k=>r.value=k),width:600,rootClassName:"flow-opinion-drawer"},{footer:t.withCtx(()=>[t.createVNode(A,{onClick:h,class:"btn-close"},{default:t.withCtx(()=>g[1]||(g[1]=[t.createTextVNode("关闭")])),_:1})]),default:t.withCtx(()=>[l.value?.length?(t.openBlock(),t.createElementBlock("div",oh,[t.createElementVNode("div",sh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,k=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:k.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.opinions,p=>(t.openBlock(),t.createBlock(w,{key:p.id},{default:t.withCtx(()=>[t.createElementVNode("div",ah,"节点:"+t.toDisplayString(k.title),1),t.createElementVNode("div",rh,"处理人:"+t.toDisplayString(p.userName),1),t.createElementVNode("div",ch,"处理时间:"+t.toDisplayString(p.handleTime),1),t.createElementVNode("div",dh,"处理意见:"+t.toDisplayString(p.optxt),1)]),_:2},1024))),128))],64))),128))]),_:1})])])):t.createCommentVNode("",!0),o.value?.id?(t.openBlock(),t.createElementBlock("div",hh,[t.createElementVNode("div",fh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value.opinions,k=>(t.openBlock(),t.createBlock(w,{key:k.id},{default:t.withCtx(()=>[t.createElementVNode("div",uh,"处理人:"+t.toDisplayString(k.userName),1),t.createElementVNode("div",ph,"处理时间:"+t.toDisplayString(k.handleTime),1),t.createElementVNode("div",mh,"处理意见:"+t.toDisplayString(k.optxt),1)]),_:2},1024))),128))]),_:1})])])):t.createCommentVNode("",!0),s.value?.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:2},t.renderList(s.value,k=>(t.openBlock(),t.createElementBlock("div",{class:"flow-options",key:k.id},[s.value.length>1?(t.openBlock(),t.createElementBlock("div",gh,t.toDisplayString(k.title)+",提交时间:"+t.toDisplayString(k.commitTime)+t.toDisplayString(k.completeTime?",完成时间:"+k.completeTime:""),1)):t.createCommentVNode("",!0),t.createElementVNode("div",bh,[t.createVNode(v,null,{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.tasks,p=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:p.id},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.opinions,S=>(t.openBlock(),t.createBlock(w,{key:S.id},{default:t.withCtx(()=>[t.createElementVNode("div",kh,"节点:"+t.toDisplayString(p.title),1),t.createElementVNode("div",yh,"处理人:"+t.toDisplayString(S.userName),1),t.createElementVNode("div",wh,"处理时间:"+t.toDisplayString(S.handleTime),1),t.createElementVNode("div",Ah,"处理意见:"+t.toDisplayString(S.optxt),1)]),_:2},1024))),128))],64))),128))]),_:2},1024)])]))),128)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createBlock(y,{key:3})):t.createCommentVNode("",!0)]),_:1},8,["visible"])}}}),St={release(a){return q.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return q.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return q.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return q.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return q.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return q.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return q.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},vh={class:"unione-page unione-list-page data-define-list"},Ch=oe(t.defineComponent({__name:"list",setup(a){const e=$e(),n=q.useDialog(),i=t.inject("router"),l=t.ref({fields:[{title:"状态",name:"status",control:"unione-select-box",convert:{types:"dict",dictName:"PUBLISHSTATUS"}},{title:"类别",name:"category",control:"unione-select-box",convert:{types:"dict",dictName:"DATACATEGORY"}}]}),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",convert:{types:"dict",dictName:"PUBLISHSTATUS"}}],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,St.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(k=>{s.value.data=k.body,s.value.pagination.total=k.total*1}).finally(()=>{s.value.loading=!1})}function c(k){s.value.pagination.current=k.pagination.current,s.value.pagination.pageSize=k.pagination.pageSize,r()}function d({params:k,keywords:p}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=p,r()}function h({btn:k,event:p,row:S}){console.log("table btn click",k,p,S),(k.name=="add"||k.name=="edit")&&i.push({path:"/dev/data/define/edit",query:S?{id:S.id}:{}}),k.name=="impFromDb"&&(u.value=!0),k.name=="release"&&f(S),k.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(k){n.confirm({content:"确定要发布当前数据么?",onOk:()=>{St.release([k.id]).then(p=>{p.success?(n.success({title:"发布成功",content:p.body}),r()):n.error({title:"发布失败",content:p.body})})}})}const u=t.ref(!1),m=t.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),g=t.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),w=t.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function v(k){!k||!Object.keys(k).length||!k.dsId||(se.message.loading("数据加载中..."),w.value.params=k,w.value.loading=!0,St.loadFromDb(k).then(p=>{w.value.loading=!1,se.message.destroy(),p.success?(p.body.forEach(S=>{S.checkable=!!S.id}),w.value.data=p.body,w.value.pagination.total=p.body.length):se.message.error(p.message)}))}function y(k){w.value.pagination.current=k.pagination.current,w.value.pagination.pageSize=k.pagination.pageSize}const A=t.ref();function V({btn:k}){if(k.name!="imp")return;const p=A.value.getSelected();p?.keys?.length?n.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{se.message.loading("数据导入中..."),St.impFromDb({dsId:w.value.params.dsId,tables:p.keys.join()}).then(S=>{se.message.destroy(),S.success?(n.success({content:S.message}),s.value.pagination.current=1,r()):n.error({context:S.message})})}}):n.error({content:"请选择目标记录!"})}return(k,p)=>{const S=t.resolveComponent("UnioneQuery"),_=t.resolveComponent("UnioneTable"),C=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",vh,[t.createVNode(S,{widget:l.value,onQuery:d,onReset:d},null,8,["widget"]),t.createVNode(_,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),t.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=x=>u.value=x),placement:"left"},{default:t.withCtx(()=>[t.createVNode(S,{widget:m.value,onQuery:v,onReset:v,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),t.createVNode(_,{widget:g.value,dataList:w.value.data,loading:w.value.loading,pagination:w.value.pagination,onChange:y,rowKey:"name",ref_key:"loadTableObj",ref:A},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-f4684c55"]]),Sh={class:"unione-props-setting data-field-manage"},Bh={key:0},Nh={key:1},Vh=["onClick"],Rh=["onClick"],Eh=["onClick"],Oh={key:1},_h=oe(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"}]),n=t.useModel(a,"modelValue"),i=t.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(g=>{i.value.selectedRowKeys.includes(g)||i.value.selectedRowKeys.push(g);const w=[];n.value.forEach(v=>{!m.includes(v.name)&&i.value.selectedRowKeys.includes(v.name)&&w.push(v.name)}),w.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(v=>!w.includes(v)))})}}),l={mounted:m=>m.focus()},o=t.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let g in m){const w=n.value.filter(v=>v.name==g);if(w&&w[0]){let v=o.value[g];Object.keys(v).forEach(y=>{w[0][y]=v[y]})}}o.value={}}function r(m,g){s();const w={};w[g]=m[g]||"",o.value[m.name]=w}function c(m,g){if(!m||!g){o.value={};return}const w=o.value[m.name][g];if(g=="name"&&n.value.filter(y=>y[g]==w&&y.name!=m.name).length>0){se.Modal.warn({title:"提示信息",content:"字段名称["+w+"]已存在"});return}m[g]=w,o.value={}}function d(m,g){const w=n.value.filter(v=>v.name==m.name)[0];return g=="isFk"?w.configs?.fkey?.enable:w[g]==1}function h(m,g){const w=n.value.filter(v=>v.name==m.name)[0];g=="isFk"?(w.configs||(w.configs={}),w.configs.fkey||(w.configs.fkey={}),w.configs.fkey.enable=!w.configs.fkey.enable):w[g]!=1?w[g]=1:w[g]=0}function f(){if(s(),n.value.filter(w=>w.name=="new_").length>0){o.value.new_={name:"new_"};return}const g={title:"",name:"new_",dataType:"String",isPk:0};n.value.push(g),o.value[g.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){se.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}se.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{n.value=n.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,g)=>{const w=t.resolveComponent("a-button"),v=t.resolveComponent("a-tooltip"),y=t.resolveComponent("a-input"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-select-option"),k=t.resolveComponent("a-select"),p=t.resolveComponent("a-checkbox"),S=t.resolveComponent("a-table");return t.openBlock(),t.createElementBlock("div",Sh,[t.createVNode(w,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:t.withCtx(()=>g[1]||(g[1]=[t.createTextVNode("新增")])),_:1}),t.createVNode(w,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:t.withCtx(()=>g[2]||(g[2]=[t.createTextVNode(" 删除 ")])),_:1}),t.createVNode(S,{columns:e.value,"data-source":n.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:t.withCtx(({column:_})=>[["name","title"].includes(_.key)?(t.openBlock(),t.createElementBlock("span",Bh,[g[3]||(g[3]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(_.title),1)])):t.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(_.key)?(t.openBlock(),t.createElementBlock("span",Nh,[t.createVNode(t.unref(it.FormOutlined)),t.createTextVNode(" "+t.toDisplayString(_.title),1)])):t.createCommentVNode("",!0),_.key==="isPk"?(t.openBlock(),t.createBlock(v,{key:2,title:"至少配置一个主键字段"},{default:t.withCtx(()=>[g[4]||(g[4]=t.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="isFk"?(t.openBlock(),t.createBlock(v,{key:3,title:"是否是外键字段"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="isNull"?(t.openBlock(),t.createBlock(v,{key:4,title:"是否允许为空"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0),_.key==="syncEnable"?(t.openBlock(),t.createBlock(v,{key:5,title:"是否同步到数据库"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(_.title),1)]),_:2},1024)):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:_,text:C,record:x})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(y,{key:0,value:o.value[x.name][_.dataIndex],"onUpdate:value":N=>o.value[x.name][_.dataIndex]=N,onBlur:N=>c(x,_.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,Vh)):t.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(A,{key:0,value:o.value[x.name][_.dataIndex],"onUpdate:value":N=>o.value[x.name][_.dataIndex]=N,onBlur:N=>c(x,_.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,Rh)):["dataType"].includes(_.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[x.name]||!Object.keys(o.value[x.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:N=>r(x,_.dataIndex)},[o.value[x.name]&&Object.keys(o.value[x.name]).includes(_.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(k,{key:0,value:x[_.dataIndex],"onUpdate:value":N=>x[_.dataIndex]=N,onBlur:g[0]||(g[0]=N=>c())},{default:t.withCtx(()=>[t.createVNode(V,{key:"String",value:"String"}),t.createVNode(V,{key:"Long",value:"Long"}),t.createVNode(V,{key:"Short",value:"Short"}),t.createVNode(V,{key:"Integer",value:"Integer"}),t.createVNode(V,{key:"Float",value:"Float"}),t.createVNode(V,{key:"Double",value:"Double"}),t.createVNode(V,{key:"Date",value:"Date"}),t.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(t.openBlock(),t.createElementBlock("span",Oh,t.toDisplayString(C),1))],10,Eh)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(t.openBlock(),t.createBlock(p,{key:3,checked:d(x,_.dataIndex),onClick:N=>h(x,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(t.openBlock(),t.createBlock(p,{key:4,checked:!d(x,_.dataIndex),onClick:N=>h(x,_.dataIndex)},null,8,["checked","onClick"])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Gl=1024;let Mh=0,gi=class{constructor(e,n){this.from=e,this.to=n}};class re{constructor(e={}){this.id=Mh++,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=Me.match(e)),n=>{let i=e(n);return i===void 0?null:[this,i]}}}re.closedBy=new re({deserialize:a=>a.split(" ")}),re.openedBy=new re({deserialize:a=>a.split(" ")}),re.group=new re({deserialize:a=>a.split(" ")}),re.isolate=new re({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),re.contextHash=new re({perNode:!0}),re.lookAhead=new re({perNode:!0}),re.mounted=new re({perNode:!0});class vn{constructor(e,n,i){this.tree=e,this.overlay=n,this.parser=i}static get(e){return e&&e.props&&e.props[re.mounted.id]}}const Fh=Object.create(null);class Me{constructor(e,n,i,l=0){this.name=e,this.props=n,this.id=i,this.flags=l}static define(e){let n=e.props&&e.props.length?Object.create(null):Fh,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Me(e.name||"",n,e.id,i);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");n[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 n=this.prop(re.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let i in e)for(let l of i.split(" "))n[l]=e[i];return i=>{for(let l=i.prop(re.group),o=-1;o<(l?l.length:0);o++){let s=n[o<0?i.name:l[o]];if(s)return s}}}}Me.none=new Me("",Object.create(null),0,8);class bi{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let i of this.types){let l=null;for(let o of e){let s=o(i);s&&(l||(l=Object.assign({},i.props)),l[s[0].id]=s[1])}n.push(l?new Me(i.name,l,i.id,i.flags):i)}return new bi(n)}}const Cn=new WeakMap,Jl=new WeakMap;var ve;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(ve||(ve={}));class we{constructor(e,n,i,l,o){if(this.type=e,this.children=n,this.positions=i,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=vn.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let i of this.children){let l=i.toString();l&&(n&&(n+=","),n+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new wi(this.topNode,e)}cursorAt(e,n=0,i=0){let l=Cn.get(this)||this.topNode,o=new wi(l);return o.moveTo(e,n),Cn.set(this,o._tree),o}get topNode(){return new Pe(this,0,0,null)}resolve(e,n=0){let i=tn(Cn.get(this)||this.topNode,e,n,!1);return Cn.set(this,i),i}resolveInner(e,n=0){let i=tn(Jl.get(this)||this.topNode,e,n,!0);return Jl.set(this,i),i}resolveStack(e,n=0){return Dh(this,e,n)}iterate(e){let{enter:n,leave:i,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&ve.IncludeAnonymous)>0;for(let c=this.cursor(s|ve.IncludeAnonymous);;){let d=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&i&&(r||!c.type.isAnonymous)&&i(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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:xi(Me.none,this.children,this.positions,0,this.children.length,0,this.length,(n,i,l)=>new we(this.type,n,i,l,this.propValues),e.makeTree||((n,i,l)=>new we(Me.none,n,i,l)))}static build(e){return $h(e)}}we.empty=new we(Me.none,[],[],0);class ki{constructor(e,n){this.buffer=e,this.index=n}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 ki(this.buffer,this.index)}}class mt{constructor(e,n,i){this.buffer=e,this.length=n,this.set=i}get type(){return Me.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],i=this.buffer[e+3],l=this.set.types[n],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,i==e)return o;let s=[];for(;e<i;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,i,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=n&&!(Xl(o,l,s[c+1],s[c+2])&&(r=c,i>0));c=s[c+3]);return r}slice(e,n,i){let l=this.buffer,o=new Uint16Array(n-e),s=0;for(let r=e,c=0;r<n;){o[c++]=l[r++],o[c++]=l[r++]-i;let d=o[c++]=l[r++]-i;o[c++]=l[r++]-e,s=Math.max(s,d)}return new mt(o,s,this.set)}}function Xl(a,e,n,i){switch(a){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function tn(a,e,n,i){for(var l;a.from==a.to||(n<1?a.from>=e:a.from>e)||(n>-1?a.to<=e:a.to<e);){let s=!i&&a instanceof Pe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=i?0:ve.IgnoreOverlays;if(i)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Pe&&s.index<0&&((l=r.enter(e,n,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,n,o);if(!s)return a;a=s}}class Zl{cursor(e=0){return new wi(this,e)}getChild(e,n=null,i=null){let l=eo(this,e,n,i);return l.length?l[0]:null}getChildren(e,n=null,i=null){return eo(this,e,n,i)}resolve(e,n=0){return tn(this,e,n,!1)}resolveInner(e,n=0){return tn(this,e,n,!0)}matchContext(e){return yi(this,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),i=this;for(;n;){let l=n.lastChild;if(!l||l.to!=n.to)break;l.type.isError&&l.from==l.to?(i=n,n=l.prevSibling):n=l}return i}get node(){return this}get next(){return this.parent}}class Pe extends Zl{constructor(e,n,i,l){super(),this._tree=e,this.from=n,this.index=i,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,n,i,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,d=n>0?r.length:-1;e!=d;e+=n){let h=r[e],f=c[e]+s.from;if(Xl(l,i,f,f+h.length)){if(h instanceof mt){if(o&ve.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,n,i-f,l);if(u>-1)return new gt(new Th(s,h,e,f),null,u)}else if(o&ve.IncludeAnonymous||!h.type.isAnonymous||Ai(h)){let u;if(!(o&ve.IgnoreMounts)&&(u=vn.get(h))&&!u.overlay)return new Pe(u.tree,f,e,s);let m=new Pe(h,f,e,s);return o&ve.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?h.children.length-1:0,n,i,l)}}}if(o&ve.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<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,n,i=0){let l;if(!(i&ve.IgnoreOverlays)&&(l=vn.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((n>0?s<=o:s<o)&&(n<0?r>=o:r>o))return new Pe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,i)}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 eo(a,e,n,i){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=l.type.is(n),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function yi(a,e,n=e.length-1){for(let i=a.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class Th{constructor(e,n,i,l){this.parent=e,this.buffer=n,this.index=i,this.start=l}}class gt 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,n,i){super(),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,n,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new gt(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,n,i=0){if(i&ve.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new gt(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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new gt(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new gt(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let s=i.buffer[this.index+1];e.push(i.slice(l,o,s)),n.push(0)}return new we(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function to(a){if(!a.length)return null;let e=0,n=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>n.from||s.to<n.to)&&(n=s,e=o)}let i=n instanceof Pe&&n.index<0?null:n.parent,l=a.slice();return i?l[e]=i:l.splice(e,1),new Ih(l,n)}class Ih{constructor(e,n){this.heads=e,this.node=n}get next(){return to(this.heads)}}function Dh(a,e,n){let i=a.resolveInner(e,n),l=null;for(let o=i instanceof Pe?i:i.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[i])).push(s.resolve(e,n)),o=s}else{let s=vn.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Pe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(tn(r,e,n,!1))}}return l?to(l):i}class wi{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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,n){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=n||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(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,n,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,n-this.buffer.start,i);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,n,i=this.mode){return this.buffer?i&ve.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ve.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ve.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:n}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(n.findChild(l,this.index,-1,0,4))}else{let l=n.buffer[this.index+3];if(l<(i<0?n.buffer.length:n.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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 n,i,{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:n,parent:i}=l)}else({index:n,_parent:i}=this._tree);for(;i;{index:n,_parent:i}=i)if(n>-1)for(let o=n+e,s=e<0?-1:i._tree.children.length;o!=s;o+=e){let r=i._tree.children[o];if(this.mode&ve.IncludeAnonymous||r instanceof mt||!r.type.isAnonymous||Ai(r))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,i=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;n=s,i=o+1;break e}l=this.stack[--o]}for(let l=i;l<this.stack.length;l++)n=new gt(this.buffer,n,this.stack[l]);return this.bufferNode=new gt(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&n&&n(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return yi(this.node,e);let{buffer:n}=this.buffer,{types:i}=n.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return yi(this.node,e,l);let s=i[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function Ai(a){return a.children.some(e=>e instanceof mt||!e.type.isAnonymous||Ai(e))}function $h(a){var e;let{buffer:n,nodeSet:i,maxBufferLength:l=Gl,reused:o=[],minRepeatType:s=i.types.length}=a,r=Array.isArray(n)?new ki(n,n.length):n,c=i.types,d=0,h=0;function f(p,S,_,C,x,N){let{id:R,start:b,end:B,size:F}=r,E=h;for(;F<0;)if(r.next(),F==-1){let L=o[R];_.push(L),C.push(b-p);return}else if(F==-3){d=R;return}else if(F==-4){h=R;return}else throw new RangeError(`Unrecognized record size: ${F}`);let M=c[R],P,T,W=b-p;if(B-b<=l&&(T=v(r.pos-S,x))){let L=new Uint16Array(T.size-T.skip),O=r.pos-T.size,te=L.length;for(;r.pos>O;)te=y(T.start,L,te);P=new mt(L,B-T.start,i),W=T.start-p}else{let L=r.pos-F;r.next();let O=[],te=[],D=R>=s?R:-1,K=0,ue=B;for(;r.pos>L;)D>=0&&r.id==D&&r.size>=0?(r.end<=ue-l&&(g(O,te,b,K,r.end,ue,D,E),K=O.length,ue=r.end),r.next()):N>2500?u(b,L,O,te):f(b,L,O,te,D,N+1);if(D>=0&&K>0&&K<O.length&&g(O,te,b,K,b,ue,D,E),O.reverse(),te.reverse(),D>-1&&K>0){let j=m(M);P=xi(M,O,te,0,O.length,0,B-b,j,j)}else P=w(M,O,te,B-b,E-B)}_.push(P),C.push(W)}function u(p,S,_,C){let x=[],N=0,R=-1;for(;r.pos>S;){let{id:b,start:B,end:F,size:E}=r;if(E>4)r.next();else{if(R>-1&&B<R)break;R<0&&(R=F-l),x.push(b,B,F),N++,r.next()}}if(N){let b=new Uint16Array(N*4),B=x[x.length-2];for(let F=x.length-3,E=0;F>=0;F-=3)b[E++]=x[F],b[E++]=x[F+1]-B,b[E++]=x[F+2]-B,b[E++]=E;_.push(new mt(b,x[2]-B,i)),C.push(B-p)}}function m(p){return(S,_,C)=>{let x=0,N=S.length-1,R,b;if(N>=0&&(R=S[N])instanceof we){if(!N&&R.type==p&&R.length==C)return R;(b=R.prop(re.lookAhead))&&(x=_[N]+R.length+b)}return w(p,S,_,C,x)}}function g(p,S,_,C,x,N,R,b){let B=[],F=[];for(;p.length>C;)B.push(p.pop()),F.push(S.pop()+_-x);p.push(w(i.types[R],B,F,N-x,b-N)),S.push(x-_)}function w(p,S,_,C,x=0,N){if(d){let R=[re.contextHash,d];N=N?[R].concat(N):[R]}if(x>25){let R=[re.lookAhead,x];N=N?[R].concat(N):[R]}return new we(p,S,_,C,N)}function v(p,S){let _=r.fork(),C=0,x=0,N=0,R=_.end-l,b={size:0,start:0,skip:0};e:for(let B=_.pos-p;_.pos>B;){let F=_.size;if(_.id==S&&F>=0){b.size=C,b.start=x,b.skip=N,N+=4,C+=4,_.next();continue}let E=_.pos-F;if(F<0||E<B||_.start<R)break;let M=_.id>=s?4:0,P=_.start;for(_.next();_.pos>E;){if(_.size<0)if(_.size==-3)M+=4;else break e;else _.id>=s&&(M+=4);_.next()}x=P,C+=F,N+=M}return(S<0||C==p)&&(b.size=C,b.start=x,b.skip=N),b.size>4?b:void 0}function y(p,S,_){let{id:C,start:x,end:N,size:R}=r;if(r.next(),R>=0&&C<s){let b=_;if(R>4){let B=r.pos-(R-4);for(;r.pos>B;)_=y(p,S,_)}S[--_]=b,S[--_]=N-p,S[--_]=x-p,S[--_]=C}else R==-3?d=C:R==-4&&(h=C);return _}let A=[],V=[];for(;r.pos>0;)f(a.start||0,a.bufferStart||0,A,V,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:A.length?V[0]+A[0].length:0;return new we(c[a.topID],A.reverse(),V.reverse(),k)}const no=new WeakMap;function Sn(a,e){if(!a.isAnonymous||e instanceof mt||e.type!=a)return 1;let n=no.get(e);if(n==null){n=1;for(let i of e.children){if(i.type!=a||!(i instanceof we)){n=1;break}n+=Sn(a,i)}no.set(e,n)}return n}function xi(a,e,n,i,l,o,s,r,c){let d=0;for(let g=i;g<l;g++)d+=Sn(a,e[g]);let h=Math.ceil(d*1.5/8),f=[],u=[];function m(g,w,v,y,A){for(let V=v;V<y;){let k=V,p=w[V],S=Sn(a,g[V]);for(V++;V<y;V++){let _=Sn(a,g[V]);if(S+_>=h)break;S+=_}if(V==k+1){if(S>h){let _=g[k];m(_.children,_.positions,0,_.children.length,w[k]+A);continue}f.push(g[k])}else{let _=w[V-1]+g[V-1].length-p;f.push(xi(a,g,w,k,V,p,_,null,c))}u.push(p+A-o)}}return m(e,n,i,l,0),(r||c)(f,u,s)}class Bt{constructor(e,n,i,l,o=!1,s=!1){this.from=e,this.to=n,this.tree=i,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,n=[],i=!1){let l=[new Bt(0,e.length,e,0,!1,i)];for(let o of n)o.to>e.length&&l.push(o);return l}static applyChanges(e,n,i=128){if(!n.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,d=0;;r++){let h=r<n.length?n[r]:null,f=h?h.fromA:1e9;if(f-c>=i)for(;s&&s.from<f;){let u=s;if(c>=u.from||f<=u.to||d){let m=Math.max(u.from,c)-d,g=Math.min(u.to,f)-d;u=m>=g?null:new Bt(m,g,u.tree,u.offset+d,r>0,!!h)}if(u&&l.push(u),s.to>f)break;s=o<e.length?e[o++]:null}if(!h)break;c=h.toA,d=h.toA-h.toB}return l}}class io{startParse(e,n,i){return typeof e=="string"&&(e=new Ph(e)),i=i?i.length?i.map(l=>new gi(l.from,l.to)):[new gi(0,0)]:[new gi(0,e.length)],this.createParse(e,n||[],i)}parse(e,n,i){let l=this.startParse(e,n,i);for(;;){let o=l.advance();if(o)return o}}}class Ph{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new re({perNode:!0});class Bn{constructor(e,n,i,l,o,s,r,c,d,h=0,f){this.p=e,this.stack=n,this.state=i,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=d,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,i=0){let l=e.parser.context;return new Bn(e,[],n,i,i,0,[],0,l?new lo(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let i=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),i==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-(i-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from,h=this.reducePos-d;h>=2e3&&!(!((n=this.p.parser.nodeSet.types[l])===null||n===void 0)&&n.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=h));let f=c?this.stack[c-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,d,m,u+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,n,i,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(n==i)return;if(s.buffer[r-2]>=n){s.buffer[r-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,n,i,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]>i;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>i;)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]=n,this.buffer[s+2]=i,this.buffer[s+3]=l}}shift(e,n,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(n,i),n<=this.p.parser.maxNode&&this.buffer.push(n,i,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||n<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,i),this.shiftContext(n,i),n<=s.maxNode&&this.buffer.push(n,i,l,4)}}apply(e,n,i,l){e&65536?this.reduce(e):this.shift(e,n,i,l)}useNode(e,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(n,l),this.buffer.push(i,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,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let i=e.buffer.slice(n),l=e.bufferBase+n;for(;e&&l==e.bufferBase;)e=e.parent;return new Bn(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,i?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Lh(this);;){let i=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(i==0)return!1;if(!(i&65536))return!0;n.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<n.length;o+=2)(s=n[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(n[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<n.length;o+=2){let s=n[o+1];l.some((r,c)=>c&1&&r==s)||l.push(n[o],s)}n=l}let i=[];for(let l=0;l<n.length&&i.length<4;l+=2){let o=n[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(n[l],this.pos),s.reducePos=this.pos,s.score-=200,i.push(s)}return i}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if(!(n&65536))return!1;if(!e.validAction(this.state,n)){let i=n>>19,l=n&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],i=(l,o)=>{if(!n.includes(l))return n.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=i(s,o+1);if(r!=null)return r}})};return i(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 n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}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 n=new lo(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}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 lo{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Lh{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=l}}class Nn{constructor(e,n,i){this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Nn(e,n,n-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 Nn(this.stack,this.pos,this.index)}}function Vn(a,e=Uint16Array){if(typeof a!="string")return a;let n=null;for(let i=0,l=0;i<a.length;){let o=0;for(;;){let s=a.charCodeAt(i++),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}n?n[l++]=o:n=new e(o)}return n}class Rn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const oo=new Rn;class Uh{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=oo,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let i=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<i.from;){if(!l)return null;let s=this.ranges[--l];o-=i.from-s.to,i=s}for(;n<0?o>i.to:o>=i.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-i.to,i=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,i,l;if(n>=0&&n<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(n);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(i=o,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,n=0){let i=n?this.resolveOffset(n,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>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,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=oo,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,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let i="";for(let l of this.ranges){if(l.from>=n)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,n)))}return i}}class It{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:i}=n.p;jh(this.data,e,n,this.id,i.data,i.tokenPrecTable)}}It.prototype.contextual=It.prototype.fallback=It.prototype.extend=!1,It.prototype.fallback=It.prototype.extend=!1;function jh(a,e,n,i,l,o){let s=0,r=1<<i,{dialect:c}=n.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 g=a[m];if(c.allows(g)&&(e.token.value==-1||e.token.value==g||zh(g,e.token.value,l,o))){e.acceptToken(g);break}}let h=e.next,f=0,u=a[s+2];if(e.next<0&&u>f&&a[d+u*3-3]==65535){s=a[d+u*3-1];continue e}for(;f<u;){let m=f+u>>1,g=d+m+(m<<1),w=a[g],v=a[g+1]||65536;if(h<w)u=m;else if(h>=v)f=m+1;else{s=a[g+2],e.advance();continue e}}break}}function so(a,e,n){for(let i=e,l;(l=a[i])!=65535;i++)if(l==n)return i-e;return-1}function zh(a,e,n,i){let l=so(n,i,e);return l<0||so(n,i,a)<l}const Te=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let vi=null;function ao(a,e,n){let i=a.cursor(ve.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.to<e:i.from>e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(a.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:a.length}}class qh{constructor(e,n){this.fragments=e,this.nodeSet=n,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?ao(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ao(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 n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let i=this.trees[n],l=this.index[n];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[l],s=this.start[n]+i.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof we){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(re.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[n]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+o.length}}}class Qh{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Rn)}getActions(e){let n=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<o.length;d++){if(!(1<<d&s))continue;let h=o[d],f=this.tokens[d];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=s||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=s,f.context=r),f.lookAhead>f.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let u=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!h.extend&&(i=f,n>u))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!i&&e.pos==this.stream.end&&(i=new Rn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,n=this.addActions(e,i.value,i.end,n)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Rn,{pos:i,p:l}=e;return n.start=i,n.end=Math.min(i+1,l.stream.end),n.value=i==l.stream.end?l.parser.eofTerm:0,n}updateCachedToken(e,n,i){let l=this.stream.clipPos(i.pos);if(n.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.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),i);if(r>=0&&i.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,n,i,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=n,this.actions[l++]=i,l}addActions(e,n,i,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=ot(r,d+2);else{l==0&&r[d+1]==2&&(l=this.putAction(ot(r,d+2),n,i,l));break}r[d]==n&&(l=this.putAction(ot(r,d+1),n,i,l))}return l}}class Wh{constructor(e,n,i,l){this.parser=e,this.input=n,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 Uh(n,l),this.tokens=new Qh(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[Bn.start(this,e.top[0],o)],this.fragments=i.length&&this.stream.end-o>e.bufferLength*4?new qh(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,i=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>n)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!i.length){let s=l&&Yh(l);if(s)return Te&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Te&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);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,i);if(s)return Te&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(i.length>s)for(i.sort((r,c)=>c.score-r.score);i.length>s;)i.pop();i.some(r=>r.reducePos>n)&&this.recovering--}else if(i.length>1){e:for(let s=0;s<i.length-1;s++){let r=i[s];for(let c=s+1;c<i.length;c++){let d=i[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)i.splice(c--,1);else{i.splice(s--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let s=1;s<i.length;s++)i[s].pos<this.minStackPos&&(this.minStackPos=i[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,n,i){let l=e.pos,{parser:o}=this,s=Te?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,h=d?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?o.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!d||(f.prop(re.contextHash)||0)==h))return e.useNode(f,u),Te&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(f.type.id)})`),!0;if(!(f instanceof we)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof we&&f.positions[0]==0)f=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Te&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let h=c[d++],f=c[d++],u=c[d++],m=d==c.length||!i,g=m?e:e.split(),w=this.tokens.mainToken;if(g.apply(h,f,w?w.start:g.pos,u),Te&&console.log(s+this.stackID(g)+` (via ${h&65536?`reduce of ${o.getName(h&65535)}`:"shift"} for ${o.getName(f)} @ ${l}${g==e?"":", split"})`),m)return!0;g.pos>l?n.push(g):i.push(g)}return!1}advanceFully(e,n){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ro(e,n),!0}}runRecovery(e,n,i){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=n[s<<1],d=n[(s<<1)+1],h=Te?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Te&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=h;for(let m=0;f.forceReduce()&&m<10&&(Te&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Te&&(u=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(c))Te&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(d==r.pos&&(d++,c=0),r.recoverByDelete(c,d),Te&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),ro(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),we.build({buffer:Nn.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 n=(vi||(vi=new WeakMap)).get(e);return n||vi.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function ro(a,e){for(let n=0;n<e.length;n++){let i=e[n];if(i.pos==a.pos&&i.sameState(a)){e[n].score<a.score&&(e[n]=a);return}}e.push(a)}class Kh{constructor(e,n,i){this.source=e,this.flags=n,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class En extends io{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let r=0;r<e.repeatNodeCount;r++)n.push("");let i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<n.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=re[c]);for(let d=1;d<r.length;){let h=r[d++];if(h>=0)o(h,c,r[d++]);else{let f=r[d+-h];for(let u=-h;u>0;u--)o(r[d++],c,f);d++}}}this.nodeSet=new bi(n.map((r,c)=>Me.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:i.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=Gl;let s=Vn(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(co),this.states=Vn(e.states,Uint32Array),this.data=Vn(e.stateData),this.goto=Vn(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new It(s,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,i){let l=new Wh(this,e,n,i);for(let o of this.wrappers)l=o(l,e,n,i);return l}getGoto(e,n,i=!1){let l=this.goto;if(n>=l[0])return-1;for(let o=l[n+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&i)return c;for(let d=o+(s>>1);o<d;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,n){let i=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=i[o])==65535)if(i[o+1]==1)s=i[o=ot(i,o+2)];else{if(i[o+1]==2)return ot(i,o+2);break}if(s==n||s==0)return ot(i,o+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,i=>i==n?!0:null)}allActions(e,n){let i=this.stateSlot(e,4),l=i?n(i):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=ot(this.data,o+2);else break;l=n(ot(this.data,o+1))}return l}nextStates(e){let n=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ot(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];n.some((o,s)=>s&1&&o==l)||n.push(this.data[i],l)}}return n}configure(e){let n=Object.assign(Object.create(En.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=i}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(r=>r.from==i.external);if(!o)return i;let s=Object.assign(Object.assign({},i),{external:o.to});return n.specializers[l]=co(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}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 n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),i=n.map(()=>!1);if(e)for(let o of e.split(" ")){let s=n.indexOf(o);s>=0&&(i[s]=!0)}let l=null;for(let o=0;o<n.length;o++)if(!i[o])for(let s=this.dialects[n[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Kh(e,i,l)}static deserialize(e){return new En(e)}}function ot(a,e){return a[e]|a[e+1]<<16}function Yh(a){let e=null;for(let n of a){let i=n.p.stoppedAt;(n.pos==n.p.stream.end||i!=null&&n.pos>i)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function co(a){if(a.external){let e=a.extend?1:0;return(n,i)=>a.external(n,i)<<1|e}return a.get}let Hh=0;class Le{constructor(e,n,i,l){this.name=e,this.set=n,this.base=i,this.modified=l,this.id=Hh++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let i=typeof e=="string"?e:"?";if(e instanceof Le&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let l=new Le(i,[],null,[]);if(l.set.push(l),n)for(let o of n.set)l.set.push(o);return l}static defineModifier(e){let n=new On(e);return i=>i.modified.indexOf(n)>-1?i:On.get(i.base||i,i.modified.concat(n).sort((l,o)=>l.id-o.id))}}let Gh=0;class On{constructor(e){this.name=e,this.instances=[],this.id=Gh++}static get(e,n){if(!n.length)return e;let i=n[0].instances.find(r=>r.base==e&&Jh(n,r.modified));if(i)return i;let l=[],o=new Le(e.name,l,e,n);for(let r of n)r.instances.push(o);let s=Xh(n);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(On.get(r,c));return o}}function Jh(a,e){return a.length==e.length&&a.every((n,i)=>n==e[i])}function Xh(a){let e=[[]];for(let n=0;n<a.length;n++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(a[n]));return e.sort((n,i)=>i.length-n.length)}function ho(a){let e=Object.create(null);for(let n in a){let i=a[n];Array.isArray(i)||(i=[i]);for(let l of n.split(" "))if(l){let o=[],s=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){s=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(o.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let c=o.length-1,d=o[c];if(!d)throw new RangeError("Invalid path: "+l);let h=new Ci(i,s,c>0?o.slice(0,c):null);e[d]=h.sort(e[d])}}return Zh.add(e)}const Zh=new re;class Ci{constructor(e,n,i,l){this.tags=e,this.mode=n,this.context=i,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}}Ci.empty=new Ci([],2,null);function fo(a,e){let n=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:i,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let d=n[c.id];if(d){s=s?s+" "+d:d;break}}return s},scope:i}}const H=Le.define,_n=H(),bt=H(),uo=H(bt),po=H(bt),kt=H(),Mn=H(kt),Si=H(kt),Ye=H(),Nt=H(Ye),He=H(),Ge=H(),Bi=H(),nn=H(Bi),Fn=H(),Q={comment:_n,lineComment:H(_n),blockComment:H(_n),docComment:H(_n),name:bt,variableName:H(bt),typeName:uo,tagName:H(uo),propertyName:po,attributeName:H(po),className:H(bt),labelName:H(bt),namespace:H(bt),macroName:H(bt),literal:kt,string:Mn,docString:H(Mn),character:H(Mn),attributeValue:H(Mn),number:Si,integer:H(Si),float:H(Si),bool:H(kt),regexp:H(kt),escape:H(kt),color:H(kt),url:H(kt),keyword:He,self:H(He),null:H(He),atom:H(He),unit:H(He),modifier:H(He),operatorKeyword:H(He),controlKeyword:H(He),definitionKeyword:H(He),moduleKeyword:H(He),operator:Ge,derefOperator:H(Ge),arithmeticOperator:H(Ge),logicOperator:H(Ge),bitwiseOperator:H(Ge),compareOperator:H(Ge),updateOperator:H(Ge),definitionOperator:H(Ge),typeOperator:H(Ge),controlOperator:H(Ge),punctuation:Bi,separator:H(Bi),bracket:nn,angleBracket:H(nn),squareBracket:H(nn),paren:H(nn),brace:H(nn),content:Ye,heading:Nt,heading1:H(Nt),heading2:H(Nt),heading3:H(Nt),heading4:H(Nt),heading5:H(Nt),heading6:H(Nt),contentSeparator:H(Ye),list:H(Ye),quote:H(Ye),emphasis:H(Ye),strong:H(Ye),link:H(Ye),monospace:H(Ye),strikethrough:H(Ye),inserted:H(),deleted:H(),changed:H(),invalid:H(),meta:Fn,documentMeta:H(Fn),annotation:H(Fn),processingInstruction:H(Fn),definition:Le.defineModifier("definition"),constant:Le.defineModifier("constant"),function:Le.defineModifier("function"),standard:Le.defineModifier("standard"),local:Le.defineModifier("local"),special:Le.defineModifier("special")};for(let a in Q){let e=Q[a];e instanceof Le&&(e.name=a)}fo([{tag:Q.link,class:"tok-link"},{tag:Q.heading,class:"tok-heading"},{tag:Q.emphasis,class:"tok-emphasis"},{tag:Q.strong,class:"tok-strong"},{tag:Q.keyword,class:"tok-keyword"},{tag:Q.atom,class:"tok-atom"},{tag:Q.bool,class:"tok-bool"},{tag:Q.url,class:"tok-url"},{tag:Q.labelName,class:"tok-labelName"},{tag:Q.inserted,class:"tok-inserted"},{tag:Q.deleted,class:"tok-deleted"},{tag:Q.literal,class:"tok-literal"},{tag:Q.string,class:"tok-string"},{tag:Q.number,class:"tok-number"},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],class:"tok-string2"},{tag:Q.variableName,class:"tok-variableName"},{tag:Q.local(Q.variableName),class:"tok-variableName tok-local"},{tag:Q.definition(Q.variableName),class:"tok-variableName tok-definition"},{tag:Q.special(Q.variableName),class:"tok-variableName2"},{tag:Q.definition(Q.propertyName),class:"tok-propertyName tok-definition"},{tag:Q.typeName,class:"tok-typeName"},{tag:Q.namespace,class:"tok-namespace"},{tag:Q.className,class:"tok-className"},{tag:Q.macroName,class:"tok-macroName"},{tag:Q.propertyName,class:"tok-propertyName"},{tag:Q.operator,class:"tok-operator"},{tag:Q.comment,class:"tok-comment"},{tag:Q.meta,class:"tok-meta"},{tag:Q.invalid,class:"tok-invalid"},{tag:Q.punctuation,class:"tok-punctuation"}]);const ef=ho({String:Q.string,Number:Q.number,"True False":Q.bool,PropertyName:Q.propertyName,Null:Q.null,",":Q.separator,"[ ]":Q.squareBracket,"{ }":Q.brace}),tf=En.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:[ef],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 Ni=[],mo=[];(()=>{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,n=0;e<a.length;e++)(e%2?mo:Ni).push(n=n+a[e])})();function nf(a){if(a<768)return!1;for(let e=0,n=Ni.length;;){let i=e+n>>1;if(a<Ni[i])n=i;else if(a>=mo[i])e=i+1;else return!0;if(e==n)return!1}}function go(a){return a>=127462&&a<=127487}const bo=8205;function lf(a,e,n=!0,i=!0){return(n?ko:of)(a,e,i)}function ko(a,e,n){if(e==a.length)return e;e&&yo(a.charCodeAt(e))&&wo(a.charCodeAt(e-1))&&e--;let i=Vi(a,e);for(e+=Ao(i);e<a.length;){let l=Vi(a,e);if(i==bo||l==bo||n&&nf(l))e+=Ao(l),i=l;else if(go(l)){let o=0,s=e-2;for(;s>=0&&go(Vi(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function of(a,e,n){for(;e>0;){let i=ko(a,e-2,n);if(i<e)return i;e--}return 0}function Vi(a,e){let n=a.charCodeAt(e);if(!wo(n)||e+1==a.length)return n;let i=a.charCodeAt(e+1);return yo(i)?(n-55296<<10)+(i-56320)+65536:n}function yo(a){return a>=56320&&a<57344}function wo(a){return a>=55296&&a<56320}function Ao(a){return a<65536?1:2}class ae{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,n,i){[e,n]=Dt(this,e,n);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(n,this.length,l,1),Je.from(l,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Dt(this,e,n);let i=[];return this.decompose(e,n,i,0),Je.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new ln(this),o=new ln(e);for(let s=n,r=n;;){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>=i)return!0}}iter(e=1){return new ln(this,e)}iterRange(e,n=this.length){return new vo(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Co(i)}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]?ae.empty:e.length<=32?new ye(e):Je.from(ye.split(e,[]))}}class ye extends ae{constructor(e,n=sf(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((n?i:r)>=e)return new af(l,r,i,s);l=r+1,i++}}decompose(e,n,i,l){let o=e<=0&&n>=this.length?this:new ye(xo(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(l&1){let s=i.pop(),r=Tn(o.text,s.text.slice(),0,o.length);if(r.length<=32)i.push(new ye(r,s.length+o.length));else{let c=r.length>>1;i.push(new ye(r.slice(0,c)),new ye(r.slice(c)))}}else i.push(o)}replace(e,n,i){if(!(i instanceof ye))return super.replace(e,n,i);[e,n]=Dt(this,e,n);let l=Tn(this.text,Tn(i.text,xo(this.text,0,e)),n),o=this.length+i.length-(n-e);return l.length<=32?new ye(l,o):Je.from(ye.split(l,[]),o)}sliceString(e,n=this.length,i=`
|
|
15
|
+
`){[e,n]=Dt(this,e,n);let l="";for(let o=0,s=0;o<=n&&s<this.text.length;s++){let r=this.text[s],c=o+r.length;o>e&&s&&(l+=i),e<c&&n>o&&(l+=r.slice(Math.max(0,e-o),n-o)),o=c+1}return l}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],l=-1;for(let o of e)i.push(o),l+=o.length+1,i.length==32&&(n.push(new ye(i,l)),i=[],l=-1);return l>-1&&n.push(new ye(i,l)),n}}class Je extends ae{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,l){for(let o=0;;o++){let s=this.children[o],r=l+s.length,c=i+s.lines-1;if((n?c:r)>=e)return s.lineInner(e,n,i,l);l=r+1,i=c+1}}decompose(e,n,i,l){for(let o=0,s=0;s<=n&&o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e<=c&&n>=s){let d=l&((s<=e?1:0)|(c>=n?2:0));s>=e&&c<=n&&!d?i.push(r):r.decompose(e-s,n-s,i,d)}s=c+1}}replace(e,n,i){if([e,n]=Dt(this,e,n),i.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&&n<=r){let c=s.replace(e-o,n-o,i),d=this.lines-s.lines+c.lines;if(c.lines<d>>4&&c.lines>d>>6){let h=this.children.slice();return h[l]=c,new Je(h,this.length-(n-e)+i.length)}return super.replace(o,r,c)}o=r+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=`
|
|
16
|
+
`){[e,n]=Dt(this,e,n);let l="";for(let o=0,s=0;o<this.children.length&&s<=n;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=i),e<c&&n>s&&(l+=r.sliceString(e-s,n-s,i)),s=c+1}return l}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Je))return 0;let i=0,[l,o,s,r]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=n,o+=n){if(l==s||o==r)return i;let c=this.children[l],d=e.children[o];if(c!=d)return i+c.scanIdentical(d,n);i+=c.length+1}}static from(e,n=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let g of e)g.flatten(m);return new ye(m,n)}let l=Math.max(32,i>>5),o=l<<1,s=l>>1,r=[],c=0,d=-1,h=[];function f(m){let g;if(m.lines>o&&m instanceof Je)for(let w of m.children)f(w);else m.lines>s&&(c>s||!c)?(u(),r.push(m)):m instanceof ye&&c&&(g=h[h.length-1])instanceof ye&&m.lines+g.lines<=32?(c+=m.lines,d+=m.length+1,h[h.length-1]=new ye(g.text.concat(m.text),g.length+1+m.length)):(c+m.lines>l&&u(),c+=m.lines,d+=m.length+1,h.push(m))}function u(){c!=0&&(r.push(h.length==1?h[0]:Je.from(h,d)),d=-1,c=h.length=0)}for(let m of e)f(m);return u(),r.length==1?r[0]:new Je(r,n)}}ae.empty=new ye([""],0);function sf(a){let e=-1;for(let n of a)e+=n.length+1;return e}function Tn(a,e,n=0,i=1e9){for(let l=0,o=0,s=!0;o<a.length&&l<=i;o++){let r=a[o],c=l+r.length;c>=n&&(c>i&&(r=r.slice(0,i-l)),l<n&&(r=r.slice(n-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function xo(a,e,n){return Tn(a,[""],e,n)}class ln{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof ye?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],o=this.offsets[i],s=o>>1,r=l instanceof ye?l.text.length:l.children.length;if(s==(n>0?r:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
17
|
+
`,this;e--}else if(l instanceof ye){let c=l.text[s+(n<0?-1:0)];if(this.offsets[i]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof ye?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 vo{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new ln(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*n,this.value=l.length<=i?l:n<0?l.slice(l.length-i):l.slice(0,i),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 Co{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:l}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ae.prototype[Symbol.iterator]=function(){return this.iter()},ln.prototype[Symbol.iterator]=vo.prototype[Symbol.iterator]=Co.prototype[Symbol.iterator]=function(){return this});class af{constructor(e,n,i,l){this.from=e,this.to=n,this.number=i,this.text=l}get length(){return this.to-this.from}}function Dt(a,e,n){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,n))]}function st(a,e,n=!0,i=!0){return lf(a,e,n,i)}const Ri=/\r\n?|\n/;var Ie=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Ie||(Ie={}));class at{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,l=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(i,l,o),l+=o):l+=s,i+=o}}iterChangedRanges(e,n=!1){Ei(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],l=this.sections[n++];l<0?e.push(i,l):e.push(l,i)}return new at(e)}composeDesc(e){return this.empty?e:e.empty?this:So(this,e)}mapDesc(e,n=!1){return e.empty?this:Oi(this,e,n)}mapPos(e,n=-1,i=Ie.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(i!=Ie.Simple&&d>=e&&(i==Ie.TrackDel&&l<e&&d>e||i==Ie.TrackBefore&&l<e||i==Ie.TrackAfter&&d>e))return null;if(d>e||d==e&&n<0&&!r)return e==l||n<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,n=e){for(let i=0,l=0;i<this.sections.length&&l<=n;){let o=this.sections[i++],s=this.sections[i++],r=l+o;if(s>=0&&l<=n&&r>=e)return l<e&&r>n?"cover":!0;l=r}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],l=this.sections[n++];e+=(e?" ":"")+i+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new at(e)}static create(e){return new at(e)}}class Ce extends at{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ei(this,(n,i,l,o,s)=>e=e.replace(l,l+(i-n),s),!1),e}mapDesc(e,n=!1){return Oi(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let l=0,o=0;l<n.length;l+=2){let s=n[l],r=n[l+1];if(r>=0){n[l]=r,n[l+1]=s;let c=l>>1;for(;i.length<c;)i.push(ae.empty);i.push(s?e.slice(o,o+s):ae.empty)}o+=s}return new Ce(n,i)}compose(e){return this.empty?e:e.empty?this:So(this,e,!0)}map(e,n=!1){return e.empty?this:Oi(this,e,n,!0)}iterChanges(e,n=!1){Ei(this,e,n)}get desc(){return at.create(this.sections)}filter(e){let n=[],i=[],l=[],o=new on(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let h=Math.min(o.len,c-r);Ve(l,h,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;Ve(n,h,f),f>0&&yt(i,n,o.text),o.forward(h),r+=h}let d=e[s++];for(;r<d;){if(o.done)break e;let h=Math.min(o.len,d-r);Ve(n,h,-1),Ve(l,h,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(h),r+=h}}return{changes:new Ce(n,i),filtered:at.create(l)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],l=this.sections[n+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let l=[],o=[],s=0,r=null;function c(h=!1){if(!h&&!l.length)return;s<n&&Ve(l,n-s,-1);let f=new Ce(l,o);r=r?r.compose(f.map(r)):f,l=[],o=[],s=0}function d(h){if(Array.isArray(h))for(let f of h)d(f);else if(h instanceof Ce){if(h.length!=n)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${n})`);c(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:m}=h;if(f>u||f<0||u>n)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${n})`);let g=m?typeof m=="string"?ae.of(m.split(i||Ri)):m:ae.empty,w=g.length;if(f==u&&w==0)return;f<s&&c(),f>s&&Ve(l,f-s,-1),Ve(l,u-f,w),yt(o,l,g),s=u}}return d(e),c(!r),r}static empty(e){return new Ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")n.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)n.push(o[0],0);else{for(;i.length<l;)i.push(ae.empty);i[l]=ae.of(o.slice(1)),n.push(o[0],i[l].length)}}}return new Ce(n,i)}static createSet(e,n){return new Ce(e,n)}}function Ve(a,e,n,i=!1){if(e==0&&n<=0)return;let l=a.length-2;l>=0&&n<=0&&n==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=n:i?(a[l]+=e,a[l+1]+=n):a.push(e,n)}function yt(a,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<a.length)a[a.length-1]=a[a.length-1].append(n);else{for(;a.length<i;)a.push(ae.empty);a.push(n)}}function Ei(a,e,n){let i=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let d=l,h=o,f=ae.empty;for(;d+=r,h+=c,c&&i&&(f=f.append(i[s-2>>1])),!(n||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,d,o,h,f),l=d,o=h}}}function Oi(a,e,n,i=!1){let l=[],o=i?[]:null,s=new on(a),r=new on(e);for(let c=-1;;){if(s.done&&r.len||r.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&r.ins==-1){let d=Math.min(s.len,r.len);Ve(l,d,-1),s.forward(d),r.forward(d)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!n))){let d=r.len;for(Ve(l,r.ins,-1);d;){let h=Math.min(s.len,d);s.ins>=0&&c<s.i&&s.len<=h&&(Ve(l,0,s.ins),o&&yt(o,l,s.text),c=s.i),s.forward(h),d-=h}r.next()}else if(s.ins>=0){let d=0,h=s.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);d+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;Ve(l,d,c<s.i?s.ins:0),o&&c<s.i&&yt(o,l,s.text),c=s.i,s.forward(s.len-h)}else{if(s.done&&r.done)return o?Ce.createSet(l,o):at.create(l);throw new Error("Mismatched change set lengths")}}}function So(a,e,n=!1){let i=[],l=n?[]:null,o=new on(a),s=new on(e);for(let r=!1;;){if(o.done&&s.done)return l?Ce.createSet(i,l):at.create(i);if(o.ins==0)Ve(i,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ve(i,0,s.ins,r),l&&yt(l,i,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=i.length;if(o.ins==-1){let h=s.ins==-1?-1:s.off?0:s.ins;Ve(i,c,h,r),l&&h&&yt(l,i,s.text)}else s.ins==-1?(Ve(i,o.off?0:o.len,c,r),l&&yt(l,i,o.textBit(c))):(Ve(i,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&yt(l,i,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||i.length>d),o.forward2(c),s.forward(c)}}}}class on{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,n=this.i-2>>1;return n>=e.length?ae.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?ae.empty:n[i].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 Vt{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}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,n=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Vt(i,l,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return X.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return X.range(this.anchor,i)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!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 X.range(e.anchor,e.head)}static create(e,n,i){return new Vt(e,n,i)}}class X{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:X.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new X([this.main],0)}addRange(e,n=!0){return X.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,X.create(i,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 X(e.ranges.map(n=>Vt.fromJSON(n)),e.main)}static single(e,n=e){return new X([X.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=i:o.from<i)return X.normalized(e.slice(),n);i=o.to}return new X(e,n)}static cursor(e,n=0,i,l){return Vt.create(e,e,(n==0?0:n<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,n,i,l){let o=(i??16777215)<<6|(l==null?7:Math.min(6,l));return n<e?Vt.create(n,e,48|o):Vt.create(e,n,(n>e?8:0)|o)}static normalized(e,n=0){let i=e[n];e.sort((l,o)=>l.from-o.from),n=e.indexOf(i);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<=n&&n--,e.splice(--l,2,o.anchor>o.head?X.range(c,r):X.range(r,c))}}return new X(e,n)}}function Bo(a,e){for(let n of a.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let _i=0;class ne{constructor(e,n,i,l,o){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=l,this.id=_i++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new ne(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:Mi),!!e.static,e.enables)}of(e){return new In([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new In(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new In(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function Mi(a,e){return a==e||a.length==e.length&&a.every((n,i)=>n===e[i])}class In{constructor(e,n,i,l){this.dependencies=e,this.facet=n,this.type=i,this.value=l,this.id=_i++}dynamicSlot(e){var n;let i=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,d=!1,h=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?d=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||h.push(e[f.id]);return{create(f){return f.values[s]=i(f),1},update(f,u){if(c&&u.docChanged||d&&(u.docChanged||u.selection)||Fi(f,h)){let m=i(f);if(r?!No(m,f.values[s],l):!l(m,f.values[s]))return f.values[s]=m,1}return 0},reconfigure:(f,u)=>{let m,g=u.config.address[o];if(g!=null){let w=Ln(u,g);if(this.dependencies.every(v=>v instanceof ne?u.facet(v)===f.facet(v):v instanceof Rt?u.field(v,!1)==f.field(v,!1):!0)||(r?No(m=i(f),w,l):l(m=i(f),w)))return f.values[s]=w,0}else m=i(f);return f.values[s]=m,1}}}}function No(a,e,n){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!n(a[i],e[i]))return!1;return!0}function Fi(a,e){let n=!1;for(let i of e)an(a,i)&1&&(n=!0);return n}function rf(a,e,n){let i=n.map(c=>a[c.id]),l=n.map(c=>c.type),o=i.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let d=[];for(let h=0;h<i.length;h++){let f=Ln(c,i[h]);if(l[h]==2)for(let u of f)d.push(u);else d.push(f)}return e.combine(d)}return{create(c){for(let d of i)an(c,d);return c.values[s]=r(c),1},update(c,d){if(!Fi(c,o))return 0;let h=r(c);return e.compare(h,c.values[s])?0:(c.values[s]=h,1)},reconfigure(c,d){let h=Fi(c,i),f=d.config.facets[e.id],u=d.facet(e);if(f&&!h&&Mi(n,f))return c.values[s]=u,0;let m=r(c);return e.compare(m,u)?(c.values[s]=u,0):(c.values[s]=m,1)}}}const Dn=ne.define({static:!0});class Rt{constructor(e,n,i,l,o){this.id=e,this.createF=n,this.updateF=i,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let n=new Rt(_i++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Dn).find(i=>i.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,l)=>{let o=i.values[n],s=this.updateF(o,l);return this.compareF(o,s)?0:(i.values[n]=s,1)},reconfigure:(i,l)=>{let o=i.facet(Dn),s=l.facet(Dn),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(i.values[n]=r.create(i),1):l.config.address[this.id]!=null?(i.values[n]=l.field(this),0):(i.values[n]=this.create(i),1)}}}init(e){return[this,Dn.of({field:this,create:e})]}get extension(){return this}}const Et={lowest:4,low:3,default:2,high:1,highest:0};function sn(a){return e=>new Vo(e,a)}const cf={highest:sn(Et.highest),high:sn(Et.high),default:sn(Et.default),low:sn(Et.low),lowest:sn(Et.lowest)};class Vo{constructor(e,n){this.inner=e,this.prec=n}}class $n{of(e){return new Ti(this,e)}reconfigure(e){return $n.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ti{constructor(e,n){this.compartment=e,this.inner=n}}class Pn{constructor(e,n,i,l,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let l=[],o=Object.create(null),s=new Map;for(let u of df(e,n,s))u instanceof Rt?l.push(u):(o[u.facet.id]||(o[u.facet.id]=[])).push(u);let r=Object.create(null),c=[],d=[];for(let u of l)r[u.id]=d.length<<1,d.push(m=>u.slot(m));let h=i?.config.facets;for(let u in o){let m=o[u],g=m[0].facet,w=h&&h[u]||[];if(m.every(v=>v.type==0))if(r[g.id]=c.length<<1|1,Mi(w,m))c.push(i.facet(g));else{let v=g.combine(m.map(y=>y.value));c.push(i&&g.compare(v,i.facet(g))?i.facet(g):v)}else{for(let v of m)v.type==0?(r[v.id]=c.length<<1|1,c.push(v.value)):(r[v.id]=d.length<<1,d.push(y=>v.dynamicSlot(y)));r[g.id]=d.length<<1,d.push(v=>rf(v,g,m))}}let f=d.map(u=>u(r));return new Pn(e,s,f,r,c,o)}}function df(a,e,n){let i=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let d=i[c].indexOf(s);d>-1&&i[c].splice(d,1),s instanceof Ti&&n.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let d of s)o(d,r);else if(s instanceof Ti){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(s.compartment)||s.inner;n.set(s.compartment,d),o(d,r)}else if(s instanceof Vo)o(s.inner,s.prec);else if(s instanceof Rt)i[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof In)i[r].push(s),s.facet.extensions&&o(s.facet.extensions,Et.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,Et.default),i.reduce((s,r)=>s.concat(r))}function an(a,e){if(e&1)return 2;let n=e>>1,i=a.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;a.status[n]=4;let l=a.computeSlot(a,a.config.dynamicSlots[n]);return a.status[n]=2|l}function Ln(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const Ro=ne.define(),Ii=ne.define({combine:a=>a.some(e=>e),static:!0}),Eo=ne.define({combine:a=>a.length?a[0]:void 0,static:!0}),Oo=ne.define(),_o=ne.define(),Mo=ne.define(),Fo=ne.define({combine:a=>a.length?a[0]:!1});class $t{constructor(e,n){this.type=e,this.value=n}static define(){return new hf}}class hf{of(e){return new $t(this,e)}}class ff{constructor(e){this.map=e}of(e){return new xe(this,e)}}class xe{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new xe(this.type,n)}is(e){return this.type==e}static define(e={}){return new ff(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(n);o&&i.push(o)}return i}}xe.reconfigure=xe.define(),xe.appendConfig=xe.define();class Re{constructor(e,n,i,l,o,s){this.startState=e,this.changes=n,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&Bo(i,n.newLength),o.some(r=>r.type==Re.time)||(this.annotations=o.concat(Re.time.of(Date.now())))}static create(e,n,i,l,o,s){return new Re(e,n,i,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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Re.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Re.time=$t.define(),Re.userEvent=$t.define(),Re.addToHistory=$t.define(),Re.remote=$t.define();function uf(a,e){let n=[];for(let i=0,l=0;;){let o,s;if(i<a.length&&(l==e.length||e[l]>=a[i]))o=a[i++],s=a[i++];else if(l<e.length)o=e[l++],s=e[l++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function To(a,e,n){var i;let l,o,s;return n?(l=e.changes,o=Ce.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):(i=a.selection)===null||i===void 0?void 0:i.map(l),effects:xe.mapEffects(a.effects,l).concat(xe.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Di(a,e,n){let i=e.selection,l=Pt(e.annotations);return e.userEvent&&(l=l.concat(Re.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ce?e.changes:Ce.of(e.changes||[],n,a.facet(Eo)),selection:i&&(i instanceof X?i:X.single(i.anchor,i.head)),effects:Pt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Io(a,e,n){let i=Di(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;i=To(i,Di(a,e[o],s?i.changes.newLength:a.doc.length),s)}let l=Re.create(a,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return mf(n?pf(l):l)}function pf(a){let e=a.startState,n=!0;for(let l of e.facet(Oo)){let o=l(a);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:uf(n,o))}if(n!==!0){let l,o;if(n===!1)o=a.changes.invertedDesc,l=Ce.empty(e.doc.length);else{let s=a.changes.filter(n);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=Re.create(e,l,a.selection&&a.selection.map(o),xe.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let i=e.facet(_o);for(let l=i.length-1;l>=0;l--){let o=i[l](a);o instanceof Re?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Re?a=o[0]:a=Io(e,Pt(o),!1)}return a}function mf(a){let e=a.startState,n=e.facet(Mo),i=a;for(let l=n.length-1;l>=0;l--){let o=n[l](a);o&&Object.keys(o).length&&(i=To(i,Di(e,o,a.changes.newLength),!0))}return i==a?a:Re.create(e,a.changes,a.selection,i.effects,i.annotations,i.scrollIntoView)}const gf=[];function Pt(a){return a==null?gf:Array.isArray(a)?a:[a]}var rt=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(rt||(rt={}));const bf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let $i;try{$i=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function kf(a){if($i)return $i.test(a);for(let e=0;e<a.length;e++){let n=a[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||bf.test(n)))return!0}return!1}function yf(a){return e=>{if(!/\S/.test(e))return rt.Space;if(kf(e))return rt.Word;for(let n=0;n<a.length;n++)if(e.indexOf(a[n])>-1)return rt.Word;return rt.Other}}class de{constructor(e,n,i,l,o,s){this.config=e,this.doc=n,this.selection=i,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++)an(this,r<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return an(this,i),Ln(this,i)}update(...e){return Io(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:l}=n;for(let r of e.effects)r.is($n.reconfigure)?(n&&(l=new Map,n.compartments.forEach((c,d)=>l.set(d,c)),n=null),l.set(r.value.compartment,r.value.extension)):r.is(xe.reconfigure)?(n=null,i=r.value):r.is(xe.appendConfig)&&(n=null,i=Pt(i).concat(r.value));let o;n?o=e.startState.values.slice():(n=Pn.resolve(i,l,this),o=new de(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let s=e.startState.facet(Ii)?e.newSelection:e.newSelection.asSingle();new de(n,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:X.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),l=this.changes(i.changes),o=[i.range],s=Pt(i.effects);for(let r=1;r<n.ranges.length;r++){let c=e(n.ranges[r]),d=this.changes(c.changes),h=d.map(l);for(let u=0;u<r;u++)o[u]=o[u].map(h);let f=l.mapDesc(d,!0);o.push(c.range.map(f)),l=l.compose(h),s=xe.mapEffects(s,h).concat(xe.mapEffects(Pt(c.effects),f))}return{changes:l,selection:X.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Ce?e:Ce.of(e,this.doc.length,this.facet(de.lineSeparator))}toText(e){return ae.of(e.split(this.facet(de.lineSeparator)||Ri))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(an(this,n),Ln(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof Rt&&this.config.address[l.id]!=null&&(n[i]=l.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let o in i)if(Object.prototype.hasOwnProperty.call(e,o)){let s=i[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return de.create({doc:e.doc,selection:X.fromJSON(e.selection),extensions:n.extensions?l.concat([n.extensions]):l})}static create(e={}){let n=Pn.resolve(e.extensions||[],new Map),i=e.doc instanceof ae?e.doc:ae.of((e.doc||"").split(n.staticFacet(de.lineSeparator)||Ri)),l=e.selection?e.selection instanceof X?e.selection:X.single(e.selection.anchor,e.selection.head):X.single(0);return Bo(l,i.length),n.staticFacet(Ii)||(l=l.asSingle()),new de(n,i,l,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(de.tabSize)}get lineBreak(){return this.facet(de.lineSeparator)||`
|
|
18
|
+
`}get readOnly(){return this.facet(Fo)}phrase(e,...n){for(let i of this.facet(de.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>n.length?i:n[o-1]})),e}languageDataAt(e,n,i=-1){let l=[];for(let o of this.facet(Ro))for(let s of o(this,n,i))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return yf(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-i,r=e-i;for(;s>0;){let c=st(n,s,!1);if(o(n.slice(c,s))!=rt.Word)break;s=c}for(;r<l;){let c=st(n,r);if(o(n.slice(r,c))!=rt.Word)break;r=c}return s==r?null:X.range(s+i,r+i)}}de.allowMultipleSelections=Ii,de.tabSize=ne.define({combine:a=>a.length?a[0]:4}),de.lineSeparator=Eo,de.readOnly=Fo,de.phrases=ne.define({compare(a,e){let n=Object.keys(a),i=Object.keys(e);return n.length==i.length&&n.every(l=>a[l]==e[l])}}),de.languageData=Ro,de.changeFilter=Oo,de.transactionFilter=_o,de.transactionExtender=Mo,$n.reconfigure=xe.define();class Lt{eq(e){return this==e}range(e,n=e){return rn.create(e,n,this)}}Lt.prototype.startSide=Lt.prototype.endSide=0,Lt.prototype.point=!1,Lt.prototype.mapMode=Ie.TrackDel;class rn{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new rn(e,n,i)}}function Pi(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class Li{constructor(e,n,i,l){this.from=e,this.to=n,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,l=0){let o=i?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||(i?this.value[c].endSide:this.value[c].startSide)-n;if(c==s)return d>=0?s:r;d>=0?r=c:s=c+1}}between(e,n,i,l){for(let o=this.findIndex(n,-1e9,!0),s=this.findIndex(i,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,n){let i=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let d=this.value[c],h=this.from[c]+e,f=this.to[c]+e,u,m;if(h==f){let g=n.mapPos(h,d.startSide,d.mapMode);if(g==null||(u=m=g,d.startSide!=d.endSide&&(m=n.mapPos(h,d.endSide),m<u)))continue}else if(u=n.mapPos(h,d.startSide),m=n.mapPos(f,d.endSide),u>m||u==m&&d.startSide>0&&d.endSide<=0)continue;(m-u||d.endSide-d.startSide)<0||(s<0&&(s=u),d.point&&(r=Math.max(r,m-u)),i.push(d),l.push(u-s),o.push(m-s))}return{mapped:i.length?new Li(l,o,i,r):null,pos:s}}}class ge{constructor(e,n,i,l){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=l}static create(e,n,i,l){return new ge(e,n,i,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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(n.length==0&&!s)return this;if(i&&(n=n.slice().sort(Pi)),this.isEmpty)return n.length?ge.of(n):this;let r=new $o(this,null,-1).goto(0),c=0,d=[],h=new Un;for(;r.value||c<n.length;)if(c<n.length&&(r.from-n[c].from||r.startSide-n[c].value.startSide)>=0){let f=n[c++];h.addInner(f.from,f.to,f.value)||d.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(r.chunkIndex)<n[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||d.push(rn.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!d.length?ge.empty:this.nextLayer.update({add:d,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],i=[],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),n.push(c),i.push(e.mapPos(r));else if(d===!0){let{mapped:h,pos:f}=c.map(r,e);h&&(l=Math.max(l,h.maxPoint),n.push(h),i.push(f))}}let o=this.nextLayer.map(e);return n.length==0?o:new ge(i,n,o||ge.empty,l)}between(e,n,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(n>=o&&e<=o+s.length&&s.between(o,e-o,n-o,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return cn.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return cn.from(e).goto(n)}static compare(e,n,i,l,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),r=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),c=Do(s,r,i),d=new dn(s,c,o),h=new dn(r,c,o);i.iterGaps((f,u,m)=>Po(d,f,h,u,m,l)),i.empty&&i.length==0&&Po(d,0,h,0,0,l)}static eq(e,n,i=0,l){l==null&&(l=999999999);let o=e.filter(h=>!h.isEmpty&&n.indexOf(h)<0),s=n.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=Do(o,s),c=new dn(o,r,0).goto(i),d=new dn(s,r,0).goto(i);for(;;){if(c.to!=d.to||!ji(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,n,i,l,o=-1){let s=new dn(e,null,o).goto(n),r=n,c=s.openStart;for(;;){let d=Math.min(s.to,i);if(s.point){let h=s.activeForPoint(s.to),f=s.pointFrom<n?h.length+1:s.point.startSide<0?h.length:Math.min(h.length,c);l.point(r,d,s.point,h,f,s.pointRank),c=Math.min(s.openEnd(d),h.length)}else d>r&&(l.span(r,d,s.active,c),c=s.openEnd(d));if(s.to>i)return c+(s.point&&s.to>i?1:0);r=s.to,s.next()}}static of(e,n=!1){let i=new Un;for(let l of e instanceof rn?[e]:n?wf(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return ge.empty;let n=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=ge.empty;l=l.nextLayer)n=new ge(l.chunkPos,l.chunk,n,Math.max(l.maxPoint,n.maxPoint));return n}}ge.empty=new ge([],[],null,-1);function wf(a){if(a.length>1)for(let e=a[0],n=1;n<a.length;n++){let i=a[n];if(Pi(e,i)>0)return a.slice().sort(Pi);e=i}return a}ge.empty.nextLayer=ge.empty;class Un{finishChunk(e){this.chunks.push(new Li(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,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new Un)).add(e,n,i)}addInner(e,n,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.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(n-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+e,this.lastTo=n.to[i]+e,!0}finish(){return this.finishInner(ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Do(a,e,n){let i=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&i.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=i.get(o.chunk[s]);r!=null&&(n?n.mapPos(r):r)==o.chunkPos[s]&&!n?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class $o{constructor(e,n,i,l=0){this.layer=e,this.skip=n,this.minPoint=i,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,i){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++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!i||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],i=e+n.from[this.rangeIndex];if(this.from=i,this.to=e+n.to[this.rangeIndex],this.value=n.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 cn{constructor(e){this.heap=e}static from(e,n=null,i=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&l.push(new $o(s,n,i,o));return l.length==1?l[0]:new cn(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let i of this.heap)i.goto(e,n);for(let i=this.heap.length>>1;i>=0;i--)Ui(this.heap,i);return this.next(),this}forward(e,n){for(let i of this.heap)i.forward(e,n);for(let i=this.heap.length>>1;i>=0;i--)Ui(this.heap,i);(this.to-e||this.value.endSide-n)<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(),Ui(this.heap,0)}}}function Ui(a,e){for(let n=a[e];;){let i=(e<<1)+1;if(i>=a.length)break;let l=a[i];if(i+1<a.length&&l.compare(a[i+1])>=0&&(l=a[i+1],i++),n.compare(l)<0)break;a[i]=n,a[e]=l,e=i}}class dn{constructor(e,n,i){this.minPoint=i,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=cn.from(e,n,i)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){jn(this.active,e),jn(this.activeTo,e),jn(this.activeRank,e),this.minActive=Lo(this.active,this.activeTo)}addActive(e){let n=0,{value:i,to:l,rank:o}=this.cursor;for(;n<this.activeRank.length&&(o-this.activeRank[n]||l-this.activeTo[n])>0;)n++;zn(this.active,n,i),zn(this.activeTo,n,l),zn(this.activeRank,n,o),e&&zn(e,n,this.cursor.from),this.minActive=Lo(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let i=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),i&&jn(i,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(i),this.cursor.next();else if(n&&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(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(e){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)n++;return n}}function Po(a,e,n,i,l,o){a.goto(e),n.goto(i);let s=i+l,r=i,c=i-e;for(;;){let d=a.to+c-n.to,h=d||a.endSide-n.endSide,f=h<0?a.to+c:n.to,u=Math.min(f,s);if(a.point||n.point?a.point&&n.point&&(a.point==n.point||a.point.eq(n.point))&&ji(a.activeForPoint(a.to),n.activeForPoint(n.to))||o.comparePoint(r,u,a.point,n.point):u>r&&!ji(a.active,n.active)&&o.compareRange(r,u,a.active,n.active),f>s)break;(d||a.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(f),r=f,h<=0&&a.next(),h>=0&&n.next()}}function ji(a,e){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(a[n]!=e[n]&&!a[n].eq(e[n]))return!1;return!0}function jn(a,e){for(let n=e,i=a.length-1;n<i;n++)a[n]=a[n+1];a.pop()}function zn(a,e,n){for(let i=a.length-1;i>=e;i--)a[i+1]=a[i];a[e]=n}function Lo(a,e){let n=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||a[l].endSide-a[n].endSide)<0&&(n=l,i=e[l]);return n}function Af(a,e,n,i){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?n-o%n:1,l=st(a,l)}return i===!0?-1:a.length}const zi="ͼ",Uo=typeof Symbol>"u"?"__"+zi:Symbol.for(zi),qi=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),jo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class wt{constructor(e,n){this.rules=[];let{finish:i}=n||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,d){let h=[],f=/^@(\w+)\b/.exec(s[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return c.push(s[0]+";");for(let m in r){let g=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(w=>s.map(v=>w.replace(/&/,v))).reduce((w,v)=>w.concat(v)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),g,h,u)}else g!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+g+";")}(h.length||u)&&c.push((i&&!f&&!d?s.map(i):s).join(", ")+" {"+h.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
|
|
19
|
+
`)}static newName(){let e=jo[Uo]||1;return jo[Uo]=e+1,zi+e.toString(36)}static mount(e,n,i){let l=e[qi],o=i&&i.nonce;l?o&&l.setNonce(o):l=new xf(e,o),l.mount(Array.isArray(n)?n:[n],e)}}let zo=new Map;class xf{constructor(e,n){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=zo.get(i);if(o)return e[qi]=o;this.sheet=new l.CSSStyleSheet,zo.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[qi]=this}mount(e,n){let i=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),i)for(let d=0;d<r.rules.length;d++)i.insertRule(r.rules[d],l++)}else{for(;o<c;)l+=this.modules[o++].rules.length;l+=r.rules.length,o++}}if(i)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.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=n.head||n;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 Ut={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:"'"},Qi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Se=0;Se<10;Se++)Ut[48+Se]=Ut[96+Se]=String(Se);for(var Se=1;Se<=24;Se++)Ut[Se+111]="F"+Se;for(var Se=65;Se<=90;Se++)Ut[Se]=String.fromCharCode(Se+32),Qi[Se]=String.fromCharCode(Se);for(var Wi in Ut)Qi.hasOwnProperty(Wi)||(Qi[Wi]=Ut[Wi]);function hn(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Ki(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function qn(a,e){if(!e.anchorNode)return!1;try{return Ki(a,e.anchorNode)}catch{return!1}}function fn(a){return a.nodeType==3?_t(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function un(a,e,n,i){return n?qo(a,e,n,i,-1)||qo(a,e,n,i,1):!1}function Ot(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Qn(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function qo(a,e,n,i,l){for(;;){if(a==n&&e==i)return!0;if(e==(l<0?0:Xe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=Ot(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?Xe(a):0}else return!1}}function Xe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Wn(a,e){let n=e?a.left:a.right;return{left:n,right:n,top:a.top,bottom:a.bottom}}function vf(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 Qo(a,e){let n=e.width/a.offsetWidth,i=e.height/a.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-a.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-a.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function Cf(a,e,n,i,l,o,s,r){let c=a.ownerDocument,d=c.defaultView||window;for(let h=a,f=!1;h&&!f;)if(h.nodeType==1){let u,m=h==c.body,g=1,w=1;if(m)u=vf(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let A=h.getBoundingClientRect();({scaleX:g,scaleY:w}=Qo(h,A)),u={left:A.left,right:A.left+h.clientWidth*g,top:A.top,bottom:A.top+h.clientHeight*w}}let v=0,y=0;if(l=="nearest")e.top<u.top?(y=e.top-(u.top+s),n>0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+s)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+s,n<0&&e.top-y<u.top&&(y=e.top-(u.top+s)));else{let A=e.bottom-e.top,V=u.bottom-u.top;y=(l=="center"&&A<=V?e.top+A/2-V/2:l=="start"||l=="center"&&n<0?e.top-s:e.bottom-V+s)-u.top}if(i=="nearest"?e.left<u.left?(v=e.left-(u.left+o),n>0&&e.right>u.right+v&&(v=e.right-u.right+o)):e.right>u.right&&(v=e.right-u.right+o,n<0&&e.left<u.left+v&&(v=e.left-(u.left+o))):v=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-o:e.right-(u.right-u.left)+o)-u.left,v||y)if(m)d.scrollBy(v,y);else{let A=0,V=0;if(y){let k=h.scrollTop;h.scrollTop+=y/w,V=(h.scrollTop-k)*w}if(v){let k=h.scrollLeft;h.scrollLeft+=v/g,A=(h.scrollLeft-k)*g}e={left:e.left-A,top:e.top-V,right:e.right-A,bottom:e.bottom-V},A&&Math.abs(A-v)<1&&(i="nearest"),V&&Math.abs(V-y)<1&&(l="nearest")}if(m)break;(e.top<u.top||e.bottom>u.bottom||e.left<u.left||e.right>u.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function Sf(a){let e=a.ownerDocument,n,i;for(let l=a.parentNode;l&&!(l==e.body||n&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=l),!n&&l.scrollWidth>l.clientWidth&&(n=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:n,y:i}}class Bf{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:n,focusNode:i}=e;this.set(n,Math.min(e.anchorOffset,n?Xe(n):0),i,Math.min(e.focusOffset,i?Xe(i):0))}set(e,n,i,l){this.anchorNode=e,this.anchorOffset=n,this.focusNode=i,this.focusOffset=l}}let jt=null;function Wo(a){if(a.setActive)return a.setActive();if(jt)return a.focus(jt);let e=[];for(let n=a;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(a.focus(jt==null?{get preventScroll(){return jt={preventScroll:!0},!0}}:void 0),!jt){jt=!1;for(let n=0;n<e.length;){let i=e[n++],l=e[n++],o=e[n++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=o&&(i.scrollLeft=o)}}}let Ko;function _t(a,e,n=e){let i=Ko||(Ko=document.createRange());return i.setEnd(a,n),i.setStart(a,e),i}function zt(a,e,n,i){let l={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);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 Nf(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Yo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function Vf(a,e){let n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,Xe(n));;)if(i){if(n.nodeType!=1)return!1;let l=n.childNodes[i-1];l.contentEditable=="false"?i--:(n=l,i=Xe(n))}else{if(n==a)return!0;i=Ot(n),n=n.parentNode}}function Ho(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function Go(a,e){for(let n=a,i=e;;){if(n.nodeType==3&&i>0)return{node:n,offset:i};if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=Xe(n)}else if(n.parentNode&&!Qn(n))i=Ot(n),n=n.parentNode;else return null}}function Jo(a,e){for(let n=a,i=e;;){if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!Qn(n))i=Ot(n)+1,n=n.parentNode;else return null}}class Ee{constructor(e,n,i=!0){this.node=e,this.offset=n,this.precise=i}static before(e,n){return new Ee(e.parentNode,Ot(e),n)}static after(e,n){return new Ee(e.parentNode,Ot(e)+1,n)}}const Yi=[];class he{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 n=this.posAtStart;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let i=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:i.firstChild)){let r=he.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,n),s.flags&=-8}if(o=l?l.nextSibling:i.firstChild,n&&!n.written&&n.node==i&&o!=s.dom&&(n.written=!0),s.dom.parentNode==i)for(;o&&o!=s.dom;)o=Xo(o);else i.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:i.firstChild,o&&n&&n.node==i&&(n.written=!0);o;)o=Xo(o)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,n),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let i;if(e==this.dom)i=this.dom.childNodes[n];else{let l=Xe(e)==0?0:n==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?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!he.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==i)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,n,i=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,d=i,h=i;c<this.children.length;c++){let f=this.children[c],u=d+f.length;if(d<e&&u>n)return f.domBoundsAround(e,n,d);if(u>=e&&l==-1&&(l=c,o=d),d>n&&f.dom.parentNode==this.dom){s=c,r=h;break}h=u,d=u+f.breakAfter}return{from:o,to:r<0?i+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 n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.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 n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,i=Yi){this.markDirty();for(let l=e;l<n;l++){let o=this.children[l];o.parent==this&&i.indexOf(o)<0&&o.destroy()}i.length<250?this.children.splice(e,n-e,...i):this.children=[].concat(this.children.slice(0,e),i,this.children.slice(n));for(let l=0;l<i.length;l++)i[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,n=1){return this.childCursor().findPos(e,n)}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,n,i,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}}he.prototype.breakAfter=0;function Xo(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Zo{constructor(e,n,i){this.children=e,this.pos=n,this.i=i,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function es(a,e,n,i,l,o,s,r,c){let{children:d}=a,h=d.length?d[e]:null,f=o.length?o[o.length-1]:null,u=f?f.breakAfter:s;if(!(e==i&&h&&!s&&!u&&o.length<2&&h.merge(n,l,o.length?f:null,n==0,r,c))){if(i<d.length){let m=d[i];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&f&&m.merge(0,l,f,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(f?f.breakAfter=1:s=1),i++}for(h&&(h.breakAfter=s,n>0&&(!s&&o.length&&h.merge(n,h.length,o[0],!1,r,0)?h.breakAfter=o.shift().breakAfter:(n<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(n,h.length,null,!1,r,0),e++));e<i&&o.length;)if(d[i-1].become(o[o.length-1]))i--,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&&i<d.length&&!d[e-1].breakAfter&&d[i].merge(0,0,d[e-1],!1,r,c)&&e--,(e<i||o.length)&&a.replaceChildren(e,i,o)}}function ts(a,e,n,i,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(n,1),{i:d,off:h}=s.findPos(e,-1),f=e-n;for(let u of i)f+=u.length;a.length+=f,es(a,d,h,r,c,i,0,l,o)}let Fe=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Hi=typeof document<"u"?document:{documentElement:{style:{}}};const Gi=/Edge\/(\d+)/.exec(Fe.userAgent),ns=/MSIE \d/.test(Fe.userAgent),Ji=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fe.userAgent),Kn=!!(ns||Ji||Gi),is=!Kn&&/gecko\/(\d+)/i.test(Fe.userAgent),Xi=!Kn&&/Chrome\/(\d+)/.exec(Fe.userAgent),ls="webkitFontSmoothing"in Hi.documentElement.style,os=!Kn&&/Apple Computer/.test(Fe.vendor),ss=os&&(/Mobile\/\w+/.test(Fe.userAgent)||Fe.maxTouchPoints>2);var J={mac:ss||/Mac/.test(Fe.platform),windows:/Win/.test(Fe.platform),linux:/Linux|X11/.test(Fe.platform),ie:Kn,ie_version:ns?Hi.documentMode||6:Ji?+Ji[1]:Gi?+Gi[1]:0,gecko:is,gecko_version:is?+(/Firefox\/(\d+)/.exec(Fe.userAgent)||[0,0])[1]:0,chrome:!!Xi,chrome_version:Xi?+Xi[1]:0,ios:ss,android:/Android\b/.test(Fe.userAgent),webkit:ls,safari:os,webkit_version:ls?+(/\bAppleWebKit\/(\d+)/.exec(Fe.userAgent)||[0,0])[1]:0,tabSize:Hi.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Rf=256;class qe extends he{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,i){return this.flags&8||i&&(!(i instanceof qe)||this.length-(n-e)+i.length>Rf||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new qe(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Ee(this.dom,e)}domBoundsAround(e,n,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return Ef(this.dom,e,n)}}class ct extends he{constructor(e,n=[],i=0){super(),this.mark=e,this.children=n,this.length=i;for(let l of n)l.setParent(this)}setAttrs(e){if(Yo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);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,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,i,l,o,s){return i&&(!(i instanceof ct&&i.mark.eq(this.mark))||e&&o<=0||n<this.length&&s<=0)?!1:(ts(this,e,n,i?i.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let n=[],i=0,l=-1,o=0;for(let r of this.children){let c=i+r.length;c>e&&n.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=o),i=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new ct(this.mark,n,s)}domAtPos(e){return as(this,e)}coordsAt(e,n){return cs(this,e,n)}}function Ef(a,e,n){let i=a.nodeValue.length;e>i&&(e=i);let l=e,o=e,s=0;e==0&&n<0||e==i&&n>=0?J.chrome||J.gecko||(e?(l--,s=1):o<i&&(o++,s=-1)):n<0?l--:o<i&&o++;let r=_t(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:n>=0)?0:r.length-1];return J.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,d=>d.width)||c),s?Wn(c,s<0):c||null}class Mt extends he{static create(e,n,i){return new Mt(e,n,i)}constructor(e,n,i){super(),this.widget=e,this.length=n,this.side=i,this.prevWidget=null}split(e){let n=Mt.create(this.widget,this.length-e,this.side);return this.length-=e,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"))}getSide(){return this.side}merge(e,n,i,l,o,s){return i&&(!(i instanceof Mt)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}become(e){return e instanceof Mt&&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 ae.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,i=n&&n.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):ae.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ee.before(this.dom):Ee.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let i=this.widget.coordsAt(this.dom,e,n);if(i)return i;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 Wn(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 qt extends he{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof qt&&e.side==this.side}split(){return new qt(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?Ee.before(this.dom):Ee.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ae.empty}get isHidden(){return!0}}qe.prototype.children=Mt.prototype.children=qt.prototype.children=Yi;function as(a,e){let n=a.dom,{children:i}=a,l=0;for(let o=0;l<i.length;l++){let s=i[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==n)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=i[o-1];if(s.dom.parentNode==n)return s.domAtPos(s.length)}for(let o=l;o<i.length;o++){let s=i[o];if(s.dom.parentNode==n)return s.domAtPos(0)}return new Ee(n,0)}function rs(a,e,n){let i,{children:l}=a;n>0&&e instanceof ct&&l.length&&(i=l[l.length-1])instanceof ct&&i.mark.eq(e.mark)?rs(i,e.children[0],n-1):(l.push(e),e.setParent(a)),a.length+=e.length}function cs(a,e,n){let i=null,l=-1,o=null,s=-1;function r(d,h){for(let f=0,u=0;f<d.children.length&&u<=h;f++){let m=d.children[f],g=u+m.length;g>=h&&(m.children.length?r(m,h-u):(!o||o.isHidden&&(n>0||_f(o,m)))&&(g>h||u==g&&m.getSide()>0)?(o=m,s=h-u):(u<h||u==g&&m.getSide()<0&&!m.isHidden)&&(i=m,l=h-u)),u=g}}r(a,e);let c=(n<0?i:o)||i||o;return c?c.coordsAt(Math.max(0,c==i?l:s),n):Of(a)}function Of(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let n=fn(e);return n[n.length-1]||null}function _f(a,e){let n=a.coordsAt(0,1),i=e.coordsAt(0,1);return n&&i&&i.top<n.bottom}function Zi(a,e){for(let n in a)n=="class"&&e.class?e.class+=" "+a.class:n=="style"&&e.style?e.style+=";"+a.style:e[n]=a[n];return e}const ds=Object.create(null);function Yn(a,e,n){if(a==e)return!0;a||(a=ds),e||(e=ds);let i=Object.keys(a),l=Object.keys(e);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=l.length-(n&&l.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function el(a,e,n){let i=!1;if(e)for(let l in e)n&&l in n||(i=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(n)for(let l in n)e&&e[l]==n[l]||(i=!0,l=="style"?a.style.cssText=n[l]:a.setAttribute(l,n[l]));return i}function Mf(a){let e=Object.create(null);for(let n=0;n<a.attributes.length;n++){let i=a.attributes[n];e[i.name]=i.value}return e}class tl{eq(e){return!1}updateDOM(e,n){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,n,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ze=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Ze||(Ze={}));class Oe extends Lt{constructor(e,n,i,l){super(),this.startSide=e,this.endSide=n,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new pn(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return n+=i&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new At(e,n,n,i,e.widget||null,!1)}static replace(e){let n=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:s}=hs(e,n);i=(o?n?-3e8:-1:5e8)-1,l=(s?n?2e8:1:-6e8)+1}return new At(e,i,l,n,e.widget||null,!0)}static line(e){return new mn(e)}static set(e,n=!1){return ge.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Oe.none=ge.empty;class pn extends Oe{constructor(e){let{start:n,end:i}=hs(e);super(n?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,i;return this==e||e instanceof pn&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Yn(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}pn.prototype.point=!1;class mn extends Oe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof mn&&this.spec.class==e.spec.class&&Yn(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}mn.prototype.mapMode=Ie.TrackBefore,mn.prototype.point=!0;class At extends Oe{constructor(e,n,i,l,o,s){super(n,i,o,e),this.block=l,this.isReplace=s,this.mapMode=l?n<=0?Ie.TrackBefore:Ie.TrackAfter:Ie.TrackDel}get type(){return this.startSide!=this.endSide?Ze.WidgetRange:this.startSide<=0?Ze.WidgetBefore:Ze.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof At&&Ff(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}At.prototype.point=!0;function hs(a,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=a;return n==null&&(n=a.inclusive),i==null&&(i=a.inclusive),{start:n??e,end:i??e}}function Ff(a,e){return a==e||!!(a&&e&&a.compare(e))}function Hn(a,e,n,i=0){let l=n.length-1;l>=0&&n[l]+i>=a?n[l]=Math.max(n[l],e):n.push(a,e)}class Ae extends he{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,i,l,o,s){if(i){if(!(i instanceof Ae))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),ts(this,e,n,i?i.children.slice():[],o,s),!0}split(e){let n=new Ae;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i,off:l}=this.childPos(e);l&&(n.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let o=i;o<this.children.length;o++)n.append(this.children[o],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,n}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){Yn(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){rs(this,e,n)}addLineDeco(e){let n=e.spec.attributes,i=e.spec.class;n&&(this.attrs=Zi(n,this.attrs||{})),i&&(this.attrs=Zi({class:i},this.attrs||{}))}domAtPos(e){return as(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var i;this.dom?this.flags&4&&(Yo(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&&(el(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let l=this.dom.lastChild;for(;l&&he.get(l)instanceof ct;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=he.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!J.ios||!this.children.some(o=>o instanceof qe))){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,n;for(let i of this.children){if(!(i instanceof qe)||/[^ -~]/.test(i.text))return null;let l=fn(i.dom);if(l.length!=1)return null;e+=l[0].width,n=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let i=cs(this,e,n);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=i.bottom-i.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:i.top+s,bottom:i.bottom-s,left:i.left,right:i.left}}}return i}become(e){return e instanceof Ae&&this.children.length==0&&e.children.length==0&&Yn(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,n){for(let i=0,l=0;i<e.children.length;i++){let o=e.children[i],s=l+o.length;if(s>=n){if(o instanceof Ae)return o;if(s>n)break}l=s+o.breakAfter}return null}}class dt extends he{constructor(e,n,i){super(),this.widget=e,this.length=n,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,n,i,l,o,s){return i&&(!(i instanceof dt)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Ee.before(this.dom):Ee.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let i=new dt(this.widget,n,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return Yi}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):ae.empty}domBoundsAround(){return null}become(e){return e instanceof dt&&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,n){let i=this.widget.coordsAt(this.dom,e,n);return i||(this.widget instanceof nl?null:Wn(this.dom.getBoundingClientRect(),this.length?e==0:n<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:n,endSide:i}=this.deco;return n==i?!1:e<0?n<0:i>0}}class nl extends tl{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 gn{constructor(e,n,i,l){this.doc=e,this.pos=n,this.end=i,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=n}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 dt&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ae),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Gn(new qt(-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 dt)&&this.getLine()}buildText(e,n,i){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(n.slice(n.length-i)),this.getLine().append(Gn(new qe(this.text.slice(this.textOff,this.textOff+l)),n),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,n,i,l){this.buildText(n-e,i,l),this.pos=n,this.openStart<0&&(this.openStart=l)}point(e,n,i,l,o,s){if(this.disallowBlockEffectsFor[s]&&i instanceof At){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=n-e;if(i instanceof At)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new dt(i.widget||Qt.block,r,i));else{let c=Mt.create(i.widget||Qt.inline,r,r?0:i.startSide),d=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<n||i.startSide>0),h=!c.isEditable&&(e<n||o>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!d&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),d&&(f.append(Gn(new qt(1),l),o),o=l.length+Math.max(0,o-l.length)),f.append(Gn(c,l),o),this.atCursorPos=h,this.pendingBuffer=h?e<n||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);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=n),this.openStart<0&&(this.openStart=o)}static build(e,n,i,l,o){let s=new gn(e,n,i,o);return s.openEnd=ge.spans(l,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Gn(a,e){for(let n of e)a=new ct(n,[a],a.length);return a}class Qt extends tl{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Qt.inline=new Qt("span"),Qt.block=new Qt("div");var Be=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(Be||(Be={}));const Ft=Be.LTR,il=Be.RTL;function fs(a){let e=[];for(let n=0;n<a.length;n++)e.push(1<<+a[n]);return e}const Tf=fs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),If=fs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ll=Object.create(null),et=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),n=a.charCodeAt(1);ll[e]=n,ll[n]=-e}function us(a){return a<=247?Tf[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?If[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Df=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class xt{get dir(){return this.level%2?il:Ft}constructor(e,n,i){this.from=e,this.to=n,this.level=i}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,i,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=n&&r.to>=n){if(r.level==i)return s;(o<0||(l!=0?l<0?r.from<n:r.to>n:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ps(a,e){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++){let i=a[n],l=e[n];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!ps(i.inner,l.inner))return!1}return!0}const fe=[];function $f(a,e,n,i,l){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:e,r=o<i.length?i[o].from:n,c=o?256:l;for(let d=s,h=c,f=c;d<r;d++){let u=us(a.charCodeAt(d));u==512?u=h:u==8&&f==4&&(u=16),fe[d]=u==4?2:u,u&7&&(f=u),h=u}for(let d=s,h=c,f=c;d<r;d++){let u=fe[d];if(u==128)d<r-1&&h==fe[d+1]&&h&24?u=fe[d]=h:fe[d]=256;else if(u==64){let m=d+1;for(;m<r&&fe[m]==64;)m++;let g=d&&h==8||m<n&&fe[m]==8?f==1?1:8:256;for(let w=d;w<m;w++)fe[w]=g;d=m-1}else u==8&&f==1&&(fe[d]=1);h=u,u&7&&(f=u)}}}function Pf(a,e,n,i,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=i.length;s++){let d=s?i[s-1].to:e,h=s<i.length?i[s].from:n;for(let f=d,u,m,g;f<h;f++)if(m=ll[u=a.charCodeAt(f)])if(m<0){for(let w=r-3;w>=0;w-=3)if(et[w+1]==-m){let v=et[w+2],y=v&2?l:v&4?v&1?o:l:0;y&&(fe[f]=fe[et[w]]=y),r=w;break}}else{if(et.length==189)break;et[r++]=f,et[r++]=u,et[r++]=c}else if((g=fe[f])==2||g==1){let w=g==l;c=w?0:1;for(let v=r-3;v>=0;v-=3){let y=et[v+2];if(y&2)break;if(w)et[v+2]|=2;else{if(y&4)break;et[v+2]|=4}}}}}function Lf(a,e,n,i){for(let l=0,o=i;l<=n.length;l++){let s=l?n[l-1].to:a,r=l<n.length?n[l].from:e;for(let c=s;c<r;){let d=fe[c];if(d==256){let h=c+1;for(;;)if(h==r){if(l==n.length)break;h=n[l++].to,r=l<n.length?n[l].from:e}else if(fe[h]==256)h++;else break;let f=o==1,u=(h<e?fe[h]:i)==1,m=f==u?f?1:2:i;for(let g=h,w=l,v=w?n[w-1].to:a;g>c;)g==v&&(g=n[--w].from,v=w?n[w-1].to:a),fe[--g]=m;c=h}else o=d,c++}}}function ol(a,e,n,i,l,o,s){let r=i%2?2:1;if(i%2==l%2)for(let c=e,d=0;c<n;){let h=!0,f=!1;if(d==o.length||c<o[d].from){let w=fe[c];w!=r&&(h=!1,f=w==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,g=c;e:for(;;)if(d<o.length&&g==o[d].from){if(f)break e;let w=o[d];if(!h)for(let v=w.to,y=d+1;;){if(v==n)break e;if(y<o.length&&o[y].from==v)v=o[y++].to;else{if(fe[v]==r)break e;break}}if(d++,u)u.push(w);else{w.from>c&&s.push(new xt(c,w.from,m));let v=w.direction==Ft!=!(m%2);sl(a,v?i+1:i,l,w.inner,w.from,w.to,s),c=w.to}g=w.to}else{if(g==n||(h?fe[g]!=r:fe[g]==r))break;g++}u?ol(a,c,g,i+1,l,u,s):c<g&&s.push(new xt(c,g,m)),c=g}else for(let c=n,d=o.length;c>e;){let h=!0,f=!1;if(!d||c>o[d-1].to){let w=fe[c-1];w!=r&&(h=!1,f=w==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,g=c;e:for(;;)if(d&&g==o[d-1].to){if(f)break e;let w=o[--d];if(!h)for(let v=w.from,y=d;;){if(v==e)break e;if(y&&o[y-1].to==v)v=o[--y].from;else{if(fe[v-1]==r)break e;break}}if(u)u.push(w);else{w.to<c&&s.push(new xt(w.to,c,m));let v=w.direction==Ft!=!(m%2);sl(a,v?i+1:i,l,w.inner,w.from,w.to,s),c=w.from}g=w.from}else{if(g==e||(h?fe[g-1]!=r:fe[g-1]==r))break;g--}u?ol(a,g,c,i+1,l,u,s):g<c&&s.push(new xt(g,c,m)),c=g}}function sl(a,e,n,i,l,o,s){let r=e%2?2:1;$f(a,l,o,i,r),Pf(a,l,o,i,r),Lf(l,o,i,r),ol(a,l,o,e,n,i,s)}function Uf(a,e,n){if(!a)return[new xt(0,0,e==il?1:0)];if(e==Ft&&!n.length&&!Df.test(a))return ms(a.length);if(n.length)for(;a.length>fe.length;)fe[fe.length]=256;let i=[],l=e==Ft?0:1;return sl(a,l,l,n,0,a.length,i),i}function ms(a){return[new xt(0,a,0)]}let gs="";function jf(a,e,n,i,l){var o;let s=i.head-a.from,r=xt.find(e,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),c=e[r],d=c.side(l,n);if(s==d){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;c=e[r=u],s=c.side(!l,n),d=c.side(l,n)}let h=st(a.text,s,c.forward(l,n));(h<c.from||h>c.to)&&(h=d),gs=a.text.slice(Math.min(s,h),Math.max(s,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==d&&f.level+(l?0:1)<c.level?X.cursor(f.side(!l,n)+a.from,f.forward(l,n)?1:-1,f.level):X.cursor(h+a.from,c.forward(l,n)?-1:1,c.level)}function zf(a,e,n){for(let i=e;i<n;i++){let l=us(a.charCodeAt(i));if(l==1)return Ft;if(l==2||l==4)return il}return Ft}const bs=ne.define(),ks=ne.define(),ys=ne.define(),ws=ne.define(),al=ne.define(),As=ne.define(),xs=ne.define(),rl=ne.define(),cl=ne.define(),vs=ne.define({combine:a=>a.some(e=>e)}),qf=ne.define({combine:a=>a.some(e=>e)}),Cs=ne.define();class Wt{constructor(e,n="nearest",i="nearest",l=5,o=5,s=!1){this.range=e,this.y=n,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Wt(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 Wt(X.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Jn=xe.define({map:(a,e)=>a.map(e)}),Ss=xe.define();function tt(a,e,n){let i=a.facet(ws);i.length?i[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const ht=ne.define({combine:a=>a.length?a[0]:!0});let Qf=0;const Kt=ne.define({combine(a){return a.filter((e,n)=>{for(let i=0;i<n;i++)if(a[i].plugin==e.plugin)return!1;return!0})}});class Yt{constructor(e,n,i,l,o){this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Kt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Kt.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:i,eventObservers:l,provide:o,decorations:s}=n||{};return new Yt(Qf++,e,i,l,r=>{let c=[];return s&&c.push(bn.of(d=>{let h=d.plugin(r);return h?s(h):Oe.none})),o&&c.push(o(r)),c})}static fromClass(e,n){return Yt.define((i,l)=>new e(i,l),n)}}class dl{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 n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(tt(n.state,i,"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(n){tt(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){tt(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Bs=ne.define(),hl=ne.define(),bn=ne.define(),Ns=ne.define(),fl=ne.define(),Vs=ne.define();function Rs(a,e){let n=a.state.facet(Vs);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(a):o),l=[];return ge.spans(i,e.from,e.to,{point(){},span(o,s,r,c){let d=o-e.from,h=s-e.from,f=l;for(let u=r.length-1;u>=0;u--,c--){let m=r[u].spec.bidiIsolate,g;if(m==null&&(m=zf(e.text,d,h)),c>0&&f.length&&(g=f[f.length-1]).to==d&&g.direction==m)g.to=h,f=g.inner;else{let w={from:d,to:h,direction:m,inner:[]};f.push(w),f=w.inner}}}}),l}const Es=ne.define();function Os(a){let e=0,n=0,i=0,l=0;for(let o of a.state.facet(Es)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(n=Math.max(n,s.right)),s.top!=null&&(i=Math.max(i,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:n,top:i,bottom:l}}const kn=ne.define();class Ue{constructor(e,n,i,l){this.fromA=e,this.toA=n,this.fromB=i,this.toB=l}join(e){return new Ue(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 n=e.length,i=this;for(;n>0;n--){let l=e[n-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(n-1,1)}}return e.splice(n,0,i),e}static extendWithRanges(e,n){if(n.length==0)return e;let i=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],d=s-r,h=c?c.fromB:1e9;for(;o<n.length&&n[o]<h;){let f=n[o],u=n[o+1],m=Math.max(r,f),g=Math.min(h,u);if(m<=g&&new Ue(m+d,g+d,m,g).addToSet(i),u>h)break;o+=2}if(!c)return i;new Ue(c.fromA,c.toA,c.fromB,c.toB).addToSet(i),s=c.toA,r=c.toB}}}class Xn{constructor(e,n,i){this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Ce.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new Ue(o,s,r,c))),this.changedRanges=l}static create(e,n,i){return new Xn(e,n,i)}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 _s extends he{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=Oe.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 Ae],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ue(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?l=this.domChanged.newSel.head:!Xf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Kf(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:d,to:h}=this.hasComposition;i=new Ue(d,h,e.changes.mapPos(d,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(J.ie||J.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=Gf(s,r,e.changes);return i=Ue.extendWithRanges(i,c),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,i);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=J.chrome||J.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 dt&&s.widget instanceof nl&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,n,i){let l=i?i.range.addToSet(e.slice()):e,o=this.childCursor(n);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:d,fromB:h,toB:f}=r,u,m,g,w;if(i&&i.range.fromB<f&&i.range.toB>h){let k=gn.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=gn.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,g=k.openStart,w=p.openEnd;let S=this.compositionView(i);p.breakAtStart?S.breakAfter=1:p.content.length&&S.merge(S.length,S.length,p.content[0],!1,p.openStart,0)&&(S.breakAfter=p.content[0].breakAfter,p.content.shift()),k.content.length&&S.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),u=k.content.concat(S).concat(p.content)}else({content:u,breakAtStart:m,openStart:g,openEnd:w}=gn.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:v,off:y}=o.findPos(d,1),{i:A,off:V}=o.findPos(c,-1);es(this,A,V,v,y,u,m,g,w)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let i of n.effects)i.is(Ss)&&(this.editContextFormatting=i.value)}compositionView(e){let n=new qe(e.text.nodeValue);n.flags|=8;for(let{deco:l}of e.marks)n=new ct(l,[n],n.length);let i=new Ae;return i.append(n,0),i}fixCompositionDOM(e){let n=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=he.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];n(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)i=l.childPos(i.off,1),l=l.children[i.i],n(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,o=!l&&!(this.view.state.facet(ht)||this.dom.tabIndex>-1)&&qn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||n||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(J.gecko&&r.empty&&!this.hasComposition&&Wf(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Ee(f,0),s=!0}let h=this.view.observer.selectionRange;(s||!h.focusNode||(!un(c.node,c.offset,h.anchorNode,h.anchorOffset)||!un(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{J.android&&J.chrome&&this.dom.contains(h.focusNode)&&Jf(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=hn(this.view.root);if(f)if(r.empty){if(J.gecko){let u=Yf(c.node,c.offset);if(u&&u!=3){let m=(u==1?Go:Jo)(c.node,c.offset);m&&(c=new Ee(m.node,m.offset))}}f.collapse(c.node,c.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([c,d]=[d,c]),u.setEnd(d.node,d.offset),u.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(u)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Ee(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Ee(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&un(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,i=hn(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!n.empty||!n.assoc||!i.modify)return;let s=Ae.find(this,n.head);if(!s)return;let r=s.posAtStart;if(n.head==r||n.head==r+s.length)return;let c=this.coordsAt(n.head,-1),d=this.coordsAt(n.head,1);if(!c||!d||c.bottom>d.top)return;let h=this.domAtPos(n.head+n.assoc);i.collapse(h.node,h.offset),i.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&i.collapse(l,o)}moveToLine(e){let n=this.dom,i;if(e.node!=n)return e;for(let l=e.offset;!i&&l<n.childNodes.length;l++){let o=he.get(n.childNodes[l]);o instanceof Ae&&(i=o.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let o=he.get(n.childNodes[l]);o instanceof Ae&&(i=o.domAtPos(o.length))}return i?new Ee(i.node,i.offset,!0):e}nearest(e){for(let n=e;n;){let i=he.get(n);if(i&&i.rootView==this)return i;n=n.parentNode}return null}posFromDOM(e,n){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,n)+i.posAtStart}domAtPos(e){let{i:n,off:i}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let l=this.children[n];if(i<l.length||l instanceof Ae)break;n++,i=0}return this.children[n].domAtPos(i)}coordsAt(e,n){let i=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))&&(!i||r instanceof Ae&&!(i instanceof Ae&&n>=0)))i=r,l=d;else if(i&&d==e&&c==e&&r instanceof dt&&Math.abs(n)<2){if(r.deco.startSide<0)break;s&&(i=null)}o=d}return i?i.coordsAt(e-l,n):null}coordsForChar(e){let{i:n,off:i}=this.childPos(e,1),l=this.children[n];if(!(l instanceof Ae))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=c}if(!(l instanceof qe))return null;let o=st(l.text,i);if(o==i)return null;let s=_t(l.dom,i,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 n=[],{from:i,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==Be.LTR;for(let d=0,h=0;h<this.children.length;h++){let f=this.children[h],u=d+f.length;if(u>l)break;if(d>=i){let m=f.dom.getBoundingClientRect();if(n.push(m.height),s){let g=f.dom.lastChild,w=g?fn(g):[];if(w.length){let v=w[w.length-1],y=c?v.right-m.left:m.right-v.left;y>r&&(r=y,this.minWidth=o,this.minWidthFrom=d,this.minWidthTo=u)}}}d=u+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Be.RTL:Be.LTR}measureTextSize(){for(let o of this.children)if(o instanceof Ae){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),n,i,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=fn(e.firstChild)[0];n=e.getBoundingClientRect().height,i=o?o.width/27:7,l=o?o.height:n,e.remove()}),{lineHeight:n,charWidth:i,textHeight:l}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new Zo(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let i=0,l=0;;l++){let o=l==n.viewports.length?null:n.viewports[l],s=o?o.from-1:this.length;if(s>i){let r=(n.lineBlockAt(s).bottom-n.lineBlockAt(i).top)/this.view.scaleY;e.push(Oe.replace({widget:new nl(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return Oe.set(e)}updateDeco(){let e=1,n=this.view.state.facet(bn).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(Ns).map((o,s)=>{let r=typeof o=="function";return r&&(i=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,n.push(ge.join(l))),this.decorations=[this.editContextFormatting,...n,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(Cs))try{if(d(this.view,e.range,e))return!0}catch(h){tt(this.view.state,h,"scroll handler")}let{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),l;if(!i)return;!n.empty&&(l=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=Os(this.view),s={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;Cf(this.view.scrollDOM,s,n.head<n.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==Be.LTR)}}function Wf(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 Ms(a,e){let n=a.observer.selectionRange;if(!n.focusNode)return null;let i=Go(n.focusNode,n.focusOffset),l=Jo(n.focusNode,n.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let r=he.get(l.node);if(!r||r instanceof qe&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=he.get(i.node);!c||c instanceof qe&&c.text!=i.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Kf(a,e,n){let i=Ms(a,n);if(!i)return null;let{node:l,from:o,to:s}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(i.from,i.to)!=r)return null;let c=e.invertedDesc,d=new Ue(c.mapPos(o),c.mapPos(s),o,s),h=[];for(let f=l.parentNode;;f=f.parentNode){let u=he.get(f);if(u instanceof ct)h.push({node:f,deco:u.mark});else{if(u instanceof Ae||f.nodeName=="DIV"&&f.parentNode==a.contentDOM)return{range:d,text:l,marks:h,line:f};if(f!=a.contentDOM)h.push({node:f,deco:new pn({inclusive:!0,attributes:Mf(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Yf(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,n){Hn(e,n,this.changes)}comparePoint(e,n){Hn(e,n,this.changes)}boundChange(e){Hn(e,e,this.changes)}};function Gf(a,e,n){let i=new Hf;return ge.compare(a,e,n,i),i.changes}function Jf(a,e){for(let n=a;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Xf(a,e){let n=!1;return e&&a.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(n=!0)}),n}function Zf(a,e,n=1){let i=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return X.cursor(e);o==0?n=1:o==l.length&&(n=-1);let s=o,r=o;n<0?s=st(l.text,o,!1):r=st(l.text,o);let c=i(l.text.slice(s,r));for(;s>0;){let d=st(l.text,s,!1);if(i(l.text.slice(d,s))!=c)break;s=d}for(;r<l.length;){let d=st(l.text,r);if(i(l.text.slice(r,d))!=c)break;r=d}return X.range(s+l.from,r+l.from)}function eu(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function tu(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ul(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function Fs(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function Ts(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function pl(a,e,n){let i,l,o,s,r=!1,c,d,h,f;for(let g=a.firstChild;g;g=g.nextSibling){let w=fn(g);for(let v=0;v<w.length;v++){let y=w[v];l&&ul(l,y)&&(y=Fs(Ts(y,l.bottom),l.top));let A=eu(e,y),V=tu(n,y);if(A==0&&V==0)return g.nodeType==3?Is(g,e,n):pl(g,e,n);(!i||s>V||s==V&&o>A)&&(i=g,l=y,o=A,s=V,r=A?e<y.left?v>0:v<w.length-1:!0),A==0?n>y.bottom&&(!h||h.bottom<y.bottom)?(c=g,h=y):n<y.top&&(!f||f.top>y.top)&&(d=g,f=y):h&&ul(h,y)?h=Ts(h,y.bottom):f&&ul(f,y)&&(f=Fs(f,y.top))}}if(h&&h.bottom>=n?(i=c,l=h):f&&f.top<=n&&(i=d,l=f),!i)return{node:a,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return Is(i,u,n);if(r&&i.contentEditable!="false")return pl(i,u,n);let m=Array.prototype.indexOf.call(a.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function Is(a,e,n){let i=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<i;r++){let c=_t(a,r,r+1).getClientRects();for(let d=0;d<c.length;d++){let h=c[d];if(h.top==h.bottom)continue;s||(s=e-h.left);let f=(h.top>n?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<o){let u=e>=(h.left+h.right)/2,m=u;if((J.chrome||J.gecko)&&_t(a,r).getBoundingClientRect().left==h.right&&(m=!u),f<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=f}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function Ds(a,e,n,i=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:d}=a.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>d)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,p=!1;c=a.elementAtHeight(u),c.type!=Ze.Text;)for(;u=i>0?c.bottom+k:c.top-k,!(u>=0&&u<=d);){if(p)return n?null:0;p=!0,i=-i}f=r+u;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:n?null:$s(a,s,c,h,f);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:n?null:$s(a,s,c,h,f);let g=a.dom.ownerDocument,w=a.root.elementFromPoint?a.root:g,v=w.elementFromPoint(h,f);v&&!a.contentDOM.contains(v)&&(v=null),v||(h=Math.max(s.left+1,Math.min(s.right-1,h)),v=w.elementFromPoint(h,f),v&&!a.contentDOM.contains(v)&&(v=null));let y,A=-1;if(v&&((l=a.docView.nearest(v))===null||l===void 0?void 0:l.isEditable)!=!1){if(g.caretPositionFromPoint){let k=g.caretPositionFromPoint(h,f);k&&({offsetNode:y,offset:A}=k)}else if(g.caretRangeFromPoint){let k=g.caretRangeFromPoint(h,f);k&&({startContainer:y,startOffset:A}=k,(!a.contentDOM.contains(y)||J.safari&&nu(y,A,h)||J.chrome&&iu(y,A,h))&&(y=void 0))}y&&(A=Math.min(Xe(y),A))}if(!y||!a.docView.dom.contains(y)){let k=Ae.find(a.docView,m);if(!k)return u>c.top+c.height/2?c.to:c.from;({node:y,offset:A}=pl(k.dom,h,f))}let V=a.docView.nearest(y);if(!V)return null;if(V.isWidget&&((o=V.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=V.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(y,A)+V.posAtStart}function $s(a,e,n,i,l){let o=Math.round((i-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&n.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-n.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(n.from,n.to);return n.from+Af(s,o,a.state.tabSize)}function nu(a,e,n){let i,l=a;if(a.nodeType!=3||e!=(i=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 _t(a,i-1,i).getBoundingClientRect().right>n}function iu(a,e,n){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 i=a.nodeType==1?a.getBoundingClientRect():_t(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}function lu(a,e,n){let i=a.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Ze.Text&&(l.type!=o.type||(n<0?o.from<e:o.to>e)))&&(l=o)}}return l||i}return i}function ou(a,e,n,i){let l=lu(a,e.head,e.assoc||-1),o=!i||l.type!=Ze.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:n==(r==Be.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return X.cursor(c,n?-1:1)}return X.cursor(n?l.to:l.from,n?-1:1)}function Ps(a,e,n,i){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=jf(l,o,s,r,n),h=gs;if(!d){if(l.number==(n?a.state.doc.lines:1))return r;h=`
|
|
21
|
+
`,l=a.state.doc.line(l.number+(n?1:-1)),o=a.bidiSpans(l),d=a.visualLineSide(l,!n)}if(c){if(!c(h))return r}else{if(!i)return d;c=i(h)}r=d}}function su(a,e,n){let i=a.state.charCategorizer(e),l=i(n);return o=>{let s=i(o);return l==rt.Space&&(l=s),l==s}}function au(a,e,n,i){let l=e.head,o=n?1:-1;if(l==(n?a.state.doc.length:0))return X.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),d=a.coordsAtPos(l,e.assoc||-1),h=a.documentTop;if(d)s==null&&(s=d.left-c.left),r=o<0?d.top:d.bottom;else{let m=a.viewState.lineBlockAt(l);s==null&&(s=Math.min(c.right-c.left,a.defaultCharacterWidth*(l-m.from))),r=(o<0?m.top:m.bottom)+h}let f=c.left+s,u=i??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let g=r+(u+m)*o,w=Ds(a,{x:f,y:g},!1,o);if(g<c.top||g>c.bottom||(o<0?w<l:w>l)){let v=a.docView.coordsForChar(w),y=!v||g<v.top?-1:1;return X.cursor(w,y,void 0,s)}}}function Zn(a,e,n){for(;;){let i=0;for(let l of a)l.between(e-1,e+1,(o,s,r)=>{if(e>o&&e<s){let c=i||n||(e-o<s-e?-1:1);e=c<0?o:s,i=c}});if(!i)return e}}function ml(a,e,n){let i=Zn(a.state.facet(fl).map(l=>l(a)),n.from,e.head>n.from?-1:1);return i==n.from?n:X.cursor(i,i<n.from?1:-1)}const yn="";class ru{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(de.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=yn}readRange(e,n){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let o=this.text.length;this.readNode(l);let s=l.nextSibling;if(s==n)break;let r=he.get(l),c=he.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:Qn(l))||Qn(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(i,n),this}readTextNode(e){let n=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=n.indexOf(this.lineSeparator,i),s=this.lineSeparator.length):(r=l.exec(n))&&(o=r.index,s=r[0].length),this.append(n.slice(i,o<0?n.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);i=o+s}}readNode(e){if(e.cmIgnore)return;let n=he.get(e),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.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,n){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(e,n){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(cu(e,i.node,i.offset)?n:0))}}function cu(a,e,n){for(;;){if(!e||n<Xe(e))return!1;if(e==a)return!0;n=Ot(e)+1,e=e.parentNode}}class Ls{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class du{constructor(e,n,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){let r=o||s?[]:uu(e),c=new ru(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=pu(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Ki(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||!Ki(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((J.ios||J.chrome)&&e.state.selection.main.empty&&c!=d&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(c,d),u=Math.max(c,d),m=h.from-f,g=h.to-u;(m==0||m==1||f==0)&&(g==0||g==-1||u==e.state.doc.length)&&(c=0,d=e.state.doc.length)}this.newSel=X.single(d,c)}}}function Us(a,e){let n,{newSel:i}=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||J.android&&e.text.length<r-s)&&(c=l.to,d="end");let h=fu(a.state.doc.sliceString(s,r,yn),e.text,c-s,d);h&&(J.chrome&&o==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==yn+yn&&h.toB--,n={from:s+h.from,to:s+h.toA,insert:ae.of(e.text.slice(h.from,h.toB).split(yn))})}else i&&(!a.hasFocus&&a.state.facet(ht)||i.main.eq(l))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!l.empty&&i&&i.main.empty?n={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(J.mac||J.android)&&n&&n.from==n.to&&n.from==l.head-1&&/^\. ?$/.test(n.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(i&&n.insert.length==2&&(i=X.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:ae.of([n.insert.toString().replace("."," ")])}):n&&n.from>=l.from&&n.to<=l.to&&(n.from!=l.from||n.to!=l.to)&&l.to-l.from-(n.to-n.from)<=4?n={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,n.from).append(n.insert).append(a.state.doc.slice(n.to,l.to))}:J.chrome&&n&&n.from==n.to&&n.from==l.head&&n.insert.toString()==`
|
|
22
|
+
`&&a.lineWrapping&&(i&&(i=X.single(i.main.anchor-1,i.main.head-1)),n={from:l.from,to:l.to,insert:ae.of([" "])}),n)return gl(a,n,i,o);if(i&&!i.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:i,scrollIntoView:s,userEvent:r}),!0}else return!1}function gl(a,e,n,i=-1){if(J.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(J.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&&zt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&zt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&zt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=hu(a,e,n));return a.state.facet(As).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function hu(a,e,n){let i,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&&(!n||n.main.empty&&n.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):"";i=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=n&&n.main.to<=r.newLength?n.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let d=a.state.sliceDoc(e.from,e.to),h,f=n&&Ms(a,n.main.head);if(f){let g=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-g}}else h=a.state.doc.lineAt(o.head);let u=o.to-e.to,m=o.to-o.from;i=l.changeByRange(g=>{if(g.from==o.from&&g.to==o.to)return{changes:r,range:c||g.map(r)};let w=g.to-u,v=w-d.length;if(g.to-g.from!=m||a.state.sliceDoc(v,w)!=d||g.to>=h.from&&g.from<=h.to)return{range:g};let y=l.changes({from:v,to:w,insert:e.insert}),A=g.to-o.to;return{changes:y,range:c?X.range(Math.max(0,c.anchor+A),Math.max(0,c.head+A)):g.map(y)}})}else i={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(i,{userEvent:s,scrollIntoView:!0})}function fu(a,e,n,i){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(i=="end"){let c=Math.max(0,o-Math.min(s,r));n-=s+c-o}if(s<o&&a.length<e.length){let c=n<=o&&n>=s?o-n:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=n<=o&&n>=r?o-n:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function uu(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:l,focusOffset:o}=a.observer.selectionRange;return n&&(e.push(new Ls(n,i)),(l!=n||o!=i)&&e.push(new Ls(l,o))),e}function pu(a,e){if(a.length==0)return null;let n=a[0].pos,i=a.length==2?a[1].pos:n;return n>-1&&i>-1?X.single(n+e,i+e):null}class mu{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,J.safari&&e.contentDOM.addEventListener("input",()=>null),J.gecko&&_u(e.contentDOM.ownerDocument)}handleEvent(e){!Cu(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,n){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,n);for(let l of i.handlers){if(n.defaultPrevented)break;if(l(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=gu(e),i=this.handlers,l=this.view.contentDOM;for(let o in n)if(o!="scroll"){let s=!n[o].handlers.length,r=i[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 i)o!="scroll"&&!n[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=n}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&&ku.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),J.android&&J.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return J.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=zs.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||bu.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,zt(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:J.safari&&!J.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 js(a,e){return(n,i)=>{try{return e.call(a,i,n)}catch(l){tt(n.state,l)}}}function gu(a){let e=Object.create(null);function n(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of a){let l=i.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&n(r).handlers.push(js(i.value,c))}if(s)for(let r in s){let c=s[r];c&&n(r).observers.push(js(i.value,c))}}for(let i in Qe)n(i).handlers.push(Qe[i]);for(let i in je)n(i).observers.push(je[i]);return e}const zs=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],bu="dthko",ku=[16,17,18,20,91,92,224,225],ei=6;function ti(a){return Math.max(0,a)*.7+8}function yu(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class wu{constructor(e,n,i,l){this.view=e,this.startEvent=n,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Sf(e.contentDOM),this.atoms=e.state.facet(fl).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=n.shiftKey,this.multiple=e.state.facet(de.allowMultipleSelections)&&Au(e,n),this.dragging=vu(e,n)&&Xs(n)==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&&yu(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=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=Os(this.view);e.clientX-c.left<=l+ei?n=-ti(l-e.clientX):e.clientX+c.right>=s-ei&&(n=ti(e.clientX-s)),e.clientY-c.top<=o+ei?i=-ti(o-e.clientY):e.clientY+c.bottom>=r-ei&&(i=ti(e.clientY-r)),this.setScrollSpeed(n,i)}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,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let i=0;i<e.ranges.length;i++){let l=e.ranges[i],o=null;if(l.empty){let s=Zn(this.atoms,l.from,0);s!=l.from&&(o=X.cursor(s,-1))}else{let s=Zn(this.atoms,l.from,-1),r=Zn(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=X.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(n||(n=e.ranges.slice()),n[i]=o)}return n?X.create(n,e.mainIndex):e}select(e){let{view:n}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Au(a,e){let n=a.state.facet(bs);return n.length?n[0](e):J.mac?e.metaKey:e.ctrlKey}function xu(a,e){let n=a.state.facet(ks);return n.length?n[0](e):J.mac?!e.altKey:!e.ctrlKey}function vu(a,e){let{main:n}=a.state.selection;if(n.empty)return!1;let i=hn(a.root);if(!i||i.rangeCount==0)return!0;let l=i.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 Cu(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,i;n!=a.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=he.get(n))&&i.ignoreEvent(e))return!1;return!0}const Qe=Object.create(null),je=Object.create(null),qs=J.ie&&J.ie_version<15||J.ios&&J.webkit_version<604;function Su(a){let e=a.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{a.focus(),n.remove(),Qs(a,n.value)},50)}function ni(a,e,n){for(let i of a.facet(e))n=i(n,a);return n}function Qs(a,e){e=ni(a.state,rl,e);let{state:n}=a,i,l=1,o=n.toText(e),s=o.lines==n.selection.ranges.length;if(bl!=null&&n.selection.ranges.every(c=>c.empty)&&bl==o.toString()){let c=-1;i=n.changeByRange(d=>{let h=n.doc.lineAt(d.from);if(h.from==c)return{range:d};c=h.from;let f=n.toText((s?o.line(l++).text:e)+n.lineBreak);return{changes:{from:h.from,insert:f},range:X.cursor(d.from+f.length)}})}else s?i=n.changeByRange(c=>{let d=o.line(l++);return{changes:{from:c.from,to:c.to,insert:d.text},range:X.cursor(c.from+d.length)}}):i=n.replaceSelection(o);a.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}je.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Qe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),je.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},je.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Qe.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of a.state.facet(ys))if(n=i(a,e),n)break;if(!n&&e.button==0&&(n=Vu(a,e)),n){let i=!a.hasFocus;a.inputState.startMouseSelection(new wu(a,e,n,i)),i&&a.observer.ignore(()=>{Wo(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 Ws(a,e,n,i){if(i==1)return X.cursor(e,n);if(i==2)return Zf(a.state,e,n);{let l=Ae.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++,X.range(s,r)}}let Ks=(a,e,n)=>e>=n.top&&e<=n.bottom&&a>=n.left&&a<=n.right;function Bu(a,e,n,i){let l=Ae.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&&Ks(n,i,s))return-1;let r=l.coordsAt(o,1);return r&&Ks(n,i,r)?1:s&&s.bottom>=i?-1:1}function Ys(a,e){let n=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Bu(a,n,e.clientX,e.clientY)}}const Nu=J.ie&&J.ie_version<=11;let Hs=null,Gs=0,Js=0;function Xs(a){if(!Nu)return a.detail;let e=Hs,n=Js;return Hs=a,Js=Date.now(),Gs=!e||n>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(Gs+1)%3:1}function Vu(a,e){let n=Ys(a,e),i=Xs(e),l=a.state.selection;return{update(o){o.docChanged&&(n.pos=o.changes.mapPos(n.pos),l=l.map(o.changes))},get(o,s,r){let c=Ys(a,o),d,h=Ws(a,c.pos,c.bias,i);if(n.pos!=c.pos&&!s){let f=Ws(a,n.pos,n.bias,i),u=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=u<h.from?X.range(u,m):X.range(m,u)}return s?l.replaceRange(l.main.extend(h.from,h.to)):r&&i==1&&l.ranges.length>1&&(d=Ru(l,c.pos))?d:r?l.addRange(h):X.create([h])}}}function Ru(a,e){for(let n=0;n<a.ranges.length;n++){let{from:i,to:l}=a.ranges[n];if(i<=e&&l>=e)return X.create(a.ranges.slice(0,n).concat(a.ranges.slice(n+1)),a.mainIndex==n?0:a.mainIndex-(a.mainIndex>n?1:0))}return null}Qe.dragstart=(a,e)=>{let{selection:{main:n}}=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>=n.to||s<=n.from)&&(n=X.range(o,s))}}let{inputState:i}=a;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",ni(a.state,cl,a.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Qe.dragend=a=>(a.inputState.draggedContent=null,!1);function Zs(a,e,n,i){if(n=ni(a.state,rl,n),!n)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=i&&o&&xu(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:n},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}Qe.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),l=0,o=()=>{++l==n.length&&Zs(a,e,i.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[s]=r.result),o()},r.readAsText(n[s])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Zs(a,e,i,!0),!0}return!1},Qe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let n=qs?null:e.clipboardData;return n?(Qs(a,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Su(a),!1)};function Eu(a,e){let n=a.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),a.focus()},50)}function Ou(a){let e=[],n=[],i=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),n.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),n.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}i=!0}return{text:ni(a,cl,e.join(a.lineBreak)),ranges:n,linewise:i}}let bl=null;Qe.copy=Qe.cut=(a,e)=>{let{text:n,ranges:i,linewise:l}=Ou(a.state);if(!n&&!l)return!1;bl=l?n:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=qs?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(Eu(a,n),!1)};const ea=$t.define();function ta(a,e){let n=[];for(let i of a.facet(xs)){let l=i(a,e);l&&n.push(l)}return n.length?a.update({effects:n,annotations:ea.of(!0)}):null}function na(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let n=ta(a.state,e);n?a.dispatch(n):a.update([])}},10)}je.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),na(a)},je.blur=a=>{a.observer.clearSelectionRange(),na(a)},je.compositionstart=je.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},je.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,J.chrome&&J.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},je.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Qe.beforeinput=(a,e)=>{var n,i;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(n=e.dataTransfer)===null||n===void 0?void 0:n.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 gl(a,{from:c,to:d,insert:a.state.toText(o)},null),!0}}let l;if(J.chrome&&J.android&&(l=zs.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.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 J.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),J.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>je.compositionend(a,e),20),!1};const ia=new Set;function _u(a){ia.has(a)||(ia.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const la=["pre-wrap","normal","pre-line","break-spaces"];let Ht=!1;function oa(){Ht=!1}class Mu{constructor(e){this.lineWrapping=e,this.doc=ae.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let i=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((n-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 la.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(n=!0,this.heightSamples[Math.floor(l*10)]=!0)}return n}refresh(e,n,i,l,o,s){let r=la.indexOf(e)>-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=n,this.charWidth=i,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let d=0;d<s.length;d++){let h=s[d];h<0?d++:this.heightSamples[Math.floor(h*10)]=!0}}return c}}class Fu{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class nt{constructor(e,n,i,l,o){this.from=e,this.length=n,this.top=i,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Ze.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 At?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new nt(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var be=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(be||(be={}));const ii=.001;class _e{constructor(e,n,i=2){this.length=e,this.height=n,this.flags=i}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)>ii&&(Ht=!0),this.height=e)}replace(e,n,i){return _e.of(i)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,i,l){let o=this,s=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:d,fromB:h,toB:f}=l[r],u=o.lineAt(c,be.ByPosNoHeight,i.setDoc(n),0,0),m=u.to>=d?u:o.lineAt(d,be.ByPosNoHeight,i,0,0);for(f+=m.to-d,d=m.to;r>0&&u.from<=l[r-1].toA;)c=l[r-1].fromA,h=l[r-1].fromB,r--,c<u.from&&(u=o.lineAt(c,be.ByPosNoHeight,i,0,0));h+=u.from-c,c=u.from;let g=kl.build(i.setDoc(s),e,h,f);o=li(o,o.replace(c,d,g))}return o.updateHeight(i,0)}static empty(){return new De(0,0)}static of(e){if(e.length==1)return e[0];let n=0,i=e.length,l=0,o=0;for(;;)if(n==i)if(l>o*2){let r=e[n-1];r.break?e.splice(--n,1,r.left,null,r.right):e.splice(--n,1,r.left,r.right),i+=1+r.break,l-=r.size}else if(o>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[n++];r&&(l+=r.size)}else{let r=e[--i];r&&(o+=r.size)}let s=0;return e[n-1]==null?(s=1,n--):e[n]==null&&(s=1,i++),new Tu(_e.of(e.slice(0,n)),s,_e.of(e.slice(i)))}}function li(a,e){return a==e?a:(a.constructor!=e.constructor&&(Ht=!0),e)}_e.prototype.size=1;class sa extends _e{constructor(e,n,i){super(e,n),this.deco=i}blockAt(e,n,i,l){return new nt(l,this.length,i,this.height,this.deco||0)}lineAt(e,n,i,l,o){return this.blockAt(0,i,l,o)}forEachLine(e,n,i,l,o,s){e<=o+this.length&&n>=o&&s(this.blockAt(0,i,l,o))}updateHeight(e,n=0,i=!1,l){return l&&l.from<=n&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class De extends sa{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,i,l){return new nt(l,this.length,i,this.height,this.breaks)}replace(e,n,i){let l=i[0];return i.length==1&&(l instanceof De||l instanceof Ne&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof Ne?l=new De(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):_e.of(i)}updateHeight(e,n=0,i=!1,l){return l&&l.from<=n&&l.more?this.setHeight(l.heights[l.index++]):(i||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 Ne extends _e{constructor(e){super(e,0)}heightMetrics(e,n){let i=e.doc.lineAt(n).number,l=e.doc.lineAt(n+this.length).number,o=l-i+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:i,lastLine:l,perLine:s,perChar:r}}blockAt(e,n,i,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(n,l);if(n.lineWrapping){let d=l+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=n.doc.lineAt(d),f=r+h.length*c,u=Math.max(i,e-f/2);return new nt(h.from,h.length,u,f,0)}else{let d=Math.max(0,Math.min(s-o,Math.floor((e-i)/r))),{from:h,length:f}=n.doc.line(o+d);return new nt(h,f,i+r*d,r,0)}}lineAt(e,n,i,l,o){if(n==be.ByHeight)return this.blockAt(e,i,l,o);if(n==be.ByPosNoHeight){let{from:m,to:g}=i.doc.lineAt(e);return new nt(m,g-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(i,o),d=i.doc.lineAt(e),h=r+d.length*c,f=d.number-s,u=l+r*f+c*(d.from-o-f);return new nt(d.from,d.length,Math.max(l,Math.min(u,l+this.height-h)),h,0)}forEachLine(e,n,i,l,o,s){e=Math.max(e,o),n=Math.min(n,o+this.length);let{firstLine:r,perLine:c,perChar:d}=this.heightMetrics(i,o);for(let h=e,f=l;h<=n;){let u=i.doc.lineAt(h);if(h==e){let g=u.number-r;f+=c*g+d*(e-o-g)}let m=c+d*u.length;s(new nt(u.from,u.length,f,m,0)),f+=m,h=u.to+1}}replace(e,n,i){let l=this.length-n;if(l>0){let o=i[i.length-1];o instanceof Ne?i[i.length-1]=new Ne(o.length+l):i.push(null,new Ne(l-1))}if(e>0){let o=i[0];o instanceof Ne?i[0]=new Ne(e+o.length):i.unshift(new Ne(e-1),null)}return _e.of(i)}decomposeLeft(e,n){n.push(new Ne(e-1),null)}decomposeRight(e,n){n.push(null,new Ne(this.length-e-1))}updateHeight(e,n=0,i=!1,l){let o=n+this.length;if(l&&l.from<=n+this.length&&l.more){let s=[],r=Math.max(n,l.from),c=-1;for(l.from>n&&s.push(new Ne(l.from-n-1).updateHeight(e,n));r<=o&&l.more;){let h=e.doc.lineAt(r).length;s.length&&s.push(null);let f=l.heights[l.index++];c==-1?c=f:Math.abs(f-c)>=ii&&(c=-2);let u=new De(h,f);u.outdated=!1,s.push(u),r+=h+1}r<=o&&s.push(null,new Ne(o-r).updateHeight(e,r));let d=_e.of(s);return(c<0||Math.abs(d.height-this.height)>=ii||Math.abs(c-this.heightMetrics(e,n).perLine)>=ii)&&(Ht=!0),li(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Tu extends _e{constructor(e,n,i){super(e.length+n+i.length,e.height+i.height,n|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,n,i,l){let o=i+this.left.height;return e<o?this.left.blockAt(e,n,i,l):this.right.blockAt(e,n,o,l+this.left.length+this.break)}lineAt(e,n,i,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=n==be.ByHeight?e<s:e<r,d=c?this.left.lineAt(e,n,i,l,o):this.right.lineAt(e,n,i,s,r);if(this.break||(c?d.to<r:d.from>r))return d;let h=n==be.ByPosNoHeight?be.ByPosNoHeight:be.ByPos;return c?d.join(this.right.lineAt(r,h,i,s,r)):this.left.lineAt(r,h,i,l,o).join(d)}forEachLine(e,n,i,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,n,i,l,o,s),n>=c&&this.right.forEachLine(e,n,i,r,c,s);else{let d=this.lineAt(c,be.ByPos,i,l,o);e<d.from&&this.left.forEachLine(e,d.from-1,i,l,o,s),d.to>=e&&d.from<=n&&s(d),n>d.to&&this.right.forEachLine(d.to+1,n,i,r,c,s)}}replace(e,n,i){let l=this.left.length+this.break;if(n<l)return this.balanced(this.left.replace(e,n,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,n-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of i)o.push(r);if(e>0&&aa(o,s-1),n<this.length){let r=o.length;this.decomposeRight(n,o),aa(o,r)}return _e.of(o)}decomposeLeft(e,n){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(i++,e>=i&&n.push(null)),e>i&&this.right.decomposeLeft(e-i,n)}decomposeRight(e,n){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,n);e<i&&this.left.decomposeRight(e,n),this.break&&e<l&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?_e.of(this.break?[e,null,n]:[e,n]):(this.left=li(this.left,e),this.right=li(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,i=!1,l){let{left:o,right:s}=this,r=n+o.length+this.break,c=null;return l&&l.from<=n+o.length&&l.more?c=o=o.updateHeight(e,n,i,l):o.updateHeight(e,n,i),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,i,l):s.updateHeight(e,r,i),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 aa(a,e){let n,i;a[e]==null&&(n=a[e-1])instanceof Ne&&(i=a[e+1])instanceof Ne&&a.splice(e-1,3,new Ne(n.length+1+i.length))}const Iu=5;class kl{constructor(e,n){this.pos=e,this.oracle=n,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,n){if(this.lineStart>-1){let i=Math.min(n,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof De?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new De(i-this.pos,-1)),this.writtenTo=i,n>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,i){if(e<n||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=n-e;i.block?this.addBlock(new sa(s,l,i)):(s||o||l>=Iu)&&this.addLineDeco(l,o,s)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,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 De(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let i=new Ne(n-e);return this.oracle.doc.lineAt(e).to==n&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof De)return e;let n=new De(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=n,this.writtenTo=this.pos=this.pos+i}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof De)&&!this.isCovered?this.nodes.push(new De(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof De&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,n,i,l){let o=new kl(i,e);return ge.spans(n,i,l,o,0),o.finish(i)}}function Du(a,e,n){let i=new $u;return ge.compare(a,e,n,i,0),i.changes}class $u{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,i,l){(e<n||i&&i.heightRelevant||l&&l.heightRelevant)&&Hn(e,n,this.changes,5)}}function Pu(a,e){let n=a.getBoundingClientRect(),i=a.ownerDocument,l=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(l.innerWidth,n.right),r=Math.max(0,n.top),c=Math.min(l.innerHeight,n.bottom);for(let d=a.parentNode;d&&d!=i.body;)if(d.nodeType==1){let h=d,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();o=Math.max(o,u.left),s=Math.min(s,u.right),r=Math.max(r,u.top),c=Math.min(d==a.parentNode?l.innerHeight:c,u.bottom)}d=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:r-(n.top+e),bottom:Math.max(r,c)-(n.top+e)}}function Lu(a){let e=a.getBoundingClientRect(),n=a.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function Uu(a,e){let n=a.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class yl{constructor(e,n,i,l){this.from=e,this.to=n,this.size=i,this.displaySize=l}static same(e,n){if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],o=n[i];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,n){return Oe.replace({widget:new ju(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class ju extends tl{constructor(e,n){super(),this.size=e,this.vertical=n}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 ra{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=ca,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Be.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(hl).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Mu(n),this.stateDeco=e.facet(bn).filter(i=>typeof i!="function"),this.heightMap=_e.empty().applyChanges(this.stateDeco,ae.empty,this.heightOracle.setDoc(e.doc),[new Ue(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Oe.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let i=0;i<=1;i++){let l=i?n.head:n.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new oi(o,s))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ca:new wl(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(wn(e,this.scaler))})}update(e,n=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(bn).filter(h=>typeof h!="function");let l=e.changedRanges,o=Ue.extendWithRanges(l,Du(i,this.stateDeco,e?e.changes:Ce.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);oa(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Ht)&&(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;(n&&(n.range.head<c.from||n.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(qf)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,i=window.getComputedStyle(n),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Be.RTL:Be.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=n.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let d=0,h=0;if(r.width&&r.height){let{scaleX:k,scaleY:p}=Qo(n,r);(k>.005&&Math.abs(this.scaleX-k)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=k,this.scaleY=p,d|=16,s=c=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Ho(e.scrollDOM);let g=(this.printing?Uu:Pu)(n,this.paddingTop),w=g.top-this.pixelViewport.top,v=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(c=!0)),!this.inView&&!this.scrollTarget&&!Lu(e.dom))return 0;let A=r.width;if((this.contentDOMWidth!=A||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(A-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:S,textHeight:_}=e.docView.measureTextSize();s=p>0&&l.refresh(o,p,S,_,Math.max(5,A/S),k),s&&(e.docView.minWidth=0,d|=16)}w>0&&v>0?h=Math.max(w,v):w<0&&v<0&&(h=Math.min(w,v)),oa();for(let p of this.viewports){let S=p.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(p);this.heightMap=(s?_e.empty().applyChanges(this.stateDeco,ae.empty,this.heightOracle,[new Ue(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new Fu(p.from,S))}Ht&&(d|=2)}let V=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),d|=this.updateForViewport()),(d&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new oi(l.lineAt(s-i*1e3,be.ByHeight,o,0,0).from,l.lineAt(r+(1-i)*1e3,be.ByHeight,o,0,0).to);if(n){let{head:d}=n.range;if(d<c.from||d>c.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(d,be.ByPos,o,0,0),u;n.y=="center"?u=(f.top+f.bottom)/2-h/2:n.y=="start"||n.y=="nearest"&&d<c.from?u=f.top:u=f.bottom-h,c=new oi(l.lineAt(u-1e3/2,be.ByHeight,o,0,0).from,l.lineAt(u+h+1e3/2,be.ByHeight,o,0,0).to)}}return c}mapViewport(e,n){let i=n.mapPos(e.from,-1),l=n.mapPos(e.to,1);return new oi(this.heightMap.lineAt(i,be.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,be.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,be.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(n,be.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=r+Math.max(10,Math.min(i,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let i=[];for(let l of e)n.touchesRange(l.from,l.to)||i.push(new yl(n.mapPos(l.from),n.mapPos(l.to),l.size,l.displaySize));return i}ensureLineGaps(e,n){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=Be.LTR&&!i)return[];let r=[],c=(h,f,u,m)=>{if(f-h<o)return;let g=this.state.selection.main,w=[g.from];g.empty||w.push(g.to);for(let y of w)if(y>h&&y<f){c(h,y-10,u,m),c(y+10,f,u,m);return}let v=qu(e,y=>y.from>=u.from&&y.to<=u.to&&Math.abs(y.from-h)<o&&Math.abs(y.to-f)<o&&!w.some(A=>y.from<A&&y.to>A));if(!v){if(f<u.to&&n&&i&&n.visibleRanges.some(V=>V.from<=f&&V.to>=f)){let V=n.moveToLineBoundary(X.cursor(f),!1,!0).head;V>h&&(f=V)}let y=this.gapSize(u,h,f,m),A=i||y<2e6?y:2e6;v=new yl(h,f,y,A)}r.push(v)},d=h=>{if(h.length<s||h.type!=Ze.Text)return;let f=zu(h.from,h.to,this.stateDeco);if(f.total<s)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,g;if(i){let w=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,y;if(u!=null){let A=ai(f,u),V=((this.visibleBottom-this.visibleTop)/2+w)/h.height;v=A-V,y=A+V}else v=(this.visibleTop-h.top-w)/h.height,y=(this.visibleBottom-h.top+w)/h.height;m=si(f,v),g=si(f,y)}else{let w=f.total*this.heightOracle.charWidth,v=l*this.heightOracle.charWidth,y=0;if(w>2e6)for(let S of e)S.from>=h.from&&S.from<h.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=S.size-S.displaySize);let A=this.pixelViewport.left+y,V=this.pixelViewport.right+y,k,p;if(u!=null){let S=ai(f,u),_=((V-A)/2+v)/w;k=S-_,p=S+_}else k=(A-v)/w,p=(V+v)/w;m=si(f,k),g=si(f,p)}m>h.from&&c(h.from,m,h,f),g<h.to&&c(g,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(d):d(h);return r}gapSize(e,n,i,l){let o=ai(l,i)-ai(l,n);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){yl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Oe.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let i=[];ge.spans(n,this.viewport.from,this.viewport.to,{span(o,s){i.push({from:o,to:s})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o<i.length&&!(l&8);o++){let s=this.visibleRanges[o],r=i[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=i,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||wn(this.heightMap.lineAt(e,be.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(n=>n.top<=e&&n.bottom>=e)||wn(this.heightMap.lineAt(this.scaler.fromDOM(e),be.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return wn(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 oi{constructor(e,n){this.from=e,this.to=n}}function zu(a,e,n){let i=[],l=a,o=0;return ge.spans(n,a,e,{span(){},point(s,r){s>l&&(i.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(i.push({from:l,to:e}),o+=e-l),{total:o,ranges:i}}function si({total:a,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(a*n);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(i<=r)return o+i;i-=r}}function ai(a,e){let n=0;for(let{from:i,to:l}of a.ranges){if(e<=l){n+=e-i;break}n+=l-i}return n/a.total}function qu(a,e){for(let n of a)if(e(n))return n}const ca={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class wl{constructor(e,n,i){let l=0,o=0,s=0;this.viewports=i.map(({from:r,to:c})=>{let d=n.lineAt(r,be.ByPos,e,0,0).top,h=n.lineAt(c,be.ByPos,e,0,0).bottom;return l+=h-d,{from:r,to:c,top:d,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(n.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 n=0,i=0,l=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.top)return l+(e-i)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);i=o.bottom,l=o.domBottom}}fromDOM(e){for(let n=0,i=0,l=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.domTop)return i+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);i=o.bottom,l=o.domBottom}}eq(e){return e instanceof wl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,i)=>n.from==e.viewports[i].from&&n.to==e.viewports[i].to):!1}}function wn(a,e){if(e.scale==1)return a;let n=e.toDOM(a.top),i=e.toDOM(a.bottom);return new nt(a.from,a.length,n,i-n,Array.isArray(a._content)?a._content.map(l=>wn(l,e)):a._content)}const ri=ne.define({combine:a=>a.join(" ")}),Al=ne.define({combine:a=>a.indexOf(!0)>-1}),xl=wt.newName(),da=wt.newName(),ha=wt.newName(),fa={"&light":"."+da,"&dark":"."+ha};function vl(a,e,n){return new wt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return a;if(!n||!n[l])throw new RangeError(`Unsupported selector: ${l}`);return n[l]}):a+" "+i}})}const Qu=vl("."+xl,{"&":{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"}},fa),Wu={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Cl=J.ie&&J.ie_version<=11;class Ku{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Bf,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(n=>{for(let i of n)this.queue.push(i);(J.ie&&J.ie_version<=11||J.ios&&e.composing)&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&J.android&&e.constructor.EDIT_CONTEXT!==!1&&!(J.chrome&&J.chrome_version<126)&&(this.editContext=new Hu(e),e.state.facet(ht)&&(e.contentDOM.editContext=this.editContext.editContext)),Cl&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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 n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.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(n=>{n.length>0&&n[n.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((n,i)=>n!=e[i]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,l=this.selectionRange;if(i.state.facet(ht)?i.root.activeElement!=this.dom:!qn(this.dom,l))return;let o=l.anchorNode&&i.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(J.ie&&J.ie_version<=11||J.android&&J.chrome)&&!i.state.selection.main.empty&&l.focusNode&&un(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=hn(e.root);if(!n)return!1;let i=J.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Yu(this.view,n)||n;if(!i||this.selectionRange.eq(i))return!1;let l=qn(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Vf(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let i=this.dom;i;)if(i.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=n)i.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,Wu),Cl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Cl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var i;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&&zt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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 n=-1,i=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),n==-1?{from:n,to:i}=s:(n=Math.min(s.from,n),i=Math.max(s.to,i)))}return{from:n,to:i,typeOver:l}}readChange(){let{from:e,to:n,typeOver:i}=this.processRecords(),l=this.selectionChanged&&qn(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 du(this.view,e,n,i);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 n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let i=this.view.state,l=Us(this.view,n);return this.view.state==i&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let i=ua(n,e.previousSibling||e.target.previousSibling,-1),l=ua(n,e.nextSibling||e.target.nextSibling,1);return{from:i?n.posAfter(i):n.posAtStart,to:l?n.posBefore(l):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.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(ht)!=e.state.facet(ht)&&(e.view.contentDOM.editContext=e.state.facet(ht)?this.editContext.editContext:null))}destroy(){var e,n,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.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 ua(a,e,n){for(;e;){let i=he.get(e);if(i&&i.parent==a)return i;let l=e.parentNode;e=l!=a.dom?l:n>0?e.nextSibling:e.previousSibling}return null}function pa(a,e){let n=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return un(s.node,s.offset,l,o)&&([n,i,l,o]=[l,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:l,focusOffset:o}}function Yu(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return pa(a,l)}let n=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),n=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",i,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",i,!0),n?pa(a,n):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 n=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=i=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(i.updateRangeStart),c=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:r,drifted:!1});let d={from:r,to:c,insert:ae.of(i.text.split(`
|
|
23
|
+
`))};if(d.from==this.from&&o<this.from?d.from=o:d.to==this.to&&o>this.to&&(d.to=o),d.from==d.to&&!d.insert.length){let h=X.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));h.main.eq(l)||e.dispatch({selection:h,userEvent:"select"});return}if((J.mac||J.android)&&d.from==s-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:r,to:c,insert:ae.of([i.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let h=this.to-this.from+(d.to-d.from+d.insert.length);gl(e,d,X.single(this.toEditorPos(i.selectionStart,h),this.toEditorPos(i.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let s=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.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)}n.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let o of i.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(c<d){let h=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(Oe.mark({attributes:{style:h}}).range(c,d))}}}e.dispatch({effects:Ss.of(Oe.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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=hn(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,d)=>{if(i)return;let h=d.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(d)){l=this.pendingContextChange=null,n+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(o+=n,s+=n,s<=this.from)this.from+=h,this.to+=h;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),d.toString()),this.to+=h}n+=h}),l&&!i&&this.revertPending(e.state),!i}update(e){let n=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),l=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ce{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 n;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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Nf(e.parent)||document,this.viewState=new ra(e.state||de.create(e)),e.scrollTo&&e.scrollTo.is(Jn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(l=>new dl(l));for(let l of this.plugins)l.update(this);this.observer=new Ku(this),this.inputState=new mu(this),this.inputState.ensureHandlers(this.plugins),this.docView=new _s(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Re?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,i=!1,l,o=this.state;for(let u of e){if(u.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=u.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(u=>u.annotation(ea))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=ta(o,s),c||(r=1));let d=this.observer.delayedAndroidKey,h=null;if(d?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(de.phrases)!=this.state.facet(de.phrases))return this.setState(o);l=Xn.create(this,o,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;f=new Wt(m.empty?m:X.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Jn)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=ci.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),n=this.docView.update(l),this.state.facet(kn)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(ri)!=l.state.facet(ri)&&(this.viewState.mustMeasureContent=!0),(n||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(al))try{u(l)}catch(m){tt(this.state,m,"update listener")}(c||h)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),h&&!Us(this,h)&&d.force&&zt(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 n=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new ra(e),this.plugins=e.facet(Kt).map(i=>new dl(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new _s(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Kt),i=e.state.facet(Kt);if(n!=i){let l=[];for(let o of i){let s=n.indexOf(o);if(s<0)l.push(new dl(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);n!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(i){tt(this.state,i,"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 n=null,i=this.scrollDOM,l=i.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(Ho(i))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];c&4||([this.measureRequests,d]=[d,this.measureRequests]);let h=d.map(m=>{try{return m.read(this)}catch(g){return tt(this.state,g),ma}}),f=Xn.create(this,this.state,[]),u=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let m=0;m<d.length;m++)if(h[m]!=ma)try{let g=d[m];g.write&&g.write(h[m],this)}catch(g){tt(this.state,g)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let g=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(g>1||g<-1){l=l+g,i.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let r of this.state.facet(al))r(n)}get themeClasses(){return xl+" "+(this.state.facet(Al)?ha:da)+" "+this.state.facet(ri)}updateAttrs(){let e=ga(this,Bs,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ht)?"true":"false",class:"cm-content",style:`${J.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),ga(this,hl,n);let i=this.observer.ignore(()=>{let l=el(this.contentDOM,this.contentAttrs,n),o=el(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=n,i}showAnnouncements(e){let n=!0;for(let i of e)for(let l of i.effects)if(l.is(ce.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(kn);let e=this.state.facet(ce.cspNonce);wt.mount(this.root,this.styleModules.concat(Qu).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(i=>i.plugin==e)||null),n&&n.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,n,i){return ml(this,e,Ps(this,e,n,i))}moveByGroup(e,n){return ml(this,e,Ps(this,e,n,i=>su(this,e.head,i)))}visualLineSide(e,n){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=i[n?i.length-1:0];return X.cursor(o.side(n,l)+e.from,o.forward(!n,l)?1:-1)}moveToLineBoundary(e,n,i=!0){return ou(this,e,n,i)}moveVertically(e,n,i){return ml(this,e,au(this,e,n,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),Ds(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let i=this.docView.coordsAt(e,n);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[xt.find(o,e-l.from,-1,n)];return Wn(i,s.dir==Be.LTR==n>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(vs)||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>Gu)return ms(e.length);let n=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n&&(o.fresh||ps(o.isolates,i=Rs(this,e))))return o.order;i||(i=Rs(this,e));let l=Uf(e.text,n,i);return this.bidiCache.push(new ci(e.from,e.to,n,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||J.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wo(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,n={}){return Jn.of(new Wt(typeof e=="number"?X.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Jn.of(new Wt(X.cursor(i.from),"start","start",i.top-e,n,!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 Yt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Yt.define(()=>({}),{eventObservers:e})}static theme(e,n){let i=wt.newName(),l=[ri.of(i),kn.of(vl(`.${i}`,e))];return n&&n.dark&&l.push(Al.of(!0)),l}static baseTheme(e){return cf.lowest(kn.of(vl("."+xl,e,fa)))}static findFromDOM(e){var n;let i=e.querySelector(".cm-content"),l=i&&he.get(i)||he.get(e);return((n=l?.rootView)===null||n===void 0?void 0:n.view)||null}}ce.styleModule=kn,ce.inputHandler=As,ce.clipboardInputFilter=rl,ce.clipboardOutputFilter=cl,ce.scrollHandler=Cs,ce.focusChangeEffect=xs,ce.perLineTextDirection=vs,ce.exceptionSink=ws,ce.updateListener=al,ce.editable=ht,ce.mouseSelectionStyle=ys,ce.dragMovesSelection=ks,ce.clickAddsSelectionRange=bs,ce.decorations=bn,ce.outerDecorations=Ns,ce.atomicRanges=fl,ce.bidiIsolatedRanges=Vs,ce.scrollMargins=Es,ce.darkTheme=Al,ce.cspNonce=ne.define({combine:a=>a.length?a[0]:""}),ce.contentAttributes=hl,ce.editorAttributes=Bs,ce.lineWrapping=ce.contentAttributes.of({class:"cm-lineWrapping"}),ce.announce=xe.define();const Gu=4096,ma={};class ci{constructor(e,n,i,l,o,s){this.from=e,this.to=n,this.dir=i,this.isolates=l,this.fresh=o,this.order=s}static update(e,n){if(n.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Be.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!n.touchesRange(s.from,s.to)&&i.push(new ci(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return i}}function ga(a,e,n){for(let i=a.state.facet(e),l=i.length-1;l>=0;l--){let o=i[l],s=typeof o=="function"?o(a):o;s&&Zi(s,n)}return n}class Gt extends Lt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Gt.prototype.elementClass="",Gt.prototype.toDOM=void 0,Gt.prototype.mapMode=Ie.TrackBefore,Gt.prototype.startSide=Gt.prototype.endSide=-1,Gt.prototype.point=!0;var Sl;const Jt=new re;function Ju(a){return ne.define({combine:a?e=>e.concat(a):void 0})}const Xu=new re;class We{constructor(e,n,i=[],l=""){this.data=e,this.name=l,de.prototype.hasOwnProperty("tree")||Object.defineProperty(de.prototype,"tree",{get(){return Bl(this)}}),this.parser=n,this.extension=[Zt.of(this),de.languageData.of((o,s,r)=>{let c=ba(o,s,r),d=c.type.prop(Jt);if(!d)return[];let h=o.facet(d),f=c.type.prop(Xu);if(f){let u=c.resolve(s-c.from,r);for(let m of f)if(m.test(u,o)){let g=o.facet(m.facet);return m.type=="replace"?g:g.concat(h)}}return h})].concat(i)}isActiveAt(e,n,i=-1){return ba(e,n,i).type.prop(Jt)==this.data}findRegions(e){let n=e.facet(Zt);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let i=[],l=(o,s)=>{if(o.prop(Jt)==this.data){i.push({from:s,to:s+o.length});return}let r=o.prop(re.mounted);if(r){if(r.tree.prop(Jt)==this.data){if(r.overlay)for(let c of r.overlay)i.push({from:c.from+s,to:c.to+s});else i.push({from:s,to:s+o.length});return}else if(r.overlay){let c=i.length;if(l(r.tree,r.overlay[0].from+s),i.length>c)return}}for(let c=0;c<o.children.length;c++){let d=o.children[c];d instanceof we&&l(d,o.positions[c]+s)}};return l(Bl(e),0),i}get allowsNesting(){return!0}}We.setState=xe.define();function ba(a,e,n){let i=a.facet(Zt),l=Bl(a).topNode;if(!i||i.allowsNesting)for(let o=l;o;o=o.enter(e,n,ve.ExcludeBuffers))o.type.isTop&&(l=o);return l}class di extends We{constructor(e,n,i){super(e,n,[],i),this.parser=n}static define(e){let n=Ju(e.languageData);return new di(n,e.parser.configure({props:[Jt.add(i=>i.isTop?n:void 0)]}),e.name)}configure(e,n){return new di(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Bl(a){let e=a.field(We.state,!1);return e?e.tree:we.empty}class Zu{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,n){let i=this.cursorPos-this.string.length;return e<i||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-i,n-i)}}let An=null;class hi{constructor(e,n,i=[],l,o,s,r,c){this.parser=e,this.state=n,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,i){return new hi(e,n,[],we.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Zu(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=we.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(Bt.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Bt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=An;An=this;try{return e()}finally{An=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=ka(e,n.from,n.to);return e}changes(e,n){let{fragments:i,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,h,f,u)=>c.push({fromA:d,toA:h,fromB:f,toB:u})),i=Bt.applyChanges(i,c),l=we.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let d of this.skipped){let h=e.mapPos(d.from,1),f=e.mapPos(d.to,-1);h<f&&r.push({from:h,to:f})}}}return new hi(this.parser,n,i,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 n=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:l,to:o}=this.skipped[i];l<e.to&&o>e.from&&(this.fragments=ka(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends io{createParse(n,i,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=An;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 we(Me.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return An}}function ka(a,e,n){return Bt.applyChanges(a,[{fromA:e,toA:n,fromB:e,toB:n}])}class Xt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new Xt(n)}static init(e){let n=Math.min(3e3,e.doc.length),i=hi.create(e.facet(Zt).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new Xt(i)}}We.state=Rt.define({create:Xt.init,update(a,e){for(let n of e.effects)if(n.is(We.setState))return n.value;return e.startState.facet(Zt)!=e.state.facet(Zt)?Xt.init(e.state):a.apply(e)}});let ya=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ya=a=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nl=typeof navigator<"u"&&(!((Sl=navigator.scheduling)===null||Sl===void 0)&&Sl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ep=Yt.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 n=this.view.state.field(We.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(We.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=ya(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:l}}=this.view,o=i.field(We.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!Nl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&i.doc.length>l+1e3,c=o.context.work(()=>Nl&&Nl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:We.setState.of(new Xt(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(n=>tt(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Zt=ne.define({combine(a){return a.length?a[0]:null},enables:a=>[We.state,ep,ce.contentAttributes.compute([a],e=>{let n=e.facet(a);return n&&n.name?{"data-language":n.name}:{}})]});class tp{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const np=new re;function wa({except:a,units:e=1}={}){return n=>{let i=a&&a.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const ip=new re;function lp(a){let e=a.firstChild,n=a.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?a.to:n.from}:null}class Vl{constructor(e,n){this.specs=e;let i;function l(r){let c=wt.newName();return(i||(i=Object.create(null)))["."+c]=r,c}const o=typeof n.all=="string"?n.all:n.all?l(n.all):void 0,s=n.scope;this.scope=s instanceof We?r=>r.prop(Jt)==s.data:s?r=>r==s:void 0,this.style=fo(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=i?new wt(i):null,this.themeType=n.themeType}static define(e,n){return new Vl(e,n||{})}}Q.meta,Q.link,Q.heading,Q.emphasis,Q.strong,Q.strikethrough,Q.keyword,Q.atom,Q.bool,Q.url,Q.contentSeparator,Q.labelName,Q.literal,Q.inserted,Q.string,Q.deleted,Q.regexp,Q.escape,Q.string,Q.variableName,Q.variableName,Q.typeName,Q.namespace,Q.className,Q.variableName,Q.macroName,Q.propertyName,Q.comment,Q.invalid;const op=Object.create(null),Aa=[Me.none],xa=[],va=Object.create(null),sp=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"]])sp[a]=ap(op,e);function Rl(a,e){xa.indexOf(a)>-1||(xa.push(a),console.warn(e))}function ap(a,e){let n=[];for(let r of e.split(" ")){let c=[];for(let d of r.split(".")){let h=a[d]||Q[d];h?typeof h=="function"?c.length?c=c.map(h):Rl(d,`Modifier ${d} used at start of tag`):c.length?Rl(d,`Tag ${d} used as modifier`):c=Array.isArray(h)?h:[h]:Rl(d,`Unknown highlighting tag ${d}`)}for(let d of c)n.push(d)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+n.map(r=>r.id),o=va[l];if(o)return o.id;let s=va[l]=Me.define({id:Aa.length,name:i,props:[ho({[i]:n})]});return Aa.push(s),s.id}Be.RTL,Be.LTR;const rp=di.define({name:"json",parser:tf.configure({props:[np.add({Object:wa({except:/^\s*\}/}),Array:wa({except:/^\s*\]/})}),ip.add({"Object Array":lp})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function cp(){return new tp(rp)}const El=[{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 dp(){const a=$e();if(a.formRules?.length){const e={};El.forEach(i=>{e[i.name]=i});const n=[...El];return a.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):n.push(l)}),n}return El}const hp={loadAdvances:dp},fp={class:"unione-props-setting data-field-setting"},up={key:0},pp=["onClick"],mp={class:"field-txt"},gp=["onClick"],bp={key:1,class:"field-txt"},kp=["onClick"],yp={key:0,class:"field-txt"},wp={key:3,class:"edit-field"},Ap=["onClick"],xp=oe(t.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=t.ref([cp()]),n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"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"}]),i=t.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=t.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let p in k){const S=i.value.filter(_=>_.name==p);if(S&&S[0]){let _=o.value[p];Object.keys(_).forEach(C=>{C=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[C]):S[0][C]=_[C]})}}o.value={}}function r(k,p){s();const S={};p=="convertName"?(k.convert||(k.convert={}),S[p]=k.convert?.type):S[p]=k[p]||"",o.value[k.name]=S}function c(k,p){{o.value={};return}}function d(k,p){switch(p){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function h(k,p){switch(p){case"query":k.configs=q.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=q.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=q.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=q.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=q.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const f=t.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(k,p){switch(f.value.prop=p,f.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),p){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),f.value.show=k.configs.query,f.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),f.value.show=k.configs.show.form,f.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),f.value.show=k.configs.show.view,f.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),f.value.show=k.configs.show.list,f.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),f.value.show=k.configs.sort,f.value.title=`排序设置/${k.title}(${k.name})`;break}f.value.visible=!0}const m=t.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const p=m.value.options.filter(S=>S.value==k);return p[0]?p[0].label:k}}),g=t.ref({visible:!1,field:{},props:{},advances:hp.loadAdvances(),showInfo:k=>{let p=0;if(k.configs?.rule){const S=k.configs.rule;S.advance&&p++,typeof S.rangeMin<"u"&&p++,typeof S.rangeMax<"u"&&p++,typeof S.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const k=g.value.props;g.value.field.configs=q.utils.obj.ext(g.value.field.configs,{rule:{...k}}),g.value.visible=!1,g.value.props={}}});function w(k){g.value.visible=!0,g.value.field=k,g.value.props=k.configs?.rule||{}}const v=t.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const p=k.configs?.widget?.name,S=v.value.widgets.filter(_=>_.value==p);return S[0]?S[0].label:p},toSetting:(k,p)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=p},toclose:()=>{v.value.visible=!1}});function y(k){v.value.field=k,k.configs=q.utils.obj.ext(k.configs,{widget:{props:{}}}),v.value.widget=k.configs.widget,v.value.visible=!0}const A=t.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,p="--")=>A.value.types.filter(S=>S.value==k)[0]?.label||p,toAddOption:()=>{A.value.convert.options||(A.value.convert.options=[]),A.value.convert.options.push({label:"",value:""})},toDelOption:(k,p)=>{A.value.convert.options.splice(k,1)},toSetting:()=>{A.value.visible=!1}});function V(k){A.value.visible=!0,A.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),A.value.convert=k.configs.convert}return(k,p)=>{const S=t.resolveComponent("ToolOutlined"),_=t.resolveComponent("a-button"),C=t.resolveComponent("a-select"),x=t.resolveComponent("a-checkbox"),N=t.resolveComponent("a-table"),R=t.resolveComponent("a-switch"),b=t.resolveComponent("a-form-item"),B=t.resolveComponent("a-select-option"),F=t.resolveComponent("a-input-number"),E=t.resolveComponent("a-form"),M=t.resolveComponent("a-modal"),P=t.resolveComponent("a-input"),T=t.resolveComponent("unione-select-box"),W=t.resolveComponent("a-checkbox-group"),L=t.resolveComponent("unione-section");return t.openBlock(),t.createElementBlock("div",fp,[t.createVNode(N,{columns:n.value,"data-source":i.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",up,[t.createVNode(S),t.createTextVNode(" "+t.toDisplayString(O.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:O,text:te,record:D})=>[["rules"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",!g.value.showInfo(D)&&"empty"]),onClick:K=>w(D)},[t.createElementVNode("span",mp,t.toDisplayString(g.value.showInfo(D)),1),g.value.showInfo(D)?(t.openBlock(),t.createBlock(_,{key:0,type:"link"},{default:t.withCtx(()=>p[50]||(p[50]=[t.createTextVNode("设置")])),_:1})):t.createCommentVNode("",!0)],10,pp)):["widget"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[D.name]||!Object.keys(o.value[D.name]).includes(O.dataIndex))&&!te&&"empty"]),onClick:K=>r(D,O.dataIndex)},[o.value[D.name]&&Object.keys(o.value[D.name]).includes(O.dataIndex)?t.withDirectives((t.openBlock(),t.createBlock(C,{key:0,value:D.configs?.widget?.name,allowClear:!0,options:v.value.widgets,onChange:K=>v.value.toSetting(D,K),onBlur:p[0]||(p[0]=K=>c())},null,8,["value","options","onChange"])),[[l]]):(t.openBlock(),t.createElementBlock("span",bp,t.toDisplayString(v.value.widgetName(D)),1)),t.createVNode(_,{type:"link",onClick:t.withModifiers(K=>y(D),["stop"])},{default:t.withCtx(()=>p[51]||(p[51]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])],10,gp)):["convertName"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[D.name]||!Object.keys(o.value[D.name]).includes(O.dataIndex))&&!D.convert?.type&&"empty"]),onClick:K=>V(D)},[D.configs?.convert?.types?(t.openBlock(),t.createElementBlock("span",yp,t.toDisplayString(A.value.getTypes(D.configs.convert.types)),1)):t.createCommentVNode("",!0)],10,kp)):["query","form","view","list","sort"].includes(O.dataIndex)?(t.openBlock(),t.createElementBlock("div",wp,[t.createVNode(x,{checked:d(D,O.dataIndex),onClick:K=>h(D,O.dataIndex)},null,8,["checked","onClick"]),t.createVNode(_,{type:"link",onClick:K=>u(D,O.dataIndex)},{default:t.withCtx(()=>p[52]||(p[52]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])])):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(M,{visible:f.value.visible,"onUpdate:visible":p[14]||(p[14]=O=>f.value.visible=O),width:600,title:f.value.title,onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:t.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:t.withCtx(()=>[t.createVNode(b,{label:"启用状态"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.enable,"onUpdate:checked":p[1]||(p[1]=O=>f.value.show.enable=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(t.openBlock(),t.createBlock(b,{key:0,label:"默认排序"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=O=>f.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="sort"?(t.openBlock(),t.createBlock(b,{key:1,label:"排序方式"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.asc,"onUpdate:checked":p[3]||(p[3]=O=>f.value.show.asc=O),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(t.openBlock(),t.createBlock(b,{key:2,label:"高级查询"})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=O=>f.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.show.visible,"onUpdate:checked":p[5]||(p[5]=O=>f.value.show.visible=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),f.value.prop=="query"?(t.openBlock(),t.createBlock(b,{key:5,label:"查询方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.types,"onUpdate:value":p[6]||(p[6]=O=>f.value.show.types=O)},{default:t.withCtx(()=>[t.createVNode(B,{key:"EQ",value:"EQ"},{default:t.withCtx(()=>p[53]||(p[53]=[t.createTextVNode("精确查询")])),_:1}),t.createVNode(B,{key:"LIKE",value:"LIKE"},{default:t.withCtx(()=>p[54]||(p[54]=[t.createTextVNode("模糊查询")])),_:1}),t.createVNode(B,{key:"LLIKE",value:"LLIKE"},{default:t.withCtx(()=>p[55]||(p[55]=[t.createTextVNode("左模糊")])),_:1}),t.createVNode(B,{key:"RLIKE",value:"RLIKE"},{default:t.withCtx(()=>p[56]||(p[56]=[t.createTextVNode("右模糊")])),_:1}),t.createVNode(B,{key:"RANGE",value:"RANGE"},{default:t.withCtx(()=>p[57]||(p[57]=[t.createTextVNode("范围查询")])),_:1}),t.createVNode(B,{key:"ADVANCE",value:"ADVANCE"},{default:t.withCtx(()=>p[58]||(p[58]=[t.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(b,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:t.withCtx(()=>[t.createVNode(F,{value:f.value.show.index,"onUpdate:value":p[7]||(p[7]=O=>f.value.show.index=O)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:t.withCtx(()=>[t.createVNode(F,{min:0,max:24,value:f.value.show.width,"onUpdate:value":p[8]||(p[8]=O=>f.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:t.withCtx(()=>[t.createVNode(F,{min:0,value:f.value.show.width,"onUpdate:value":p[9]||(p[9]=O=>f.value.show.width=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(F,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=O=>f.value.show.labelWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:t.withCtx(()=>[t.createVNode(F,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=O=>f.value.show.valueWidth=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:11,label:"固定位置"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":p[12]||(p[12]=O=>f.value.show.fixed=O),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["list"].includes(f.value.prop)?(t.openBlock(),t.createBlock(b,{key:12,label:"对齐方式"},{default:t.withCtx(()=>[t.createVNode(C,{value:f.value.show.align,"onUpdate:value":p[13]||(p[13]=O=>f.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(M,{visible:A.value.visible,"onUpdate:visible":p[33]||(p[33]=O=>A.value.visible=O),width:600,title:A.value.getTypes(A.value.convert.types,"转换")+"设置",onOk:A.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:A.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(b,{label:"转换类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:A.value.convert.types,"onUpdate:value":p[15]||(p[15]=O=>A.value.convert.types=O),allowClear:!0,options:A.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:0,label:"是否搜索"},{default:t.withCtx(()=>[t.createVNode(R,{checked:f.value.convert.search,"onUpdate:checked":p[16]||(p[16]=O=>f.value.convert.search=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="option"?(t.openBlock(),t.createBlock(b,{key:1,label:"选项设置"},{default:t.withCtx(()=>[t.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:A.value.toAddOption},{default:t.withCtx(()=>p[59]||(p[59]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(N,{columns:A.value.optionColumn,"data-source":A.value.convert.options,size:"small"},{bodyCell:t.withCtx(({column:O,record:te,index:D})=>[O.dataIndex==="label"?(t.openBlock(),t.createBlock(P,{key:0,value:te.label,"onUpdate:value":K=>te.label=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="value"?(t.openBlock(),t.createBlock(P,{key:1,value:te.value,"onUpdate:value":K=>te.value=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):t.createCommentVNode("",!0),O.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:2,onClick:K=>A.value.toDelOption(D,te)},"删除",8,Ap)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):t.createCommentVNode("",!0),["dbtable","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:2,label:"数据源"},{default:t.withCtx(()=>[t.createVNode(T,{value:A.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=O=>A.value.convert.dsId=O),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:3,label:"table名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=O=>A.value.convert.tableName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:4,label:"table名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=O=>A.value.convert.tableName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:5,label:"主键字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.idField,"onUpdate:value":p[20]||(p[20]=O=>A.value.convert.idField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"&&["unione-tree-box"].includes(A.value.field.widget?.name)?(t.openBlock(),t.createBlock(b,{key:6,label:"父级字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=O=>A.value.convert.pidField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:7,label:"value字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=O=>A.value.convert.valueField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:8,label:"label字段"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=O=>A.value.convert.labelField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=O=>A.value.convert.tableField=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=O=>A.value.convert.tableWhere=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=O=>A.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=O=>A.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:13,label:"异步加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=O=>A.value.convert.isAsync=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dbtable"?(t.openBlock(),t.createBlock(b,{key:14,label:"分页加载"},{default:t.withCtx(()=>[t.createVNode(R,{checked:A.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=O=>A.value.convert.isPaging=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):t.createCommentVNode("",!0),A.value.convert.types=="dict"?(t.openBlock(),t.createBlock(b,{key:15,label:"字典名称"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=O=>A.value.convert.dictName=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:t.withCtx(()=>[t.createVNode(P,{value:A.value.convert.url,"onUpdate:value":p[31]||(p[31]=O=>A.value.convert.url=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),["local","remote"].includes(A.value.convert.types)?(t.openBlock(),t.createBlock(b,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:t.withCtx(()=>[t.createVNode(t.unref(en.Codemirror),{modelValue:A.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=O=>A.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(M,{visible:v.value.visible,"onUpdate:visible":p[40]||(p[40]=O=>v.value.visible=O),width:600,title:"控件设置",onOk:v.value.toclose},{default:t.withCtx(()=>[t.createVNode(E,{model:v.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(b,{label:"组件类型"},{default:t.withCtx(()=>[t.withDirectives(t.createVNode(C,{value:v.value.widget.name,"onUpdate:value":p[34]||(p[34]=O=>v.value.widget.name=O),allowClear:!0,options:v.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),t.createVNode(b,{label:"输入提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=O=>v.value.widget.placeholder=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"帮助说明"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.help,"onUpdate:value":p[36]||(p[36]=O=>v.value.widget.help=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"提示文本"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=O=>v.value.widget.tooltip=O)},null,8,["value"])]),_:1}),["a-date-picker"].includes(v.value.widget.name)?(t.openBlock(),t.createBlock(b,{key:0,label:"显示格式"},{default:t.withCtx(()=>[t.createVNode(P,{value:v.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=O=>v.value.field.dataFormat=O)},null,8,["value"])]),_:1})):t.createCommentVNode("",!0),v.value.widget.name=="unione-select-box"?(t.openBlock(),t.createBlock(b,{key:1,label:"下拉框类型"},{default:t.withCtx(()=>[t.createVNode(C,{value:v.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=O=>v.value.widget.props.mode=O),allowClear:!0},{default:t.withCtx(()=>[t.createVNode(B,{value:"multiple"},{default:t.withCtx(()=>p[60]||(p[60]=[t.createTextVNode("多选")])),_:1}),t.createVNode(B,{value:"tags"},{default:t.withCtx(()=>p[61]||(p[61]=[t.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):t.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),t.createVNode(M,{visible:g.value.visible,"onUpdate:visible":p[49]||(p[49]=O=>g.value.visible=O),width:600,title:"规则设置",onOk:g.value.toSetting},{default:t.withCtx(()=>[t.createVNode(E,{model:g.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(b,{label:"触发时机"},{default:t.withCtx(()=>[t.createVNode(W,{value:g.value.props.trigger,"onUpdate:value":p[41]||(p[41]=O=>g.value.props.trigger=O),options:["change","blur"]},null,8,["value"])]),_:1}),g.value.field.isNull?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(b,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:t.withCtx(()=>[t.createVNode(x,{checked:g.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=O=>g.value.props.whitespace=O)},{default:t.withCtx(()=>p[62]||(p[62]=[t.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),t.createVNode(b,{label:"预设类型"},{default:t.withCtx(()=>[t.createVNode(C,{options:g.value.advances,fieldNames:{label:"title",value:"name"},value:g.value.props.advance,"onUpdate:value":p[43]||(p[43]=O=>g.value.props.advance=O)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(g.value.field.dataType)?(t.openBlock(),t.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(b,{label:"有效区间"},{default:t.withCtx(()=>[t.createVNode(F,{value:g.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=O=>g.value.props.rangeMin=O)},null,8,["value"]),p[63]||(p[63]=t.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),t.createVNode(F,{value:g.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=O=>g.value.props.rangeMax=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=O=>g.value.props.rangeMessage=O)},null,8,["value"])]),_:1})]),_:1})):t.createCommentVNode("",!0),t.createVNode(L,{title:"正则验证",type:"line"},{default:t.withCtx(()=>[t.createVNode(b,{label:"表达式"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=O=>g.value.props.regExpress=O)},null,8,["value"])]),_:1}),t.createVNode(b,{label:"错误提示"},{default:t.withCtx(()=>[t.createVNode(P,{value:g.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=O=>g.value.props.regMessage=O)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),vp={class:"unione-props-setting data-field-fkey"},Cp={key:0},Sp=["onClick"],Bp=["onClick"],Np=["onClick"],Vp=["onClick"],Rp=["onClick"],Ep=["onClick"],Op=["onClick"],_p=["onClick"],Mp=oe(t.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=q.useDialog(),n=t.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),i=t.useModel(a,"modelValue"),l=t.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),o=t.ref({});function s(){o.value={}}function r(u,m){s();const g={};g[m]=u.configs.fkey[m]||"",o.value[u.name]=g}function c(u,m,g){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=g.name,u.configs.fkey.dsnTitle=g.title,u.configs.fkey.dsnId=g.id}function d(u,m,g,w){u.configs.fkey[m]=g,m=="fieldName"&&(u.configs.fkey.fieldTitle=w.title),m=="labelName"&&(u.configs.fkey.labelTitle=w.title)}function h(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=t.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(u,m)=>{f.value.editField[u]=m},onShowFieldChange:(u,m,g)=>{u.name=g.name,u.title=g.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=q.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,m)=>{const g=t.resolveComponent("FormOutlined"),w=t.resolveComponent("unione-select-box"),v=t.resolveComponent("a-button"),y=t.resolveComponent("a-table"),A=t.resolveComponent("a-input-number"),V=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",vp,[t.createVNode(y,{columns:n.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:t.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(t.openBlock(),t.createElementBlock("span",Cp,[t.createVNode(g),t.createTextVNode(" "+t.toDisplayString(k.title),1)])):t.createCommentVNode("",!0)]),bodyCell:t.withCtx(({column:k,record:p})=>[["dsnName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(S,_)=>c(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,Sp)):["dsnTitle"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(S,_)=>c(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,Bp)):t.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,_)=>d(p,"fieldName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,Np)):["labelName"].includes(k.dataIndex)?(t.openBlock(),t.createElementBlock("div",{key:3,class:t.normalizeClass(["edit-field",(!o.value[p.name]||!Object.keys(o.value[p.name]).includes(k.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(p,k.dataIndex)},[o.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(o.value[p.name]).includes(k.dataIndex)?(t.openBlock(),t.createBlock(w,{key:0,value:o.value[p.name][k.dataIndex],"onUpdate:value":S=>o.value[p.name][k.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(S,_)=>d(p,"labelName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(t.openBlock(),t.createBlock(v,{key:0,type:"link",onClick:t.withModifiers(S=>h(p),["stop"])},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("设置")])),_:2},1032,["onClick"])):t.createCommentVNode("",!0)],64))],10,Vp)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),t.createVNode(V,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>f.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:t.withCtx(()=>[t.createVNode(v,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("新增")])),_:1},8,["onClick"]),t.createVNode(y,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:t.withCtx(({column:k,record:p,index:S,text:_})=>[k.dataIndex==="title"?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="title"?(t.openBlock(),t.createBlock(w,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>f.value.editField={}),onSelect:(C,x)=>f.value.onShowFieldChange(p,C,x)},null,8,["value","onUpdate:value","convert","onSelect"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Rp)):t.createCommentVNode("",!0),k.dataIndex==="width"?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="width"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[1]||(m[1]=C=>f.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Ep)):t.createCommentVNode("",!0),k.dataIndex==="index"?(t.openBlock(),t.createElementBlock("div",{key:2,class:t.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,k.dataIndex)},[f.value.editField[S]=="index"?(t.openBlock(),t.createBlock(A,{key:0,onBlur:m[2]||(m[2]=C=>f.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(_),1)],64))],10,Op)):t.createCommentVNode("",!0),k.dataIndex==="action"?(t.openBlock(),t.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(S)},"删除",8,_p)):t.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),Fp={class:"unione-props-setting data-filter"},Tp={class:"title"},Ip={class:"name"},Dp={class:"action"},$p=oe(t.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=q.useDialog(),n=t.useModel(a,"modelValue");function i(){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:()=>{n.value.splice(d,1)}})}const s=t.ref(),r=t.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(d=>{if(r.value.name){const h=n.value.filter(f=>f.name==r.value.name)[0];if(!h){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&n.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(d).forEach(f=>{h[f]=d[f]})}else{if(n.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}n.value.push(d)}r.value.visible=!1})}});function c(){const d=[];r.value.filter.filter||(r.value.filter.filter=""),d.push("-- @if(isNotEmpty(params."),d.push(r.value.filter.name||"xxx"),d.push(") && !isBlank(params."),d.push(r.value.filter.name||"xxx"),d.push(`)
|
|
24
24
|
`),d.push(" AND XXX=#{params."),d.push(r.value.filter.name||"xxx"),d.push(`}
|
|
25
25
|
`),d.push(`-- @}
|
|
26
|
-
`),r.value.filter.filter=r.value.filter.filter+d.join("")}return(d,h)=>{const f=t.resolveComponent("a-button"),u=t.resolveComponent("a-card"),m=t.resolveComponent("PlusOutlined"),g=t.resolveComponent("a-empty"),w=t.resolveComponent("a-input"),v=t.resolveComponent("a-form-item"),y=t.resolveComponent("a-textarea"),A=t.resolveComponent("a-tag"),V=t.resolveComponent("a-form"),k=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",Mp,[(n.value.length,t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,(p,S)=>(t.openBlock(),t.createBlock(u,{class:"filter-box",size:"small",key:S},{default:t.withCtx(()=>[t.createElementVNode("div",Tp,"过滤标题:"+t.toDisplayString(p.title),1),t.createElementVNode("div",Fp,"过滤名称:"+t.toDisplayString(p.name),1),t.createElementVNode("div",Ip,[t.createVNode(f,{size:"small",onClick:_=>l(p)},{default:t.withCtx(()=>h[4]||(h[4]=[t.createTextVNode("编辑")])),_:2},1032,["onClick"]),t.createVNode(f,{danger:"",size:"small",onClick:_=>o(S)},{default:t.withCtx(()=>h[5]||(h[5]=[t.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),t.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:t.withCtx(()=>[t.createVNode(m,{class:"btn"})]),_:1})],64)),t.createVNode(k,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(v,{label:"过滤标题",name:"title"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),t.createVNode(v,{label:"过滤名称",name:"name"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),t.createVNode(v,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:t.withCtx(()=>[t.createVNode(y,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),t.createVNode(A,{class:"btn-tmpl",color:"blue",onClick:c},{default:t.withCtx(()=>h[6]||(h[6]=[t.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),$p={class:"unione-page form-page data-define-edit"},Pp={class:"actions"},Lp=le(t.defineComponent({__name:"edit",setup(a){const e=Y.useDialog(),n=t.inject("route"),i=t.inject("router"),l=t.ref(),o=t.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=t.ref(),r=t.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=t.ref({configs:{fields:[],filters:[]}}),d=t.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{Ct.release([c.value.id]).then(w=>{w.success?(e.success({title:"发布成功",content:w.body}),g(c.value.id)):e.error({title:"发布失败",content:w.body})})}})}async function u(){const w=await l.value.validate(),v={...c.value,...w};v.configs.show=await s.value.getValue(),console.log("formData",v),oe.message.loading({content:"提交中..."}),d.value=!0,Ct.save(v).then(y=>{oe.message.destroy(),y.success?(c.value=y.body,l.value.setValue(y.body),s.value.setValue(y.body.configs?.show||{}),oe.message.success("保存成功!")):oe.message.error(y.message)}).finally(()=>{d.value=!1})}const m=t.ref(!1);t.onMounted(()=>{n.query.id&&g(n.query.id)});function g(w){oe.message.loading({content:"加载中..."}),Ct.detail(w).then(v=>{v.success?(c.value=v.body,l.value.setValue(v.body),s.value.setValue(v.body.configs?.show||{}),oe.message.destroy()):oe.message.error(v.message)})}return(w,v)=>{const y=t.resolveComponent("unione-form"),A=t.resolveComponent("unione-section"),V=t.resolveComponent("OrderedListOutlined"),k=t.resolveComponent("a-tab-pane"),p=t.resolveComponent("ToolOutlined"),S=t.resolveComponent("ApiOutlined"),_=t.resolveComponent("FunnelPlotOutlined"),C=t.resolveComponent("a-tabs"),x=t.resolveComponent("a-button");return t.openBlock(),t.createElementBlock("div",$p,[t.createVNode(A,{title:"基础信息",type:"line"},{default:t.withCtx(()=>[t.createVNode(y,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),t.createVNode(A,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":v[0]||(v[0]=N=>m.value=N)},{default:t.withCtx(()=>[t.createVNode(y,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),t.createVNode(C,null,{default:t.withCtx(()=>[t.createVNode(k,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(V),v[5]||(v[5]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(Oh,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[1]||(v[1]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(p),v[6]||(v[6]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(Ap,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[2]||(v[2]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-fkeys"},{tab:t.withCtx(()=>[t.createVNode(S),v[7]||(v[7]=t.createTextVNode("外键设置 "))]),default:t.withCtx(()=>[t.createVNode(_p,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[3]||(v[3]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"data-filter"},{tab:t.withCtx(()=>[t.createVNode(_),v[8]||(v[8]=t.createTextVNode("数据过滤 "))]),default:t.withCtx(()=>[t.createVNode(Dp,{modelValue:c.value.configs.filters,"onUpdate:modelValue":v[4]||(v[4]=N=>c.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),t.createElementVNode("div",Pp,[t.createVNode(x,{type:"primary",onClick:u,loading:d.value},{default:t.withCtx(()=>v[9]||(v[9]=[t.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(t.openBlock(),t.createBlock(x,{key:0,danger:"",onClick:f,loading:d.value},{default:t.withCtx(()=>v[10]||(v[10]=[t.createTextVNode("发布")])),_:1},8,["loading"])):t.createCommentVNode("",!0),t.createVNode(x,{onClick:h},{default:t.withCtx(()=>v[11]||(v[11]=[t.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),El={find(a){return Y.axios.admin({url:"/api/data/source/find",method:"post",data:a})},save(a){return Y.axios.admin({url:"/api/data/source/save",method:"post",data:a})},delete(a){return Y.axios.admin({url:"/api/data/source/delete",method:"post",data:a})},detail(a){return Y.axios.admin({url:"/api/data/source/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},linktest(a){return Y.axios.admin({url:"/api/data/source/linktest",method:"post",data:a})}},Up={class:"unione-page unione-list-page data-source-list"},jp={class:"btns"},zp=le(t.defineComponent({__name:"list",setup(a){De();const e=Y.useDialog();t.inject("router");const n=t.ref({fields:[{title:"状态",name:"useSts",control:"unione-select-box",convert:{types:"dict",dictName:"USEORNOT"}},{title:"类型",name:"dsType",control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSTYPE"}}]}),i=t.ref({leftBtns:[],rightBtns:["downTmpl"],columns:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"类别",name:"category",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"类型",name:"dsType",convert:{types:"dict",dictName:"DMSDSTYPE"}},{title:"IP",name:"ip"},{title:"端口",name:"port"},{title:"链接URL",name:"url",width:250},{title:"使用状态",name:"useSts",convert:{types:"dict",dictName:"USEORNOT"}},{title:"创建时间",name:"created"}],operation:{title:"操作",width:130,btns:["view"],count:3,more:{layout:"vertical"}}});t.onMounted(()=>{o()});const l=t.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function o(){l.value.loading=!0,El.find({page:l.value.pagination.current,pageSize:l.value.pagination.pageSize,body:l.value.params,keywords:l.value.keywords}).then(u=>{l.value.data=u.body,l.value.pagination.total=u.total*1}).finally(()=>{l.value.loading=!1})}function s(u){l.value.pagination.current=u.pagination.current,l.value.pagination.pageSize=u.pagination.pageSize,o()}function r({params:u,keywords:m}){l.value.pagination.current=1,l.value.params=u,l.value.keywords=m,o()}function c({btn:u,event:m,row:g}){(u.name=="add"||u.name=="edit")&&(f.value.visible=!0,f.value.title=u.name=="add"?"新增数据源":"修改数据源",f.value.placement=u.name=="add"?"left":"right",f.value.row=g||{},u.name=="edit"&&t.nextTick(()=>{h.value.setValue(g)})),u.name=="linktest"&&d(g)}function d(u){El.linktest(u).then(m=>{m.success?(e.success({title:"连接测试成功",content:m.body}),o()):e.error({title:"连接测试失败",content:m.body})})}const h=t.ref(),f=t.ref({visible:!1,title:"新增数据源",placement:"left",row:{},form:{fields:[{title:"标题",name:"title",required:!0},{title:"名称",name:"name",required:!0},{title:"类别",name:"category",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"类型",name:"dsType",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSTYPE"}},{title:"IP",name:"ip",required:!0},{title:"端口",name:"port",required:!0},{title:"链接URL",name:"url",required:!0},{title:"驱动名称",name:"driverName",required:!0},{title:"认证类型",name:"authType",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSAUTHTYPE"}},{title:"用户名",name:"username",required:!0,event:{visible:(u,m)=>m.authType=="uname"}},{title:"密码",name:"password",control:"unione-pwd-box",required:!0,event:{visible:(u,m)=>m.authType=="uname",required:(u,m)=>!m.id}},{title:"使用状态",name:"useSts",value:1,control:"unione-switch-box",convert:{types:"dict",dictName:"USEORNOT"}},{title:"备注",name:"descs",control:"a-textarea"}],setting:{showColumn:1,labelWidth:5}},tosave:()=>{h.value.validate().then(u=>{u={...f.value.row,...u},El.save(u).then(m=>{m.success?(e.success({content:m.message}),f.value.row.id=m.body,o()):e.error({content:m.message})})})}});return(u,m)=>{const g=t.resolveComponent("UnioneQuery"),w=t.resolveComponent("UnioneTable"),v=t.resolveComponent("unione-form"),y=t.resolveComponent("a-button"),A=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",Up,[t.createVNode(g,{widget:n.value,onQuery:r,onReset:r},null,8,["widget"]),t.createVNode(w,{widget:i.value,dataList:l.value.data,loading:l.value.loading,pagination:l.value.pagination,onChange:s,onBtnClick:c},null,8,["widget","dataList","loading","pagination"]),t.createVNode(A,{title:f.value.title,width:550,visible:f.value.visible,"onUpdate:visible":m[2]||(m[2]=V=>f.value.visible=V),placement:f.value.placement,class:"drawer-form"},{default:t.withCtx(()=>[t.createVNode(v,{form:f.value.form,ref_key:"formObj",ref:h},null,8,["form"]),t.createElementVNode("div",jp,[t.createVNode(y,{type:"primary",onClick:f.value.tosave},{default:t.withCtx(()=>m[3]||(m[3]=[t.createTextVNode("保存")])),_:1},8,["onClick"]),t.createVNode(y,{onClick:m[0]||(m[0]=V=>d(f.value.row))},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("连接测试")])),_:1}),t.createVNode(y,{onClick:m[1]||(m[1]=V=>f.value.visible=!1)},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("取消")])),_:1})])]),_:1},8,["title","visible","placement"])])}}}),[["__scopeId","data-v-49bd93a9"]]),qp={UnioneEditor:lt,locales:fi,loadConfig:De,DataStorage:ui,Convertor:Ke,install(a,e){Y.loadConfig(e);const n=De(e);n.axios&&Y.axios.create(n.axios),a.component("UnioneBtn",La),a.component("UnioneTabs",ja),a.component("UnioneSection",Ya),a.component("UnioneQuery",$l),a.component("UnioneTable",Pl),a.component("UnioneRichText",ld),a.component("UnioneFormItem",mr),a.component("UnioneForm",hr),a.component("UnioneSelectBox",gr),a.component("UnioneSwitchBox",br),a.component("UnioneRadioBox",kr),a.component("UnioneCheckBox",yr),a.component("UnionePwdBox",wr),a.component("UnioneRandomInput",xr),a.component("UnioneUploadBox",vr),a.component("UnionePageEditor",zl),a.component("UnionePageForm",ql),a.component("UnionePageTree",Ql),a.component("UnionePageLeft",Wl),a.component("UnionePageList",Kl),a.component("UnioneFlowTodo",Yl),a.component("UnioneFlowAudit",ih),a.component("UnioneFlowOpinion",Ah)}};ie.Convertor=Ke,ie.DataStorage=ui,ie.UnioneDataDefineEdit=Lp,ie.UnioneDataDefineList=vh,ie.UnioneDataSourceList=zp,ie.UnioneEditor=lt,ie.UnioneFlowTodo=Yl,ie.UnionePage=xt,ie.UnionePageEditor=zl,ie.UnionePageForm=ql,ie.UnionePageLeft=Wl,ie.UnionePageList=Kl,ie.UnionePageSetting=vt,ie.UnionePageTree=Ql,ie.UnioneQueryForm=$l,ie.UnioneTableList=Pl,ie.default=qp,ie.loadConfig=De,ie.locales=fi,ie.useDebounce=ut,ie.utils=Ar,Object.defineProperties(ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
26
|
+
`),r.value.filter.filter=r.value.filter.filter+d.join("")}return(d,h)=>{const f=t.resolveComponent("a-button"),u=t.resolveComponent("a-card"),m=t.resolveComponent("PlusOutlined"),g=t.resolveComponent("a-empty"),w=t.resolveComponent("a-input"),v=t.resolveComponent("a-form-item"),y=t.resolveComponent("a-textarea"),A=t.resolveComponent("a-tag"),V=t.resolveComponent("a-form"),k=t.resolveComponent("a-modal");return t.openBlock(),t.createElementBlock("div",Fp,[(n.value.length,t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,(p,S)=>(t.openBlock(),t.createBlock(u,{class:"filter-box",size:"small",key:S},{default:t.withCtx(()=>[t.createElementVNode("div",Tp,"过滤标题:"+t.toDisplayString(p.title),1),t.createElementVNode("div",Ip,"过滤名称:"+t.toDisplayString(p.name),1),t.createElementVNode("div",Dp,[t.createVNode(f,{size:"small",onClick:_=>l(p)},{default:t.withCtx(()=>h[4]||(h[4]=[t.createTextVNode("编辑")])),_:2},1032,["onClick"]),t.createVNode(f,{danger:"",size:"small",onClick:_=>o(S)},{default:t.withCtx(()=>h[5]||(h[5]=[t.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),t.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:t.withCtx(()=>[t.createVNode(m,{class:"btn"})]),_:1})],64)),t.createVNode(k,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:t.withCtx(()=>[t.createVNode(V,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:t.withCtx(()=>[t.createVNode(v,{label:"过滤标题",name:"title"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),t.createVNode(v,{label:"过滤名称",name:"name"},{default:t.withCtx(()=>[t.createVNode(w,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),t.createVNode(v,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:t.withCtx(()=>[t.createVNode(y,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),t.createVNode(A,{class:"btn-tmpl",color:"blue",onClick:c},{default:t.withCtx(()=>h[6]||(h[6]=[t.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),Pp={class:"unione-page form-page data-define-edit"},Lp={class:"actions"},Up=oe(t.defineComponent({__name:"edit",setup(a){const e=q.useDialog(),n=t.inject("route"),i=t.inject("router"),l=t.ref(),o=t.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=t.ref(),r=t.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=t.ref({configs:{fields:[],filters:[]}}),d=t.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{St.release([c.value.id]).then(w=>{w.success?(e.success({title:"发布成功",content:w.body}),g(c.value.id)):e.error({title:"发布失败",content:w.body})})}})}async function u(){const w=await l.value.validate(),v={...c.value,...w};v.configs.show=await s.value.getValue(),console.log("formData",v),se.message.loading({content:"提交中..."}),d.value=!0,St.save(v).then(y=>{se.message.destroy(),y.success?(c.value=y.body,l.value.setValue(y.body),s.value.setValue(y.body.configs?.show||{}),se.message.success("保存成功!")):se.message.error(y.message)}).finally(()=>{d.value=!1})}const m=t.ref(!1);t.onMounted(()=>{n.query.id&&g(n.query.id)});function g(w){se.message.loading({content:"加载中..."}),St.detail(w).then(v=>{v.success?(c.value=v.body,l.value.setValue(v.body),s.value.setValue(v.body.configs?.show||{}),se.message.destroy()):se.message.error(v.message)})}return(w,v)=>{const y=t.resolveComponent("unione-form"),A=t.resolveComponent("unione-section"),V=t.resolveComponent("OrderedListOutlined"),k=t.resolveComponent("a-tab-pane"),p=t.resolveComponent("ToolOutlined"),S=t.resolveComponent("ApiOutlined"),_=t.resolveComponent("FunnelPlotOutlined"),C=t.resolveComponent("a-tabs"),x=t.resolveComponent("a-button");return t.openBlock(),t.createElementBlock("div",Pp,[t.createVNode(A,{title:"基础信息",type:"line"},{default:t.withCtx(()=>[t.createVNode(y,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),t.createVNode(A,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":v[0]||(v[0]=N=>m.value=N)},{default:t.withCtx(()=>[t.createVNode(y,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),t.createVNode(C,null,{default:t.withCtx(()=>[t.createVNode(k,{key:"field-mange"},{tab:t.withCtx(()=>[t.createVNode(V),v[5]||(v[5]=t.createTextVNode("字段管理 "))]),default:t.withCtx(()=>[t.createVNode(_h,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[1]||(v[1]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-setting"},{tab:t.withCtx(()=>[t.createVNode(p),v[6]||(v[6]=t.createTextVNode("字段设置 "))]),default:t.withCtx(()=>[t.createVNode(xp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[2]||(v[2]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"field-fkeys"},{tab:t.withCtx(()=>[t.createVNode(S),v[7]||(v[7]=t.createTextVNode("外键设置 "))]),default:t.withCtx(()=>[t.createVNode(Mp,{modelValue:c.value.configs.fields,"onUpdate:modelValue":v[3]||(v[3]=N=>c.value.configs.fields=N)},null,8,["modelValue"])]),_:1}),t.createVNode(k,{key:"data-filter"},{tab:t.withCtx(()=>[t.createVNode(_),v[8]||(v[8]=t.createTextVNode("数据过滤 "))]),default:t.withCtx(()=>[t.createVNode($p,{modelValue:c.value.configs.filters,"onUpdate:modelValue":v[4]||(v[4]=N=>c.value.configs.filters=N)},null,8,["modelValue"])]),_:1})]),_:1}),t.createElementVNode("div",Lp,[t.createVNode(x,{type:"primary",onClick:u,loading:d.value},{default:t.withCtx(()=>v[9]||(v[9]=[t.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(t.openBlock(),t.createBlock(x,{key:0,danger:"",onClick:f,loading:d.value},{default:t.withCtx(()=>v[10]||(v[10]=[t.createTextVNode("发布")])),_:1},8,["loading"])):t.createCommentVNode("",!0),t.createVNode(x,{onClick:h},{default:t.withCtx(()=>v[11]||(v[11]=[t.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Ol={find(a){return q.axios.admin({url:"/api/data/source/find",method:"post",data:a})},save(a){return q.axios.admin({url:"/api/data/source/save",method:"post",data:a})},delete(a){return q.axios.admin({url:"/api/data/source/delete",method:"post",data:a})},detail(a){return q.axios.admin({url:"/api/data/source/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},linktest(a){return q.axios.admin({url:"/api/data/source/linktest",method:"post",data:a})}},jp={class:"unione-page unione-list-page data-source-list"},zp={class:"btns"},qp=oe(t.defineComponent({__name:"list",setup(a){$e();const e=q.useDialog();t.inject("router");const n=t.ref({fields:[{title:"状态",name:"useSts",control:"unione-select-box",convert:{types:"dict",dictName:"USEORNOT"}},{title:"类型",name:"dsType",control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSTYPE"}}]}),i=t.ref({leftBtns:[],rightBtns:["downTmpl"],columns:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"类别",name:"category",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"类型",name:"dsType",convert:{types:"dict",dictName:"DMSDSTYPE"}},{title:"IP",name:"ip"},{title:"端口",name:"port"},{title:"链接URL",name:"url",width:250},{title:"使用状态",name:"useSts",convert:{types:"dict",dictName:"USEORNOT"}},{title:"创建时间",name:"created"}],operation:{title:"操作",width:130,btns:["view"],count:3,more:{layout:"vertical"}}});t.onMounted(()=>{o()});const l=t.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function o(){l.value.loading=!0,Ol.find({page:l.value.pagination.current,pageSize:l.value.pagination.pageSize,body:l.value.params,keywords:l.value.keywords}).then(u=>{l.value.data=u.body,l.value.pagination.total=u.total*1}).finally(()=>{l.value.loading=!1})}function s(u){l.value.pagination.current=u.pagination.current,l.value.pagination.pageSize=u.pagination.pageSize,o()}function r({params:u,keywords:m}){l.value.pagination.current=1,l.value.params=u,l.value.keywords=m,o()}function c({btn:u,event:m,row:g}){(u.name=="add"||u.name=="edit")&&(f.value.visible=!0,f.value.title=u.name=="add"?"新增数据源":"修改数据源",f.value.placement=u.name=="add"?"left":"right",f.value.row=g||{},u.name=="edit"&&t.nextTick(()=>{h.value.setValue(g)})),u.name=="linktest"&&d(g)}function d(u){Ol.linktest(u).then(m=>{m.success?(e.success({title:"连接测试成功",content:m.body}),o()):e.error({title:"连接测试失败",content:m.body})})}const h=t.ref(),f=t.ref({visible:!1,title:"新增数据源",placement:"left",row:{},form:{fields:[{title:"标题",name:"title",required:!0},{title:"名称",name:"name",required:!0},{title:"类别",name:"category",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"类型",name:"dsType",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSTYPE"}},{title:"IP",name:"ip",required:!0},{title:"端口",name:"port",required:!0},{title:"链接URL",name:"url",required:!0},{title:"驱动名称",name:"driverName",required:!0},{title:"认证类型",name:"authType",required:!0,control:"unione-select-box",convert:{types:"dict",dictName:"DMSDSAUTHTYPE"}},{title:"用户名",name:"username",required:!0,event:{visible:(u,m)=>m.authType=="uname"}},{title:"密码",name:"password",control:"unione-pwd-box",required:!0,event:{visible:(u,m)=>m.authType=="uname",required:(u,m)=>!m.id}},{title:"使用状态",name:"useSts",value:1,control:"unione-switch-box",convert:{types:"dict",dictName:"USEORNOT"}},{title:"备注",name:"descs",control:"a-textarea"}],setting:{showColumn:1,labelWidth:5}},tosave:()=>{h.value.validate().then(u=>{u={...f.value.row,...u},Ol.save(u).then(m=>{m.success?(e.success({content:m.message}),f.value.row.id=m.body,o()):e.error({content:m.message})})})}});return(u,m)=>{const g=t.resolveComponent("UnioneQuery"),w=t.resolveComponent("UnioneTable"),v=t.resolveComponent("unione-form"),y=t.resolveComponent("a-button"),A=t.resolveComponent("a-drawer");return t.openBlock(),t.createElementBlock("div",jp,[t.createVNode(g,{widget:n.value,onQuery:r,onReset:r},null,8,["widget"]),t.createVNode(w,{widget:i.value,dataList:l.value.data,loading:l.value.loading,pagination:l.value.pagination,onChange:s,onBtnClick:c},null,8,["widget","dataList","loading","pagination"]),t.createVNode(A,{title:f.value.title,width:550,visible:f.value.visible,"onUpdate:visible":m[2]||(m[2]=V=>f.value.visible=V),placement:f.value.placement,class:"drawer-form"},{default:t.withCtx(()=>[t.createVNode(v,{form:f.value.form,ref_key:"formObj",ref:h},null,8,["form"]),t.createElementVNode("div",zp,[t.createVNode(y,{type:"primary",onClick:f.value.tosave},{default:t.withCtx(()=>m[3]||(m[3]=[t.createTextVNode("保存")])),_:1},8,["onClick"]),t.createVNode(y,{onClick:m[0]||(m[0]=V=>d(f.value.row))},{default:t.withCtx(()=>m[4]||(m[4]=[t.createTextVNode("连接测试")])),_:1}),t.createVNode(y,{onClick:m[1]||(m[1]=V=>f.value.visible=!1)},{default:t.withCtx(()=>m[5]||(m[5]=[t.createTextVNode("取消")])),_:1})])]),_:1},8,["title","visible","placement"])])}}}),[["__scopeId","data-v-49bd93a9"]]),Qp={UnioneEditor:lt,locales:ui,loadConfig:$e,DataStorage:pi,Convertor:Ke,install(a,e){q.loadConfig(e);const n=$e(e);n.axios&&q.axios.create(n.axios),a.component("UnioneBtn",Ua),a.component("UnioneTabs",za),a.component("UnioneSection",Ha),a.component("UnioneQuery",Pl),a.component("UnioneTable",Ll),a.component("UnioneRichText",od),a.component("UnioneFormItem",gr),a.component("UnioneForm",fr),a.component("UnioneSelectBox",br),a.component("UnioneSwitchBox",kr),a.component("UnioneRadioBox",yr),a.component("UnioneCheckBox",wr),a.component("UnionePwdBox",Ar),a.component("UnioneRandomInput",vr),a.component("UnioneUploadBox",Cr),a.component("UnionePageEditor",ql),a.component("UnionePageForm",Ql),a.component("UnionePageTree",Wl),a.component("UnionePageLeft",Kl),a.component("UnionePageList",Yl),a.component("UnioneFlowTodo",Hl),a.component("UnioneFlowAudit",lh),a.component("UnioneFlowOpinion",xh)}};le.Convertor=Ke,le.DataStorage=pi,le.UnioneDataDefineEdit=Up,le.UnioneDataDefineList=Ch,le.UnioneDataSourceList=qp,le.UnioneEditor=lt,le.UnioneFlowTodo=Hl,le.UnionePage=vt,le.UnionePageEditor=ql,le.UnionePageForm=Ql,le.UnionePageLeft=Kl,le.UnionePageList=Yl,le.UnionePageSetting=Ct,le.UnionePageTree=Wl,le.UnioneQueryForm=Pl,le.UnioneTableList=Ll,le.default=Qp,le.loadConfig=$e,le.locales=ui,le.useDebounce=pt,le.utils=xr,Object.defineProperties(le,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|