@a2simcode/ui 0.0.273 → 0.0.274

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.
@@ -13,4 +13,4 @@
13
13
  roundFun,
14
14
  sumFun,
15
15
  sumproductFun,
16
- getCompValue)=>{ return ${x} }`;let E;const _=_r(x);if(_.res)try{E=_.fn(a,r,l,i,s,d,c,f,p,u,h,g,m,w,v)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(E)?"":(o.decimal!==void 0&&(E=E.toFixed(o.decimal)),E)}),S=(0,n.computed)(()=>{let y=b.value;return o.thousandSeparator&&(y=Yl(y)),o.isChinese&&(y=Jl(y)),y});return(0,n.watch)(b,y=>{k("update:modelValue",y),k("change",{value:y,data:S.value})}),(y,x)=>{const E=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(E,{modelValue:S.value,"onUpdate:modelValue":x[0]||(x[0]=_=>S.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),dg=cg,cs=ve(dg),ug={class:"j-block j-input-count"},fg={class:"j-input-count-top"},pg={class:"j-input-count-tool"},hg={style:{"font-weight":"600"}},gg={class:"j-input-count-codebox"},mg={key:0,class:"j-input-count-cursor"},yg={key:0,class:"fun_color"},vg={key:1,class:"comp_color"},bg={key:2,class:"num_color"},wg={key:3,class:"j-input-count-cursor"},Cg={class:"j-input-count-bottom"},xg={class:"j-input-count-left"},kg={class:"mb-8px fw-600"},Sg={class:"j-input-count-right"},Eg={class:"j-input-count-funs"},_g={style:{"font-weight":"600",padding:"8px"}},Bg={class:"j-input-count-funs-content"},Rg={class:"j-input-count-fundes"},Tg={style:{"font-size":"14px","font-weight":"300"}},Vg=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=tt(),a=e,r=t,l=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],i=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),d=(0,n.ref)([]),c=(0,n.reactive)({cells:[],cursor:0}),f=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(y){r("update:modelValue",y.length>0?JSON.stringify(y):""),r("change",{value:y.length>0?JSON.stringify(y):"",data:y})}}),p=y=>{d.value=y},u=(y,x)=>{const E={value:y,type:x};if(c.cells.splice(c.cursor,0,E),c.cursor+=1,x==="fun"){const _={value:"(",type:x},V={value:")",type:x};c.cells.splice(c.cursor,0,_,V),c.cursor+=1}},h=()=>{c.cursor>0&&(c.cursor-=1)},g=()=>{c.cursor<c.cells.length&&(c.cursor+=1)},m=()=>{c.cursor>0&&(c.cells.splice(c.cursor-1,1),c.cursor-=1)},w=()=>{c.cells=[],c.cursor=0},k=()=>{c.cells=kt(f.value),c.cursor=c.cells.length,s.value=!0},C=()=>{f.value=c.cells,s.value=!1},v=()=>{c.cells=[],c.cursor=0,s.value=!1},b=(0,n.computed)(()=>{const y={};return a.list.forEach(x=>{x.children.forEach(E=>{y[E.value]=`${x.label}.${E.label}`})}),y}),S=y=>b.value[y]||y;return(y,x)=>{const E=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("el-space"),T=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(E,(0,n.mergeProps)(y.$attrs,{type:e.type,size:e.size,label:e.label,onClick:k}),null,16,["type","size","label"]),(0,n.createVNode)(T,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:C,onClosed:v},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",ug,[(0,n.createElementVNode)("div",fg,[(0,n.createElementVNode)("div",pg,[(0,n.createElementVNode)("span",hg,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(V,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(E,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(E,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(E,{type:"link",danger:"",label:"清空",onClick:w})]),_:1})]),(0,n.createElementVNode)("div",gg,[c.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",mg)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.cells,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:A},[P.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",yg,(0,n.toDisplayString)(P.value.toUpperCase()),1)):P.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",vg," #"+(0,n.toDisplayString)(S(P.value))+"# ",1)):P.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",bg,(0,n.toDisplayString)(P.value),1)):(0,n.createCommentVNode)("",!0),A+1==c.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",wg)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(V,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,(P,A)=>(0,n.createVNode)(E,{key:A,label:P.label+"",onClick:N=>u(P.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",Cg,[(0,n.createElementVNode)("div",xg,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:A},[(0,n.createElementVNode)("div",kg,(0,n.toDisplayString)((0,n.unref)(o)(P.label)),1),(0,n.createVNode)(V,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(P.children,N=>((0,n.openBlock)(),(0,n.createBlock)(E,{key:N.value,onClick:M=>u(N.value,"comp"),label:(0,n.unref)(o)(N.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",Sg,[(0,n.createElementVNode)("div",Eg,[(0,n.createElementVNode)("span",_g,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",Bg,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(P,A)=>(0,n.createVNode)(E,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:A,onMouseover:N=>p(P.des),onClick:N=>u(P.value,"fun"),label:P.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",Rg,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:A,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",Tg,(0,n.toDisplayString)((0,n.unref)(o)(P)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Mg=Vg,ds=ve(Mg),Ng={key:0},Ag=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),r=(0,n.ref)(),l=(0,n.ref)(null),i=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{l.value&&l.value.update&&(l.value.options.decimalPlaces=o.decimals,l.value.reset(),l.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,u=>{l.value&&l.value.update&&l.value.update(u)});const s=()=>{l.value||(i.value.startVal=o.startValue,i.value.decimalPlaces=o.decimals,i.value.duration=o.duration,l.value=new Ku.CountUp(r.value,Number(o.endValue),i.value),l.value.start(()=>{o.callback?.(l.value)}))};return(0,n.onUnmounted)(()=>{l.value=null}),(0,n.onBeforeUnmount)(()=>{l.value=null}),t({myProps:a,el:r,init:s,start:u=>{l.value&&l.value.start&&l.value.start(()=>{u?.(l.value)})},pauseResume:()=>{l.value&&l.value.pauseResume&&l.value.pauseResume()},reset:()=>{l.value&&l.value.reset&&l.value.reset()},update:u=>{l.value&&l.value.update&&l.value.update(u)}}),(u,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:r},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",Ng,(0,n.toDisplayString)(e.endValue),1))],512))}}),jg=Ag,us=ve(jg),Pg={class:"j-block j-data-panel"},zg={key:0,class:"j-data-panel-header"},Hg={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Lg={class:"j-data-panel-header-right"},Og={class:"j-data-panel-body"},Dg=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Pg,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",zg,[(0,n.createElementVNode)("div",Hg,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",Lg,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Og,[(0,n.renderSlot)(t.$slots,"default")])]))}}),Ig=Dg,fs=ve(Ig),Fg={class:"j-divider-content"},$g=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const r={color:t.color};return t.size&&Number(t.size)&&(r.fontSize=`${t.size}px`),r}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(r,l)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",Fg,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Wg=$g,ps=ve(Wg),Ug={class:"j-hpanel"},Jg={class:"j-hpanel-main"},Yg=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Ug,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",Jg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),Kg=Yg,hs=ve(Kg),Gg={class:"j-vpanel"},qg={class:"j-vpanel-main"},Xg=(0,n.defineComponent)({name:"JVpanel",__name:"vpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Gg,[(0,n.renderSlot)(t.$slots,"top"),(0,n.createElementVNode)("div",qg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"bottom")]))}}),Zg=Xg,gs=ve(Zg),Qg=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},icon:{},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),l=(0,n.ref)(),i=async(f,p)=>{o.ok&&(f("保存数据中..."),l.value=await o.ok(),a("update:modelValue",l.value),a("change",{value:l.value}),p(),r.value.close())},s=()=>o.beforeClose?o.beforeClose(l.value):!0,d=()=>{o.closed?.()},c=()=>{r.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(l.value)},200)};return(0,n.watch)(()=>o.modelValue,f=>{l.value=f},{immediate:!0}),(f,p)=>{const u=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(u,(0,n.mergeProps)({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,icon:e.icon,onClick:c}),null,16,["type","label","size","icon"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:r,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:i,onClosed:d},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),e0=Qg,ms=ve(e0),t0=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},icon:{},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),l=(0,n.ref)(""),i=p=>{l.value=p},s=()=>l.value,d=p=>o.beforeClose?o.beforeClose(p):!0,c=p=>{a("change",p)},f=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,u)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:r.value,"onUpdate:modelValue":u[1]||(u[1]=w=>r.value=w),type:e.type,"btn-text":f.value,title:e.title,size:e.size,icon:e.icon,width:e.width,height:e.height,"before-close":d,ok:s,open:i,onChange:c},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=w=>l.value=w),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["modelValue","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{"model-value":e.example,mode:e.mode,readonly:""},null,8,["model-value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","icon","width","height"])}}}),n0=t0,ys=ve(n0),o0=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?i.value:a.modelValue},set(m){i.value=m,r("update:modelValue",m),r("input",m)}}),d=m=>{r("input",m)},c=m=>{r("focus",m)},f=m=>{r("blur",m)},p=()=>{r("clear"),r("update:modelValue","")},u=m=>{r("change",m)},h=m=>{r("color-change",m),r("change",m)},g=m=>{r("active-change",m)};return t({focus:()=>{l.value?.focus()},blur:()=>{l.value?.blur()},select:()=>{l.value?.select()}}),(m,w)=>{const k=(0,n.resolveComponent)("el-color-picker"),C=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(C,(0,n.mergeProps)({ref_key:"inputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=v=>s.value=v),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:p,onChange:u}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":w[0]||(w[0]=v=>s.value=v),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),a0=o0,vs=ve(a0),r0=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"},align:{default:"left"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const r={...t.style};return t.color&&(r.color=t.color),t.size&&(typeof t.size=="number"?r.fontSize=`${t.size}px`:r.fontSize=t.size),t.weight&&(r.fontWeight=t.weight),t.align&&(r.textAlign=t.align),r});return(r,l)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),l0=r0,bs=ve(l0),i0={class:"j-decorated-title-wrapper1"},s0={class:"j-decorated-title-wrapper1-line"},c0={key:3,class:"j-decorated-title-wrapper2"},d0={class:"wrapper2"},u0={class:"wrapper2-line"},f0={key:4,class:"j-decorated-title-wrapper3"},p0={class:"wrapper3"},h0={class:"wrapper3-line"},g0={key:5,class:"j-decorated-title-wrapper4"},m0={class:"wrapper4"},y0={class:"wrapper4-center"},v0={key:6,class:"j-decorated-title-wrapper5"},b0={class:"wrapper5"},w0={class:"wrapper5-left"},C0={class:"wrapper5-right"},x0=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=tt(),o=e,a=(0,n.computed)(()=>o.class||""),r=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),l=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),i=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),d=(0,n.computed)(()=>({...o.style}));return(c,f)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(d.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(i.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",i0,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([r.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",s0,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([l.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",c0,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",d0,[(0,n.createElementVNode)("div",u0,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",f0,[(0,n.createElementVNode)("div",p0,[(0,n.createElementVNode)("div",h0,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",g0,[(0,n.createElementVNode)("div",m0,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",y0,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",v0,[(0,n.createElementVNode)("div",b0,[(0,n.createElementVNode)("div",w0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[0]||(f[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",C0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[1]||(f[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),k0=x0,ws=ve(k0),S0={class:"j-block"},E0={class:"j-input-decorated-title-wrapper mb-0px"},_0=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=tt(),a=t,r=(0,n.ref)(),l=c=>{r.value?.hide(),a("update:modelValue",c),a("change",c)},i=(0,n.ref)("mdi:chevron-down"),s=()=>{i.value="mdi:chevron-up"},d=()=>{i.value="mdi:chevron-down"};return(c,f)=>{const p=(0,n.resolveComponent)("j-decorated-title"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",S0,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:r,onShow:s,onHide:d},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",E0,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(u,{icon:i.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>l(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),B0=_0,Cs=ve(B0),R0=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{modelValue:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i=(0,n.ref)("");let s=null;const d=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,yo.javascript)();case"css":case"text/css":return(0,Xu.css)();case"html":case"text/html":return(0,Zu.html)();case"json":case"application/json":return(0,Qu.json)();case"sql":case"text/x-sql":return(0,ef.sql)();case"xml":case"text/xml":return(0,tf.xml)();case"python":case"text/x-python":return(0,nf.python)();case"markdown":case"text/markdown":return(0,of.markdown)();case"java":case"text/x-java":return(0,af.java)();case"vue":case"text/x-vue":return(0,yo.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,yo.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,yo.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,yo.javascript)({jsx:!0,typescript:!0});default:return(0,yo.javascript)()}},c=()=>{const m=[qu.basicSetup,(0,Qt.lineNumbers)(),(0,Qt.highlightActiveLineGutter)(),(0,Qt.highlightSpecialChars)(),(0,Cr.history)(),(0,Qt.drawSelection)(),(0,Qt.dropCursor)(),(0,vo.indentOnInput)(),(0,vo.bracketMatching)(),(0,wr.closeBrackets)(),(0,Qt.rectangularSelection)(),(0,vo.foldGutter)(),Qt.keymap.of([...wr.closeBracketsKeymap,...Cr.defaultKeymap,...Cr.historyKeymap,...vo.foldKeymap]),(0,vo.syntaxHighlighting)(vo.defaultHighlightStyle)];return m.push(d(a.mode)),a.readonly&&m.push(br.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,wr.autocompletion)({override:[w=>{const k=w.matchBefore(/\w*/);if(!k||k.from===k.to)return null;const C=a.handleHint(k.text);return C.length===0?null:{from:k.from,options:C.map(v=>({label:typeof v=="string"?v:v.label||v.name||"",detail:typeof v=="string"?"":v.detail||"",type:typeof v=="string"?"variable":v.type||"variable",apply:typeof v=="string"?v:v.apply||v.name||v.label||""}))}}]})),m.push(Qt.EditorView.updateListener.of(w=>{if(w.docChanged){const k=w.state.doc.toString();i.value=k,r("update:modelValue",k),r("change",{value:k})}})),m},f=async()=>{l.value&&(s=new Qt.EditorView({state:br.EditorState.create({doc:a.modelValue,extensions:c()}),parent:l.value}),i.value=a.modelValue)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const w=br.EditorState.create({doc:m,extensions:c()});l.value&&(s=new Qt.EditorView({state:w,parent:l.value}));const k=s.state.doc.toString();k!==a.modelValue&&s.dispatch({changes:{from:0,to:k.length,insert:a.modelValue}})},u=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const w=s.state.doc.length;s.dispatch({selection:{anchor:w,head:w},scrollIntoView:!0})}},100)},h=()=>{let m=(0,Gu.format)(a.modelValue);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),r("update:modelValue",m),r("change",{value:m})};let g=null;return(0,n.watch)(()=>a.modelValue,m=>{m!==i.value&&(i.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&u()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await f(),typeof window<"u"&&window.ResizeObserver&&l.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(l.value))}),(0,n.onUnmounted)(()=>{g&&l.value&&(g.unobserve(l.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:l,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),T0=R0,xs=ve(T0),V0=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),r=(0,n.ref)("0"),l=(0,n.computed)(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":r.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:i.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),i=(0,n.computed)(()=>Number.parseInt(r.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{r.value=s}}),(s,d)=>{const c=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(l.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),M0=V0,N0=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),r=(0,n.ref)("0"),l=(0,n.computed)(()=>{const{barStyle:i,toLeft:s}=o;return{...i,width:s?"0":r.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:i=>{r.value=i}}),(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(l.value)},null,4))}}),A0=N0,j0=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),r=(0,n.computed)(()=>{const{contentStyle:i}=o;return{...i,fontSize:"12px"}});t({getEl:()=>a.value});const l=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(r.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),P0=j0,z0=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,r=(0,n.useModel)(e,"modelValue"),l=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),i=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),d=(0,n.useTemplateRef)("contentRef"),c=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>l.isPassing,k=>{if(k){const{endTime:C,startTime:v}=l;a("success",{isPassing:k,time:((C-v)/1e3).toFixed(1)}),r.value=k}}),(0,n.watchEffect)(()=>{l.isPassing=!!r.value});function f(k){return"pageX"in k?k.pageX:"touches"in k&&k.touches[0]?k.touches[0].pageX:0}function p(k){l.isPassing||c.value&&(a("start",k),l.moveDistance=f(k)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),l.startTime=Date.now(),l.isMoving=!0)}function u(k){const C=i.value?.offsetWidth??220,v=k?.offsetWidth??40;return{actionWidth:v,offset:C-v-6,wrapperWidth:C}}function h(k){const{isMoving:C,moveDistance:v}=l;if(C){const b=(0,n.unref)(c),S=(0,n.unref)(s);if(!b||!S)return;const{actionWidth:y,offset:x,wrapperWidth:E}=u(b.getEl()),_=f(k)-v;a("move",{event:k,moveDistance:v,moveX:_}),_>0&&_<=x?(b.setLeft(`${_}px`),S.setWidth(`${_+y/2}px`)):_>x&&(b.setLeft(`${E-y}px`),S.setWidth(`${E-y/2}px`),m())}}function g(k){const{isMoving:C,isPassing:v,moveDistance:b}=l;if(C&&!v){a("end",k);const S=c.value,y=(0,n.unref)(s);if(!S||!y)return;const x=f(k)-b,{actionWidth:E,offset:_,wrapperWidth:V}=u(S.getEl());x<_?w():(S.setLeft(`${V-E}px`),y.setWidth(`${V-E/2}px`),m()),l.isMoving=!1}}function m(){l.endTime=Date.now(),l.isPassing=!0,l.isMoving=!1}function w(){l.isMoving=!1,l.isPassing=!1,l.moveDistance=0,l.toLeft=!1,l.startTime=0,l.endTime=0;const k=(0,n.unref)(c),C=(0,n.unref)(s),v=(0,n.unref)(d);!k||!C||!v||(v.getEl().style.width="100%",l.toLeft=!0,setTimeout(()=>{l.toLeft=!1,k.setLeft("0"),C.setWidth("0")},300))}return(k,C)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:i,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(A0,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":l.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(P0,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":l.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(M0,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":l.isPassing,"to-left":l.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),H0=z0,ks=ve(H0),L0=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:r,toArray:l,activeMenu:i,theme:s}=Co(),{getHMoreMenus:d}=wi(),c=(0,n.ref)([]);o.pId==="moreId"?c.value=d.value:c.value=l(r()[o.pId||""]||[],[]);const f=g=>{const m=c.value.find(w=>w.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:u,wrapperProps:h}=(0,xr.useVirtualList)(c,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(u)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),w=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:w.data.value,"parent-actives":(0,n.unref)(i)?.pid?.split(".")||[],item:w.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),O0=L0,D0={class:"j-menu-item-label"},I0={class:"j-menu-item-label"},F0={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},$0={class:"j-menu-item-label"},W0=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=tt(),{activeMenuId:a}=Co(),r=t,l=i=>{r("click",i)};return(i,s)=>{const d=(0,n.resolveComponent)("j-icon"),c=(0,n.resolveComponent)("el-tooltip"),f=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>l(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",D0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(f,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",I0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",F0)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(O0,{"p-id":e.item.value,onClick:l},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>l(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",$0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),Va=W0,U0=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=f=>{a("click",f)},{list:s,containerProps:d,wrapperProps:c}=(0,xr.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(f,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(l)==="dark"}]},(0,n.unref)(d)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(c))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),u=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:u.data.value,"parent-actives":(0,n.unref)(r)?.pid?.split(".")||[],item:u.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":u.data.entering,"menu-item-leaving":u.data.leaving}),onClick:i},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),J0=U0,Y0=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=(0,n.ref)(),s=(0,n.ref)(0);let d=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&i.value&&(d=new ResizeObserver(()=>{i.value&&(s.value=i.value.offsetWidth)}),d.observe(i.value))});const c=(0,n.computed)(()=>{const h=[];let g=0,m=0;const w=o.menuList.length;return o.menuList.forEach(k=>{m++;const C=(Jt(k.label)||0)+32+16+4+8;g+=C,(m===w&&g<=s.value||m<w&&g+56<=s.value)&&h.push(k)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),f=(0,n.computed)(()=>{const h=[];let g=0;const m=c.value.length;return o.menuList.forEach(w=>{g++,g>=m&&h.push(w)}),h}),p=(0,n.computed)(()=>{const h=r.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(g=>g.value===h[1])>-1||f.value.findIndex(g=>g.value===r.value?.value)>-1)&&h.push("moreId"),h}),u=h=>{a("click",h)};return Ci({getHMoreMenus:f}),(0,n.onUnmounted)(()=>{d&&i.value&&(d.unobserve(i.value),d.disconnect(),d=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:i,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(l)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,m=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:u},null,8,["parent-actives","item"]))),128))],2))}}),K0=Y0,G0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=i[g%i.length]}),o.menuList)),d=(0,n.computed)(()=>r.value?.pid?.split(".")||[]),c=h=>{a("click",h)},{list:f,containerProps:p,wrapperProps:u}=(0,xr.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(l)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(u))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(f),m=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:m.data.value,"parent-actives":d.value,item:m.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),q0=G0,X0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let r={};const l=(0,n.ref)("");l.value=o.activeId||"";const i=(m,w,k,C,v)=>{k=k||[];for(let b=0,S=k.length;b<S;b++){const y=k[b],x={};x.pid=w,x.indent=C,l.value===y.value&&(x.active=!0),Object.keys(y).forEach(_=>{_!=="children"&&(x[_]=y[_])}),v&&v.includes(y.value)&&(x.open=!0),m.push(x);const E=y.children||[];E.length>0&&(x.hasChildren=!0,v||(r[x.value]=E),(!v||x.open&&!o.collapsed)&&i(m,`${w}.${x.value}`,E,C+1,v))}},s=(m,w)=>{const k=[];return i(k,"0",m,0,w),k},d=(0,n.ref)([]);let c=[];const f=()=>{r={},c=s(o.menus);const m=[];if(l.value&&o.mode==="inline"){const w=c.find(k=>k.value===l.value);w&&m.push(...w.pid.split("."))}d.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{f()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{f()});const p=()=>{if(d.value.find(m=>m.active)?.value!==l.value){const m=c.find(w=>w.value===l.value);if(m){const w=[];o.mode==="inline"&&w.push(...m.pid.split(".")),d.value=s(o.menus,w)}}},u=(0,n.computed)(()=>c.find(m=>m.value===l.value));(0,n.watch)(()=>o.activeId,()=>{l.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const m=[];if(l.value){const w=c.find(k=>k.value===l.value);w&&m.push(...w.pid.split("."))}d.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const w=[];w.push(...m.pid.split(".")),m.open||w.push(m.value);const k=s(o.menus,w),C=new Set(d.value.map(b=>b.value)),v=new Set(k.map(b=>b.value));k.forEach(b=>{C.has(b.value)||(b.entering=!0)}),d.value.forEach(b=>{v.has(b.value)||(b.leaving=!0)}),d.value=k,setTimeout(()=>{d.value.forEach(b=>{b.entering=!1,b.leaving=!1})},300)}else{if(l.value===m.value)return;l.value=m.value,a("click",m)}};return bi({getMenuMap:()=>r,toArray:s,activeMenu:u,activeMenuId:l,theme:h}),(m,w)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(J0,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(K0,{key:1,"menu-list":d.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(q0,{key:2,"menu-list":d.value,onClick:g},null,8,["menu-list"]))}}),Z0=X0,Ss=ve(Z0),Q0={class:"j-keyword-panel"},em={key:0},tm={key:1,class:"columns-wrapper"},nm=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=tt(),a=e,r=(0,n.useModel)(e,"checkAll"),l=(0,n.useModel)(e,"checkFields"),i=(0,n.ref)(!1),s=(0,n.ref)(""),d=(0,n.computed)(()=>a.columns.filter(u=>u.config?.filter?.isSearchKeyword?s.value?u.config?.label?.indexOf(s.value)!=-1:!0:!1).map(u=>({label:u.config?.label,value:u.id}))),c=()=>{r.value||(r.value=!0,i.value=!1,l.value=[])},f=u=>{u.length>0?r.value=!1:r.value=!0};return t({init:()=>{r.value?i.value=!1:i.value=!0}}),(u,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),w=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Q0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:r.value}]),onClick:c},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),r.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=k=>i.value=!i.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:i.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",em,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=k=>s.value=k),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",tm,[(0,n.createVNode)(w,{modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=k=>l.value=k),options:d.value,style:{display:"flex","flex-direction":"column"},onChange:f},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),om=nm,am={key:0,class:"title"},rm={class:"content"},lm={key:0,class:"field-wrapper fixed-field-wrapper"},im={class:"relation"},sm={style:{width:"72px"}},cm={class:"btn-wrapper"},dm={class:"field-wrapper"},um={class:"buttons"},fm=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]},searchList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=(0,n.useModel)(e,"relation"),i=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),d=(0,n.ref)([]),c=()=>{i.value=!i.value},f=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:u.value.join(","),options:p.value}),config:{style:{width:i.value?"132px":"160px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:S,row:y})=>{const x=r.columns.find(V=>V.id===S)?.config||{};let E="eq",_="text";["options"].includes(x.dataType||"")?E="in":["dateTime"].includes(x.type||"")?(E="range",_="dateTime"):["number"].includes(x.type||"")&&(_="number"),y.method=E,y.type=x.valueType||_,y.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:S})=>{const y=r.columns.find(x=>x.id===S.field)?.config||{};return["options","switch","dataItem","dataView"].includes(y.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:i.value?"134px":"130px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:S})=>{S.value=void 0}}},{id:"value",type:"input",getCompType:({row:S})=>{const y=r.columns.find(x=>x.id===S.field)?.config||{};if(["options","dataItem","switch"].includes(y.dataType||"")){if(["in","nin"].includes(S.method)||["eq","ne"].includes(S.method))return"j-select"}else{if(["dateTime"].includes(y.type||""))return["formula"].includes(S.method)?"j-select":"j-date";if(["number"].includes(y.type||""))return"j-number"}return"j-input"},getCompConfig:({row:S})=>{if(["empty","not_empty"].includes(S.method||""))return{display:!1};const y=r.columns.find(E=>E.id===S.field)?.config||{},x={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(S.method||"")&&(x.multiple=!0,x.collapseTags=!0,x.collapseTagsTooltip=!0),["options","dataItem"].includes(y.dataType||"")?(x.collapseTags=!0,x.collapseTagsTooltip=!0,x.dataType=y.dataType,x.dataCode=y.dataCode,x.options=y.options):["switch"].includes(y.dataType||"")?(x.options=[],x.dataType="options",y.activeValue==null?x.options.push({label:"是",value:"1"}):x.options.push({label:"是",value:y.activeValue}),y.inactiveValue==null?x.options.push({label:"否",value:"0"}):x.options.push({label:"否",value:y.inactiveValue})):["dateTime"].includes(y.type||"")&&(["formula"].includes(S.method)?(x.placeholder="",x.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],x.dataType="options"):(x.selectType="datetime",["range"].includes(S.method)?(x.selectType="datetimerange",x.startPlaceholder="开始时间",x.endPlaceholder="结束时间",x.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):x.placeholder="")),x},config:{style:{width:i.value?"246px":"296px",flex:i.value?"auto":"1"},appendTo:i.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{d.value=r.searchFieldList,s.value=r.searchList});const p=(0,n.computed)(()=>r.columns.filter(S=>!S.children?.length&&!S.config?.isNotFilter).map(S=>({label:S.config?.label,value:S.id,dataType:S.config?.dataType,options:S.config?.options}))),u=(0,n.computed)(()=>d.value.map(S=>S.field)),h=({data:S})=>{if(u.value.includes(S.value))return;const y=r.columns.find(_=>_.id===S.value)?.config||{};let x="eq",E="text";["options","dataItem"].includes(y.dataType||"")?x="in":["dateTime"].includes(y.type||"")&&(x="range",E="dateTime"),d.value.push({field:S.value,method:x,type:y.valueType||E})},g=o,m=()=>{d.value.length=0},w=()=>{i.value?g("filter"):g("close",!0)},k=()=>{d.value.forEach(S=>{S.value=void 0}),g("filter")},C=()=>d.value,v=(0,n.shallowRef)();return t({getSearchFields:C,getFixedSearchData:()=>v.value?.getFormData(!1)||{}}),(S,y)=>{const x=(0,n.resolveComponent)("j-icon"),E=(0,n.resolveComponent)("j-form"),_=(0,n.resolveComponent)("j-select"),V=(0,n.resolveComponent)("j-button-select"),T=(0,n.resolveComponent)("j-button"),P=(0,n.resolveComponent)("j-input-rows"),A=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":i.value}])},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",am,[(0,n.createVNode)(x,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",rm,[s.value.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",lm,[(0,n.createVNode)(E,{ref_key:"formRef",ref:v,schema:s.value,config:{labelWidth:80,labelPosition:i.value?"top":"left"}},null,8,["schema","config"])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",im,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",sm,[(0,n.createVNode)(_,{modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=N=>l.value=N),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",cm,[(0,n.createVNode)(V,{label:"添加过滤条件",options:p.value,"model-value":u.value.join(","),onChange:h},null,8,["options","model-value"]),d.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,type:"text",danger:"",label:"删除全部",onClick:m})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",dm,[(0,n.createVNode)(P,{modelValue:d.value,"onUpdate:modelValue":y[1]||(y[1]=N=>d.value=N),columns:f,"edit-config":{isAddBtn:!1},"is-wrap":i.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(A,{placement:"bottom",content:i.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,n.createVNode)(x,{rotate:45,icon:i.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",um,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:w},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:k},null,8,["label"])])],2)}}}),Es=fm,pm={class:"j-order-panel"},hm={class:"content"},gm={class:"btn-wrapper"},mm={class:"field-wrapper"},ym={class:"buttons"},vm=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=o,i=(0,n.computed)(()=>r.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),d=(0,n.computed)(()=>s.value.map(g=>g.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g?.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:g})=>{d.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},u=()=>{l("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],l("clear")};return t({init:p}),(g,m)=>{const w=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-input-rows"),C=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",pm,[(0,n.createElementVNode)("div",hm,[(0,n.createElementVNode)("div",gm,[(0,n.createVNode)(w,{label:"添加排序规则",options:i.value,"model-value":d.value.join(","),onChange:f},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",mm,[(0,n.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=v=>s.value=v),columns:c,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",ym,[(0,n.createVNode)(C,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:u},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(C,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),bm=vm,wm={class:"j-column-panel"},Cm={class:"content"},xm={class:"search-wrapper"},km={class:"tree-wrapper"},Sm={class:"buttons"},Em=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=o,i=(0,n.ref)(),s=(0,n.ref)(""),d={},c=(0,n.ref)([]),f=(0,n.ref)([]),p=(y,x)=>{const E=[],_=new Map;y.forEach(T=>{_.set(T.id||"",T),d[T.id||""]=T});const V=new Set;return x&&x.length>0&&x.forEach(T=>{const P=_.get(T.id);if(P){V.add(P.id||"");const A={id:P.id||"",label:P.config?.label||P.id||"",type:P.type,display:P.config?.display!==!1};P.children&&P.children.length>0&&(A.children=p(P.children,T.children)),E.push(A)}}),y.forEach(T=>{if(!V.has(T.id||"")){const P={id:T.id||"",label:T.config?.label||T.id||"",type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(P.children=p(T.children)),E.push(P)}}),E},u=(y,x)=>x.length===0?y:y.map(E=>{const _=x.some(T=>E.label.toLowerCase().includes(T.toLowerCase())),V=E.children?u(E.children,x):[];return _||V.length>0?{...E,children:V.length>0?V:E.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return f.value;const y=s.value.split(/\s+/).filter(Boolean);return u(f.value,y)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const y=new Map;if(r.columnConfig&&r.columnConfig.length>0){const x=E=>{E.forEach(_=>{y.set(_.id,_),_.children&&x(_.children)})};x(r.columnConfig)}return y}),w=()=>{const y=x=>{const E=[];return x.forEach(_=>{let V=!0;if(m.value.size>0){const T=m.value.get(_.id||"");T?V=T.display:V=_.config?.display!==!1}else V=_.config?.display!==!1;V&&(E.push(_.id||""),_.children&&E.push(...y(_.children)))}),E};g.value=y(r.columns)},k=(y,{node:x})=>{y.includes(x.id)?g.value.push(x.id):g.value=g.value.filter(E=>E!==x.id)},C=(y,x,E)=>E==="inner"?!1:y.parent===x.parent,v=()=>{const y=x=>x.map(E=>{const _={...E,display:g.value.includes(E.id)};return E.children&&(_.children=y(E.children)),_});l("save",y(f.value))},b=()=>{if(w(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",i.value){const y=i.value;y.setCheck&&y.setCheck(g.value);const x=y.$refs?.treeRef||y;x?.setCheckedKeys&&x.setCheckedKeys(g.value)}l("save",void 0)};return t({init:()=>{w(),c.value=p(r.columns,r.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(y,x)=>{const E=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),V=(0,n.resolveComponent)("j-tree"),T=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",wm,[(0,n.createElementVNode)("div",Cm,[(0,n.createElementVNode)("div",xm,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":x[0]||(x[0]=P=>s.value=P),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",km,[(0,n.createVNode)(V,{ref_key:"treeRef",ref:i,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":C,check:k},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",Sm,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:b},null,8,["label"])])])}}}),_m=Em,Bm={class:"j-table-panel-left"},Rm={class:"j-table-panel-top"},Tm={class:"j-table-panel-top-right"},Vm={key:0,style:{width:"200px"}},Mm={class:"j-table-panel-main"},Nm={class:"j-table-panel-vnode-content"},Am={key:0,class:"j-table-panel-vnode-pagination"},jm={key:0,class:"j-table-panel-filter-panel"},Pm=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{viewMode:{type:String,default:"table"},modelValue:{type:Array,default:()=>[]},columns:{type:Array,required:!0,default:()=>[]},columnFilter:{type:Array,default:()=>[]},searchList:{type:Array,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},multipleDisabled:{type:Function,default:null},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},renderVNode:Function,renderVNodeClass:String,rowDrag:{type:Boolean,default:!1},cardLabelKey:{type:String,default:"f_Name"},cardLoadSrc:{type:Function,default:void 0},cardFallback:{type:String,default:""},cardBackgroundColor:{type:String,default:""},cardShowBigEditButton:{type:Boolean,default:!1},cardWidth:{type:Number,default:258},cardHeight:{type:Number,default:184},cardImageFit:{type:String,default:"fill"}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),{openLayer:r}=En(),l=e,i=o;l.isMultiple&&!l.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)(),d=(0,n.ref)(),c=(0,n.ref)([]),f=(0,n.ref)(0),p=(0,n.ref)(1),u=(0,n.ref)(l.pageSize||100),h=(0,n.ref)(0),g=(0,n.computed)(()=>h.value>0),m=(0,n.ref)([]),w=(0,n.ref)(!1),k=(0,n.computed)(()=>l.batchButtons&&l.batchButtons.length>0),C=(0,n.computed)(()=>m.value.length>0),v=(0,n.computed)(()=>k.value&&C.value&&l.isMultiple||w.value),b=(0,n.computed)(()=>!!l.loadData),S=(0,n.computed)(()=>!!l.loadData&&l.isPage&&!v.value),y=(0,n.computed)(()=>l.viewMode==="card"),x=(0,n.computed)(()=>w.value?m.value:c.value);k.value&&!l.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const E=le=>l.rowKey?l.rowKey.split(",").map(ie=>le[ie.trim()]).join("::"):"",_=(le,ie)=>{if(!ie||ie.length===0)return le.filter(se=>se.config?.display!==!1).map(se=>se.children&&se.children.length>0?{...se,children:_(se.children)}:se);const Ve=new Map(le.map(se=>[se.id,se])),_e=[];return ie.forEach(se=>{const Je=Ve.get(se.id);if(Je){if(se.display){let Ct=Je;Je.children&&Je.children.length>0&&(Ct={...Je,children:_(Je.children,se.children)}),_e.push(Ct)}Ve.delete(se.id)}}),le.forEach(se=>{if(Ve.has(se.id)&&se.config?.display!==!1){let Je=se;se.children&&se.children.length>0&&(Je={...se,children:_(se.children)}),_e.push(Je)}}),_e},V=(0,n.computed)(()=>_(l.columns,$.value)),T=(0,n.computed)(()=>ti(l.columns,le=>le.config.label)),P=(0,n.ref)(""),A=(0,n.computed)(()=>T.value.some(le=>le.config?.filter?.isSearchKeyword)),N=(0,n.ref)(),M=(0,n.ref)(!0),B=(0,n.ref)([]),H=(0,n.computed)(()=>M.value?"搜索全部":`搜索范围:${T.value.filter(le=>B.value.includes(le.id)).map(le=>le.config?.label).join("、")}`),W=()=>{N.value.init()},X=(0,n.ref)(),fe=(0,n.ref)(!1),J=(0,n.ref)(!1),Y=(0,n.ref)(!1),G=(0,n.ref)([]),j=(0,n.ref)("and"),me=(0,n.ref)(),Pe=(0,n.ref)(!1),pe=(0,n.ref)([]),Ne=(0,n.ref)(),Fe=le=>{const ie=new Map(T.value.map(Ve=>[Ve.id,Ve.config?.label||Ve.id]));return le.split(",").map(Ve=>Ve.trim()).filter(Boolean).map(Ve=>{const[_e,se]=Ve.split(/\s+/),Je=(se||"ASC").toUpperCase()==="DESC"?"DESC":"ASC";return{label:ie.get(_e)||_e,value:_e,sord:Je}}).filter(Ve=>Ve.value)};(0,n.watch)([()=>l.sort,()=>T.value],([le])=>{const ie=(le||"").trim();if(ie){if(ie!==Ne.value){pe.value=Fe(ie),Ne.value=ie;return}const Ve=new Map(T.value.map(_e=>[_e.id,_e.config?.label||_e.id]));pe.value=pe.value.map(_e=>({..._e,label:Ve.get(_e.value)||_e.label||_e.value}));return}Ne.value&&(pe.value=[],Ne.value=void 0)},{immediate:!0});const Ge=()=>{me.value.init(pe.value)},Q=le=>{pe.value=le,Pe.value=!1,Wt()},ge=()=>{pe.value=[],Wt()},Re=(0,n.ref)(),rt=(0,n.ref)(!1),$=(0,n.ref)(),ae=(0,n.computed)(()=>$.value!=null),ye=()=>{Re.value?.init()},Ce=le=>{$.value=le,rt.value=!1},Me=(0,n.ref)(!1),Se=()=>{Me.value=!Me.value},Te=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),w.value&&(w.value=!1,s.value.setRecords(c.value))),d.value?.clearSelection?.(),i("select",{selections:[],record:{},checked:!1,isMultiple:l.isMultiple})},We=()=>{w.value=!w.value,!y.value&&(w.value?s.value?.setRecords(m.value):s.value?.setRecords(c.value),s.value?.setSelection?.(m.value))},wt=(0,n.computed)(()=>{if(m.value.length>0&&l.isMultiple){const le=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:w.value?"全部":"仅选中",config:{type:"text"},click:We},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Te}],ie=l.batchButtons.map(Ve=>({...Ve,click:()=>{Ve.click&&Ve.click({data:m.value,openLayer:r})}}));return[...le,...ie]}return l.buttons}),Pt=(0,n.computed)(()=>wt.value.filter(le=>le.config?.display!==!1)),Rt=(0,n.ref)(null),Xe=(0,n.ref)(0),Nt=()=>{Xe.value=Rt.value?.clientWidth||0};let ct;(0,n.onMounted)(()=>{(0,n.nextTick)(Nt),ct=new ResizeObserver(()=>{Nt()}),Rt.value&&ct.observe(Rt.value)}),(0,n.onBeforeUnmount)(()=>{ct?.disconnect()}),(0,n.watch)(()=>Pt.value,()=>{(0,n.nextTick)(Nt)},{deep:!0}),(0,n.watch)(Me,()=>{(0,n.nextTick)(Nt)});const yt=(0,n.computed)(()=>{const le=Pt.value;if(le.length===0)return[];const ie=Xe.value;if(ie<=0)return le;const Ve=Math.max(0,ie-4),_e=(xt,Dt)=>xt.groupId||`__auto_${Dt}`,se=xt=>{if(xt.config?.notLabel===!0||!xt.label)return 28;const Dt=24,Tt=Jt(xt.label||"")||0,At=xt.config?.icon?18:0;return Math.ceil(Tt+Dt+At+2)};if((xt=>{let Dt=0,Tt=null;return xt.forEach((At,Io)=>{const ma=_e(At,Io);Tt!==null&&(Dt+=ma===Tt?-1:8),Dt+=se(At),Tt=ma}),Dt})(le)<=Ve)return le;const Ct={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},Bt=28,Ut=[];let Gt=0,uo=null;for(let xt=0;xt<le.length;xt++){const Dt=le[xt],Tt=_e(Dt,xt);let At=Gt;uo!==null&&(At+=Tt===uo?-1:8),At+=se(Dt);const Io=le.length-(xt+1)>0?(At>0?8:0)+Bt:0;if(At+Io<=Ve)Ut.push(Dt),Gt=At,uo=Tt;else break}const fo=le.slice(Ut.length);if(fo.length===0)return le;const Oe={...Ct,children:fo};return Ut.length===0?[Oe]:[...Ut,Oe]});let lt;const it=async le=>{h.value++;const ie={};le&&(lt=le),lt&&(ie.query=lt);try{const Ve={};Ve.rel=j.value,Ve.cond=(X.value?.getSearchFields?.()||G.value).filter(se=>se.value!==void 0&&se.value!==null&&se.value!==""||["empty","not_empty"].includes(se.method)).map(se=>({field:se.field,method:se.method,value:se.value,type:se.type})),Ve.cond.length>0?Y.value=!0:Y.value=!1,ie.filter=Ve;const _e=pe.value.map(se=>se.value+" "+se.sord).join(",");if(P.value&&(ie.keyword={value:P.value,fields:M.value?T.value.filter(se=>se.config?.filter?.isSearchKeyword).map(se=>se.id):(0,n.unref)(B)}),ie.fixedFilter=X.value?.getFixedSearchData?.()||{},l.loadData){if(l.isPage){ie.pagination={rows:(0,n.unref)(u),page:p.value,sort:_e||l.sort||l.rowKey};const se=await l.loadData(ie)||{};c.value=se.rows||[],f.value=se.records||0}else ie.sort=_e,c.value=await l.loadData(ie)||[],f.value=c.value.length;s.value?.setRecords(x.value),k.value?(m.value=[],w.value=!1,d.value?.clearSelection?.()):l.rowKey&&m.value.length>0&&(s.value?.setSelection?.(m.value),d.value?.selections&&(d.value.selections.value=m.value.map(se=>E(se)).filter(Boolean)))}else c.value=l.modelValue||[],f.value=c.value.length,s.value?.setRecords(x.value)}finally{h.value=Math.max(0,h.value-1)}};(0,n.watch)(()=>l.modelValue,async()=>{await it()}),(0,n.watch)(()=>y.value,async le=>{if(await(0,n.nextTick)(),!le){s.value?.setSelection?.(m.value);return}d.value?.selections&&(d.value.selections.value=m.value.map(ie=>E(ie)).filter(Boolean))});const Wt=async()=>{l.loadData&&(p.value=1,await it())},U=({rows:le,page:ie})=>{u.value=le,p.value=ie,it()},ue=le=>{U({rows:(0,n.unref)(u),page:le})},ee=le=>{U({rows:le,page:1})},ne=async()=>{m.value=[],w.value=!1,p.value=1,lt=void 0,await it()},he=async le=>{m.value=[],w.value=!1,await it(le)},Ee=async()=>{await ne()},Ae=le=>{i("ready",le)},Ue=({selections:le,record:ie,checked:Ve,isMultiple:_e})=>{let se=[];if(!l.isMultiple){m.value=le,i("select",{selections:le,record:ie,checked:Ve,isMultiple:_e});return}if(k.value)se=le;else if(!l.rowKey)se=le;else{const Je=new Map(le.map(Bt=>[E(Bt),Bt])),Ct=new Map(m.value.map(Bt=>[E(Bt),Bt]));c.value.forEach(Bt=>{const Ut=E(Bt);Je.has(Ut)?Ct.set(Ut,Je.get(Ut)):Ct.delete(Ut)}),se=Array.from(Ct.values())}m.value=se,i("select",{selections:se,record:ie,checked:Ve,isMultiple:_e}),w.value&&se.length===0?(w.value=!1,s.value&&s.value.setRecords(c.value)):w.value&&se.length>0&&s.value&&(s.value.setRecords(se),s.value.setSelection?.(se))},vt=le=>{m.value=le},et=le=>{m.value=[le],i("select",{selections:[le],record:le,checked:!0,isMultiple:!1})},bn=()=>{const le=m.value||[],ie=!y.value&&s.value?.getSelection?.()||[];if(ie.length===0)return le;if(!l.rowKey||le.length===0)return ie;const Ve=new Map(ie.map(se=>[E(se),se])),_e=le.map(se=>Ve.get(E(se))||se);return m.value=_e,_e},wn=le=>{if(m.value=le,y.value){d.value?.selections&&(d.value.selections.value=(le||[]).map(ie=>E(ie)).filter(Boolean));return}s.value?.setSelection?.(le)},Cn=()=>y.value?d.value:s.value,io=(0,n.computed)(()=>l.pageSizes||[100,200,500,1e3]),so=(0,n.computed)(()=>!!l.rowKey&&!l.isMultiple),Do=(0,n.computed)(()=>!!l.rowKey&&l.isMultiple),ga=({buttons:le,row:ie})=>{if(!l.actionFilter)return;const Ve=c.value.findIndex(_e=>E(_e)===E(ie));le.forEach(_e=>{const se=l.actionFilter?.({action:_e,record:ie,recordIndex:Ve,col:-1,row:Ve,table:s.value});if(se===!1){_e.config=_e.config||{},_e.config.display=!1;return}se&&typeof se=="object"&&(se.display!==void 0&&(_e.config=_e.config||{},_e.config.display=se.display),se.disabled!==void 0&&(_e.config=_e.config||{},_e.config.disabled=se.disabled))})},co=({selections:le,rows:ie})=>{if(!l.isMultiple){const _e=ie[0],se=_e?[_e]:[];m.value=se,i("select",{selections:se,record:_e||{},checked:!!_e,isMultiple:!1});return}let Ve=[];if(k.value||!l.rowKey)Ve=ie;else{const _e=new Set(le),se=new Map(m.value.map(Je=>[E(Je),Je]));c.value.forEach(Je=>{const Ct=E(Je);Ct&&(_e.has(Ct)?se.set(Ct,Je):se.delete(Ct))}),Ve=Array.from(se.values())}m.value=Ve,i("select",{selections:Ve,record:ie[0]||{},checked:Ve.length>0,isMultiple:!0}),w.value&&Ve.length===0&&(w.value=!1)};return(0,n.onMounted)(async()=>{l.immediate&&await he()}),t({refreshData:he,resetData:ne,getSelection:bn,setSelection:wn,clearSelection:()=>{Te()},getTableRef:Cn}),(le,ie)=>{const Ve=(0,n.resolveComponent)("j-buttons"),_e=(0,n.resolveComponent)("j-icon"),se=(0,n.resolveComponent)("el-popover"),Je=(0,n.resolveComponent)("el-tooltip"),Ct=(0,n.resolveComponent)("el-input"),Bt=(0,n.resolveComponent)("j-button"),Ut=(0,n.resolveComponent)("el-pagination"),Gt=(0,n.resolveComponent)("j-card-list"),uo=(0,n.resolveComponent)("j-table"),fo=(0,n.resolveDirective)("loading");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,n.createElementVNode)("div",Bm,[(0,n.createElementVNode)("div",Rm,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:Rt,class:"j-table-panel-top-left"},[(0,n.createVNode)(Ve,{list:yt.value},null,8,["list"])],512),(0,n.createElementVNode)("div",Tm,[b.value&&A.value&&!v.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Vm,[(0,n.createVNode)(Ct,{modelValue:P.value,"onUpdate:modelValue":ie[2]||(ie[2]=Oe=>P.value=Oe),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(Wt,["enter"]),onClear:Wt},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(_e,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Je,{placement:"bottom",content:H.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:W,onHide:Wt},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(_e,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(om,{ref_key:"keywordPanelRef",ref:N,"check-all":M.value,"onUpdate:checkAll":ie[0]||(ie[0]=Oe=>M.value=Oe),"check-fields":B.value,"onUpdate:checkFields":ie[1]||(ie[1]=Oe=>B.value=Oe),columns:T.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),b.value&&e.showFilterButton&&!fe.value&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(se,{key:1,visible:J.value,"onUpdate:visible":ie[6]||(ie[6]=Oe=>J.value=Oe),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:Wt},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:Y.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Es,{ref_key:"filterPanelRef",ref:X,"is-pin":fe.value,"onUpdate:isPin":ie[3]||(ie[3]=Oe=>fe.value=Oe),relation:j.value,"onUpdate:relation":ie[4]||(ie[4]=Oe=>j.value=Oe),"search-list":e.searchList,"search-field-list":G.value,columns:T.value,onFilter:Wt,onClose:ie[5]||(ie[5]=Oe=>J.value=!1)},null,8,["is-pin","relation","search-list","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),b.value&&e.showOrderButton&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{visible:Pe.value,"onUpdate:visible":ie[7]||(ie[7]=Oe=>Pe.value=Oe),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Ge},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{class:(0,n.normalizeClass)({active:pe.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(bm,{ref_key:"orderPanelRef",ref:me,columns:T.value,onSave:Q,onClear:ge},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!v.value&&!e.renderVNode&&!y.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{visible:rt.value,"onUpdate:visible":ie[8]||(ie[8]=Oe=>rt.value=Oe),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ye},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{class:(0,n.normalizeClass)({active:ae.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(_m,{ref_key:"columnPanelRef",ref:Re,columns:e.columns,"column-config":$.value,onSave:Ce},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{type:"text",icon:"mdi:refresh",onClick:Ee})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:5,placement:"bottom",content:Me.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Se},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",Mm,[e.renderVNode?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(["j-block","j-table-panel-vnode",e.renderVNodeClass])},[(0,n.createElementVNode)("div",Nm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(x.value,(Oe,xt)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.renderVNode(Oe)),{key:E(Oe)||xt,onClick:Dt=>et(Oe)},null,8,["onClick"]))),128))]),S.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Am,[ie[16]||(ie[16]=(0,n.createElementVNode)("div",null,null,-1)),(0,n.createVNode)(Ut,{"current-page":p.value,"onUpdate:currentPage":ie[9]||(ie[9]=Oe=>p.value=Oe),"page-size":u.value,"onUpdate:pageSize":ie[10]||(ie[10]=Oe=>u.value=Oe),"page-sizes":e.pageSizes||[100,200,500,1e3],total:f.value,layout:"total, prev, pager, next, sizes",onCurrentChange:ue,onSizeChange:ee},null,8,["current-page","page-size","page-sizes","total"])])):(0,n.createCommentVNode)("",!0)],2)):y.value?((0,n.openBlock)(),(0,n.createBlock)(Gt,{key:1,ref_key:"cardListRef",ref:d,"data-source":x.value,"load-src":e.cardLoadSrc,"label-key":e.cardLabelKey,buttons:e.actions,fallback:e.cardFallback,"is-page":S.value,"page-sizes":io.value,"page-total":f.value,"table-page":p.value,"onUpdate:tablePage":ie[11]||(ie[11]=Oe=>p.value=Oe),"page-size":u.value,"onUpdate:pageSize":ie[12]||(ie[12]=Oe=>u.value=Oe),"max-btns":e.actionsMaxCount,"row-key":e.rowKey,"is-radio":so.value,"is-multi-select":Do.value,"background-color":e.cardBackgroundColor,"show-big-edit-button":e.cardShowBigEditButton,"card-width":e.cardWidth,"card-height":e.cardHeight,"image-fit":e.cardImageFit,"set-button":ga,onLoadPageData:U,onSelectionChange:co},null,8,["data-source","load-src","label-key","buttons","fallback","is-page","page-sizes","page-total","table-page","page-size","max-btns","row-key","is-radio","is-multi-select","background-color","show-big-edit-button","card-width","card-height","image-fit"])):((0,n.openBlock)(),(0,n.createBlock)(uo,{key:2,ref_key:"tableRef",ref:s,"table-page":p.value,"onUpdate:tablePage":ie[13]||(ie[13]=Oe=>p.value=Oe),columns:V.value,"column-filter":e.columnFilter,"sub-columns":e.subColumns,records:x.value,"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"multiple-disabled":e.multipleDisabled,"is-page":S.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":f.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,"row-drag":e.rowDrag,onLoadPageData:U,onReady:Ae,onSelectionChanged:Ue,onSelectRecordsChanged:vt},null,8,["table-page","columns","column-filter","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","multiple-disabled","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children","row-drag"]))])),[[fo,g.value]])]),b.value&&e.showFilterButton&&fe.value&&!v.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",jm,[(0,n.createVNode)(Es,{ref_key:"filterPanelRef",ref:X,"is-pin":fe.value,"onUpdate:isPin":ie[14]||(ie[14]=Oe=>fe.value=Oe),relation:j.value,"onUpdate:relation":ie[15]||(ie[15]=Oe=>j.value=Oe),"search-list":e.searchList,"search-field-list":G.value,columns:T.value,onFilter:Wt},null,8,["is-pin","relation","search-list","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),zm=Pm,_s=ve(zm),Hm={class:"j-button-select"},Lm={class:"search-wraper"},Om={class:"options-wraper"},Dm=["onClick"],Im=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=tt(),l=(0,n.ref)(""),i=(0,n.computed)(()=>l.value===""?o.options:o.options.filter(c=>(c.label||"").includes(l.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const f=[...s.value,c.value].join(",");a("update:modelValue",f),a("change",{value:f,data:c})};return(c,f)=>{const p=(0,n.resolveComponent)("j-button"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Hm,[(0,n.createElementVNode)("div",Lm,[(0,n.createVNode)(h,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=m=>l.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(r)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(u,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",Om,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(w=>d(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(u,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(r)(m.label)),1)],10,Dm))),128))])])]),_:1},8,["width"])}}}),Fm=Im,Bs=ve(Fm),$m={class:"j-tree-item-text"},Wm={key:2,class:"j-tree-item-button-group"},Um={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Jm=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,checkStrictly:{type:Boolean,default:!1},check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:l,t:i}=tt(),{getDataByComp:s,loadDataByComp:d}=l(),c=(0,n.ref)(),f=(0,n.ref)(!1),p=(0,n.ref)(""),u=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({config:a})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):u.value),w=async()=>{f.value=!0,a.loadData&&(u.value=await a.loadData()||[]),d&&await d({type:"j-tree",config:a}),f.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},k=(N,M=!0)=>{c.value?.setCurrentKey(N,M)},C=()=>c.value?.getCurrentKey(),v=(N,M=!1)=>{c.value?.setCheckedKeys(N,M)},b=(N=!1)=>c.value?.getCheckedKeys(N),S=async(N,M,B,H)=>{if(p.value=N.value,a.nodeClickFlow&&a.runFlow){const W=JSON.parse(a.nodeClickFlow);await a.runFlow(W,{value:N.value})}a.click&&a.click(N.value,N,H)},y=(N,{checkedKeys:M,checkedNodes:B,halfCheckedKeys:H,halfCheckedNodes:W})=>{a.check&&a.check(M,{node:N,checkedNodes:B,halfCheckedKeys:H,halfCheckedNodes:W})},x=(N,M,B,H)=>{r("node-drop",N,M,B,H)},E=N=>{const M=kt(a.treeButtons);return N&&a.filterButton?a.filterButton({buttons:M,node:N}):M},{openLayer:_}=En(),V=(N,M)=>{N.config?.disabled||N.click&&N.click({data:M,openLayer:_})},T=(0,n.ref)(""),P=(N,M)=>{T.value=N?M.value:""},A=(N,M,B)=>a.allowDrop?a.allowDrop(N,M,B):!(B=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await w()}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{w()}),t({refreshData:w,setValue:k,getValue:C,setCheck:v,getCheck:b}),(N,M)=>{const B=(0,n.resolveComponent)("j-icon"),H=(0,n.resolveComponent)("j-button"),W=(0,n.resolveComponent)("el-dropdown-item"),X=(0,n.resolveComponent)("el-dropdown-menu"),fe=(0,n.resolveComponent)("el-dropdown"),J=(0,n.resolveComponent)("el-tree"),Y=(0,n.resolveComponent)("el-empty"),G=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(J,{key:0,ref_key:"treeRef",ref:c,"node-key":"value","default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":A,"expand-on-click-node":e.expandOnClickNode,"check-strictly":e.checkStrictly,onNodeClick:S,onCheck:y,onNodeDrop:x},{default:(0,n.withCtx)(({node:j})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":T.value===j.data.value}])},[j.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,class:"j-tree-item-open-icon",size:18,icon:j.data.openIcon,color:j.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),j.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:1,class:"j-tree-item-default-icon",size:18,icon:j.data[e.iconKey]||e.defaultIcon||"",color:j.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",$m,(0,n.toDisplayString)(j.label),1),E(j.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",Wm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(E(j.data),(me,Pe)=>((0,n.openBlock)(),(0,n.createBlock)(fe,{key:Pe,trigger:"click",onVisibleChange:pe=>P(pe,j.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(X,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(me.children,(pe,Ne)=>((0,n.openBlock)(),(0,n.createBlock)(W,{key:Ne,disabled:pe.disabled,divided:pe.divided,onClick:(0,n.withModifiers)(Fe=>V(pe,j.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:pe.danger?"var(--j-color-danger)":pe.color||e.buttonIconColor||"var(--j-color-text-2)"})},[pe.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,icon:pe.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(i)(pe.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(H,{icon:me.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node","check-strictly"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",Um,[(0,n.createVNode)(Y,{description:(0,n.unref)(i)(e.emptyDes)},null,8,["description"])]))],2)),[[G,f.value]])}}}),Ym=Jm,Rs=ve(Ym),Km=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=tt(),{getDataByComp:r}=a(),l=(0,n.computed)(()=>r?r({type:"j-tree-select",config:o})||[]:[]),i=(0,n.computed)(()=>o.options?o.options:o.dataCode||o.dataType?l.value:[]),s=t,d=(0,n.computed)({get(){return o.modelValue},set(f){s("update:modelValue",f)}}),c=f=>{s("change",f)};return(f,p)=>{const u=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(u,{modelValue:d.value,"onUpdate:modelValue":p[0]||(p[0]=h=>d.value=h),style:{width:"100%"},data:i.value,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:c},null,8,["modelValue","data","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),Gm=Km,Ts=ve(Gm),Vs=ve(Ji),qm=kr.default;async function Xm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const r=new qm({[e]:[a]});let l=[];try{await r.validate({[e]:t})}catch(i){i.errors?l=i.errors.map(({message:s})=>s):l=[a.message||"校验错误"]}return l.length>0?l[0]:""}async function Zm(e,t,o){const a=o.map((r,l)=>({...r,ruleIndex:l})).sort(({warningOnly:r,ruleIndex:l},{warningOnly:i,ruleIndex:s})=>!!r==!!i?l-s:r?1:-1);for(let r=0;r<a.length;r+=1){const l=a[r];"pattern"in l&&(t+="");const i=await Xm(e,t,l);if(i!=="")return{name:e,errors:i}}}function Qm(e,t){const o=(l,i,s,d,c)=>{Object.keys(i).forEach(f=>{let p=f;s&&(p=`${s}.${f}`);const u=i[f],{rules:h,myGridtableId:g}=t(p,s?i:void 0,()=>d,c);if(h.length){const m=a(p,u,h);l.push(m)}g&&u.forEach(m=>{o(l,m,g,u,s?i:void 0)})})},a=(l,i,s)=>Zm(l,i,s);return{validateForm:async()=>{const l=(0,n.unref)(e),i=[];o(i,l,"");const s=await Promise.all(i),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:a}}var Ms=({data:e,actions:t,utils:o,inputParams:a,notRunActions:r})=>{const l=s=>e.filter(d=>d.source===s).map(d=>d.target),i=async s=>{s=s||"start";const d=e.find(c=>c.id===s);if(d.config.type==="start"){const c=l(s);for(let f=0;f<c.length;f++)await i(c[f])}else{const c=t[d.config.type];c&&await c(d.config,o,async f=>{if(f=f||{},f.nodeId=s,f.next!==!1){const p=l(f.nodeId);for(let u=0;u<p.length;u++)await i(p[u])}},a,f=>{r[f]={data:e,inputParams:a}})}};return{run:i}},ey=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1},actions:{type:Object,default:()=>({})}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:l,existField:i,httpGet:s,httpPost:d,success:c,warning:f,error:p,info:u,t:h}=tt();let g;l&&(g=l());const m=U=>{p&&p(U)},w=(0,n.ref)(!1),k=(0,n.computed)(()=>a.config?.gutter||16),C=(0,n.computed)(()=>a.config?.span||24),v=(0,n.computed)(()=>a.config?.labelWidth),b=(0,n.computed)(()=>a.config?.labelPosition||"right"),S=(0,n.computed)(()=>E.length===1&&(E[0].type==="j-tabs"||E[0].type==="j-layout"||E[0].config?.isAutoWindow)),y=(0,n.reactive)({}),x=(0,n.ref)({}),E=(0,n.reactive)([]),_={};let V={},T={},P=[],A={},N={},M=!1,B=0,H;const W=()=>new Promise(U=>{const ue=globalThis.requestAnimationFrame;typeof ue=="function"?ue(()=>U()):setTimeout(()=>U(),0)}),X=U=>{const ue=globalThis.requestIdleCallback;typeof ue=="function"?ue(()=>U()):setTimeout(()=>U(),0)},fe=()=>{const U={};return Object.keys(y).forEach(ue=>{U[ue]=y[ue]}),U},J=()=>{M||(A=kt(N),M=!0)},Y=async U=>{w.value&&me&&(U.getTableData||Br(me,U.config.valueIdKey||U.id,U.formData[U.config.valueIdKey||U.id])),r("change",U),_[U.id]?.config?.codeChange&&await it(JSON.parse(_[U.id]?.config?.codeChange),{param:U}),a.config?.codeChange&&await it(JSON.parse(a.config?.codeChange),{param:U})},G=U=>Sa(_[U]?.type||"")&&!_[U]?.config?.notInput||_[U]?.config?.isInput,j=U=>["j-table","j-table-panel","j-input-rows","j-input-cards"].includes(_[U]?.type||"");let me;const Pe=(U,ue)=>{Object.keys(U).forEach(ee=>{const ne=U[ee];ue&&(ee=ue+"."+ee),ne!=null&&typeof ne=="object"&&!xa(ne)&&Pe(ne,ee),y[ee]=ne})},pe=(U,ue)=>{let ee=U.id;return ee||(U.config?.table&&U.config?.field?ee=`${U.config.table}.${U.config.field}`:U.config?.table?ee=U.config?.table:U.config?.field&&(ee=U.config?.field),ue&&(ee=`${ue}.${ee}`)),ee||ka("j")},Ne=(U,ue,ee,ne="")=>{U.forEach(he=>{he.id=pe(he,ne);const Ee={id:he.id,slot:he.slot,type:he.type||"",getCompType:he.getCompType,getCompConfig:he.getCompConfig,config:{},children:[]};ue.push(Ee);const{children:Ae}=he;$o(Ee,he,["children","config"]),$o(Ee.config,he.config||{},[]),a.config.size&&Ee.config.size===void 0&&(Ee.config.size=a.config.size),_[he.id]&&console.warn("有重复的组件id:"+he.id),_[he.id]=Ee,a.readonly===!0&&(Ee.config.readonly=!0);let Ue=!1,vt;ne!==""&&(Ue=!0,Ee.config.parentTableId=ne,vt=_[ne]?.config?.table);const et=Ee.config||{};if(G(he.id))!ee&&Ue===!1&&(et?.defaultValue===0?y[he.id]=et?.defaultValue:y[he.id]=et?.defaultValue||void 0),et.table&&et.field?V[`${et.table}_${et.field}`.toLowerCase()]=he.id:et.field&&(Ue?V[`${vt}_${et.field}`.toLowerCase()]=he.id:V[`${et.field}`.toLowerCase()]=he.id);else if(Ue&&et.field)V[`${vt}_${et.field}`.toLowerCase()]=he.id;else if(j(he.id))!ee&&!et.isSubTable&&(y[he.id]=[]),et.table&&(V[et.table.toLowerCase()||""]=he.id),et.isSubTable||P.push(Ee);else if(et?.defaultValue)y[he.id]=et?.defaultValue;else if(he.type==="collapse"&&et?.isExpand){const bn=[];(et?.groups||[]).forEach(wn=>{bn.push(wn.i)}),y[he.id]=bn}Ae&&Ae.length>0&&Ne(Ae,Ee.children,ee,j(Ee.id)?Ee.id:ne)})},Fe=async(U,ue)=>{const ee=++B,ne=w.value;w.value=!1,ne&&await(0,n.nextTick)();const he=!!ue;if(E.length=0,V=Object.create(null),T=Object.create(null),P=[],me=ue,bo(y),bo(_),he&&Pe(ue,""),Ne(U,E,he),N=fe(),M=!1,A=N,X(()=>{ee===B&&(A=kt(N),M=!0)}),await(0,n.nextTick)(),w.value=!0,await(0,n.nextTick)(),await W(),a.config?.codeInit){const Ee=a.config.codeInit;let Ae;H?.raw===Ee?Ae=H.obj:(Ae=JSON.parse(Ee),H={raw:Ee,obj:Ae}),await it(Ae,{param:{}})}},Ge=(U,ue,ee)=>{const ne=[];return ue.forEach(he=>{const Ee={};Object.keys(he).forEach(Ae=>{if(!ee||ee(Ae,he[Ae],U)){const Ue=Se(Ae);if(Ue?.type==="j-table"||Ue?.type==="j-table-panel")Ee[Ue?.id||""]=Ge(Ae,he[Ae],ee);else{let vt=V[`${U}_${Ae}`.toLowerCase()]||Ae;vt=vt.indexOf(".")!==-1?vt.split(".")[1]:vt,Ee[vt]=he[Ae]}}}),ne.push(Ee)}),ne},Q=(U,ue)=>{Object.keys(U||{}).forEach(ee=>{let ne=U[ee];const he=Se(ee);if(he===void 0)ne&&(xa(ne)&&(ne=ne[0]||{}),typeof ne=="object"?Object.keys(ne).forEach(Ee=>{if(!ue||ue(ee,ne[Ee],ee)){let Ae=Ee;ee!=="main"&&(Ae=`${ee}_${Ee}`),T[Ae]=ee,y[V[Ae.toLowerCase()]||Ee]=ne[Ee]}}):y[ee]=ne);else if(j(he.id||"")){if(!Array.isArray(ne)){console.warn("表格数据不是数组:"+ee);return}ne?.length>0?y[V[ee.toLowerCase()]||ee]=Ge(ee,ne,ue):y[V[ee.toLowerCase()]||ee]=[]}else(!ue||ue(ee,ne,ee))&&(y[V[ee.toLowerCase()]||ee]=ne)}),me&&Object.keys(y).forEach(ee=>{const ne=Se(ee);(ne===void 0||!["j-tabs","j-collapse"].includes(ne.type||""))&&Br(me,ee,y[ee])})},ge=new Set(["parentRow","_i","_compTypeByRender"]),Re=(U,ue=!1)=>{const ee={};return Object.keys(U).forEach(ne=>{if(ge.has(ne))return;const he=_[ne];if(he){const Ee=he.config?.table,Ae=he.config?.field;if(ue)Ae?ee[Ae]=U[ne]:ee[ne]=U[ne];else if(j(ne)){const Ue=[];U[ne].forEach(vt=>{Ue.push(Re(vt,!0))}),ee[Ee||ne]=Ue}else Ee&&Ae?(ee[Ee]=ee[Ee]||{},ee[Ee][Ae]=U[ne]):Ae&&(ee[Ae]=U[ne])}else ue?ne!=="_X_ROW_KEY"&&ne!=="_isHover"&&(ee[ne]=U[ne]):T[ne]?(ee[T[ne]]=ee[T[ne]]||{},ee[T[ne]][ne.replace(`${T[ne]}_`,"")]=U[ne]):ee[ne]=U[ne]}),ee},rt=(U=!0)=>U?Re(y):y,$=(U,ue,ee,ne)=>{let he=_[U];if(he==null){const Ae=U.split(".");he=_[Ae[Ae.length-1]]||{}}if(!he)return{};const Ee=$t({config:he.config||{},getCompConfig:he.getCompConfig,formData:y,getTableData:ee,row:ue,pRowData:ne});return Ee._componentId=he?.id,Ee},ae=(U,ue,ee,ne)=>{const he=$(U,ue,ee,ne);if(he.isNotRule!==!0&&he.display!==!1){const Ee=he.rule||[],Ae=Ee.find(Ue=>Ue.type==="only");return Ae&&(Ae.validator=async(Ue,vt)=>{if(vt&&!await i({table:Ue.table,key:Ue.key,keyName:Ue.keyName,field:Ue.field,keyValue:Ue.getKeyValue?Ue.getKeyValue():"",value:vt,paramNames:Ue.paramNames,getParams:Ue.getParams,withProjectId:Ue.withProjectId,getValue:Ue.getValue,formData:y}))throw h(Ue.message)||h("数据值重复")}),{rules:Ee,myGridtableId:j(he._componentId)?he._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:ye}=Qm(y,ae),Ce=async()=>{x.value={};const U=await ye();return Object.keys(U).length>0?(x.value=U,m(`${h(_[Object.keys(U)[0]]?.config?.label)}:${h(U[Object.keys(U)[0]].msg)}`),!1):!0},Me=()=>{x.value={},J(),bo(y),Object.keys(A||{}).forEach(U=>{y[U]=A[U]})},Se=U=>{let ue=_[U];return ue===void 0&&V[U.toLowerCase()]&&(ue=_[V[U.toLowerCase()]]),ue},Te=({id:U,i:ue,value:ee,type:ne})=>{if(ne==="add")y[U].push(ee);else if(ne==="delete")y[U].splice(ue,1);else{const he=Se(U);he&&(he.config.parentTableId?y[he.config.parentTableId][ue][U]=ee:y[U]=ee)}},We=({id:U,i:ue})=>{const ee=Se(U);if(ee){if(ee.config.parentTableId){const ne=y[ee.config.parentTableId],he=ee.id?ee.id.replace(`${ee.config.parentTableId}.`,""):"";if(ue!=null)return(ne[ue]||{})[he||""];const Ee=[];return ne&&ne.forEach(Ae=>{Ee.push(Ae[he||""])}),Ee}if(j(ee.id||"")){const ne=[];return y[ee.id||""].forEach(he=>{ne.push(Re(he,!0))}),ne}return y[ee.id||""]}if(y[U])return y[U]},wt=async({id:U,i:ue})=>{const ee=We({id:U,i:ue}),ne=Se(U);if(ne&&g?.getLabel)if(ue!==void 0){const he=ee[ue],Ee=y[ne.config.parentTableId||""][ue],Ae=$t({config:ne.config,getCompConfig:ne.getCompConfig,formData:y,tableData:y[ne.config.parentTableId||""],row:Ee});return await g?.getLabel({value:he,config:Ae,formData:y,tableData:y[ne.config.parentTableId||""],row:Ee})}else{const he=$t({config:ne.config,getCompConfig:ne.getCompConfig,formData:y});return await g?.getLabel({value:ee,config:he,formData:y})}return ee},Pt=async(U,ue)=>g?.loadViewDataList?await g?.loadViewDataList(U,ue,!1):[],Rt=U=>(U.set=Te,U.get=We,U.setFormData=Q,U.getFormData=rt,U.getLabel=wt,U.getViewData=Pt,U.getDateNow=ue=>_a(new Date,ue||"YYYY-MM-DD HH:mm:ss"),U.httpGet=s||(()=>{console.log("当前状态不支持")}),U.httpPost=d||(()=>{console.log("当前状态不支持")}),U.loading=ue=>{kn(ue)},U.showMsg=({text:ue,type:ee})=>{switch(ee){case"success":c&&c(ue);break;case"warning":f&&f(ue);break;case"error":p&&p(ue);break;case"info":u&&u(ue);break;default:u&&u(ue);break}},U),Xe=async(U,ue)=>{if(U&&U.trim()){U=`async (jcode) => {${U}}`;const{res:ee,fn:ne}=_r(U);ee&&await ne(Rt(ue))}},Nt=async()=>{a.config?.codeAfterSetData&&await it(JSON.parse(a.config?.codeAfterSetData),{param:{}})},ct=async()=>{a.config?.codeBeforeSave&&await it(JSON.parse(a.config?.codeBeforeSave),{param:{}})},yt=async()=>{a.config?.codeAfterSave&&await it(JSON.parse(a.config?.codeAfterSave),{param:{}})};a.schema&&Fe(a.schema);const lt={},it=async(U,ue)=>{const{run:ee}=Ms({data:U,actions:a.actions,utils:{showLoading:kn,executeEvent:Xe},inputParams:ue,notRunActions:lt});await ee()};return Vr({formData:y,components:_,errorFields:x,isAutoWindow:S,gutter:k,span:C,labelWidth:v,labelPosition:b,getValue:We,formChange:Y,runFlow:it,runFlowByNotRunActions:async U=>{const ue=lt[U];ue&&(delete lt[U],await it(ue.data,ue.inputParams))}}),Mr({contextType:"form"}),Kn({}),t({init:Fe,reset:Me,validate:Ce,setValue:Te,getValue:We,getLabel:wt,setFormData:Q,getFormData:rt,afterSetData:Nt,beforeSave:ct,afterSave:yt}),(U,ue)=>{const ee=(0,n.resolveComponent)("j-form-item"),ne=(0,n.resolveComponent)("el-row"),he=(0,n.resolveComponent)("el-form");return w.value?((0,n.openBlock)(),(0,n.createBlock)(he,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":b.value,"label-width":v.value,size:e.config?.size,onSubmit:ue[0]||(ue[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[S.value?((0,n.openBlock)(),(0,n.createBlock)(ee,(0,n.mergeProps)({key:0},E[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(ne,{key:1,gutter:k.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(E,Ee=>((0,n.openBlock)(),(0,n.createBlock)(ee,(0,n.mergeProps)({key:Ee.id},{ref_for:!0},Ee),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),ty=ey,Ns=ve(ty),As=ve(Ui),ny={class:"j-page"},oy=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),r=(0,n.reactive)([]),l={},i=(0,n.reactive)({}),s=(C,v)=>{C.forEach(b=>{b.id=b.id||ka("c");const S={id:b.id,slot:b.slot,type:b.type||"",getCompConfig:b.getCompConfig,getCompType:b.getCompType},{children:y}=b;l[b.id]=S,S.config=[],$o(S.config,b.config||{},["defaultValue"]),b?.config?.defaultValue!==void 0&&(i[b.id]=b.config.defaultValue),v.push(S),y&&y.length>0&&(S.children=[],s(y,S.children))})},d=C=>{a.value=!1,r.splice(0,r.length),bo(l),bo(i),s(C,r),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&d(o.schema);const{openLayer:c}=En(),f={},p=async(C,v)=>{const{run:b}=Ms({data:C,actions:o.actions,utils:{showLoading:kn,openLayer:c,call:m},inputParams:v,notRunActions:f});await b()},u=async C=>{const v=f[C];v&&(delete f[C],await p(v.data,v.inputParams))},h=new Tr,g=new Map,m=(C,v,b,...S)=>{if(b?.immediate){const y=g.get(C)||new Map;y.set(v,S),g.set(C,y)}return h.emit(C,v,...S)},w=(C,v)=>{h.on(C,v);const b=g.get(C);b&&(g.delete(C),b.forEach((S,y)=>{v(y,...S||[])}))},k=(C,v)=>{h.off(C,v)};return _i({registerMethod:(C,v)=>(w(C,v),()=>{k(C,v)}),runFlow:p,runFlowByNotRunActions:u}),Mr({contextType:"page"}),t({init:d,call:m,on:w,off:k}),(C,v)=>{const b=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",ny,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,S=>((0,n.openBlock)(),(0,n.createBlock)(b,{key:S.id,id:S.id,type:S.type,config:S.config,children:S.children},null,8,["id","type","config","children"]))),128))])}}}),ay=oy,js=ve(ay),ry=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,l=>{l?r.value=l:(r.value=Ft(),a("update:modelValue",r.value))},{immediate:!0}),(l,i)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=d=>r.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),ly=ry,Ps=ve(ly),iy={key:0,class:"j-panel-top"},sy=["title"],cy={style:{margin:"0","font-size":"14px"}},dy={key:1},uy={key:1,class:"j-panel-bottom"},fy=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=En(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,r)=>{const l=(0,n.resolveComponent)("j-button"),i=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",iy,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",cy,(0,n.toDisplayString)(e.title||""),1)])],8,sy)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",dy,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,d=>((0,n.openBlock)(),(0,n.createBlock)(i,{key:d.id,placement:"top",content:d.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(l,(0,n.mergeProps)({ref_for:!0},d.config,{onClick:c=>o(d),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",uy,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),py=fy,zs=ve(py),hy={class:"j-input-rows"},gy={key:0,class:"j-input-rows-num"},my={key:1,class:"j-input-rows-char"},yy=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""},actions:{type:Array,default:()=>[]}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=y=>y==null,a=e,r=t,{formData:l}=Sn(),i=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),c=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),f=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(y=>{y._i||(y._i=Ft())})):(m.value=[],r("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,y=>{m.value=a.modelValue||[],m.value=y||[],m.value.forEach(x=>{x._i||(x._i=Ft())})},{deep:!0});const k=y=>{const x={};return!a.isCompact&&y.config?.colWidth&&(x.width=`${y.config.colWidth}px`),x},C=()=>{const y={_i:Ft()};a.columns.forEach(x=>{const E=x.config?.valueRowKey||x.id||"";x.type==="j-layer-form"?x.config?.defaultValue&&Object.prototype.toString.call(x.config.defaultValue)==="[object Object]"&&Object.assign(y,kt(x.config?.defaultValue)):E&&(y[E]=kt(x.config?.defaultValue))}),m.value.push(y),r("change",{id:a.id,value:y,data:y,formData:l,tableData:m.value,type:"add"})},v=y=>{const x=m.value[y];m.value.splice(y,1),r("change",{id:a.id,value:x,data:x,formData:l,tableData:m.value,type:"delete"})},b=y=>{r("rowChange",y)};(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const y=h.value,{initSortable:x}=mi(y,{handle:".j-input-rows-drag",onEnd:E=>{const{oldIndex:_,newIndex:V}=E;if(o(_)||o(V)||_===V||_<0||V<0)return;const T=m.value.splice(_,1)[0];m.value.splice(V,0,T),r("change",{id:a.id,value:T,data:T,formData:l,tableData:m.value,type:"sort"})}});x()});const{row:S}=wo();return Kn({getTableData:()=>m.value,rowChange:b,pRowData:S}),(y,x)=>{const E=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("j-button"),T=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",hy,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:P._i+A,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",gy,(0,n.toDisplayString)(A+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",my,(0,n.toDisplayString)(g[A%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,N=>((0,n.openBlock)(),(0,n.createBlock)(E,(0,n.mergeProps)({key:N.id,ref_for:!0},N,{row:P,style:k(N)}),null,16,["row","style"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),c.value&&(u.value||m.value.length>1)&&!f.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:N=>v(A)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!f.value&&i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value}),class:"j-input-rows-actions"},[i.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:C},null,8,["label"])):(0,n.createCommentVNode)("",!0),e.actions&&e.actions.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:1,list:e.actions},null,8,["list"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),vy=yy,Hs=ve(vy),by={class:"j-input-layer"},wy=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},layerWidth:{},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},renderVNode:{},renderVNodeClass:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},buttonShape:{},buttonStatus:{},buttonBlock:{type:Boolean},notButtonLabel:{type:Boolean},buttonLoading:{type:[Boolean,Object]},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=C=>!!(C==null||typeof C=="string"&&C.trim()===""||Array.isArray(C)&&C.length===0),r=e,l=o,i=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.computed)(()=>!!r.renderVNode&&!r.isMultiSelect),f=(0,n.computed)({get(){return r.modelValue},set(C){l("update:modelValue",C)}}),p=(0,n.computed)({get(){return a(f.value)?"":r.getText?r.getText(f.value)||d.value||f.value:d.value||f.value},set(C){C||h()}}),u=async()=>{r.readonly||r.beforeOpen&&await r.beforeOpen()===!1||i.value.open()},h=()=>{d.value="",f.value="",l("change",{value:"",data:void 0})},g=async({checked:C})=>{c.value&&C&&(await(0,n.nextTick)(),await m())},m=async()=>{if(!s.value)return;const C=s.value.getSelection();if(r.isMultiSelect){const v=[],b=[];C.forEach(S=>{const y=S[r.labelKey],x=S[r.valueKey];v.push(y!=null?String(y):""),x===0||x?b.push(String(x)):b.push("")}),d.value=v.join(","),f.value=b.join(","),l("change",{value:b.join(","),data:C})}else if(C.length>0){const v=C[0],b=v[r.labelKey],S=v[r.valueKey];d.value=b!=null?String(b):"";const y=S!=null?String(S):"";f.value=y,l("change",{value:y,data:v})}else d.value="",f.value="",l("change",{value:"",data:void 0});i.value.close()},w=()=>{s.value&&s.value.clearSelection&&s.value.clearSelection()};return t({getTablePanelRef:()=>s.value}),(C,v)=>{const b=(0,n.resolveComponent)("j-button"),S=(0,n.resolveComponent)("el-input"),y=(0,n.resolveComponent)("j-table-panel"),x=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)("div",by,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)(b,{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,shape:e.buttonShape,status:e.buttonStatus,block:e.buttonBlock,"not-label":e.notButtonLabel,loading:e.buttonLoading,onClick:u},null,8,["type","size","label","icon","shape","status","block","not-label","loading"])):((0,n.openBlock)(),(0,n.createBlock)(S,{key:0,modelValue:p.value,"onUpdate:modelValue":v[0]||(v[0]=E=>p.value=E),placeholder:e.placeholder,readonly:e.readonly,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:h},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(b,{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","readonly","size","clearable"])),(0,n.createVNode)(x,{ref_key:"layerRef",ref:i,title:e.title||e.placeholder,width:e.layerWidth||e.width,height:e.height,"has-btns":!c.value,"btn-text":"确定",onOk:m,onClosed:w},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{ref_key:"tableRef",ref:s,columns:e.columns,"search-list":e.searchList,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,"render-v-node":e.renderVNode,"render-v-node-class":e.renderVNodeClass,immediate:!0,onSelect:g},null,8,["columns","search-list","row-key","is-tree","is-page","sort","is-multiple","load-data","render-v-node","render-v-node-class"])]),_:1},8,["title","width","height","has-btns"])])}}}),Cy=wy,Ls=ve(Cy),xy=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},status:{type:String,default:"normal"},label:{type:String,default:"设置"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]},row:{type:Object,default:()=>({})}},setup(e){const{t}=tt(),o=(0,n.ref)(!1),a=()=>{o.value=!0};return(r,l)=>{const i=(0,n.resolveComponent)("j-button"),s=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(i,(0,n.mergeProps)(r.$attrs,{type:e.type,size:e.size,icon:e.icon,status:e.status,label:e.label,onClick:a}),null,16,["type","size","icon","status","label"]),(0,n.createVNode)(s,{visible:o.value,"onUpdate:visible":l[0]||(l[0]=d=>o.value=d),title:(0,n.unref)(t)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Gi,{schema:e.schema,"form-config":e.formConfig},null,8,["schema","form-config"])]),_:1},8,["visible","title","height","width"])],64)}}}),ky=xy,Os=ve(ky),Sy=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(c,f)=>{if(c===void 0)return c;const p=typeof f;if(p===typeof c)return c;if(p==="number"){if(typeof c=="boolean")return c?1:0;const u=Number(c);return Number.isNaN(u)?c?1:0:u}if(p==="string")return typeof c=="boolean"&&(f==="1"||f==="0")?c?"1":"0":String(c);if(p==="boolean"){if(typeof c=="string"){const u=c.trim().toLowerCase();if(u==="false"||u==="0"||u==="")return!1;if(u==="true"||u==="1")return!0}return typeof c=="number"?c!==0:!!c}return c},l=(0,n.computed)(()=>r(o.activeValue,o.modelValue)),i=(0,n.computed)(()=>r(o.inactiveValue,o.modelValue)),s=(0,n.computed)({get(){return o.modelValue},set(c){a("update:modelValue",c)}}),d=c=>{a("change",c)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const c=s.value===l.value?i.value:l.value;s.value=c,d(c)},100)}),(c,f)=>{const p=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{id:e.id,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=u=>s.value=u),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":l.value,"inactive-value":i.value,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:d}),(0,n.createSlots)({_:2},[c.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"active-action")]),key:"0"}:void 0,c.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"inactive-action")]),key:"1"}:void 0,c.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"active")]),key:"2"}:void 0,c.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),Ey=Sy,Ds=ve(Ey),_y=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=c=>{o("update:modelValue",c)},r=(c,f)=>{o("tab-click",c,f)},l=c=>{o("tab-change",c)},i=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:r,onTabChange:l,onTabRemove:i,onTabAdd:s,onEdit:d}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),By=_y,Is=ve(By),Ry=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=l=>{o("update:modelValue",l)},r=l=>{o("change",l)};return(l,i)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(l.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:r,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),Ty=Ry,Fs=ve(Ty),Vy={class:"j-editor"},My=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),l=(0,n.ref)(),i=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=p=>{if(!p)return"";let u=p;return o.apiUrl&&o.token&&(u=u.replace(/{jcode_img_api}/g,`${o.apiUrl}/data/file/`).replace(/{jcode_img_token}/g,`token=${o.token}`)),u},f=p=>{if(!p)return"";let u=p;if(o.apiUrl){const h=`${o.apiUrl}/data/file/`;u=u.split(h).join("{jcode_img_api}"),o.token&&(u=u.split(`token=${o.token}`).join("{jcode_img_token}"))}return u};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(d)return;const g=f(h.getHtml());a("update:value",g),a("change",{value:g})};const u=(0,Dl.createEditor)({selector:r.value,html:c(o.value),config:p,mode:"default"});i.value=u,(0,Dl.createToolbar)({editor:u,selector:l.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const u=i.value;if(u){const h=u.getHtml(),g=c(p);f(h)!==p&&(d=!0,u.setHtml(g),d=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const u=i.value;u&&(p?u.disable():u.enable())}),(0,n.onBeforeUnmount)(()=>{const p=i.value;p?.destroy()}),(p,u)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Vy,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:l,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:r,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),Ny=My,$s=ve(Ny),Ay={key:0,class:"j-map-loading"},jy=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(!0),i=(0,n.ref)();let s=null,d=null,c=null,f=null;const p=async()=>{l.value=!0;try{s=await yi(a.mapKey)}catch(k){console.error("Failed to load Baidu Map:",k),l.value=!1;return}if(d!=null){h(a.lng,a.lat),l.value=!1;return}if(!i.value)return;d=new s.Map(i.value,{enableMapClick:!1});const w=new s.Point(121.480248,31.236276);d.centerAndZoom(w,17),c=new s.Marker(w,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",k=>{u(k.point)}),d.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),f=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),f.addEventListener("locationSuccess",k=>{u(k.point)}),f.addEventListener("locationError",k=>{alert(k.message)}),d.addControl(f),d.addEventListener("click",k=>{u(k.point)}),d.enableScrollWheelZoom(!0),h(a.lng,a.lat),l.value=!1},u=w=>{new s.Geocoder().getLocation(w,k=>{c.setPosition(w),d.panTo(w),r("update:address",k.address),r("update:lng",w.lng),r("update:lat",w.lat),r("change",{value:{address:k.address,lng:w.lng,lat:w.lat}})})},h=(w,k)=>{if(w&&k&&s){const C=new s.Point(w,k);c&&c.setPosition(C),d&&d.panTo(C)}};let g=null;return t({setPoint:h,querySearchAsync:(w,k)=>{!d||!s||(g||(g=new s.LocalSearch(d,{onSearchComplete:C=>{const v=[];if(C){const b=C.getCurrentNumPois();for(let S=0;S<b;S++)v.push(C.getPoi(S))}k(v)}})),g.search(w))}}),(0,n.onMounted)(()=>{p()}),(w,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Ay,[(0,n.createVNode)(Yn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:i,class:"j-map-container"},null,512)],4))}}),Py=jy,Ws=ve(Py),zy=(0,n.defineComponent)({name:"JInputMap",__name:"input-map",props:{modelValue:{type:[String],default:null},placeholder:{type:String,default:"请选择"},readonly:Boolean,size:{type:String},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=tt(),l=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.ref)(0),f=(0,n.ref)(0),p=(0,n.ref)(""),u=(0,n.computed)(()=>{let b=o.modelValue||"";if(o.modelValue===null&&(b=(0,n.unref)(p)),St(b))return{address:"",lng:0,lat:0};const S=b.split(",");return{address:S[0],lng:parseFloat(S[1]),lat:parseFloat(S[2])}}),h=(0,n.computed)({get(){return u.value.address},set(){p.value="",a("update:modelValue",void 0)}}),g=()=>{i.value.blur()},m=()=>{i.value.blur(),d.value=u.value.address,c.value=u.value.lng,f.value=u.value.lat,l.value.open("请选择地址"),setTimeout(()=>{s.value?.call("map","setPoint",null,c.value,f.value)},100)},w=(0,n.ref)([]),k=[{type:"j-layout",config:{class:["j-block"]},children:[{type:"div",slot:"top",config:{style:{padding:"8px"}},children:[{type:"el-autocomplete",config:{style:{width:"100%"},placeholder:r("请填写详细地址"),modelValue:d,value:d,fetchSuggestions:async(b,S)=>{S((0,n.unref)(w))},onInput:async b=>{d.value=b,s.value?.call("map","querySearchAsync",null,b,S=>{w.value=S.map(y=>({...y,value:`(${y.title}): ${y.address}`}))})},onSelect:b=>{d.value=`(${b.title})${b.address}`,c.value=b.point.lng,f.value=b.point.lat,s.value?.call("map","setPoint",null,b.point.lng,b.point.lat)}},children:[{slot:"option",config:{h:b=>(0,n.h)("div",{},[(0,n.h)("div",{style:{color:"var(--j-color-text)","font-size":"14px"}},b.title),(0,n.h)("div",{style:{color:"var(--color-text-secondary)","font-size":"12px","margin-bottom":"4px"}},b.address)])}}]}]},{type:"j-map",id:"map",config:{address:d,lng:c,lat:f,height:"100%",onChange:b=>{d.value=b.value.address,c.value=b.value.lng,f.value=b.value.lat}}}]}],C=()=>{!St(d.value)&&!St(c.value)&&!St(f.value)?(p.value=`${d.value},${c.value},${f.value}`,a("update:modelValue",p.value),a("change",p.value)):(a("update:modelValue",void 0),a("change",void 0)),l.value.close()},v=()=>{};return(b,S)=>{const y=(0,n.resolveComponent)("j-button"),x=(0,n.resolveComponent)("el-input"),E=(0,n.resolveComponent)("j-page"),_=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(x,{modelValue:h.value,"onUpdate:modelValue":S[0]||(S[0]=V=>h.value=V),placeholder:e.placeholder?(0,n.unref)(r)(e.placeholder):void 0,readonly:e.readonly,size:e.size,clearable:e.readonly?!1:e.clearable,onFocus:g,ref_key:"inputRef",ref:i,class:"j-input-layer"},{append:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{icon:"mdi:map-marker-outline",disabled:e.readonly,size:e.size,onClick:m},null,8,["disabled","size"])]),_:1},8,["modelValue","placeholder","readonly","size","clearable"]),(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)(b.$attrs)),null,16),(0,n.createVNode)(_,{ref_key:"layerRef",ref:l,width:900,height:500,"btn-text":"确认",destroyOnClose:!1,onOk:C,onClosed:v,style:{height:"0"}},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{style:{padding:"0"},schema:k,ref_key:"indexRef",ref:s},null,512)]),_:1},512)],64)}}}),Hy=zy,Us=ve(Hy);function Js(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ko(e){return e.originalEvent||e.srcEvent}function Ar(e){Js(e),Js(ko(e))}function So(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Ys=1500;function Ks(e,t,o){var a=this,r=o.get("dragging",!1);function l(i){if(!i.hover){var s=i.originalEvent,d=a._findTargetGfx(s),c=d&&e.get(d);d&&c&&(i.stopPropagation(),r.hover({element:c,gfx:d}),r.move(s))}}r&&t.on("drag.start",function(i){t.once("drag.move",Ys,function(s){l(s)})}),(function(){var i,s;t.on("element.hover",function(d){i=d.gfx,s=d.element}),t.on("element.hover",Ys,function(d){s&&t.fire("element.out",{element:s,gfx:i})}),t.on("element.out",function(){i=null,s=null})})(),this._findTargetGfx=function(i){var s,d;if(i instanceof MouseEvent)return s=So(i),d=document.elementFromPoint(s.x,s.y),Ly(d)}}Ks.$inject=["elementRegistry","eventBus","injector"];function Ly(e){return(0,Z.closest)(e,"svg, .djs-element",!0)}var Oy={__init__:["hoverFix"],hoverFix:["type",Ks]};function Gs(){return/mac/i.test(navigator.platform)}function qs(e,t){return(ko(e)||e).button===t}function _n(e){return qs(e,0)}function Dy(e){return qs(e,1)}function Xs(e){var t=ko(e)||e;return _n(e)?Gs()?t.metaKey:t.ctrlKey:!1}function jr(e){var t=ko(e)||e;return _n(e)&&t.shiftKey}function Yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Iy(e){return["M",e.x,e.y]}function Pr(e){return["L",e.x,e.y]}function Fy(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function $y(e,t){const o=e.length,a=[Iy(e[0])];for(let r=1;r<o;r++){const l=e[r-1],i=e[r],s=e[r+1];if(!s||!t){a.push(Pr(i));continue}const d=Math.min(t,zr(i.x-l.x,i.y-l.y),zr(s.x-i.x,s.y-i.y));if(!d){a.push(Pr(i));continue}const c=Ma(i,l,d),f=Ma(i,l,d*.5),p=Ma(i,s,d),u=Ma(i,s,d*.5);a.push(Pr(c)),a.push(Fy(f,u,p))}return a}function Ma(e,t,o){const a=t.x-e.x,r=t.y-e.y,l=o/zr(a,r);return{x:e.x+a*l,y:e.y+r*l}}function zr(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Hr(e,t,o){(0,R.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,D.create)("path",t);return(0,R.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Zs(a,e)}function Zs(e,t){return(0,D.attr)(e,{d:Yo($y(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Wy(e){return!0}function Na(e){return _n(e)||Dy(e)}var Qs=500;function ec(e,t,o){var a=this;function r(y,x,E){if(!s(y,x)){var _,V,T;E?V=t.getGraphics(E):(_=x.delegateTarget||x.target,_&&(V=_,E=t.get(V))),!(!V||!E)&&(T=e.fire(y,{element:E,gfx:V,originalEvent:x}),T===!1&&(x.stopPropagation(),x.preventDefault()))}}var l={};function i(y){return l[y]}function s(y,x){return!(c[y]||_n)(x)}var d={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},c={"element.contextmenu":Wy,"element.mousedown":Na,"element.mouseup":Na,"element.click":Na,"element.dblclick":Na};function f(y,x,E){var _=d[y];if(!_)throw new Error("unmapped DOM event name <"+y+">");return r(_,x,E)}var p="svg, .djs-element";function u(y,x,E,_){var V=l[E]=function(T){r(E,T)};_&&(c[E]=_),V.$delegate=Z.delegate.bind(y,p,x,V)}function h(y,x,E){var _=i(E);_&&Z.delegate.unbind(y,x,_.$delegate)}function g(y){(0,R.forEach)(d,function(x,E){u(y,E,x)})}function m(y){(0,R.forEach)(d,function(x,E){h(y,E,x)})}e.on("canvas.destroy",function(y){m(y.svg)}),e.on("canvas.init",function(y){g(y.svg)}),e.on(["shape.added","connection.added"],function(y){var x=y.element,E=y.gfx;e.fire("interactionEvents.createHit",{element:x,gfx:E})}),e.on(["shape.changed","connection.changed"],Qs,function(y){var x=y.element,E=y.gfx;e.fire("interactionEvents.updateHit",{element:x,gfx:E})}),e.on("interactionEvents.createHit",Qs,function(y){var x=y.element,E=y.gfx;a.createDefaultHit(x,E)}),e.on("interactionEvents.updateHit",function(y){var x=y.element,E=y.gfx;a.updateDefaultHit(x,E)});var w=v("djs-hit djs-hit-stroke"),k=v("djs-hit djs-hit-click-stroke"),C={all:v("djs-hit djs-hit-all"),"click-stroke":k,stroke:w,"no-move":v("djs-hit djs-hit-no-move")};function v(y,x){return x=(0,R.assign)({stroke:"white",strokeWidth:15},x||{}),o.cls(y,["no-fill","no-border"],x)}function b(y,x){var E=C[x];if(!E)throw new Error("invalid hit type <"+x+">");return(0,D.attr)(y,E),y}function S(y,x){(0,D.append)(y,x)}this.removeHits=function(y){(0,R.forEach)((0,Z.queryAll)(".djs-hit",y),D.remove)},this.createDefaultHit=function(y,x){var E=y.waypoints,_=y.isFrame,V;return E?this.createWaypointsHit(x,E):(V=_?"stroke":"all",this.createBoxHit(x,V,{width:y.width,height:y.height}))},this.createWaypointsHit=function(y,x){var E=Hr(x);return b(E,"stroke"),S(y,E),E},this.createBoxHit=function(y,x,E){E=(0,R.assign)({x:0,y:0},E);var _=(0,D.create)("rect");return b(_,x),(0,D.attr)(_,E),S(y,_),_},this.updateDefaultHit=function(y,x){var E=(0,Z.query)(".djs-hit",x);if(E)return y.waypoints?Zs(E,y.waypoints):(0,D.attr)(E,{width:y.width,height:y.height}),E},this.fire=r,this.triggerMouseEvent=f,this.mouseHandler=i,this.registerEvent=u,this.unregisterEvent=h}ec.$inject=["eventBus","elementRegistry","styles"];var Lr={__init__:["interactionEvents"],interactionEvents:["type",ec]};function Eo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var r=a.element;o.deselect(r)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}Eo.$inject=["eventBus","canvas"],Eo.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Eo.prototype.get=function(){return this._selectedElements},Eo.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Eo.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,R.isArray)(e)||(e=e?[e]:[]);var r=this._canvas,l=r.getRootElement();e=e.filter(function(i){return l===r.findRoot(i)}),t?(0,R.forEach)(e,function(i){o.indexOf(i)===-1&&o.push(i)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var tc="hover",nc="selected";function oc(e,t){this._canvas=e;function o(r,l){e.addMarker(r,l)}function a(r,l){e.removeMarker(r,l)}t.on("element.hover",function(r){o(r.element,tc)}),t.on("element.out",function(r){a(r.element,tc)}),t.on("selection.changed",function(r){function l(c){a(c,nc)}function i(c){o(c,nc)}var s=r.oldSelection,d=r.newSelection;(0,R.forEach)(s,function(c){d.indexOf(c)===-1&&l(c)}),(0,R.forEach)(d,function(c){s.indexOf(c)===-1&&i(c)})})}oc.$inject=["canvas","eventBus"];function ac(e,t,o,a){e.on("create.end",500,function(r){var l=r.context,i=l.canExecute,s=l.elements,d=(l.hints||{}).autoSelect;if(i){if(d===!1)return;(0,R.isArray)(d)?t.select(d):t.select(s.filter(Uy))}}),e.on("connect.end",500,function(r){var l=r.context.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(r){var l=r.previousSelection||[],i=a.get(r.context.shape.id);(0,R.find)(l,function(s){return i.id===s.id})||t.select(i)}),e.on("element.click",function(r){if(_n(r)){var l=r.element;l===o.getRootElement()&&(l=null);var i=t.isSelected(l),s=t.get().length>1,d=jr(r);if(i&&s)return d?t.deselect(l):t.select(l);i?t.deselect(l):t.select(l,d)}})}ac.$inject=["eventBus","selection","canvas","elementRegistry"];function Uy(e){return!e.hidden}var _o={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Lr],selection:["type",Eo],selectionVisuals:["type",oc],selectionBehavior:["type",ac]},Jy=/^djs-cursor-.*$/;function Or(e){var t=(0,Z.classes)(document.body);t.removeMatching(Jy),e&&t.add("djs-cursor-"+e)}function rc(){Or(null)}var Yy=5e3;function lc(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Yy,o),function(){e.off(t,o)}}function ic(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function sc(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function cc(e,t){return e=(0,R.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Ro=Math.round,dc="djs-drag-active";function Gn(e){e.preventDefault()}function Ky(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Gy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function uc(e,t,o,a){var r={threshold:5,trapClick:!0},l;function i(v){var b=t.viewbox(),S=t._container.getBoundingClientRect();return{x:b.x+(v.x-S.left)/b.scale,y:b.y+(v.y-S.top)/b.scale}}function s(v,b){b=b||l;var S=e.createEvent((0,R.assign)({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,S)===!1?!1:e.fire(b.prefix+"."+v,S)}function d(v){var b=v.filter(function(S){return a.get(S.id)});b.length&&o.select(b)}function c(v,b){var S=l.payload,y=l.displacement,x=l.globalStart,E=So(v),_=Bo(E,x),V=l.localStart,T=i(E),P=Bo(T,V);if(!l.active&&(b||Gy(_)>l.threshold)){if((0,R.assign)(S,{x:Ro(V.x+y.x),y:Ro(V.y+y.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return w();l.active=!0,l.keepSelection||(S.previousSelection=o.get(),o.select(null)),l.cursor&&Or(l.cursor),t.addMarker(t.getRootElement(),dc)}Ar(v),l.active&&((0,R.assign)(S,{x:Ro(T.x+y.x),y:Ro(T.y+y.y),dx:Ro(P.x),dy:Ro(P.y)},{originalEvent:v}),s("move"))}function f(v){var b,S=!0;l.active&&(v&&(l.payload.originalEvent=v,Ar(v)),S=s("end")),S===!1&&s("rejected"),b=k(S!==!0),s("ended",b)}function p(v){cc("Escape",v)&&(Gn(v),w())}function u(v){var b;l.active&&(b=lc(e),setTimeout(b,400),Gn(v)),f(v)}function h(v){c(v)}function g(v){var b=l.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function m(v){s("out");var b=l.payload;b.hoverGfx=null,b.hover=null}function w(v){var b;if(l){var S=l.active;S&&s("cancel"),b=k(v),S&&s("canceled",b)}}function k(v){var b,S;s("cleanup"),rc(),l.trapClick?S=u:S=f,Z.event.unbind(document,"mousemove",c),Z.event.unbind(document,"dragstart",Gn),Z.event.unbind(document,"selectstart",Gn),Z.event.unbind(document,"mousedown",S,!0),Z.event.unbind(document,"mouseup",S,!0),Z.event.unbind(document,"keyup",p),Z.event.unbind(document,"touchstart",h,!0),Z.event.unbind(document,"touchcancel",w,!0),Z.event.unbind(document,"touchmove",c,!0),Z.event.unbind(document,"touchend",f,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),dc);var y=l.payload.previousSelection;return v!==!1&&y&&!o.get().length&&d(y),b=l,l=null,b}function C(v,b,S,y){l&&w(!1),typeof b=="string"&&(y=S,S=b,b=null),y=(0,R.assign)({},r,y||{});var x=y.data||{},E,_,V,T,P;y.trapClick?T=u:T=f,v?(E=ko(v)||v,_=So(v),Ar(v),E.type==="dragstart"&&Gn(E)):(E=null,_={x:0,y:0}),V=i(_),b||(b=V),P=Ky(E),l=(0,R.assign)({prefix:S,data:x,payload:{},globalStart:_,displacement:Bo(b,V),localStart:V,isTouch:P},y),y.manual||(P?(Z.event.bind(document,"touchstart",h,!0),Z.event.bind(document,"touchcancel",w,!0),Z.event.bind(document,"touchmove",c,!0),Z.event.bind(document,"touchend",f,!0)):(Z.event.bind(document,"mousemove",c),Z.event.bind(document,"dragstart",Gn),Z.event.bind(document,"selectstart",Gn),Z.event.bind(document,"mousedown",T,!0),Z.event.bind(document,"mouseup",T,!0)),Z.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),y.autoActivate&&c(v,!0)}e.on("diagram.destroy",w),this.init=C,this.move=c,this.hover=g,this.out=m,this.end=f,this.cancel=w,this.context=function(){return l},this.setOptions=function(v){(0,R.assign)(r,v)}}uc.$inject=["eventBus","canvas","selection","elementRegistry"];var qn={__depends__:[Oy,_o],dragging:["type",uc]};function Dr(e){return e.childNodes[0]}function Aa(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Aa.prototype.next=function(){return this._prefix+ ++this._counter};var qy=new Aa("ps"),Xy=["marker-start","marker-mid","marker-end"],Zy=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Bn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}Bn.$inject=["elementRegistry","eventBus","canvas","styles"],Bn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Bn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Bn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var r=(0,D.clone)(o),l=o.getBoundingClientRect();return this._cloneMarkers(Dr(r),a),(0,D.attr)(r,this._styles.cls(a,[],{x:l.top,y:l.left})),(0,D.append)(t,r),(0,D.attr)(r,"data-preview-support-element-id",e.id),r},Bn.prototype.addFrame=function(e,t){var o=(0,D.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,D.append)(t,o),(0,D.attr)(o,"data-preview-support-element-id",e.id),o},Bn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(r=>{a._cloneMarkers(r,t,o)}),nv(e)&&Xy.forEach(function(r){if((0,D.attr)(e,r)){var l=Qy(e,r,a._canvas.getContainer());l&&a._cloneMarker(o,e,l,r,t)}})},Bn.prototype._cloneMarker=function(e,t,o,a,r="djs-dragger"){var l=[o.id,r,qy.next()].join("-"),i=(0,Z.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=i||(0,D.clone)(o);s.id=l,(0,D.classes)(s).add(r);var d=(0,Z.query)(":scope > defs",e);d||(d=(0,D.create)("defs"),(0,D.append)(e,d)),(0,D.append)(d,s),(0,D.attr)(t,a,tv(s.id))};function Qy(e,t,o){return(0,Z.query)("marker#"+ev((0,D.attr)(e,t)),o||document)}function ev(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function tv(e){return"url(#"+e+")"}function nv(e){return Zy.indexOf(e.nodeName)!==-1}var Ir={__init__:["previewSupport"],previewSupport:["type",Bn]};function Fr(e){this._commandStack=e.get("commandStack",!1)}Fr.$inject=["injector"],Fr.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var To={__init__:["rules"],rules:["type",Fr]};function ov(e){return(0,R.filter)(e,function(t){return!(0,R.find)(e,function(o){return o!==t&&fc(t,o)})})}function fc(e,t){if(t){if(e===t)return t;if(e.parent)return fc(e.parent,t)}}function pc(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function $r(e,t,o){o=o||0,(0,R.isArray)(e)||(e=[e]),(0,R.forEach)(e,function(a,r){var l=t(a,r,o);(0,R.isArray)(l)&&l.length&&$r(l,t,o+1)})}function av(e,t,o){var a=[],r=[];return $r(e,function(l,i,s){pc(a,l,t);var d=l.children;if((o===-1||s<o)&&d&&pc(r,d,t))return d}),a}function rv(e,t){return av(e,!t,-1)}function lv(e,t,o){(0,R.isUndefined)(t)&&(t=!0),(0,R.isObject)(t)&&(o=t,t=!0),o=o||{};var a=Ko(o.allShapes),r=Ko(o.allConnections),l=Ko(o.enclosedElements),i=Ko(o.enclosedConnections),s=Ko(o.topLevel,t&&(0,R.groupBy)(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),a[f.source.id]&&a[f.target.id]&&(i[f.id]=l[f.id]=f),r[f.id]=f}function c(f){if(l[f.id]=f,f.waypoints)i[f.id]=r[f.id]=f;else return a[f.id]=f,(0,R.forEach)(f.incoming,d),(0,R.forEach)(f.outgoing,d),f.children}return $r(e,c),{allShapes:a,allConnections:r,topLevel:s,enclosedConnections:i,enclosedElements:l}}function nn(e,t){t=!!t,(0,R.isArray)(e)||(e=[e]);var o,a,r,l;return(0,R.forEach)(e,function(i){var s=i;i.waypoints&&!t&&(s=nn(i.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,p=s.width||0;(d<o||o===void 0)&&(o=d),(c<a||a===void 0)&&(a=c),(d+p>r||r===void 0)&&(r=d+p),(c+f>l||l===void 0)&&(l=c+f)}),{x:o,y:a,height:l-a,width:r-o}}function hc(e,t){var o={};return(0,R.forEach)(e,function(a){var r=a;r.waypoints&&(r=nn(r)),!(0,R.isNumber)(t.y)&&r.x>t.x&&(o[a.id]=a),!(0,R.isNumber)(t.x)&&r.y>t.y&&(o[a.id]=a),r.x>t.x&&r.y>t.y&&((0,R.isNumber)(t.width)&&(0,R.isNumber)(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!(0,R.isNumber)(t.width)||!(0,R.isNumber)(t.height))&&(o[a.id]=a)}),o}function iv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sv(e){return!!(e&&e.isFrame)}function Ko(e,t){return(0,R.assign)({},e||{},t||{})}function Ht(e){return(0,R.isObject)(e)&&(0,R.has)(e,"waypoints")}function Vo(e){return(0,R.isObject)(e)&&(0,R.has)(e,"labelTarget")}var cv="drop-ok",gc="drop-not-ok",mc="attach-ok",yc="new-parent",vc="create",dv=2e3;function bc(e,t,o,a,r){function l(d,c,f,p,u){if(!c)return!1;d=(0,R.filter)(d,function(C){var v=C.labelTarget;return!C.parent&&!(Vo(C)&&d.indexOf(v)!==-1)});var h=(0,R.find)(d,function(C){return!Ht(C)}),g=!1,m=!1,w=!1;Cc(d)&&(g=r.allowed("shape.attach",{position:f,shape:h,target:c})),g||(Cc(d)?w=r.allowed("shape.create",{position:f,shape:h,source:p,target:c}):w=r.allowed("elements.create",{elements:d,position:f,target:c}));var k=u.connectionTarget;return w||g?(h&&p&&(m=r.allowed("connection.create",{source:k===p?h:p,target:k===p?p:h,hints:{targetParent:c,targetAttach:g}})),{attach:g,connect:m}):w===null||g===null?null:!1}function i(d,c){[mc,cv,gc,yc].forEach(function(f){f===c?e.addMarker(d,f):e.removeMarker(d,f)})}o.on(["create.move","create.hover"],function(d){var c=d.context,f=c.elements,p=d.hover,u=c.source,h=c.hints||{};if(!p){c.canExecute=!1,c.target=null;return}wc(d);var g={x:d.x,y:d.y},m=c.canExecute=p&&l(f,p,g,u,h);p&&m!==null&&(c.target=p,m&&m.attach?i(p,mc):i(p,m?yc:gc))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&i(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,p=c.shape,u=c.elements,h=c.target,g=c.canExecute,m=g&&g.attach,w=g&&g.connect,k=c.hints||{};if(g===!1||!h)return!1;wc(d);var C={x:d.x,y:d.y};w?p=a.appendShape(f,p,C,h,{attach:m,connection:w===!0?{}:w,connectionTarget:k.connectionTarget}):(u=a.createElements(u,C,h,(0,R.assign)({},k,{attach:m})),p=(0,R.find)(u,function(v){return!Ht(v)})),(0,R.assign)(c,{elements:u,shape:p}),(0,R.assign)(d,{elements:u,shape:p})});function s(){var d=t.context();d&&d.prefix===vc&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],dv,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){(0,R.isArray)(c)||(c=[c]);var p=(0,R.find)(c,function(h){return!Ht(h)});if(p){f=(0,R.assign)({elements:c,hints:{},shape:p},f||{}),(0,R.forEach)(c,function(h){(0,R.isNumber)(h.x)||(h.x=0),(0,R.isNumber)(h.y)||(h.y=0)});var u=nn((0,R.filter)(c,function(h){return!h.hidden}));(0,R.forEach)(c,function(h){Ht(h)&&(h.waypoints=(0,R.map)(h.waypoints,function(g){return{x:g.x-u.x-u.width/2,y:g.y-u.y-u.height/2}})),(0,R.assign)(h,{x:h.x-u.x-u.width/2,y:h.y-u.y-u.height/2})}),t.init(d,vc,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:c,context:f}})}}}bc.$inject=["canvas","dragging","eventBus","modeling","rules"];function wc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function Cc(e){return e&&e.length===1&&!Ht(e[0])}function uv(e,t,o,a,r){var l=(0,D.createTransform)();l.setTranslate(t,o);var i=(0,D.createTransform)();i.setRotate(a||0,0,0);var s=(0,D.createTransform)();s.setScale(r||1,r||1),(0,D.transform)(e,[l,i,s])}function on(e,t,o){var a=(0,D.createTransform)();a.setTranslate(t,o),(0,D.transform)(e,a)}function fv(e,t){var o=(0,D.createTransform)();o.setRotate(t,0,0),(0,D.transform)(e,o)}var pv=750;function xc(e,t,o,a,r){function l(i){var s=(0,D.create)("g");(0,D.attr)(s,r.cls("djs-drag-group",["no-events"]));var d=(0,D.create)("g");return i.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Dr(f),c)):(f=o._createContainer("shape",d),o.drawShape(Dr(f),c),on(f,c.x,c.y)),a.addDragger(c,s,f))}),s}t.on("create.move",pv,function(i){var s=i.hover,d=i.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=l(c));var p;s?(f.parentNode||(p=e.getActiveLayer(),(0,D.append)(p,f)),on(f,i.x,i.y)):(0,D.remove)(f)}),t.on("create.cleanup",function(i){var s=i.context.dragGroup;s&&(0,D.remove)(s)})}xc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var kc={__depends__:[qn,Ir,To,_o],__init__:["create","createPreview"],create:["type",bc],createPreview:["type",xc]};function Go(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wr(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var r=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),l=Go(e,t);return Math.abs(r/l)<=a}var hv=2;function Rn(e,t){var o=Array.from(arguments).flat();for(const[a,r]of Object.entries({x:"v",y:"h"}))if(gv(a,o))return r;return!1}function gv(e,t){const o=t[0];return(0,R.every)(t,function(a){return Math.abs(o[e]-a[e])<=hv})}function Sc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Ur(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var mv=/,?([a-z]),?/gi,Ec=parseFloat,ht=Math,Tn=ht.PI,an=ht.min,rn=ht.max,_c=ht.pow,Vn=ht.abs,yv=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,vv=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Bc=Array.isArray||function(e){return e instanceof Array};function bv(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wv(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function Cv(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},r=t.count=t.count||[];return bv(a,o)?(wv(r,o),a[o]):(r.length>=1e3&&delete a[r.shift()],r.push(o),a[o]=e(...arguments),a[o])}return t}function xv(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(yv,function(a,r,l){var i=[],s=r.toLowerCase();for(l.replace(vv,function(d,c){c&&i.push(+c)}),s=="m"&&i.length>2&&(o.push([r,...i.splice(0,2)]),s="l",r=r=="m"?"l":"L");i.length>=t[s]&&(o.push([r,...i.splice(0,t[s])]),!!t[s]););}),o.toString=Yr,o}function kv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Sv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Jr(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Yr(){return this.join(",").replace(mv,"$1")}function Ev(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var r=e[o],l=t[o]=new Array(r.length),i=0,s=r.length;i<s;i++)l[i]=r[i];return t.toString=Yr,t}function Rc(e,t,o,a,r,l,i,s,d){var c=1-d,f=_c(c,3),p=_c(c,2),u=d*d*d,h=f*e+p*3*d*o+c*3*d*d*r+u*i,g=f*t+p*3*d*a+c*3*d*d*l+u*s;return{x:ja(h),y:ja(g)}}function Tc(e){var t=Mv(...e);return Jr(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Mn(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function _v(e,t){return e=Jr(e),t=Jr(t),Mn(t,e.x,e.y)||Mn(t,e.x2,e.y)||Mn(t,e.x,e.y2)||Mn(t,e.x2,e.y2)||Mn(e,t.x,t.y)||Mn(e,t.x2,t.y)||Mn(e,t.x,t.y2)||Mn(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Vc(e,t,o,a,r){return e*(e*(-3*t+9*o-9*a+3*r)+6*t-12*o+6*a)-3*t+3*o}function Mc(e,t,o,a,r,l,i,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<f;g++){var m=c*p[g]+c,w=Vc(m,e,o,r,i),k=Vc(m,t,a,l,s),C=w*w+k*k;h+=u[g]*ht.sqrt(C)}return c*h}function Bv(e,t,o,a,r,l,i,s){if(!(rn(e,o)<an(r,i)||an(e,o)>rn(r,i)||rn(t,a)<an(l,s)||an(t,a)>rn(l,s))){var d=(e*a-t*o)*(r-i)-(e-o)*(r*s-l*i),c=(e*a-t*o)*(l-s)-(t-a)*(r*s-l*i),f=(e-o)*(l-s)-(t-a)*(r-i);if(f){var p=ja(d/f),u=ja(c/f),h=+p.toFixed(2),g=+u.toFixed(2);if(!(h<+an(e,o).toFixed(2)||h>+rn(e,o).toFixed(2)||h<+an(r,i).toFixed(2)||h>+rn(r,i).toFixed(2)||g<+an(t,a).toFixed(2)||g>+rn(t,a).toFixed(2)||g<+an(l,s).toFixed(2)||g>+rn(l,s).toFixed(2)))return{x:p,y:u}}}}function ja(e){return Math.round(e*1e11)/1e11}function Rv(e,t,o){if(!_v(Tc(e),Tc(t)))return o?0:[];var a=Mc(...e),r=Mc(...t),l=Ac(e)?1:~~(a/5)||1,i=Ac(t)?1:~~(r/5)||1,s=new Array(l+1),d=new Array(i+1),c={},f=o?0:[],p,u;for(p=0;p<l+1;p++){var h=Rc(...e,p/l);s[p]={x:h.x,y:h.y,t:p/l}}for(p=0;p<i+1;p++)h=Rc(...t,p/i),d[p]={x:h.x,y:h.y,t:p/i};for(p=0;p<l;p++)for(u=0;u<i;u++){var g=s[p],m=s[p+1],w=d[u],k=d[u+1],C=Vn(m.x-g.x)<.01?"y":"x",v=Vn(k.x-w.x)<.01?"y":"x",b=Bv(g.x,g.y,m.x,m.y,w.x,w.y,k.x,k.y),S;if(b){if(S=b.x.toFixed(9)+"#"+b.y.toFixed(9),c[S])continue;c[S]=!0;var y=g.t+Vn((b[C]-g[C])/(m[C]-g[C]))*(m.t-g.t),x=w.t+Vn((b[v]-w[v])/(k[v]-w[v]))*(k.t-w.t);y>=0&&y<=1&&x>=0&&x<=1&&(o?f++:f.push({x:b.x,y:b.y,t1:y,t2:x}))}}return f}function Nc(e,t,o){e=zc(e),t=zc(t);for(var a,r,l,i,s,d,c,f,p,u,h=o?0:[],g=0,m=e.length;g<m;g++){var w=e[g];if(w[0]=="M")a=s=w[1],r=d=w[2];else{w[0]=="C"?(p=[a,r,...w.slice(1)],a=p[6],r=p[7]):(p=[a,r,a,r,s,d,s,d],a=s,r=d);for(var k=0,C=t.length;k<C;k++){var v=t[k];if(v[0]=="M")l=c=v[1],i=f=v[2];else{v[0]=="C"?(u=[l,i,...v.slice(1)],l=u[6],i=u[7]):(u=[l,i,l,i,c,f,c,f],l=c,i=f);var b=Rv(p,u,o);if(o)h+=b;else{for(var S=0,y=b.length;S<y;S++)b[S].segment1=g,b[S].segment2=k,b[S].bez1=p,b[S].bez2=u;h=h.concat(b)}}}}}return h}function Tv(e){return Bc(e)&&Bc(e[0])}function Vv(e){if(kv(e))return e;var t=new Array(e.length),o=0,a=0,r=0,l=0,i=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],r=o,l=a,i++,t[0]=["M",o,a]);for(var d,c,f=i,p=e.length;f<p;f++){if(c=e[f],s=c[0],t[f]=d=new Array(c.length),s!=s.toUpperCase())switch(d[0]=s.toUpperCase(),d[0]){case"A":d[1]=c[1],d[2]=c[2],d[3]=c[3],d[4]=c[4],d[5]=c[5],d[6]=+c[6]+o,d[7]=+c[7]+a;break;case"V":d[1]=+c[1]+a;break;case"H":d[1]=+c[1]+o;break;case"M":r=+c[1]+o,l=+c[2]+a;default:for(var u=1,h=c.length;u<h;u++)d[u]=+c[u]+(u%2?o:a)}else for(var g=0,m=c.length;g<m;g++)d[g]=c[g];switch(s=s.toUpperCase(),d[0]){case"Z":o=+r,a=+l;break;case"H":o=d[1];break;case"V":a=d[1];break;case"M":r=d[d.length-2],l=d[d.length-1];default:o=d[d.length-2],a=d[d.length-1]}}return t.toString=Yr,t}function Ac(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Pa(e,t,o,a){return[e,t,o,a,o,a]}function jc(e,t,o,a,r,l){var i=.3333333333333333,s=2/3;return[i*e+s*o,i*t+s*a,i*r+s*o,i*l+s*a,r,l]}function Pc(e,t,o,a,r,l,i,s,d,c){var f=Tn*120/180,p=Tn/180*(+r||0),u=[],h,g=Cv(function(pe,Ne,Fe){return{x:pe*ht.cos(Fe)-Ne*ht.sin(Fe),y:pe*ht.sin(Fe)+Ne*ht.cos(Fe)}});if(c)x=c[0],E=c[1],S=c[2],y=c[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,d,-p),s=h.x,d=h.y;var m=(e-s)/2,w=(t-d)/2,k=m*m/(o*o)+w*w/(a*a);k>1&&(k=ht.sqrt(k),o=k*o,a=k*a);var C=o*o,v=a*a,b=(l==i?-1:1)*ht.sqrt(Vn((C*v-C*w*w-v*m*m)/(C*w*w+v*m*m))),S=b*o*w/a+(e+s)/2,y=b*-a*m/o+(t+d)/2,x=ht.asin(((t-y)/a).toFixed(9)),E=ht.asin(((d-y)/a).toFixed(9));x=e<S?Tn-x:x,E=s<S?Tn-E:E,x<0&&(x=Tn*2+x),E<0&&(E=Tn*2+E),i&&x>E&&(x=x-Tn*2),!i&&E>x&&(E=E-Tn*2)}var _=E-x;if(Vn(_)>f){var V=E,T=s,P=d;E=x+f*(i&&E>x?1:-1),s=S+o*ht.cos(E),d=y+a*ht.sin(E),u=Pc(s,d,o,a,r,0,i,T,P,[E,V,S,y])}_=E-x;var A=ht.cos(x),N=ht.sin(x),M=ht.cos(E),B=ht.sin(E),H=ht.tan(_/4),W=4/3*o*H,X=4/3*a*H,fe=[e,t],J=[e+W*N,t-X*A],Y=[s+W*B,d-X*M],G=[s,d];if(J[0]=2*fe[0]-J[0],J[1]=2*fe[1]-J[1],c)return[J,Y,G].concat(u);u=[J,Y,G].concat(u).join().split(",");for(var j=[],me=0,Pe=u.length;me<Pe;me++)j[me]=me%2?g(u[me-1],u[me],p).y:g(u[me],u[me+1],p).x;return j}function Mv(e,t,o,a,r,l,i,s){for(var d=[],c=[[],[]],f,p,u,h,g,m,w,k,C=0;C<2;++C){if(C==0?(p=6*e-12*o+6*r,f=-3*e+9*o-9*r+3*i,u=3*o-3*e):(p=6*t-12*a+6*l,f=-3*t+9*a-9*l+3*s,u=3*a-3*t),Vn(f)<1e-12){if(Vn(p)<1e-12)continue;h=-u/p,0<h&&h<1&&d.push(h);continue}w=p*p-4*u*f,k=ht.sqrt(w),!(w<0)&&(g=(-p+k)/(2*f),0<g&&g<1&&d.push(g),m=(-p-k)/(2*f),0<m&&m<1&&d.push(m))}for(var v=d.length,b=v,S;v--;)h=d[v],S=1-h,c[0][v]=S*S*S*e+3*S*S*h*o+3*S*h*h*r+h*h*h*i,c[1][v]=S*S*S*t+3*S*S*h*a+3*S*h*h*l+h*h*h*s;return c[0][b]=e,c[1][b]=t,c[0][b+1]=i,c[1][b+1]=s,c[0].length=c[1].length=b+2,{x0:an(...c[0]),y0:an(...c[1]),x1:rn(...c[0]),y1:rn(...c[1])}}function zc(e){if(Tv(e)||(e=xv(e)),Sv(e))return e;for(var t=Ev(Vv(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(u,h,g){var m,w;if(!u)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(u[0]in{T:1,Q:1})&&(h.qx=h.qy=null),u[0]){case"M":h.X=u[1],h.Y=u[2];break;case"A":u=["C",...Pc(h.x,h.y,...u.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,w=h.y*2-h.by):(m=h.x,w=h.y),u=["C",m,w,...u.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),u=["C",...jc(h.x,h.y,h.qx,h.qy,u[1],u[2])];break;case"Q":h.qx=u[1],h.qy=u[2],u=["C",...jc(h.x,h.y,u[1],u[2],u[3],u[4])];break;case"L":u=["C",...Pa(h.x,h.y,u[1],u[2])];break;case"H":u=["C",...Pa(h.x,h.y,u[1],h.y)];break;case"V":u=["C",...Pa(h.x,h.y,h.x,u[1])];break;case"Z":u=["C",...Pa(h.x,h.y,h.X,h.Y)];break}return u},r=function(u,h){if(u[h].length>7){u[h].shift();for(var g=u[h];g.length;)l[h]="A",u.splice(h++,0,["C",...g.splice(0,6)]);u.splice(h,1),c=t.length}},l=[],i="",s="",d=0,c=t.length;d<c;d++){t[d]&&(i=t[d][0]),i!="C"&&(l[d]=i,d&&(s=l[d-1])),t[d]=a(t[d],o,s),l[d]!="A"&&i=="C"&&(l[d]="C"),r(t,d);var f=t[d],p=f.length;o.x=f[p-2],o.y=f[p-1],o.bx=Ec(f[p-4])||o.x,o.by=Ec(f[p-3])||o.y}return t}function Nv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function qo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Av(e){return qo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function jv(e){for(var t=e.waypoints,o=t.reduce(function(s,d,c){var f=t[c-1];if(f){var p=s[s.length-1],u=p&&p.endLength||0,h=Hv(f,d);s.push({start:f,end:d,startLength:u,endLength:u+h,length:h})}return s},[]),a=o.reduce(function(s,d){return s+d.length},0)/2,r=0,l=o[r];l.endLength<a;)l=o[++r];var i=(a-l.startLength)/l.length;return{x:l.start.x+(l.end.x-l.start.x)*i,y:l.start.y+(l.end.y-l.start.y)*i}}function ut(e){return Ht(e)?jv(e):Av(e)}function Nn(e,t,o){o=o||0,(0,R.isObject)(o)||(o={x:o,y:o});var a=qe(e),r=qe(t),l=a.bottom+o.y<=r.top,i=a.left-o.x>=r.right,s=a.top-o.y>=r.bottom,d=a.right+o.x<=r.left,c=l?"top":s?"bottom":null,f=d?"left":i?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function Kr(e,t,o){var a=Pv(e,t);return a.length===1||a.length===2&&Go(a[0],a[1])<1?qo(a[0]):a.length>1?(a=(0,R.sortBy)(a,function(r){var l=Math.floor(r.t2*100)||1;return l=100-l,l=(l<10?"0":"")+l,r.segment2+"#"+l}),qo(a[o?0:a.length-1])):null}function Pv(e,t){return Nc(e,t)}function zv(e){e=e.slice();for(var t=0,o,a,r;e[t];)o=e[t],a=e[t-1],r=e[t+1],Go(o,r)===0||Wr(a,r,o)?e.splice(t,1):t++;return e}function Hv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lc(e,t,o,a){function r(i,s){return a.allowed("connection.create",{source:i,target:s})}function l(i,s){return r(s,i)}e.on("connect.hover",function(i){var s=i.context,d=s.start,c=i.hover,f;if(s.hover=c,f=s.canExecute=r(d,c),!(0,R.isNil)(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=l(d,c),!(0,R.isNil)(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(i){var s=i.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(i){var s=i.context,d=s.canExecute,c=s.connectionStart,f={x:i.x,y:i.y},p=s.source,u=s.target;if(!d)return!1;var h=null,g={connectionStart:Gr(s)?f:c,connectionEnd:Gr(s)?c:f};(0,R.isObject)(d)&&(h=d),s.connection=o.connect(p,u,h,g)}),this.start=function(i,s,d,c){(0,R.isObject)(d)||(c=d,d=ut(s)),t.init(i,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Lc.$inject=["eventBus","dragging","modeling","rules"];function Gr(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var Lv=1100,Ov=900,Oc="connect-ok",Dc="connect-not-ok";function Ic(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(r){var l=r.context,i=l.canExecute,s=l.hover,d=l.source,c=l.start,f=l.startPosition,p=l.target,u=l.connectionStart||f,h=l.connectionEnd||{x:r.x,y:r.y},g=u,m=h;Gr(l)&&(g=h,m=u),a.drawPreview(l,i,{source:d||c,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",Ov,function(r){var l=r.context,i=r.hover,s=l.canExecute;s!==null&&o.addMarker(i,s?Oc:Dc)}),t.on(["connect.out","connect.cleanup"],Lv,function(r){var l=r.hover;l&&(o.removeMarker(l,Oc),o.removeMarker(l,Dc))}),a&&t.on("connect.cleanup",function(r){a.cleanUp(r.context)})}Ic.$inject=["injector","eventBus","canvas"];var qr={__depends__:[_o,To,qn],__init__:["connectPreview"],connect:["type",Lc],connectPreview:["type",Ic]},Dv=15;function Fc(e,t){var o;function a(s){return i(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function r(s){var d=o.start,c=o.button,f=So(s),p=Bo(f,d);!o.dragging&&Iv(p)>Dv&&(o.dragging=!0,c===0&&lc(e),Or("grab")),o.dragging&&(p=Bo(f,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=f),s.preventDefault()}function l(s){Z.event.unbind(document,"mousemove",r),Z.event.unbind(document,"mouseup",l),o=null,rc()}function i(s){if(!(0,Z.closest)(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:So(s)},Z.event.bind(document,"mousemove",r),Z.event.bind(document,"mouseup",l),!0}}this.isActive=function(){return!!o}}Fc.$inject=["eventBus","canvas"];function Iv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var $c={__init__:["moveCanvas"],moveCanvas:["type",Fc]};function Xr(e){return Math.log(e)/Math.log(10)}function Wc(e,t){var o=Xr(e.min),a=Xr(e.max);return(Math.abs(o)+Math.abs(a))/t}function Fv(e,t){return Math.max(e.min,Math.min(e.max,t))}var $v=Math.sign||function(e){return e>=0?1:-1},Zr={min:.2,max:4},Uc=10,Wv=.1,Uv=.75;function ln(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,R.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Uv;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}ln.$inject=["config.zoomScroll","eventBus","canvas"],ln.prototype.scroll=function(t){this._canvas.scroll(t)},ln.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ln.prototype.zoom=function(t,o){var a=Wc(Zr,Uc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Wv&&(this._zoom(t,o,a),this._totalDelta=0)},ln.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||Gs()&&t.metaKey,r=t.shiftKey,l=-1*this._scale,i;if(a?l*=t.deltaMode===0?.02:.32:l*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};i=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*$v(t.deltaY)*l,this.zoom(i,d)}else r?i={dx:l*t.deltaY,dy:0}:i={dx:l*t.deltaX,dy:l*t.deltaY},this.scroll(i)}},ln.prototype.stepZoom=function(t,o){var a=Wc(Zr,Uc);this._zoom(t,o,a)},ln.prototype._zoom=function(e,t,o){var a=this._canvas,r=e>0?1:-1,l=Xr(a.zoom()),i=Math.round(l/o)*o;i+=o*r;var s=Math.pow(10,i);a.zoom(Fv(Zr,s),t)},ln.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Z.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ln.prototype._init=function(e){this.toggle(e)};var Jc={__init__:["zoomScroll"],zoomScroll:["type",ln]};function at(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}at.$inject=["eventBus","injector"],at.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},at.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let r=this._fire(e,"canExecute",o);if(r===void 0){if(!a)return!1;a.canExecute&&(r=a.canExecute(t))}return r},at.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},at.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},at.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},at.prototype.register=function(e,t){this._setHandler(e,t)},at.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},at.prototype.canUndo=function(){return!!this._getUndoAction()},at.prototype.canRedo=function(){return!!this._getRedoAction()},at.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},at.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},at.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},at.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let r;o=this._eventBus.createEvent(o);for(const l of a)if(r=this._eventBus.fire("commandStack."+l,o),o.cancelBubble)break;return r},at.prototype._createId=function(){return this._uid++},at.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},at.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,r=this._getHandler(o);if(!r)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),r.preExecute&&r.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),r.execute&&this._markDirty(r.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),r.postExecute&&r.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},at.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},at.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,R.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},at.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,R.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},at.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},at.prototype._revertedAction=function(e){this._stackIdx--},at.prototype._getHandler=function(e){return this._handlerMap[e]},at.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Jv={commandStack:["type",at]};function Xn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function za(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function An(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Qr(e,t){return!e||!t?-1:e.indexOf(t)}function Mo(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Yv=1e3;function Mt(e){this._eventBus=e}Mt.$inject=["eventBus"];function Kv(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Mt.prototype.on=function(e,t,o,a,r,l){if(((0,R.isFunction)(t)||(0,R.isNumber)(t))&&(l=r,r=a,a=o,o=t,t=null),(0,R.isFunction)(o)&&(l=r,r=a,a=o,o=Yv),(0,R.isObject)(r)&&(l=r,r=!1),!(0,R.isFunction)(a))throw new Error("handlerFn must be a function");(0,R.isArray)(e)||(e=[e]);var i=this._eventBus;(0,R.forEach)(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");i.on(d,o,r?Kv(a,l):a,l)})},Mt.prototype.canExecute=gn("canExecute"),Mt.prototype.preExecute=gn("preExecute"),Mt.prototype.preExecuted=gn("preExecuted"),Mt.prototype.execute=gn("execute"),Mt.prototype.executed=gn("executed"),Mt.prototype.postExecute=gn("postExecute"),Mt.prototype.postExecuted=gn("postExecuted"),Mt.prototype.revert=gn("revert"),Mt.prototype.reverted=gn("reverted");function gn(e){return function(o,a,r,l,i){((0,R.isFunction)(o)||(0,R.isNumber)(o))&&(i=l,l=r,r=a,a=o,o=null),this.on(o,e,a,r,l,i)}}var Gv=250,Yc=1400;function el(e,t,o){Mt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Yc,function(r){var l=r.context,i=l.shapes,s=l.validatedShapes;l.shapes=Kc(i),l.validatedShapes=Kc(s)}),a&&t.on("shape.move.start",Gv,function(r){var l=r.context,i=l.shapes,s=[];(0,R.forEach)(i,function(d){(0,R.forEach)(d.labels,function(c){!c.hidden&&l.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),(0,R.forEach)(s,function(d){a.makeDraggable(l,d,!0)})}),this.preExecuted("elements.move",Yc,function(r){var l=r.context.closure,i=l.enclosedElements,s=[];(0,R.forEach)(i,function(d){(0,R.forEach)(d.labels,function(c){i[c.id]||s.push(c)})}),l.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var l=r.context;Mo((l.connection||l.shape).labels,function(i){o.removeShape(i,{nested:!0})})}),this.execute("shape.delete",function(r){var l=r.context,i=l.shape,s=i.labelTarget;s&&(l.labelTargetIndex=Qr(s.labels,i),l.labelTarget=s,i.labelTarget=null)}),this.revert("shape.delete",function(r){var l=r.context,i=l.shape,s=l.labelTarget,d=l.labelTargetIndex;s&&(An(s.labels,i,d),i.labelTarget=s)})}Xn(el,Mt),el.$inject=["injector","eventBus","modeling"];function Kc(e){return(0,R.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var qv={__init__:["labelSupport"],labelSupport:["type",el]};function Gc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function qc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Xv(e,t,o,a){var r=o.inverse;return Object.defineProperty(e,"remove",{value:function(l){var i=this.indexOf(l);return i!==-1&&(this.splice(i,1),t.unset(l,r,a)),l}}),Object.defineProperty(e,"contains",{value:function(l){return this.indexOf(l)!==-1}}),Object.defineProperty(e,"add",{value:function(l,i){var s=this.indexOf(l);if(typeof i>"u"){if(s!==-1)return;i=this.length}s!==-1&&this.splice(s,1),this.splice(i,0,l),s===-1&&t.set(l,r,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Zv(e){return e.__refs_collection===!0}function Qv(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Xc(e,t,o){var a=Xv(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(r){e.set(r,t.inverse,o)})}function eb(e,t,o){var a=t.inverse,r=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(l){if(l!==r){var i=r;r=null,i&&e.unset(i,a,o),r=l,e.set(r,a,o)}}})}function Kt(e,t){if(!(this instanceof Kt))return new Kt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Kt.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Xc(this,t,e):eb(this,t,e)},Kt.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Zv(o)||Xc(this,t,e),o},Kt.prototype.ensureBound=function(e,t){Qv(e,t)||this.bind(e,t)},Kt.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},Kt.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var tl=new Kt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Zc=new Kt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Qc=new Kt({name:"attachers",collection:!0},{name:"host"}),ed=new Kt({name:"outgoing",collection:!0},{name:"source"}),td=new Kt({name:"incoming",collection:!0},{name:"target"});function No(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),tl.bind(this,"parent"),Zc.bind(this,"labels"),ed.bind(this,"outgoing"),td.bind(this,"incoming")}function Xo(){No.call(this),tl.bind(this,"children"),Qc.bind(this,"host"),Qc.bind(this,"attachers")}Xn(Xo,No);function nd(){No.call(this),tl.bind(this,"children")}Xn(nd,Xo);function od(){Xo.call(this),Zc.bind(this,"labelTarget")}Xn(od,Xo);function ad(){No.call(this),ed.bind(this,"source"),td.bind(this,"target")}Xn(ad,No);var tb={connection:ad,shape:Xo,label:od,root:nd};function nb(e,t){var o=tb[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,R.assign)(new o,t)}function ob(e){return e instanceof No}function jn(){this._uid=12}jn.prototype.createRoot=function(e){return this.create("root",e)},jn.prototype.createLabel=function(e){return this.create("label",e)},jn.prototype.createShape=function(e){return this.create("shape",e)},jn.prototype.createConnection=function(e){return this.create("connection",e)},jn.prototype.create=function(e,t){return t=(0,R.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),nb(e,t)};var ab={width:90,height:20};function Zn(){jn.call(this),this._translate=qc}(0,pn.default)(Zn,jn),Zn.$inject=[],Zn.prototype.baseCreate=jn.prototype.create,Zn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,ot({type:"label"},ab,t)):this.createFlowElement(e,t)},Zn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Gc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=ot({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Zn.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function Ha(e,t){this._modeling=e,this._canvas=t}Ha.$inject=["modeling","canvas"],Ha.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,R.forEach)(o,function(r){var l={x:0,y:0};(0,R.isDefined)(a.left)?l.x=a.left-r.x:(0,R.isDefined)(a.right)?l.x=a.right-r.width-r.x:(0,R.isDefined)(a.center)?l.x=a.center-Math.round(r.width/2)-r.x:(0,R.isDefined)(a.top)?l.y=a.top-r.y:(0,R.isDefined)(a.bottom)?l.y=a.bottom-r.height-r.y:(0,R.isDefined)(a.middle)&&(l.y=a.middle-Math.round(r.height/2)-r.y),t.moveElements([r],l,r.parent)})},Ha.prototype.postExecute=function(e){};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,r=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:r.attach}),e.shape=a},La.prototype.postExecute=function(e){var t=e.hints||{};rb(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function rb(e,t){return(0,R.some)(e.outgoing,function(o){return o.target===t})}function Oa(e,t){this._canvas=e,this._layouter=t}Oa.$inject=["canvas","layouter"],Oa.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,r=e.parent,l=e.parentIndex,i=e.hints;if(!o||!a)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,i)),this._canvas.addConnection(t,r,l),t},Oa.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Da=Math.round;function nl(e){this._modeling=e}nl.$inject=["modeling"],nl.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,r=e.position,l=e.hints,i=this._modeling;(0,R.forEach)(t,function(f){(0,R.isNumber)(f.x)||(f.x=0),(0,R.isNumber)(f.y)||(f.y=0)});var s=nn((0,R.filter)(t,function(f){return!f.hidden}));(0,R.forEach)(t,function(f){Ht(f)&&(f.waypoints=(0,R.map)(f.waypoints,function(p){return{x:Da(p.x-s.x-s.width/2+r.x),y:Da(p.y-s.y-s.height/2+r.y)}})),(0,R.assign)(f,{x:Da(f.x-s.x-s.width/2+r.x),y:Da(f.y-s.y-s.height/2+r.y)})});var d=ov(t),c={};(0,R.forEach)(t,function(f){if(Ht(f)){c[f.id]=(0,R.isNumber)(a)?i.createConnection(c[f.source.id],c[f.target.id],a,f,f.parent||o,l):i.createConnection(c[f.source.id],c[f.target.id],f,f.parent||o,l);return}var p=(0,R.assign)({},l);d.indexOf(f)===-1&&(p.autoResize=!1),Vo(f)&&(p=(0,R.omit)(p,["attach"])),c[f.id]=(0,R.isNumber)(a)?i.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,a,p):i.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,p)}),e.elements=(0,R.values)(c)};var rd=Math.round;function Pn(e){this._canvas=e}Pn.$inject=["canvas"],Pn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,r=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,R.assign)(t,o):(0,R.assign)(t,{x:o.x-rd(t.width/2),y:o.y-rd(t.height/2)}),this._canvas.addShape(t,a,r),t},Pn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Zo(e){Pn.call(this,e)}Xn(Zo,Pn),Zo.$inject=["canvas"];var lb=Pn.prototype.execute;Zo.prototype.execute=function(e){var t=e.shape;return sb(t),t.labelTarget=e.labelTarget,lb.call(this,e)};var ib=Pn.prototype.revert;Zo.prototype.revert=function(e){return e.shape.labelTarget=null,ib.call(this,e)};function sb(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qo(e,t){this._canvas=e,this._modeling=t}Qo.$inject=["canvas","modeling"],Qo.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;Mo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Qo.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Qr(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qo.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,An(o.children,t,a),this._canvas.addConnection(t,o),t};function ol(e,t){this._modeling=e,this._elementRegistry=t}ol.$inject=["modeling","elementRegistry"],ol.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,R.forEach)(a,function(r){o.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ea(e,t){this._canvas=e,this._modeling=t}ea.$inject=["canvas","modeling"],ea.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;Mo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.children,function(a){Ht(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},ea.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=Qr(a.children,o),t.removeShape(o),o},ea.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,r=e.oldParentIndex;return An(a.children,o,r),t.addShape(o,a),o};function Ia(e){this._modeling=e}Ia.$inject=["modeling"];var ld={x:"y",y:"x"};Ia.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,r=e.dimension;function l(w,k){w.range.min=Math.min(k[a],w.range.min),w.range.max=Math.max(k[a]+k[r],w.range.max)}function i(w){return w[a]+w[r]/2}function s(w){return w.length-1}function d(w){return w.max-w.min}function c(w,k){var C={y:0};C[a]=w-i(k),C[a]&&(C[ld[a]]=0,t.moveElements([k],C,k.parent))}var f=o[0],p=s(o),u=o[p],h,g,m=0;(0,R.forEach)(o,function(w,k){var C,v,b;if(w.elements.length<2){k&&k!==o.length-1&&(l(w,w.elements[0]),m+=d(w.range));return}C=(0,R.sortBy)(w.elements,a),v=C[0],k===p&&(v=C[s(C)]),b=i(v),w.range=null,(0,R.forEach)(C,function(S){if(c(b,S),w.range===null){w.range={min:S[a],max:S[a]+S[r]};return}l(w,S)}),k&&k!==o.length-1&&(m+=d(w.range))}),g=Math.abs(u.range.min-f.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,R.forEach)(o,function(w,k){var C={},v;w===f||w===u||(v=o[k-1],w.range.max=0,(0,R.forEach)(w.elements,function(b,S){C[ld[a]]=0,C[a]=v.range.max-b[a]+h,w.range.min!==b[a]&&(C[a]+=b[a]-w.range.min),C[a]&&t.moveElements([b],C,b.parent),w.range.max=Math.max(b[a]+b[r],S?w.range.max:0)}))})},Ia.prototype.postExecute=function(e){};function Fa(e,t){this._layouter=e,this._canvas=t}Fa.$inject=["layouter","canvas"],Fa.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,R.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Fa.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function al(){}al.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,l=t.parent;return e.oldParent=l,e.oldParentIndex=za(l.children,t),An(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(i){i.x+=o.x,i.y+=o.y,i.original&&(i.original.x+=o.x,i.original.y+=o.y)}),t},al.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,r=e.oldParentIndex,l=e.delta;return za(o.children,t),An(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(i){i.x-=l.x,i.y-=l.y,i.original&&(i.original.x-=l.x,i.original.y-=l.y)}),t};function $a(e,t,o){var a=ic(t),r=ic(o),l=Bo(e,a),i={x:l.x*(o.width/t.width),y:l.y*(o.height/t.height)};return qo({x:r.x+i.x,y:r.y+i.y})}function rl(e,t,o){var a=Wa(e),r=sd(a,t),l=a[0];return r.length?r[r.length-1]:$a(l.original||l,o,t)}function ll(e,t,o){var a=Wa(e),r=sd(a,t),l=a[a.length-1];return r.length?r[0]:$a(l.original||l,o,t)}function il(e,t,o){var a=Wa(e),r=id(t,o),l=a[0];return $a(l.original||l,r,t)}function sl(e,t,o){var a=Wa(e),r=id(t,o),l=a[a.length-1];return $a(l.original||l,r,t)}function id(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Wa(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function sd(e,t){return(0,R.filter)((0,R.map)(e,db),function(o){return cb(o,t)})}function cb(e,t){return Nn(t,e,1)==="intersect"}function db(e){return e.original||e}function cl(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}cl.prototype.add=function(e,t){return this.addAll([e],t)},cl.prototype.addAll=function(e,t){var o=lv(e,!!t,this);return(0,R.assign)(this,o),this};function ta(e){this._modeling=e}ta.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},ta.prototype.moveClosure=function(e,t,o,a,r){var l=this._modeling,i=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;r&&r.parent===o&&(f=!0),(0,R.forEach)(i,function(p){l.moveShape(p,t,c[p.id]&&!f&&o,{recurse:!1,layout:!1})}),(0,R.forEach)(s,function(p){var u=!!i[p.source.id],h=!!i[p.target.id];d[p.id]&&u&&h?l.moveConnection(p,t,c[p.id]&&!f&&o):l.layoutConnection(p,{connectionStart:u&&il(p,p.source,t),connectionEnd:h&&sl(p,p.target,t)})})},ta.prototype.getClosure=function(e){return new cl().addAll(e,!0)};function Ua(e){this._helper=new ta(e)}Ua.$inject=["modeling"],Ua.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ua.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Qn(e){this._modeling=e,this._helper=new ta(e)}Qn.$inject=["modeling"],Qn.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,l=t.parent;return e.oldBounds=(0,R.pick)(t,["x","y","width","height"]),e.oldParent=l,e.oldParentIndex=za(l.children,t),An(a.children,t,r),(0,R.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Qn.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,r=this._modeling;a.layout!==!1&&((0,R.forEach)(t.incoming,function(l){r.layoutConnection(l,{connectionEnd:sl(l,t,o)})}),(0,R.forEach)(t.outgoing,function(l){r.layoutConnection(l,{connectionStart:il(l,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Qn.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,r=e.delta;return An(o.children,t,a),(0,R.assign)(t,{parent:o,x:t.x-r.x,y:t.y-r.y}),t},Qn.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Qn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function na(e){this._modeling=e}na.$inject=["modeling"],na.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,r=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,R.isArray)(r)&&(e.oldWaypoints=a.waypoints,a.waypoints=r),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},na.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,r=e.dockingOrPoints,l=e.hints||{},i={};l.connectionStart&&(i.connectionStart=l.connectionStart),l.connectionEnd&&(i.connectionEnd=l.connectionEnd),l.layoutConnection!==!1&&(o&&(!a||l.docking==="source")&&(i.connectionStart=i.connectionStart||cd((0,R.isArray)(r)?r[0]:r)),a&&(!o||l.docking==="target")&&(i.connectionEnd=i.connectionEnd||cd((0,R.isArray)(r)?r[r.length-1]:r)),l.newWaypoints&&(i.waypoints=l.newWaypoints),this._modeling.layoutConnection(t,i))},na.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,r=e.connection;return t&&(r.source=t),o&&(r.target=o),a&&(r.waypoints=a),r};function cd(e){return e.original||e}function mn(e,t){this._modeling=e,this._rules=t}mn.$inject=["modeling","rules"],mn.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,r=e.oldShape,l=e.newData,i=e.hints||{},s;function d(g,m,w){return a.allowed("connection.reconnect",{connection:w,source:g,target:m})}var c={x:l.x,y:l.y},f={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(l,c,r.parent,i),r.host&&o.updateAttachment(s,r.host);var p;i.moveChildren!==!1&&(p=r.children.slice(),o.moveElements(p,{x:0,y:0},s,i));var u=r.incoming.slice(),h=r.outgoing.slice();(0,R.forEach)(u,function(g){var m=g.source;d(m,s,g)&&t.reconnectEnd(g,s,ll(g,s,f),i)}),(0,R.forEach)(h,function(g){var m=g.target;d(s,m,g)&&t.reconnectStart(g,s,rl(g,s,f),i)})},mn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},mn.prototype.execute=function(e){},mn.prototype.revert=function(e){},mn.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},mn.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},mn.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function oa(e){this._modeling=e}oa.$inject=["modeling"],oa.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},oa.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,R.forEach)(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:ll(r,o,a)})}),(0,R.forEach)(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:rl(r,o,a)})}))},oa.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function ub(e,t){var o=[];return(0,R.forEach)(e.concat(t),function(a){var r=a.incoming,l=a.outgoing;(0,R.forEach)(r.concat(l),function(i){var s=i.source,d=i.target;(aa(e,s)||aa(e,d)||aa(t,s)||aa(t,d))&&(aa(o,i)||o.push(i))})}),o}function aa(e,t){return e.indexOf(t)!==-1}function fb(e,t,o){var a=e.x,r=e.y,l=e.width,i=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:a,y:r+d,width:l,height:i-d};case"s":return{x:a,y:r,width:l,height:i+d};case"w":return{x:a+s,y:r,width:l-s,height:i};case"e":return{x:a,y:r,width:l+s,height:i};default:throw new Error("unknown direction: "+t)}}function zn(e){this._modeling=e}zn.$inject=["modeling"],zn.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,r=e.resizingShapes,l=e.start,i={};this.moveShapes(a,t),(0,R.forEach)(r,function(s){i[s.id]=hb(s)}),this.resizeShapes(r,t,o),this.updateConnectionWaypoints(ub(a,r),t,o,l,a,r,i)},zn.prototype.execute=function(){},zn.prototype.revert=function(){},zn.prototype.moveShapes=function(e,t){var o=this;(0,R.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},zn.prototype.resizeShapes=function(e,t,o){var a=this;(0,R.forEach)(e,function(r){var l=fb(r,o,t);a._modeling.resizeShape(r,l,null,{attachSupport:!1,autoResize:!1,layout:!1})})},zn.prototype.updateConnectionWaypoints=function(e,t,o,a,r,l,i){var s=this,d=r.concat(l);(0,R.forEach)(e,function(c){var f=c.source,p=c.target,u=pb(c),h=ud(o),g={};Hn(d,f)&&Hn(d,p)?(u=(0,R.map)(u,function(m){return fd(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&fd(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(c,u,{labelBehavior:!1})):(Hn(d,f)||Hn(d,p))&&(Hn(r,f)?g.connectionStart=il(c,f,t):Hn(r,p)?g.connectionEnd=sl(c,p,t):Hn(l,f)?g.connectionStart=rl(c,f,i[f.id]):Hn(l,p)&&(g.connectionEnd=ll(c,p,i[p.id])),s._modeling.layoutConnection(c,g))})};function dd(e){return(0,R.assign)({},e)}function pb(e){return(0,R.map)(e.waypoints,function(t){return t=dd(t),t.original&&(t.original=dd(t.original)),t})}function ud(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function fd(e,t,o){var a=ud(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Hn(e,t){return e.indexOf(t)!==-1}function hb(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ja(e){this._modeling=e}Ja.$inject=["modeling"],Ja.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=pd(o),t.collapsed=!t.collapsed;var a=hd(o,t.collapsed);return[t].concat(a)},Ja.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,r=gd(a,o);return t.collapsed=!t.collapsed,[t].concat(r)};function pd(e){var t={};return(0,R.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,R.assign)({},t,pd(o.children)))}),t}function hd(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(hd(a.children,a.collapsed||t)))}),o}function gd(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(gd(a.children,t)))}),o}function Ya(e){this._modeling=e}Ya.$inject=["modeling"],Ya.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=md(a,t),yd(o,t),t.host=o,t},Ya.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,r=e.attacherIdx;return t.host=a,md(o,t),yd(a,t,r),t};function md(e,t){return za(e&&e.attachers,t)}function yd(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),An(a,t,o)}}function dl(){}dl.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},dl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ke(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}Ke.$inject=["eventBus","elementFactory","commandStack"],Ke.prototype.getHandlers=function(){return{"shape.append":La,"shape.create":Pn,"shape.delete":ea,"shape.move":Qn,"shape.resize":oa,"shape.replace":mn,"shape.toggleCollapse":Ja,spaceTool:zn,"label.create":Zo,"connection.create":Oa,"connection.delete":Qo,"connection.move":al,"connection.layout":Fa,"connection.updateWaypoints":dl,"connection.reconnect":na,"elements.create":nl,"elements.move":Ua,"elements.delete":ol,"elements.distribute":Ia,"elements.align":Ha,"element.updateAttachment":Ya}},Ke.prototype.registerHandlers=function(e){(0,R.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},Ke.prototype.moveShape=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=null);var l={shape:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("shape.move",l)},Ke.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},Ke.prototype.moveElements=function(e,t,o,a){a=a||{};var r=a.attach,l=o,i;r===!0?(i=o,l=o.parent):r===!1&&(i=null);var s={shapes:e,delta:t,newParent:l,newHost:i,hints:a};this._commandStack.execute("elements.move",s)},Ke.prototype.moveConnection=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=void 0);var l={connection:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("connection.move",l)},Ke.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},Ke.prototype.createConnection=function(e,t,o,a,r,l){typeof o=="object"&&(l=r,r=a,a=o,o=void 0),a=this._create("connection",a);var i={source:e,target:t,parent:r,parentIndex:o,connection:a,hints:l};return this._commandStack.execute("connection.create",i),i.connection},Ke.prototype.createShape=function(e,t,o,a,r){typeof a!="number"&&(r=a,a=void 0),r=r||{};var l=r.attach,i,s;e=this._create("shape",e),l?(i=o.parent,s=o):i=o;var d={position:t,shape:e,parent:i,parentIndex:a,host:s,hints:r};return this._commandStack.execute("shape.create",d),d.shape},Ke.prototype.createElements=function(e,t,o,a,r){(0,R.isArray)(e)||(e=[e]),typeof a!="number"&&(r=a,a=void 0),r=r||{};var l={position:t,elements:e,parent:o,parentIndex:a,hints:r};return this._commandStack.execute("elements.create",l),l.elements},Ke.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var r={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",r),r.shape},Ke.prototype.appendShape=function(e,t,o,a,r){r=r||{},t=this._create("shape",t);var l={source:e,position:o,target:a,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",l),l.shape},Ke.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ke.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},Ke.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},Ke.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},Ke.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Ke.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},Ke.prototype.resizeShape=function(e,t,o,a){var r={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",r)},Ke.prototype.createSpace=function(e,t,o,a,r){var l={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",l)},Ke.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},Ke.prototype.reconnect=function(e,t,o,a,r){var l={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:r||{}};this._commandStack.execute("connection.reconnect",l)},Ke.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,R.assign)(a,{docking:"source"}))},Ke.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,R.assign)(a,{docking:"target"}))},Ke.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},Ke.prototype._create=function(e,t){return ob(t)?t:this._elementFactory.create(e,t)},Ke.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function vd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ul(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function gb(e,t){Array.isArray(e)&&e.forEach(t)}function Ka(e){const t=e.businessObject;if(t)return t.name||""}function mb(e,t){const o=e.businessObject;return o.name=t,e}var yb={width:90,height:20},Kx=15;function fl(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function bd(e){return ra(e.label)}function vb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],r=bb(e),l=Math.atan((a.y-o.y)/(a.x-o.x));let{x:i,y:s}=r;return Math.abs(l)<Math.PI/2?s-=15:i+=15,{x:i,y:s}}function bb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function wd(e){return e.waypoints?vb(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+yb.height/2}}function ra(e){return e&&!!e.labelTarget}var wb={width:0,height:0};function Cd(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return mb(c,d,f!==c),[c,f]}function a(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!ra(d)&&fl(d)&&!bd(d)&&!xd(c)){let u=wd(d);u={x:u.x,y:u.y+7},e.createLabel(d,u,{id:f.id+"_label",businessObject:f})}}function r(s){return s.oldLabel=Ka(s.element),o(s.element,s.newLabel)}function l(s){return o(s.element,s.oldLabel)}function i(s){const{element:d,newLabel:c}=s,f=d.label||d,p=s.hints||{};let{newBounds:u}=s;if(!ra(f))return;if(ra(f)&&xd(c)){p.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=Ka(f);typeof u>"u"&&(u=t.getExternalLabelBounds(f,h)),u&&e.resizeShape(f,u,wb)}this.preExecute=a,this.execute=r,this.revert=l,this.postExecute=i}Cd.$inject=["modeling","textRenderer"];function xd(e){return!e||!e.trim()}function la(e,t,o){Ke.call(this,e,t,o)}(0,pn.default)(la,Ke),la.$inject=["eventBus","elementFactory","commandStack"],la.prototype.getHandlers=function(){const e=Ke.prototype.getHandlers.call(this);return e["element.updateLabel"]=Cd,e},la.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function pl(e,t){Mt.call(this,e);function o(a){const{context:r}=a,l=r.hints||{};let i;!r.cropped&&l.createElementsBehavior!==!1&&(i=r.connection,i.waypoints=t.getCroppedWaypoints(i),r.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,pn.default)(pl,Mt),pl.$inject=["eventBus","connectionDocking"];function kd(){}kd.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ut(t.source||e.source),t.connectionEnd||ut(t.target||e.target)]};var Ga=20,Cb=5,qa=Math.round,Sd=20,xb={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function kb(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Sb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ed(e,t,o){var a=Nn(t,e,Cb),r=o.split(":")[0],l=qa((t.x-e.x)/2+e.x),i=qa((t.y-e.y)/2+e.y),s,d,c=Sb(r,a),f=/h|r|l/.test(r),p=!1,u=!1;return c?(s=f?{x:l,y:e.y}:{x:e.x,y:i},d=f?"h:h":"v:v"):(p=kb(a,r),d=f?"h:v":"v:h",p?f?(u=i===e.y,s={x:e.x+Ga*(/l/.test(r)?-1:1),y:u?i+Ga:i}):(u=l===e.x,s={x:u?l+Ga:l,y:e.y+Ga*(/t/.test(r)?-1:1)}):s={x:l,y:i}),{waypoints:hl(e,s,d).concat(s),directions:d,turnNextDirections:u}}function Eb(e,t,o){return Ed(e,t,o)}function _b(e,t,o){var a=Ed(t,e,_d(o));return{waypoints:a.waypoints.slice().reverse(),directions:_d(a.directions),turnNextDirections:a.turnNextDirections}}function Bb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var r=o+":"+a;return{waypoints:hl(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}function _d(e){return e.split(":").reverse().join(":")}function Rb(e,t,o){var a=qa((t.x-e.x)/2+e.x),r=qa((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function hl(e,t,o){if(o=o||"h:h",!Hb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Rd(o)){var a=Eb(e,t,o),r=_b(e,t,o),l=Bb(a,r);return[].concat(a.waypoints,l.waypoints,r.waypoints)}return Rb(e,t,o)}function Tb(e,t,o){var a=hl(e,t,o);return a.unshift(e),a.push(t),Vd(a)}function Vb(e,t,o,a,r){var l=(0,R.without)(r&&r.preferredLayouts||[],"straight")[0]||"h:h",i=Nn(e,t,xb[l]||0),s=zb(i,l);o=o||ut(e),a=a||ut(t);var d=s.split(":");return Tb(Td(o,e,d[0],Lb(i)),Td(a,t,d[1],i),s)}function Mb(e,t,o,a,r,l){(0,R.isArray)(o)&&(r=o,l=a,o=ut(e),a=ut(t)),l=(0,R.assign)({preferredLayouts:[]},l),r=r||[];var i=l.preferredLayouts.indexOf("straight")!==-1&&Ab(e,t,o,a,l);return i||(i=l.connectionEnd&&Pb(t,e,a,r),i)||(i=l.connectionStart&&jb(e,t,o,r),i)?i:!l.connectionStart&&!l.connectionEnd&&r&&r.length?r:Vb(e,t,o,a,l)}function Nb(e,t,o){return e>=t&&e<=o}function Bd(e,t,o){return Nb(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function Ab(e,t,o,a,r){var l={},i,s=Nn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(i="x"),/left|right/.test(s)&&(i="y"),r.preserveDocking==="target"?Bd(i,a,e)?(l[i]=a[i],[{x:l.x!==void 0?l.x:o.x,y:l.y!==void 0?l.y:o.y,original:{x:l.x!==void 0?l.x:o.x,y:l.y!==void 0?l.y:o.y}},{x:a.x,y:a.y}]):null:Bd(i,o,t)?(l[i]=o[i],[{x:o.x,y:o.y},{x:l.x!==void 0?l.x:a.x,y:l.y!==void 0?l.y:a.y,original:{x:l.x!==void 0?l.x:a.x,y:l.y!==void 0?l.y:a.y}}]):null):null}function jb(e,t,o,a){return gl(e,t,o,a)}function Pb(e,t,o,a){var r=a.slice().reverse();return r=gl(e,t,o,r),r?r.reverse():null}function gl(e,t,o,a){function r(f){return f.length<3?!0:f.length>4?!1:!!(0,R.find)(f,function(p,u){var h=f[u-1];return h&&Go(p,h)<3})}function l(f,p,u){switch(Rn(p,f)){case"v":return{x:u.x,y:f.y};case"h":return{x:f.x,y:u.y}}return{x:f.x,y:f.y}}function i(f,p,u){var h;for(h=f.length-2;h!==0;h--)if(Sc(f[h],p,Sd)||Sc(f[h],u,Sd))return f.slice(h);return f}if(r(a))return null;var s=a[0],d=a.slice(),c;return d[0]=o,d[1]=l(d[1],s,o),c=i(d,e,t),c!==d&&(d=gl(e,t,o,c)),d&&Rn(d)?null:d}function zb(e,t){if(Rd(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function Hb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Rd(e){return e&&/t|r|b|l/.test(e)}function Lb(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Td(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function Vd(e){return e.reduce(function(t,o,a){var r=t[t.length-1],l=e[a+1];return Wr(r,l,o,0)||t.push(o),t},[])}function ml(){}(0,pn.default)(ml,kd);var eo=(e,t)=>e.type===t;ml.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,r=t.waypoints||e.waypoints;let{connectionStart:l,connectionEnd:i}=t,s,d;return i===void 0&&(l=Xa(r&&r[0],o),i=Xa(r&&r[r.length-1],a)),l||(l=Xa(r&&r[0],o)),i||(i=Xa(r&&r[r.length-1],a)),eo(e,"myline")&&(o===a?s={preferredLayouts:Ob(o,e)}:eo(o,"gatewayAnd")||eo(o,"gatewayXor")||eo(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:eo(a,"gatewayAnd")||eo(a,"gatewayXor")||eo(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=ot(s,t),d=Vd(Mb(o,a,l,i,r,s))),d||[l,i]};function Xa(e,t){return e?e.original||e:ut(t)}function Ob(e,t){const{waypoints:o}=t,a=o&&o.length&&Nn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Md(e){return(0,R.assign)({original:e.point.original||e.point},e.actual)}function Ln(e,t){this._elementRegistry=e,this._graphicsFactory=t}Ln.$inject=["elementRegistry","graphicsFactory"],Ln.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,o),l=e.waypoints.slice(a.idx+1,r.idx);return l.unshift(Md(a)),l.push(Md(r)),l},Ln.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,r=o?0:a.length-1,l=a[r];return{point:l,actual:this._getIntersection(t,e,o)||l,idx:r}},Ln.prototype._getIntersection=function(e,t,o){return Kr(this._getShapePath(e),this._getConnectionPath(t),o)},Ln.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Ln.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Ln.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Nd={__depends__:[Jv,qv,_o],__init__:["modeling","elementUpdater"],modeling:["type",la],layouter:["type",ml],elementUpdater:["type",pl],elementFactory:["type",Zn],connectionDocking:["type",Ln]},Db=1e3;function to(e,t){var o=this;t=t||Db,e.on(["render.shape","render.connection"],t,function(a,r){var l=a.type,i=r.element,s=r.gfx,d=r.attrs;if(o.canRender(i))return l==="render.shape"?o.drawShape(s,i,d):o.drawConnection(s,i,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,r){if(o.canRender(r))return a.type==="render.getShapePath"?o.getShapePath(r):o.getConnectionPath(r)})}to.prototype.canRender=function(e){},to.prototype.drawShape=function(e,t){},to.prototype.drawConnection=function(e,t){},to.prototype.getShapePath=function(e){},to.prototype.getConnectionPath=function(e){};function Ib(e){return e.businessObject}function Za(e,t){return e.businessObject.strokeWidth||t||1}function Zt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function ft(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function Fb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return Yo([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function $b(e,t){const{x:o,y:a,width:r,height:l}=e;return Yo([["M",o+t,a],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,l-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-l],["a",t,t,0,0,1,t,-t],["z"]])}function Wb(e){const{x:t,y:o,width:a,height:r}=e,l=a/2,i=r/2;return Yo([["M",t+l,o],["l",l,i],["l",-l,i],["l",-l,-i],["z"]])}function Ub(e){const{x:t,y:o,width:a,height:r}=e;return Yo([["M",t,o],["l",a,0],["l",0,r],["l",-a,0],["z"]])}var yl=10,vl=.95,On=(e,t)=>e.type===t;function no(e,t,o,a,r,l,i){to.call(this,e,i);const s="var(--j-color-bg-container)",d="var(--j-color-text)",c={};Object.keys(l.palette).forEach(M=>{const B=l.palette[M];c[B.type]=B.options});const{computeStyle:f}=t;function p(M){return N[M]}function u(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function g(M,B,H,W){H=u(H);const X=Hr(B,H,W);return(0,D.append)(M,X),X}function m(M,B,H){return g(M,B,H,5)}function w(M,B,H,W,X){vd(W)&&(X=W,W=0),W=W||0,X=f(X,{stroke:d,strokeWidth:2,fill:s}),X.fill==="none"&&delete X.fillOpacity;const fe=B/2,J=H/2,Y=(0,D.create)("circle");return(0,D.attr)(Y,{cx:fe,cy:J,r:Math.round((B+H)/4-W)}),(0,D.attr)(Y,X),(0,D.append)(M,Y),Y}function k(M,B,H,W,X,fe){vd(X)&&(fe=X,X=0),X=X||0,fe=f(fe,{stroke:d,strokeWidth:2,fill:s});const J=(0,D.create)("rect");return(0,D.attr)(J,{x:X,y:X,width:B-X*2,height:H-X*2,rx:W,ry:W}),(0,D.attr)(J,fe),(0,D.append)(M,J),J}function C(M,B,H){H=f(H,["no-fill"],{strokeWidth:2,stroke:d});const W=(0,D.create)("path");return(0,D.attr)(W,{d:B}),(0,D.attr)(W,H),(0,D.append)(M,W),W}function v(M,B,H,W){const X=B/2,fe=H/2,J=[{x:X,y:0},{x:B,y:fe},{x:X,y:H},{x:0,y:fe}].map(G=>G.x+","+G.y).join(" ");W=f(W,{stroke:d,strokeWidth:2,fill:s});const Y=(0,D.create)("polygon");return(0,D.attr)(Y,{points:J}),(0,D.attr)(Y,W),(0,D.append)(M,Y),Y}function b(M,B,H,W){return C(B,H,ot({"data-marker":M},W))}function S(M,B,H){H=ot({size:{width:100}},H);const W=r.createText(B||"",H);return(0,D.classes)(W).add("djs-label"),(0,D.append)(M,W),W}function y(M,B,H){return S(M,Ib(B).name,{box:B,align:H,padding:5,style:{fill:ft(B,d)}})}function x(M,B){const H={width:90,height:30,x:B.width/2+B.x,y:B.height/2+B.y};return S(M,Ka(B),{box:H,fitBox:!0,style:ot({},r.getExternalStyle(),{fill:ft(B,d)})})}function E(M,B,H){const W=H&&H.indexOf("SubProcessMarker")!==-1;let X;W?X={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:X={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},gb(H,fe=>{p(fe)(M,B,X)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,B){const{ref:H={x:0,y:0},scale:W=1,element:X,parentGfx:fe=a._svg}=B,J=(0,D.create)("marker",{id:M,viewBox:"0 0 20 20",refX:H.x,refY:H.y,markerWidth:20*W,markerHeight:20*W,orient:"auto"});(0,D.append)(J,X);let Y=(0,Z.query)(":scope > defs",fe);Y||(Y=(0,D.create)("defs"),(0,D.append)(fe,Y)),(0,D.append)(Y,J)}function T(M,B,H,W){const X=B+"-"+_(H)+"-"+_(W)+"-"+Gc();return P(M,X,B,H,W),"url(#"+X+")"}function P(M,B,H,W,X){H==="sequenceflow-end"&&V(B,{element:(0,D.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:X,stroke:X,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),H==="messageflow-start"&&V(B,{element:(0,D.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),H==="messageflow-end"&&V(B,{element:(0,D.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),H==="association-start"&&V(B,{element:(0,D.create)("path",{d:"M 11 5 L 1 10 L 11 15",...u({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),H==="association-end"&&V(B,{element:(0,D.create)("path",{d:"M 1 5 L 11 10 L 1 15",...u({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),H==="conditional-flow-marker"&&V(B,{element:(0,D.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:W,stroke:X})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),H==="conditional-default-flow-marker"&&V(B,{element:(0,D.create)("path",{d:"M 6 4 L 10 16",...h({stroke:X,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function A(M,B,H,W){const X=c[B.type]?.icon||B.icon;X&&C(M,o.getScaledPath(X,{abspos:{x:H,y:W}}),{strokeWidth:0,fill:ft(B,c[B.type]?.iconFill||B.iconFill)})}const N={event(M,B,H){return"fillOpacity"in H||(H.fillOpacity=vl),w(M,B.width,B.height,H)},startEvent(M,B){const H={fill:Zt(B,c.startEvent?.fill||B.fill),stroke:ft(B,c.startEvent?.stroke||B.stroke),strokeWidth:Za(B,c.startEvent?.strokeWidth||B.strokeWidth)},W=p("event")(M,B,H);return A(M,B,18,18),W},endEvent(M,B){const H=p("event")(M,B,{strokeWidth:Za(B,c.endEvent?.strokeWidth||B.strokeWidth||4),fill:Zt(B,c.endEvent?.fill||B.fill),stroke:ft(B,c.endEvent?.stroke||B.stroke)});return A(M,B,18,18),H},gateway(M,B){const H={fillOpacity:vl,strokeWidth:Za(B,c[B.type]?.strokeWidth||B.strokeWidth||4),fill:Zt(B,c[B.type]?.fill||B.fill),stroke:ft(B,c[B.type]?.stroke||B.stroke)};return v(M,B.width,B.height,H)},gatewayAnd(M,B){const H=p("gateway")(M,B);return C(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[B.type]?.width||B.width,containerHeight:c[B.type]?.height||B.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:ft(B,c[B.type]?.iconFill||B.iconFill),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},gatewayXor(M,B){const H=p("gateway")(M,B);return C(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:B.width,containerHeight:B.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:ft(B,c[B.type]?.iconFill||B.iconFill),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},gatewayInclusive(M,B){const H=p("gateway")(M,B);return w(M,B.width,B.height,B.height*.24,{strokeWidth:2.5,fill:ft(B,s),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},activity(M,B,H){return H=H||{},"fillOpacity"in H||(H.fillOpacity=vl),k(M,B.width,B.height,yl,H)},task(M,B){const H={fill:Zt(B,s),stroke:ft(B,d)},W=p("activity")(M,B,H);return y(M,B,"center-middle"),E(M,B),W},userTask(M,B){const H=p("task")(M,B),W=15,X=12;return C(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:Zt(B,s),stroke:ft(B,d)}),C(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:Zt(B,s),stroke:ft(B,d)}),C(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:ft(B,d),stroke:ft(B,d)}),H},scriptTask(M,B){const H=p("task")(M,B);return C(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:ft(B,d)}),H},SubProcessMarker(M,B){on(k(M,14,14,0,{strokeWidth:1,fill:Zt(B,s),stroke:ft(B,d)}),B.width/2-7.5,B.height-20),b("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:B.width,containerHeight:B.height,position:{mx:(B.width/2-7.5)/B.width,my:(B.height-20)/B.height}}),{fill:Zt(B,s),stroke:ft(B,d)})},subprocess(M,B,H){H=ot({fill:Zt(B,s),stroke:ft(B,d)},H);const W=p("activity")(M,B,H);return y(M,B,"center-middle"),E(M,B,["SubProcessMarker"]),W},label(M,B){return x(M,B)},myline(M,B){const H=Zt(B,l.lineStroke||s),W=ft(B,l.lineStroke||d);return m(M,B.waypoints,{markerEnd:T(M,"sequenceflow-end",H,W),stroke:W})},default(M,B){const H={strokeWidth:Za(B,c[B.type]?.strokeWidth||B.strokeWidth||1),fill:Zt(B,c[B.type]?.fill||B.fill),stroke:ft(B,c[B.type]?.stroke||B.stroke)},W=k(M,B.width,B.height,B.radius||yl,H);return y(M,B,"center-middle"),E(M,B),A(M,B,B.iconX,B.iconY),W}};this.handlers=N,this._drawPath=C}(0,pn.default)(no,to),no.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],no.prototype.canRender=function(){return!0},no.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},no.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},no.prototype.getShapePath=function(e){return On(e,"startEvent")||On(e,"endEvent")?Fb(e):On(e,"userTask")||On(e,"scriptTask")||On(e,"subprocess")?$b(e,yl):On(e,"gatewayAnd")||On(e,"gatewayXor")||On(e,"gatewayInclusive")?Wb(e):Ub(e)};var Jb=0,Yb={width:150,height:50};function Kb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Gb(e){return(0,R.isObject)(e)?(0,R.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var bl=null;function qb(){return bl||(bl=document.createElement("canvas").getContext("2d")),bl}function Xb(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Ad(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ad(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Zb(e,t){var o=qb();if(!o)return{width:0,height:0};o.font=Xb(t),"letterSpacing"in o&&(o.letterSpacing=Ad(t.letterSpacing)||"0px");var a=e==="",r=a?"dummy":e.replace(/\s+$/,""),l=o.measureText(r);return{width:a?0:l.width,height:"fontBoundingBoxAscent"in l?l.fontBoundingBoxAscent+l.fontBoundingBoxDescent:l.actualBoundingBoxAscent+l.actualBoundingBoxDescent}}function Qb(e,t,o){for(var a=e.shift(),r=a,l;;){if(l=Zb(r,o),l.width=r?l.width:0,r===" "||r===""||l.width<Math.round(t)||r.length<2)return ew(e,r,a,l);r=nw(r,l.width,t)}}function ew(e,t,o,a){if(t.length<o.length){var r=o.slice(t.length).trim();e.unshift(r)}return{width:a.width,height:a.height,text:t}}var jd="­";function tw(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,r=[],l=0;if(o.length>1)for(;a=o.shift();)if(a.length+l<t)r.push(a),l+=a.length;else{(a==="-"||a===jd)&&r.pop();break}var i=r[r.length-1];return i&&i===jd&&(r[r.length-1]="-"),r.join("")}function nw(e,t,o){var a=Math.max(e.length*(o/t),1),r=tw(e,a);return r||(r=e.slice(0,Math.max(Math.round(a-1),1))),r}function Qa(e){this._config=(0,R.assign)({},{size:Yb,padding:Jb,style:{},align:"center-top"},e||{})}Qa.prototype.createText=function(e,t){return this.layoutText(e,t).element},Qa.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Qa.prototype.layoutText=function(e,t){for(var o=(0,R.assign)({},this._config.size,t.box),a=(0,R.assign)({},this._config.style,t.style),r=Kb(t.align||this._config.align),l=Gb(t.padding!==void 0?t.padding:this._config.padding),i=t.fitBox||!1,s=ow(a),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-l.left-l.right;d.length;)c.push(Qb(d,f,a));r.vertical==="middle"&&(l.top=l.bottom=0);var p=(0,R.reduce)(c,function(m,w,k){return m+(s||w.height)},0)+l.top+l.bottom,u=(0,R.reduce)(c,function(m,w,k){return w.width>m?w.width:m},0),h=l.top;r.vertical==="middle"&&(h+=(o.height-p)/2),h-=(s||c[0].height)/4;var g=(0,D.create)("text");return(0,D.attr)(g,a),(0,R.forEach)(c,function(m){var w;switch(h+=s||m.height,r.horizontal){case"left":w=l.left;break;case"right":w=(i?u:f)-l.right-m.width;break;default:w=Math.max(((i?u:f)-m.width)/2+l.left,0)}var k=(0,D.create)("tspan");(0,D.attr)(k,{x:w,y:h}),k.textContent=m.text,(0,D.append)(g,k)}),{dimensions:{width:u,height:p},element:g}};function ow(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var aw=12,rw=1.2,lw=30;function Pd(e){const t=ot({fontFamily:"Arial, sans-serif",fontSize:aw,fontWeight:"normal",lineHeight:rw},e&&e.defaultStyle||{}),o=ot({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Qa({style:t});this.getExternalLabelBounds=function(r,l){const i=a.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:o});return{x:Math.round(r.x+r.width/2-i.width/2),y:Math.round(r.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}},this.getTextAnnotationBounds=function(r,l){const i=a.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(lw,Math.round(i.height))}},this.createText=function(r,l){return a.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}Pd.$inject=["config.textRenderer"];function iw(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,r;o.abspos?(a=o.abspos.x,r=o.abspos.y):(a=o.containerWidth*o.position.mx,r=o.containerHeight*o.position.my);let l={};typeof t=="object"?(l=t,l.d.indexOf("{mx},{my}")===-1&&(l.d="m {mx},{my}"+l.d),l.width&&(a-=l.width/2),l.height&&(r-=l.height/2)):l=this.pathMap[t];const i={};if(o.position){const s=o.containerHeight/l.height*o.yScaleFactor,d=o.containerWidth/l.width*o.xScaleFactor;for(let c=0;c<l.heightElements.length;c++)i["y"+c]=l.heightElements[c]*s;for(let c=0;c<l.widthElements.length;c++)i["x"+c]=l.widthElements[c]*d}return uw(l.d,{mx:a,my:r,e:i})}}var sw=/\{([^}]+)\}/g,cw=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function dw(e,t,o){let a=o;return t.replace(cw,(r,l,i,s,d)=>{l=l||s,a&&(l in a&&(a=a[l]),typeof a=="function"&&d&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function uw(e,t){return String(e).replace(sw,(o,a)=>dw(o,a,t))}var zd={__init__:["myRenderer"],myRenderer:["type",no],textRenderer:["type",Pd],pathMap:["type",iw]};function Hd(e,t){return ot({id:e.id,type:e.type,businessObject:e},t)}function fw(e,t,o){const a=e.waypoint;return!a||a.length<2?[ut(t),ut(o)]:a.map(r=>({x:r.x,y:r.y}))}function Dn(e,t,o,a,r,l){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=r,this._translate=qc,this._textRenderer=l,this._modeling=t}Dn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Dn.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),r=this._getTarget(e);t=this._elementFactory.createConnection(Hd(e,{source:a,target:r,waypoints:fw(e,a,r)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Hd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Dn.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},Dn.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=ot(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:r}=t;if(r&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const l={x:t.x+12,y:t.y+42,width:10,height:10,name:r,id:e},i=this._textRenderer.getExternalLabelBounds(l,t.name);this._modeling.resizeShape(l,i,{width:0,height:0}),o&&this.addLabel(l,o)}}},Dn.prototype._getSource=function(e){return this._getElement(e.from)},Dn.prototype._getTarget=function(e){return this._getElement(e.to)},Dn.prototype._getElement=function(e){return this._elementRegistry.get(e)};var Ld={myImporter:["type",Dn]},Od=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(r=>({x:r.x,y:r.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const r=t.find(l=>l.id===a.id);r&&(r.name=a.name||"",r.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Dd=(e,t)=>{const o=t.get("myImporter"),a=e.filter(l=>l.type!=="myline"),r=e.filter(l=>l.type==="myline");a.forEach(l=>{o.add(l)}),r.forEach(l=>{o.add(l)})},pw=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const y=s.get("eventBus");y.on("element.dblclick",x=>{r("elementDblclick",x.element.businessObject)}),y.on("element.click",x=>{r("elementClick",x.element.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},u=()=>{let y={__init__:["myOptions"],myOptions:["type",p]};s=new Ca.default({canvas:{container:l.value},modules:[qr,kc,Nd,$c,Jc,y,zd,Ld]});const x=s.get("canvas"),E=s.get("elementFactory");c();const _=E.createRoot();x.setRootElement(_),f()};(0,n.onMounted)(()=>{u()});const h=y=>{const x=y==null?1:d+y;s.get("canvas").zoom(x),d=x},g=()=>(s.get("canvas").zoom(1),Od(s.get("elementRegistry").getAll())),m=y=>{s.clear(),c(),Dd(y,s)},w=y=>{s.get("myImporter").update(y.id,y)};return t({reset:()=>{c()},zoom:y=>{h(y)},getData:()=>g(),setData:y=>{m(y)},updateElemet:y=>{w(y)}}),(y,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:l,class:"j-work-flow"},null,512))}}),hw=pw;function wl(e){return e&&e[e.length-1]}function Id(e){return e.y}function Fd(e){return e.x}var gw={left:Fd,center:Fd,right:function(e){return e.x+e.width},top:Id,middle:Id,bottom:function(e){return e.y+e.height}};function Ao(e,t){this._modeling=e,this._rules=t}Ao.$inject=["modeling","rules"],Ao.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},Ao.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ao.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,r=o.dimension,l={},i={},s=!1,d,c,f;function p(u,h){return Math.round((u[a]+h[a]+h[r])/2)}if(this._isType(e,["left","top"]))l[e]=t[0][a];else if(this._isType(e,["right","bottom"]))f=wl(t),l[e]=f[a]+f[r];else if(this._isType(e,["center","middle"])){if((0,R.forEach)(t,function(u){var h=u[a]+Math.round(u[r]/2);i[h]?i[h].elements.push(u):i[h]={elements:[u],center:h}}),d=(0,R.sortBy)(i,function(u){return u.elements.length>1&&(s=!0),u.elements.length}),s)return l[e]=wl(d).center,l;c=t[0],t=(0,R.sortBy)(t,function(u){return u[a]+u[r]}),f=wl(t),l[e]=p(c,f)}return l},Ao.prototype.trigger=function(e,t){var o=this._modeling,a,r=(0,R.filter)(e,function(d){return!(d.waypoints||d.host||d.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:r}),(0,R.isArray)(a)&&(r=a),!(r.length<2||!a)){var l=gw[t],i=(0,R.sortBy)(r,l),s=this._alignmentPosition(t,i);o.alignElements(i,s)}};var mw={__init__:["alignElements"],alignElements:["type",Ao]},er=Math.round,yw=Math.max;function vw(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function bw(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var $d=10;function ww(e,t){var o,a;for(o=0;a=e[o];o++)if(Go(a,t)<=$d)return{point:e[o],bendpoint:!0,index:o};return null}function Cw(e,t){var o=Nc(vw(t,$d),bw(e)),a=o[0],r=o[o.length-1],l;return a?a!==r?a.segment2!==r.segment2?(l=yw(a.segment2,r.segment2)-1,{point:e[l],bendpoint:!0,index:l}):{point:{x:er(a.x+r.x)/2,y:er(a.y+r.y)/2},index:a.segment2}:{point:{x:er(a.x),y:er(a.y)},index:a.segment2}:null}function xw(e,t){return ww(e,t)||Cw(e,t)}function kw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Sw(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],r=a[0].n*t[0]+a[1].n*t[1],l=a[0].lambda*t[0]+a[1].lambda*t[1];return-r/l}function Wd(e,t){var o=t[0],a=t[1],r={x:a.x-o.x,y:a.y-o.y},l=Sw([o.x,o.y],[r.x,r.y],[e.x,e.y]);return{x:o.x+l*r.x,y:o.y+l*r.y}}function Ew(e,t){var o=Wd(e,t);return kw({x:o.x-e.x,y:o.y-e.y})}var Ud="djs-bendpoint",Jd="djs-segment-dragger";function _w(e,t){var o=So(t),a=e._container.getBoundingClientRect(),r={x:a.left,y:a.top},l=e.viewbox();return{x:l.x+(o.x-r.x)/l.scale,y:l.y+(o.y-r.y)/l.scale}}function Cl(e,t,o){return xw(t,_w(e,o))}function xl(e,t){var o=(0,D.create)("g");(0,D.classes)(o).add(Ud),(0,D.append)(e,o);var a=(0,D.create)("circle");(0,D.attr)(a,{cx:0,cy:0,r:4}),(0,D.classes)(a).add("djs-visual"),(0,D.append)(o,a);var r=(0,D.create)("circle");return(0,D.attr)(r,{cx:0,cy:0,r:10}),(0,D.classes)(r).add("djs-hit"),(0,D.append)(o,r),t&&(0,D.classes)(o).add(t),o}function Bw(e,t,o,a){var r=(0,D.create)("g");(0,D.append)(e,r);var l=18,i=6,s=11,d=Tw(t,o,a),c=i+s,f=(0,D.create)("rect");(0,D.attr)(f,{x:-l/2,y:-i/2,width:l,height:i}),(0,D.classes)(f).add("djs-visual"),(0,D.append)(r,f);var p=(0,D.create)("rect");return(0,D.attr)(p,{x:-d/2,y:-c/2,width:d,height:c}),(0,D.classes)(p).add("djs-hit"),(0,D.append)(r,p),fv(r,a==="v"?90:0,0,0),r}function Yd(e,t,o){var a=(0,D.create)("g"),r=Ur(t,o),l=Rn(t,o);return(0,D.append)(e,a),Bw(a,t,o,l),(0,D.classes)(a).add(Jd),(0,D.classes)(a).add(l==="h"?"horizontal":"vertical"),on(a,r.x,r.y),a}function kl(e){return Math.abs(Math.round(e*2/3))}function Rw(e,t){return Wd(e,Vw(e,t))}function Tw(e,t,o){var a=t.x-e.x,r=t.y-e.y;return kl(o==="h"?a:r)}function Vw(e,t){for(var o=t.waypoints,a=1/0,r,l=0;l<o.length-1;l++){var i=o[l],s=o[l+1],d=Ew(e,[i,s]);d<a&&(a=d,r=l)}return[o[r],o[r+1]]}function Sl(e){return CSS.escape(e)}function Kd(e,t,o,a,r){function l(v,b,S){var y=v.index,x=v.point,E,_,V,T,P,A;return y<=0||v.bendpoint?!1:(E=b[y-1],_=b[y],V=Ur(E,_),T=Rn(E,_),P=Math.abs(x.x-V.x),A=Math.abs(x.y-V.y),T&&P<=S&&A<=S)}function i(v,b){var S=v.waypoints,y,x,E,_;return b.index<=0||b.bendpoint||(y={start:S[b.index-1],end:S[b.index]},x=Rn(y.start,y.end),!x)?null:(x==="h"?E=y.end.x-y.start.x:E=y.end.y-y.start.y,_=kl(E)/2,_)}function s(v,b){var S=b.waypoints,y=Cl(t,S,v),x;if(y)return x=i(b,y),l(y,S,x)?r.start(v,b,y.index):a.start(v,b,y.index,!y.bendpoint),!0}function d(v,b,S){Z.event.bind(v,b,function(y){o.triggerMouseEvent(b,y,S),y.stopPropagation()})}function c(v,b){var S=t.getLayer("overlays"),y=(0,Z.query)('.djs-bendpoints[data-element-id="'+Sl(v.id)+'"]',S);return!y&&b&&(y=(0,D.create)("g"),(0,D.attr)(y,{"data-element-id":v.id}),(0,D.classes)(y).add("djs-bendpoints"),(0,D.append)(S,y),d(y,"mousedown",v),d(y,"click",v),d(y,"dblclick",v)),y}function f(v,b){return(0,Z.query)('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(S,y){var x=xl(v);(0,D.append)(v,x),on(x,S.x,S.y)}),xl(v,"floating")}function u(v,b){for(var S=b.waypoints,y,x,E,_=1;_<S.length;_++)y=S[_-1],x=S[_],Rn(y,x)&&(E=Yd(v,y,x),(0,D.attr)(E,{"data-segment-idx":_}),d(E,"mousemove",b))}function h(v){(0,R.forEach)((0,Z.queryAll)("."+Ud,v),function(b){(0,D.remove)(b)})}function g(v){(0,R.forEach)((0,Z.queryAll)("."+Jd,v),function(b){(0,D.remove)(b)})}function m(v){var b=c(v);return b||(b=c(v,!0),p(b,v),u(b,v)),b}function w(v){var b=c(v);b&&(g(b),h(b),u(b,v),p(b,v))}function k(v,b){var S=(0,Z.query)(".floating",v),y=b.point;S&&on(S,y.x,y.y)}function C(v,b,S){var y=f(b.index,v),x=S[b.index-1],E=S[b.index],_=b.point,V=Ur(x,E),T=Rn(x,E),P,A;y&&(P=Mw(y),A={x:_.x-V.x,y:_.y-V.y},T==="v"&&(A={x:A.y,y:A.x}),on(P,A.x,A.y))}e.on("connection.changed",function(v){w(v.element)}),e.on("connection.remove",function(v){var b=c(v.element);b&&(0,D.remove)(b)}),e.on("element.marker.update",function(v){var b=v.element,S;b.waypoints&&(S=m(b),v.add?(0,D.classes)(S).add(v.marker):(0,D.classes)(S).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,S=b.waypoints,y,x;if(S){if(y=c(b,!0),x=Cl(t,S,v.originalEvent),!x)return;k(y,x),x.bendpoint||C(y,x,S)}}),e.on("element.mousedown",function(v){if(_n(v)){var b=v.originalEvent,S=v.element;if(S.waypoints)return s(b,S)}}),e.on("selection.changed",function(v){var b=v.newSelection[0];b&&b.waypoints&&m(b)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&(m(b),o.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){o.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var b=v.element,S=v.newId;if(b.waypoints){var y=c(b);y&&(0,D.attr)(y,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=w,this.getBendpointsContainer=c,this.getSegmentDragger=f}Kd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function Mw(e){return(0,Z.query)(".djs-visual",e)}var Gd=Math.round,oo="reconnectStart",ao="reconnectEnd",ia="updateWaypoints";function El(e,t,o,a,r,l){this._injector=e,this.start=function(i,s,d,c){var f=o.getGraphics(s),p=s.source,u=s.target,h=s.waypoints,g;!c&&d===0?g=oo:!c&&d===h.length-1?g=ao:g=ia;var m=g===ia?"connection.updateWaypoints":"connection.reconnect",w=r.allowed(m,{connection:s,source:p,target:u});w===!1&&(w=r.allowed(m,{connection:s,source:u,target:p})),w!==!1&&a.init(i,"bendpoint.move",{data:{connection:s,connectionGfx:f,context:{allowed:w,bendpointIndex:d,connection:s,source:p,target:u,insert:c,type:g}}})},t.on("bendpoint.move.hover",function(i){var s=i.context,d=s.connection,c=d.source,f=d.target,p=i.hover,u=s.type;s.hover=p;var h;if(p){var g=u===ia?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=r.allowed(g,{connection:d,source:u===oo?p:c,target:u===ao?p:f}),h){s.source=u===oo?p:c,s.target=u===ao?p:f;return}h===!1&&(h=s.allowed=r.allowed(g,{connection:d,source:u===ao?p:f,target:u===oo?p:c})),h&&(s.source=u===ao?p:f,s.target=u===oo?p:c)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(i){var s=i.context,d=s.type;s.hover=null,s.source=null,s.target=null,d!==ia&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(i){var s=i.context,d=s.allowed,c=s.bendpointIndex,f=s.connection,p=s.insert,u=f.waypoints.slice(),h=s.source,g=s.target,m=s.type,w=s.hints||{},k={x:Gd(i.x),y:Gd(i.y)};if(!d)return!1;m===ia?(p?u.splice(c,0,k):u[c]=k,w.bendpointMove={insert:p,bendpointIndex:c},u=this.cropWaypoints(f,u),l.updateWaypoints(f,zv(u),w)):(m===oo?(w.docking="source",tr(s)&&(w.docking="target",w.newWaypoints=u.reverse())):m===ao&&(w.docking="target",tr(s)&&(w.docking="source",w.newWaypoints=u.reverse())),l.reconnect(f,h,g,k,w))},this)}El.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],El.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function tr(e){var t=e.hover,o=e.source,a=e.target,r=e.type;if(r===oo)return t&&a&&t===a&&o!==a;if(r===ao)return t&&o&&t===o&&o!==a}var Nw="reconnectStart",Aw="reconnectEnd",qd="updateWaypoints",sa="connect-ok",nr="connect-not-ok",Xd="connect-hover",Zd="djs-updating",Qd="djs-dragging",eu=1100;function tu(e,t,o,a){this._injector=t;var r=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(l){var i=l.context,s=i.bendpointIndex,d=i.connection,c=i.insert,f=d.waypoints,p=f.slice();i.waypoints=f,c&&p.splice(s,0,{x:l.x,y:l.y}),d.waypoints=p,(0,D.classes)(i.draggerGfx=xl(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(d,Qd),a.addMarker(d,Zd)}),o.on("bendpoint.move.hover",function(l){var i=l.context,s=i.allowed,d=i.hover,c=i.type;if(d){if(a.addMarker(d,Xd),c===qd)return;s?(a.removeMarker(d,nr),a.addMarker(d,sa)):s===!1&&(a.removeMarker(d,sa),a.addMarker(d,nr))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],eu,function(l){var i=l.context,s=i.hover,d=i.target;s&&(a.removeMarker(s,Xd),a.removeMarker(s,d?sa:nr))}),o.on("bendpoint.move.move",function(l){var i=l.context,s=i.allowed,d=i.bendpointIndex,c=i.draggerGfx,f=i.hover,p=i.type,u=i.connection,h=u.source,g=u.target,m=u.waypoints.slice(),w={x:l.x,y:l.y},k=i.hints||{},C={};r&&(k.connectionStart&&(C.connectionStart=k.connectionStart),k.connectionEnd&&(C.connectionEnd=k.connectionEnd),p===Nw?tr(i)?(C.connectionEnd=C.connectionEnd||w,C.source=g,C.target=f||h,m=m.reverse()):(C.connectionStart=C.connectionStart||w,C.source=f||h,C.target=g):p===Aw?tr(i)?(C.connectionStart=C.connectionStart||w,C.source=f||g,C.target=h,m=m.reverse()):(C.connectionEnd=C.connectionEnd||w,C.source=h,C.target=f||g):(C.noCropping=!0,C.noLayout=!0,m[d]=w),p===qd&&(m=e.cropWaypoints(u,m)),C.waypoints=m,r.drawPreview(i,s,C)),on(c,l.x,l.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],eu,function(l){var i=l.context,s=i.connection,d=i.draggerGfx,c=i.hover,f=i.target;s.waypoints=i.waypoints,(0,D.remove)(d),a.removeMarker(s,Zd),a.removeMarker(s,Qd),c&&(a.removeMarker(c,sa),a.removeMarker(c,f?sa:nr)),r&&r.cleanUp(i)})}tu.$inject=["bendpointMove","injector","eventBus","canvas"];var nu="connect-hover",ou="djs-updating";function au(e,t,o){return _l(e,t,e[t]+o)}function _l(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function jw(e,t,o,a){var r=Math.max(t[a],o[a]),l=Math.min(t[a],o[a]),i=20;return _l(t,a,Math.min(Math.max(l+i,e[a]),r-i))}function ru(e){return e==="x"?"y":"x"}function lu(e,t,o){var a,r;return e.original?e.original:(a=ut(t),r=ru(o),_l(e,r,a[r]))}function iu(e,t,o,a,r,l){var i=e.get("connectionDocking",!1);this.start=function(p,u,h){var g,m=o.getGraphics(u),w=h-1,k=h,C=u.waypoints,v=C[w],b=C[k],S=Cl(o,C,p),y=Rn(v,b),x,E;y&&(x=y==="v"?"x":"y",w===0&&(v=lu(v,u.source,x)),k===C.length-1&&(b=lu(b,u.target,x)),S?E=S.point:E={x:(v.x+b.x)/2,y:(v.y+b.y)/2},g={connection:u,segmentStartIndex:w,segmentEndIndex:k,segmentStart:v,segmentEnd:b,axis:x,dragPosition:E},a.init(p,E,"connectionSegment.move",{cursor:x==="x"?"resize-ew":"resize-ns",data:{connection:u,connectionGfx:m,context:g}}))};function s(p,u){if(!i)return u;var h=p.waypoints,g;return p.waypoints=u,g=i.getCroppedWaypoints(p),p.waypoints=h,g}function d(p){r.update("connection",p.connection,p.connectionGfx)}function c(p,u,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+u],w=g[p.segmentEndIndex+u],k=jw(h,m,w,ru(p.axis));on(p.draggerGfx,k.x,k.y)}function f(p,u){var h=0;return{waypoints:p.filter(function(g,m){return Wr(p[m-1],p[m+1],g)?(h=m<=u?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var u=p.context,h=p.connection,g=o.getLayer("overlays");u.originalWaypoints=h.waypoints.slice(),u.draggerGfx=Yd(g,u.segmentStart,u.segmentEnd),(0,D.classes)(u.draggerGfx).add("djs-dragging"),o.addMarker(h,ou)}),t.on("connectionSegment.move.move",function(p){var u=p.context,h=u.connection,g=u.segmentStartIndex,m=u.segmentEndIndex,w=u.segmentStart,k=u.segmentEnd,C=u.axis,v=u.originalWaypoints.slice(),b=au(w,C,p["d"+C]),S=au(k,C,p["d"+C]),y=v.length,x=0;v[g]=b,v[m]=S;var E,_;g<2&&(E=Nn(h.source,b),g===1?E==="intersect"&&(v.shift(),v[0]=b,x--):E!=="intersect"&&(v.unshift(w),x++)),m>y-3&&(_=Nn(h.target,S),m===y-2?_==="intersect"&&(v.pop(),v[v.length-1]=S):_!=="intersect"&&v.push(k)),u.newWaypoints=h.waypoints=s(h,v),c(u,x,p),u.newSegmentStartIndex=g+x,d(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,nu)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var u=p.context.hover;u&&o.removeMarker(u,nu)}),t.on("connectionSegment.move.cleanup",function(p){var u=p.context,h=u.connection;u.draggerGfx&&(0,D.remove)(u.draggerGfx),o.removeMarker(h,ou)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var u=p.context,h=u.connection;h.waypoints=u.originalWaypoints,d(p)}),t.on("connectionSegment.move.end",function(p){var u=p.context,h=u.connection,g=u.newWaypoints,m=u.newSegmentStartIndex;g=g.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var w=f(g,m),k=w.waypoints,C=s(h,k),v=w.segmentOffset,b={segmentMove:{segmentStartIndex:u.segmentStartIndex,newSegmentStartIndex:m+v}};l.updateWaypoints(h,C,b)})}iu.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Pw=Math.abs,su=Math.round;function zw(e,t,o){o=o===void 0?10:o;var a,r;for(a=0;a<t.length;a++)if(r=t[a],Pw(r-e)<=o)return r}function Hw(e){return{x:e.x,y:e.y}}function Lw(e){return{x:e.x+e.width,y:e.y+e.height}}function jo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:su(e.x+e.width/2),y:su(e.y+e.height/2)}}function or(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function yn(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,r=e[t],l=e.snapped=e.snapped||{};return o===!1?l[t]=!1:(l[t]=!0,a=o-r,e[t]+=a,e["d"+t]+=a),r}function cu(e){return e.children||[]}var Ow=Math.abs,du=Math.round,Bl=10;function uu(e){function t(l,i){if((0,R.isArray)(l)){for(var s=l.length;s--;)if(Ow(l[s]-i)<=Bl)return l[s]}else{l=+l;var d=i%l;if(d<Bl)return i-d;if(d>l-Bl)return i-d+l}return i}function o(l,i){if(l.waypoints)return Rw(i,l);if(l.width)return{x:du(l.width/2+l.x),y:du(l.height/2+l.y)}}function a(l){var i=l.context,s=i.snapPoints,d=i.connection,c=d.waypoints,f=i.segmentStart,p=i.segmentStartIndex,u=i.segmentEnd,h=i.segmentEndIndex,g=i.axis;if(s)return s;var m=[c[p-1],f,u,c[h+1]];return p<2&&m.unshift(o(d.source,l)),h>c.length-3&&m.unshift(o(d.target,l)),i.snapPoints=s={horizontal:[],vertical:[]},(0,R.forEach)(m,function(w){w&&(w=w.original||w,g==="y"&&s.horizontal.push(w.y),g==="x"&&s.vertical.push(w.x))}),s}e.on("connectionSegment.move.move",1500,function(l){var i=a(l),s=l.x,d=l.y,c,f;if(i){c=t(i.vertical,s),f=t(i.horizontal,d);var p=s-c,u=d-f;(0,R.assign)(l,{dx:l.dx-p,dy:l.dy-u,x:c,y:f}),(p||i.vertical.indexOf(s)!==-1)&&yn(l,"x",c),(u||i.horizontal.indexOf(d)!==-1)&&yn(l,"y",f)}});function r(l){var i=l.snapPoints,s=l.connection.waypoints,d=l.bendpointIndex;if(i)return i;var c=[s[d-1],s[d+1]];return l.snapPoints=i={horizontal:[],vertical:[]},(0,R.forEach)(c,function(f){f&&(f=f.original||f,i.horizontal.push(f.y),i.vertical.push(f.x))}),i}e.on(["connect.hover","connect.move","connect.end"],1500,function(l){var i=l.context.hover,s=i&&o(i,l);!Ht(i)||!s||!s.x||!s.y||(yn(l,"x",s.x),yn(l,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(l){var i=l.context,s=r(i),d=i.hover,c=d&&o(d,l),f=l.x,p=l.y,u,h;if(s){u=t(c?s.vertical.concat([c.x]):s.vertical,f),h=t(c?s.horizontal.concat([c.y]):s.horizontal,p);var g=f-u,m=p-h;(0,R.assign)(l,{dx:l.dx-g,dy:l.dy-m,x:l.x-g,y:l.y-m}),(g||s.vertical.indexOf(f)!==-1)&&yn(l,"x",u),(m||s.horizontal.indexOf(p)!==-1)&&yn(l,"y",h)}})}uu.$inject=["eventBus"];var Dw={__depends__:[qn,To],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Kd],bendpointMove:["type",El],bendpointMovePreview:["type",tu],connectionSegmentMove:["type",iu],bendpointSnapping:["type",uu]},Iw="djs-dragger";function vn(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}vn.$inject=["injector","canvas","graphicsFactory","elementFactory"],vn.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,r=e.getConnection,l=o.source,i=o.target,s=o.waypoints,d=o.connectionStart,c=o.connectionEnd,f=o.noLayout,p=o.noCropping,u=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,D.clear)(a),r||(r=e.getConnection=Fw(function(m,w,k){return g.getConnection(m,w,k)})),t&&(h=r(t,l,i)),!h){!u&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!f&&(h.waypoints=this._layouter.layoutConnection(h,{source:l,target:i,connectionStart:d,connectionEnd:c,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[l?ut(l):d,i?ut(i):c]),this._connectionDocking&&(l||i)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,l,i)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},vn.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,r=t.connectionStart||ut(o),l=t.connectionEnd||ut(a),i=this.cropWaypoints(r,l,o,a);(0,D.append)(e,this.createNoopConnection(i[0],i[1]))},vn.prototype.cropWaypoints=function(e,t,o,a){var r=this._graphicsFactory,l=o&&r.getShapePath(o),i=a&&r.getShapePath(a),s=r.getConnectionPath({waypoints:[e,t]});return e=o&&Kr(l,s,!0)||e,t=a&&Kr(i,s,!1)||t,[e,t]},vn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,D.remove)(e.connectionPreviewGfx)},vn.prototype.getConnection=function(e){var t=$w(e);return this._elementFactory.createConnection(t)},vn.prototype.createConnectionPreviewGfx=function(){var e=(0,D.create)("g");return(0,D.attr)(e,{pointerEvents:"none"}),(0,D.classes)(e).add(Iw),(0,D.append)(this._canvas.getActiveLayer(),e),e},vn.prototype.createNoopConnection=function(e,t){return Hr([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Fw(e){var t={};return function(o){var a=JSON.stringify(o),r=t[a];return r||(r=t[a]=e.apply(null,arguments)),r}}function $w(e){return(0,R.isObject)(e)?e:{}}var Ww={__init__:["connectionPreview"],connectionPreview:["type",vn]},Uw=new Aa("ov"),Jw=500;function _t(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Uw,this._overlayDefaults=(0,R.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Yw(o.getContainer()),this._init()}_t.$inject=["config.overlays","eventBus","canvas","elementRegistry"],_t.prototype.get=function(e){if((0,R.isString)(e)&&(e={id:e}),(0,R.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,R.filter)(t.overlays,(0,R.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,R.filter)(this._overlays,(0,R.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},_t.prototype.add=function(e,t,o){if((0,R.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,R.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},_t.prototype.remove=function(e){var t=this.get(e)||[];(0,R.isArray)(t)||(t=[t]);var o=this;(0,R.forEach)(t,function(a){var r=o._getOverlayContainer(a.element,!0);if(a&&((0,Z.remove)(a.html),(0,Z.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),r){var l=r.overlays.indexOf(a);l!==-1&&r.overlays.splice(l,1)}})},_t.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},_t.prototype.show=function(){ar(this._overlayRoot)},_t.prototype.hide=function(){ar(this._overlayRoot,!1)},_t.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,Z.clear)(this._overlayRoot)},_t.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,r=t.y;if(t.waypoints){var l=nn(t);a=l.x,r=l.y}fu(o,a,r),(0,Z.attr)(e.html,"data-container-id",t.id)},_t.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,r=t.left,l=t.top;if(t.right!==void 0){var i;a.waypoints?i=nn(a).width:i=a.width,r=t.right*-1+i}if(t.bottom!==void 0){var s;a.waypoints?s=nn(a).height:s=a.height,l=t.bottom*-1+s}fu(o,r||0,l||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_t.prototype._createOverlayContainer=function(e){var t=(0,Z.domify)('<div class="djs-overlays" />');(0,Z.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},_t.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";pu(this._overlayRoot,o)},_t.prototype._getOverlayContainer=function(e,t){var o=(0,R.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},_t.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,r,l;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,R.isString)(a)&&(a=(0,Z.domify)(a)),l=this._getOverlayContainer(o),r=(0,Z.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,Z.assignStyle)(r,{position:"absolute"}),r.appendChild(a),e.type&&(0,Z.classes)(r).add("djs-overlay-"+e.type);var i=this._canvas.findRoot(o),s=this._canvas.getRootElement();ar(r,i===s),e.htmlContainer=r,l.overlays.push(e),l.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_t.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),r=o&&o.minZoom,l=o&&o.maxZoom,i=e.htmlContainer,s=this._canvas.getRootElement(),d=!0;(a!==s||o&&((0,R.isDefined)(r)&&r>t.scale||(0,R.isDefined)(l)&&l<t.scale))&&(d=!1),ar(i,d),this._updateOverlayScale(e,t)},_t.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,r,l=e.htmlContainer,i,s="";o!==!0&&(o===!1?(a=1,r=1):(a=o.min,r=o.max),(0,R.isDefined)(a)&&t.scale<a&&(i=(1/t.scale||1)*a),(0,R.isDefined)(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),(0,R.isDefined)(i)&&(s="scale("+i+","+i+")"),pu(l,s)},_t.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,R.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},_t.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var r=a.element;(0,R.forEach)(t.get({element:r}),function(s){t.remove(s.id)});var l=t._getOverlayContainer(r);if(l){(0,Z.remove)(l.html);var i=t._overlayContainers.indexOf(l);i!==-1&&t._overlayContainers.splice(i,1)}}),e.on("element.changed",Jw,function(a){var r=a.element,l=t._getOverlayContainer(r,!0);l&&((0,R.forEach)(l.overlays,function(i){t._updateOverlay(i)}),t._updateOverlayContainer(l))}),e.on("element.marker.update",function(a){var r=t._getOverlayContainer(a.element,!0);r&&(0,Z.classes)(r.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Yw(e){var t=(0,Z.domify)('<div class="djs-overlay-container" />');return(0,Z.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function fu(e,t,o){(0,Z.assignStyle)(e,{left:t+"px",top:o+"px"})}function ar(e,t){e.style.display=t===!1?"none":""}function pu(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Kw={__init__:["overlays"],overlays:["type",_t]},Gw=new Aa;function Po(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Po.$inject=["eventBus"],Po.prototype.schedule=function(e,t=Gw.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},Po.prototype._schedule=function(e,t){const o=qw();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},Po.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Po.prototype._cancel=function(e){clearTimeout(e.executionId)};function qw(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var Xw={scheduler:["type",Po]},Zw="djs-element-hidden",rr=".entry",Qw=1e3,hu=8,eC=300;function gt(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}gt.$inject=["canvas","elementRegistry","eventBus","scheduler"],gt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var r=a.target,l=(0,R.isArray)(r)?r:[r];if(l.filter(function(s){return o.includes(s)}).length){e.close();var i=l.filter(function(s){return e._elementRegistry.get(s.id)});i.length&&e._updateAndOpen(i.length>1?i:i[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,R.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},gt.prototype._createContainer=function(){var e=(0,Z.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},gt.prototype.registerProvider=function(e,t){t||(t=e,e=Qw),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},gt.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,R.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,R.forEach)(t,function(r){if((0,R.isFunction)(r[o])){var l=r[o](e);(0,R.isFunction)(l)?a=l(a):(0,R.forEach)(l,function(i,s){a[s]=i})}}),a},gt.prototype.trigger=function(e,t,o){var a=this,r,l,i=t.delegateTarget||t.target;if(!i)return t.preventDefault();if(r=(0,Z.attr)(i,"data-action"),l=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(r,"hover",l,o)},eC);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,l,o)},gt.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var r=this._current.target,l=this._current.entries[e];if(l){var i=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if((0,R.isFunction)(i)){if(t==="click")return i(o,r,a)}else if(i[t])return i[t](o,r,a);o.preventDefault()}}}},gt.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},gt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},gt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,R.forEach)(t,function(r,l){var i=r.group||"default",s=(0,Z.domify)(r.html||'<div class="entry" draggable="true"></div>'),d;(0,Z.attr)(s,"data-action",l),d=(0,Z.query)("[data-group="+Sl(i)+"]",o),d||(d=(0,Z.domify)('<div class="group"></div>'),(0,Z.attr)(d,"data-group",i),o.appendChild(d)),d.appendChild(s),r.className&&tC(s,r.className),r.title&&(0,Z.attr)(s,"title",r.title),r.imageUrl&&(a=(0,Z.domify)("<img>"),(0,Z.attr)(a,"src",r.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,Z.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},gt.prototype._createHtml=function(e){var t=this,o=(0,Z.domify)('<div class="djs-context-pad"></div>');return Z.delegate.bind(o,rr,"click",function(a){t.trigger("click",a)}),Z.delegate.bind(o,rr,"dragstart",function(a){t.trigger("dragstart",a)}),Z.delegate.bind(o,rr,"mouseover",function(a){t.trigger("mouseover",a)}),Z.delegate.bind(o,rr,"mouseout",function(a){t.trigger("mouseout",a)}),Z.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},gt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&oC(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},gt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},gt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,R.isArray)(e)!==(0,R.isArray)(o)?!1:(0,R.isArray)(e)?e.length===o.length&&(0,R.every)(e,function(a){return o.includes(a)}):o===e},gt.prototype.isShown=function(){return this.isOpen()&&(0,Z.classes)(this._current.html).has("open")},gt.prototype.show=function(){this.isOpen()&&((0,Z.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},gt.prototype.hide=function(){this.isOpen()&&((0,Z.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},gt.prototype._getPosition=function(e){if(!(0,R.isArray)(e)&&Ht(e)){var t=this._canvas.viewbox(),o=nC(e),a=o.x*t.scale-t.x*t.scale,r=o.y*t.scale-t.y*t.scale;return{left:a+hu*this._canvas.zoom(),top:r}}var l=this._canvas.getContainer().getBoundingClientRect(),i=this._getTargetBounds(e);return{left:i.right-l.left+hu*this._canvas.zoom(),top:i.top-l.top}},gt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},gt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,R.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,Zw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},gt.prototype._getTargetBounds=function(e){var t=this;return((0,R.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const r=a.getBoundingClientRect();return o.top=Math.min(o.top,r.top),o.right=Math.max(o.right,r.right),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function tC(e,t){var o=(0,Z.classes)(e);t=(0,R.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function nC(e){return e.waypoints[e.waypoints.length-1]}function oC(e,t){return e=(0,R.isArray)(e)?e:[e],t=(0,R.isArray)(t)?t:[t],e.length===t.length&&(0,R.every)(e,function(o){return t.includes(o)})}var aC={__depends__:[Lr,Xw,Kw],contextPad:["type",gt]},rC=250;function ro(e){this._eventBus=e,this._tools=[],this._active=null}ro.$inject=["eventBus"],ro.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},ro.prototype.isActive=function(e){return e&&this._active===e},ro.prototype.length=function(e){return this._tools.length},ro.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ro.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(r){if(!r.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,R.forEach)(t,function(r){a.push(r+".ended"),a.push(r+".canceled")}),o.on(a,rC,function(r){this._active&&(lC(r)||this.setActive(null))},this)};function lC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,Z.closest)(t,'.group[data-group="tools"]')}var Rl={__depends__:[qn],__init__:["toolManager"],toolManager:["type",ro]};function Tl(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}Tl.$inject=["eventBus"],Tl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||iC(0,0)};function iC(e,t){var o=document.createEvent("MouseEvent"),a=e,r=t,l=e,i=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,r,l,i,!1,!1,!1,!1,0,null),o}var Vl={__init__:["mouse"],mouse:["type",Tl]},Ml=1500,gu="grab";function zo(e,t,o,a,r,l){this._dragging=o,this._mouse=l;var i=this,s=a.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Ml,function(d){if(Xs(d))return i.activateMove(d.originalEvent,!0),!1}),s&&s.addListener(Ml,function(d){if(!(!mu(d.keyEvent)||i.isActive())){var c=i._mouse.getLastMoveEvent();i.activateMove(c,!!c)}},"keyboard.keydown"),s&&s.addListener(Ml,function(d){!mu(d.keyEvent)||!i.isActive()||i.toggle()},"keyboard.keyup"),e.on("hand.end",function(d){var c=d.originalEvent.target;if(!d.hover&&!(c instanceof SVGElement))return!1;e.once("hand.ended",function(){i.activateMove(d.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(d){var c=t.viewbox().scale;t.scroll({dx:d.dx*c,dy:d.dy*c})}),e.on("hand.move.end",function(d){var c=d.context.reactivate;return!Xs(d)&&c&&e.once("hand.move.ended",function(f){i.activateHand(f.originalEvent,!0,!0)}),!1})}zo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],zo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:gu,data:{context:o||{}}})},zo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:gu,data:{context:{reactivate:o}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function mu(e){return cc("Space",e)}var sC={__depends__:[Rl,Vl],__init__:["handTool"],handTool:["type",zo]},yu="crosshair",vu="selected",cC="djs-dragging-active-lasso";function In(e,t,o,a,r,l,i){this._selection=r,this._dragging=o,this._mouse=i;var s=this,d={create:function(p){var u=t.getActiveLayer(),h=p.frame=(0,D.create)("rect");(0,D.attr)(h,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,D.append)(u,h),c(!0),this.update(p)},update:function(p){var u=p.frame,h=p.bbox;u&&h&&(0,D.attr)(u,{x:h.x,y:h.y,width:h.width,height:h.height});var g=p.marked,m=p.lastMarked;if(g&&m){for(const w of m)g.has(w)||t.removeMarker(w,vu);for(const w of g)m.has(w)||t.addMarker(w,vu)}},remove:function(p){this.update(p),p.frame&&(0,D.remove)(p.frame),c(!1)}};function c(p){(0,D.classes)(t.getContainer()).toggle(cC,p)}function f(p){var u=a.getAll();return new Set((0,R.values)(hc(u,p)))}l.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var u=p.originalEvent.target;!p.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var u=p.context;s._select(Array.from(u.marked))}),e.on("lasso.start",function(p){var u=p.context;u.bbox=bu(p),u.add=jr(p),u.lastMarked=new Set(r.get()),u.add?u.marked=u.lastMarked:u.marked=new Set,u.initialMarked=u.marked,d.create(u)}),e.on("lasso.move",function(p){var u=p.context,h=f(u.bbox=bu(p)),g=u.initialMarked.union(h);u.lastMarked=u.marked,u.marked=g,d.update(u)}),e.on("lasso.cleanup",function(p){var u=p.context;u.lastMarked=u.marked,u.marked=new Set(r.get()),d.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(jr(p))return s.activateLasso(p.originalEvent),!0})}In.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],In.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:yu,data:{context:{}},keepSelection:!0})},In.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:yu,data:{context:{}},keepSelection:!0})},In.prototype._select=function(e){this._selection.select(e)},In.prototype.select=function(e,t,o=[]){var a=(0,R.values)(hc(e,t));this._select([...o,...a])},In.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},In.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function bu(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var dC={__depends__:[Rl,Vl],__init__:["lassoTool"],lassoTool:["type",In]},wu="connect-ok",Cu="connect-not-ok";function Ho(e,t,o,a,r,l,i){var s=this;this._dragging=t,this._rules=l,this._mouse=i,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(d){var c=d.context,f=d.hover,p=c.canStartConnect=s.canStartConnect(f);p!==null&&(c.startTarget=f,a.addMarker(f,p?wu:Cu))}),e.on(["global-connect.out","global-connect.cleanup"],function(d){var c=d.context.startTarget,f=d.context.canStartConnect;c&&a.removeMarker(c,f?wu:Cu)}),e.on(["global-connect.ended"],function(d){var c=d.context.startTarget,f={x:d.x,y:d.y};if(s.canStartConnect(c))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,c,f)}),!1})}Ho.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ho.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ho.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var uC={__depends__:[qr,To,qn,Rl,Vl],globalConnect:["type",Ho]},fC=500,pC=1e3;function lo(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function r(l){var i=(0,D.create)("rect");return(0,D.attr)(i,(0,R.assign)({x:0,y:0,rx:4,width:100,height:100},o)),i}e.on(["shape.added","shape.changed"],fC,function(l){var i=l.element,s=l.gfx,d=(0,Z.query)(".djs-outline",s);d||(d=a.getOutline(i)||r(s),(0,D.append)(s,d)),a.updateShapeOutline(d,i)}),e.on(["connection.added","connection.changed"],function(l){var i=l.element,s=l.gfx,d=(0,Z.query)(".djs-outline",s);d||(d=r(s),(0,D.append)(s,d)),a.updateConnectionOutline(d,i)})}lo.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,R.forEach)(a,function(r){o=o||r.updateOutline(t,e)}),o||(0,D.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},lo.prototype.updateConnectionOutline=function(e,t){var o=nn(t);(0,D.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},lo.prototype.registerProvider=function(e,t){t||(t=e,e=pC),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},lo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},lo.prototype.getOutline=function(e){var t;return(0,R.forEach)(this._getProviders(),function(o){(0,R.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},lo.$inject=["eventBus","styles","elementRegistry"];var lr=6;function Nl(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(r){o.isSelected(r.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(r){var l=r.newSelection;a._updateMultiSelectionOutline(l)})}Nl.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,D.clear)(t);var o=e.length>1;if((0,D.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=hC(nn(e)),r=(0,D.create)("rect");(0,D.attr)(r,(0,R.assign)({rx:3},a)),(0,D.classes)(r).add("djs-selection-outline"),(0,D.append)(t,r)}},Nl.$inject=["eventBus","canvas","selection"];function hC(e){return{x:e.x-lr,y:e.y-lr,width:e.width+lr*2,height:e.height+lr*2}}var xu={__depends__:[_o],__init__:["outline","multiSelectionOutline"],outline:["type",lo],multiSelectionOutline:["type",Nl]},gC=500,mC=1250,yC=1500,ir=Math.round;function vC(e){return{x:e.x+ir(e.width/2),y:e.y+ir(e.height/2)}}function ku(e,t,o,a,r){function l(s,d,c,f){return r.allowed("elements.move",{shapes:s,delta:d,position:c,target:f})}e.on("shape.move.start",yC,function(s){var d=s.context,c=s.shape,f=a.get().slice();f.indexOf(c)===-1&&(f=[c]),f=bC(f),(0,R.assign)(d,{shapes:f,validatedShapes:f,shape:c})}),e.on("shape.move.start",mC,function(s){var d=s.context,c=d.validatedShapes;if(!(d.canExecute=l(c)))return!1}),e.on("shape.move.move",gC,function(s){var d=s.context,c=d.validatedShapes,f=s.hover,p={x:s.dx,y:s.dy},u=l(c,p,{x:s.x,y:s.y},f);if(d.delta=p,d.canExecute=u,u===null){d.target=null;return}d.target=f}),e.on("shape.move.end",function(s){var d=s.context,c=d.delta,f=d.canExecute,p=f==="attach",u=d.shapes;if(f===!1)return!1;c.x=ir(c.x),c.y=ir(c.y),!(c.x===0&&c.y===0)&&o.moveElements(u,c,d.target,{primaryShape:d.shape,attach:p})}),e.on("element.mousedown",function(s){if(_n(s)){var d=ko(s);if(!d)throw new Error("must supply DOM mousedown event");return i(d,s.element)}});function i(s,d,c,f){if((0,R.isObject)(c)&&(f=c,c=!1),!(d.waypoints||!d.parent)&&!(0,D.classes)(s.target).has("djs-hit-no-move")){var p=vC(d);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:c,data:{shape:d,context:f||{}}}),!0}}this.start=i}ku.$inject=["eventBus","dragging","modeling","selection","rules"];function bC(e){var t=(0,R.groupBy)(e,"id");return(0,R.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Su=499,Al="djs-dragging",Eu="drop-ok",_u="drop-not-ok",Bu="new-parent",Ru="attach-ok";function Tu(e,t,o,a){function r(d){return wC(l(d))}function l(d){var c=rv(d,!0),f=c.flatMap(u=>(u.incoming||[]).concat(u.outgoing||[])),p=c.concat(f);return[...new Set(p)]}function i(d,c){[Ru,Eu,_u,Bu].forEach(function(f){f===c?t.addMarker(d,f):t.removeMarker(d,f)})}function s(d,c,f){a.addDragger(c,d.dragGroup),f&&t.addMarker(c,Al),d.allDraggedElements?d.allDraggedElements.push(c):d.allDraggedElements=[c]}e.on("shape.move.start",Su,function(d){var c=d.context,f=c.shapes,p=c.allDraggedElements,u=r(f);if(!c.dragGroup){var h=(0,D.create)("g");(0,D.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,D.append)(t.getActiveLayer(),h),c.dragGroup=h}u.forEach(function(g){a.addDragger(g,c.dragGroup)}),p?p=(0,R.flatten)([p,l(f)]):p=l(f),(0,R.forEach)(p,function(g){t.addMarker(g,Al)}),c.allDraggedElements=p,c.differentParents=CC(f)}),e.on("shape.move.move",Su,function(d){var c=d.context,f=c.dragGroup,p=c.target,u=c.shape.parent,h=c.canExecute;p&&(h==="attach"?i(p,Ru):c.canExecute&&u&&p.id!==u.id?i(p,Bu):i(p,c.canExecute?Eu:_u)),on(f,d.dx,d.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(d){var c=d.context.target;c&&i(c,null)}),e.on("shape.move.cleanup",function(d){var c=d.context,f=c.allDraggedElements,p=c.dragGroup;(0,R.forEach)(f,function(u){t.removeMarker(u,Al)}),p&&(0,D.remove)(p)}),this.makeDraggable=s}Tu.$inject=["eventBus","canvas","styles","previewSupport"];function wC(e){return(0,R.filter)(e,function(t){return Ht(t)?(0,R.find)(e,(0,R.matchPattern)({id:t.source.id}))&&(0,R.find)(e,(0,R.matchPattern)({id:t.target.id})):!0})}function CC(e){return(0,R.size)((0,R.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var xC={__depends__:[Lr,_o,xu,To,qn,Ir],__init__:["move","movePreview"],move:["type",ku],movePreview:["type",Tu]},Vu=".djs-palette-toggle",Mu=".entry",kC=Vu+", "+Mu,jl="djs-palette-",SC="shown",Pl="open",Nu="two-column",EC=1e3;function mt(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var r=a.tool;o.updateToolHighlight(r)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}mt.$inject=["eventBus","canvas"],mt.prototype.registerProvider=function(e,t){t||(t=e,e=EC),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},mt.prototype.getEntries=function(){return this._getProviders().reduce(BC,{})},mt.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},mt.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,Z.domify)(mt.HTML_MARKUP);o.appendChild(a),(0,Z.classes)(o).add(jl+SC),Z.delegate.bind(a,kC,"click",function(r){var l=r.delegateTarget;if((0,Z.matches)(l,Vu))return e.toggle();e.trigger("click",r)}),Z.event.bind(a,"mousedown",function(r){r.stopPropagation()}),Z.delegate.bind(a,Mu,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},mt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},mt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,r,l=(0,Z.classes)(o),i=(0,Z.classes)(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),l.toggle(Nu,r),i.toggle(jl+Nu,r),"open"in e&&(l.toggle(Pl,e.open),i.toggle(jl+Pl,e.open)),a.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},mt.prototype._update=function(){var e=(0,Z.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,Z.clear)(e),(0,R.forEach)(t,function(o,a){var r=o.group||"default",l=(0,Z.query)("[data-group="+Sl(r)+"]",e);l||(l=(0,Z.domify)('<div class="group"></div>'),(0,Z.attr)(l,"data-group",r),e.appendChild(l));var i=(0,Z.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(l.appendChild(i),!o.separator&&((0,Z.attr)(i,"data-action",a),o.title&&(0,Z.attr)(i,"title",o.title),o.className&&_C(i,o.className),o.imageUrl)){var s=(0,Z.domify)("<img>");(0,Z.attr)(s,"src",o.imageUrl),i.appendChild(s)}}),this.open()},mt.prototype.trigger=function(e,t,o){var a,r,l=t.delegateTarget||t.target;return l?(a=(0,Z.attr)(l,"data-action"),r=t.originalEvent||t,this.triggerEntry(a,e,r,o)):t.preventDefault()},mt.prototype.triggerEntry=function(e,t,o,a){var r=this._entries[e],l;if(r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if((0,R.isFunction)(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},mt.prototype._layoutChanged=function(){this._toggleState({})},mt.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},mt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},mt.prototype.open=function(){this._toggleState({open:!0})},mt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},mt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},mt.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,Z.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,Z.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,R.forEach)(o.children,function(a){var r=a.getAttribute("data-action");if(r){var l=(0,Z.classes)(a);r=r.replace("-tool",""),l.contains("entry")&&r===e?l.add("highlighted-entry"):l.remove("highlighted-entry")}})},mt.prototype.isOpen=function(){return(0,Z.classes)(this._container).has(Pl)},mt.prototype._getParentContainer=function(){return this._canvas.getContainer()},mt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function _C(e,t){var o=(0,Z.classes)(e);((0,R.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function BC(e,t){var o=t.getPaletteEntries();return(0,R.isFunction)(o)?o(e):((0,R.forEach)(o,function(a,r){e[r]=a}),e)}var RC={__init__:["palette"],palette:["type",mt]};function Au(e,t,o,a){e.on("element.changed",function(r){var l=r.element;(l.parent||l===t.getRootElement())&&(r.gfx=o.getGraphics(l)),r.gfx&&e.fire(iv(l)+".changed",r)}),e.on("elements.changed",function(r){var l=r.elements;l.forEach(function(i){e.fire("element.changed",{element:i})}),a.updateContainments(l)}),e.on("shape.changed",function(r){a.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){a.update("connection",r.element,r.gfx)})}Au.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var TC={__init__:["changeSupport"],changeSupport:["type",Au]},sr=Math.max,cr=Math.min,VC=20;function MC(e,t,o){var a=o.x,r=o.y,l={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(l.y=e.y+r,l.height=e.height-r):t.indexOf("s")!==-1&&(l.height=e.height+r),t.indexOf("e")!==-1?l.width=e.width+a:t.indexOf("w")!==-1&&(l.x=e.x+a,l.width=e.width-a),l}function dr(e,t,o){var a=t[e],r=o.min&&o.min[e],l=o.max&&o.max[e];return(0,R.isNumber)(r)&&(a=(/top|left/.test(e)?cr:sr)(a,r)),(0,R.isNumber)(l)&&(a=(/top|left/.test(e)?sr:cr)(a,l)),a}function NC(e,t){if(!t)return e;var o=qe(e);return Hc({top:dr("top",o,t),right:dr("right",o,t),bottom:dr("bottom",o,t),left:dr("left",o,t)})}function AC(e,t,o,a){var r=qe(t),l={top:/n/.test(e)?r.bottom-o.height:r.top,left:/w/.test(e)?r.right-o.width:r.left,bottom:/s/.test(e)?r.top+o.height:r.bottom,right:/e/.test(e)?r.left+o.width:r.right},i=a?qe(a):l;return Hc({top:cr(l.top,i.top),left:cr(l.left,i.left),bottom:sr(l.bottom,i.bottom),right:sr(l.right,i.right)})}function ca(e,t){return typeof e<"u"?e:VC}function jC(e,t){var o,a,r,l;return typeof t=="object"?(o=ca(t.left),a=ca(t.right),r=ca(t.top),l=ca(t.bottom)):o=a=r=l=ca(t),{x:e.x-o,y:e.y-r,width:e.width+o+a,height:e.height+r+l}}function PC(e){return!(e.waypoints||e.type==="label")}function zC(e,t){var o;if(e.length===void 0?o=(0,R.filter)(e.children,PC):o=e,o.length)return jC(nn(o),t)}var ju=10;function da(e,t,o,a){this._dragging=a,this._rules=t;var r=this;function l(d,c){var f=d.shape,p=d.direction,u=d.resizeConstraints,h;d.delta=c,h=MC(f,p,c),d.newBounds=NC(h,u),d.canExecute=r.canResize(d)}function i(d){var c=d.resizeConstraints,f=d.minBounds;c===void 0&&(f===void 0&&(f=r.computeMinResizeBox(d)),d.resizeConstraints={min:qe(f)})}function s(d){var c=d.shape,f=d.canExecute,p=d.newBounds;if(f){if(p=Nv(p),!HC(c,p))return;o.resizeShape(c,p)}}e.on("resize.start",function(d){i(d.context)}),e.on("resize.move",function(d){var c={x:d.dx,y:d.dy};l(d.context,c)}),e.on("resize.end",function(d){s(d.context)})}da.prototype.canResize=function(e){var t=this._rules,o=(0,R.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},da.prototype.activate=function(e,t,o){var a=this._dragging,r,l;if(typeof o=="string"&&(o={direction:o}),r=(0,R.assign)({shape:t},o),l=r.direction,!l)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Pu(t,l),"resize",{autoActivate:!0,cursor:LC(l),data:{shape:t,context:r}})},da.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return AC(o,t,e.minDimensions||{width:ju,height:ju},zC(t,e.childrenBoxPadding))},da.$inject=["eventBus","rules","modeling","dragging"];function HC(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pu(e,t){var o=ut(e),a=qe(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function LC(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var zu="djs-resizing",Hu="resize-not-ok",OC=500;function Lu(e,t,o){function a(l){var i=l.shape,s=l.newBounds,d=l.frame;d||(d=l.frame=o.addFrame(i,t.getActiveLayer()),t.addMarker(i,zu)),s.width>5&&(0,D.attr)(d,{x:s.x,width:s.width}),s.height>5&&(0,D.attr)(d,{y:s.y,height:s.height}),l.canExecute?(0,D.classes)(d).remove(Hu):(0,D.classes)(d).add(Hu)}function r(l){var i=l.shape;l.frame&&(0,D.remove)(l.frame),t.removeMarker(i,zu)}e.on("resize.move",OC,function(l){a(l.context)}),e.on("resize.cleanup",function(l){r(l.context)})}Lu.$inject=["eventBus","canvas","previewSupport"];var ur=-6,fr=8,pr=20,ua="djs-resizer",DC=["n","w","s","e","nw","ne","se","sw"];function Fn(e,t,o,a){this._resize=a,this._canvas=t;var r=this;e.on("selection.changed",function(l){var i=l.newSelection;r.removeResizers(),i.length===1&&(0,R.forEach)(i,(0,R.bind)(r.addResizer,r))}),e.on("shape.changed",function(l){var i=l.element;o.isSelected(i)&&(r.removeResizers(),r.addResizer(i))})}Fn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function r(l){_n(l)&&a.activate(l,e,o)}Z.event.bind(t,"mousedown",r),Z.event.bind(t,"touchstart",r)},Fn.prototype._createResizer=function(e,t,o,a){var r=this._getResizersParent(),l=IC(a),i=(0,D.create)("g");(0,D.classes)(i).add(ua),(0,D.classes)(i).add(ua+"-"+e.id),(0,D.classes)(i).add(ua+"-"+a),(0,D.append)(r,i);var s=(0,D.create)("rect");(0,D.attr)(s,{x:-fr/2+l.x,y:-fr/2+l.y,width:fr,height:fr}),(0,D.classes)(s).add(ua+"-visual"),(0,D.append)(i,s);var d=(0,D.create)("rect");return(0,D.attr)(d,{x:-pr/2+l.x,y:-pr/2+l.y,width:pr,height:pr}),(0,D.classes)(d).add(ua+"-hit"),(0,D.append)(i,d),uv(i,t,o),i},Fn.prototype.createResizer=function(e,t){var o=Pu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},Fn.prototype.addResizer=function(e){var t=this;Ht(e)||!this._resize.canResize({shape:e})||(0,R.forEach)(DC,function(o){t.createResizer(e,o)})},Fn.prototype.removeResizers=function(){(0,D.clear)(this._getResizersParent())},Fn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Fn.$inject=["eventBus","canvas","selection","resize"];function IC(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-ur:e.indexOf("w")!==-1&&(t.x=ur),e.indexOf("s")!==-1?t.y=-ur:e.indexOf("n")!==-1&&(t.y=ur),t}var FC={__depends__:[To,qn,Ir],__init__:["resize","resizePreview","resizeHandles"],resize:["type",da],resizePreview:["type",Lu],resizeHandles:["type",Fn]};function fa(e,t,o,a,r,l){this._canvas=t,this._modeling=a,this._textRenderer=l,o.registerProvider(this),e.on("element.dblclick",s=>{i(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{r.removeResizers()}),e.on("create.end",500,s=>{const{context:d,isTouch:c}=s,f=d.shape,{canExecute:p}=s.context;c||p&&(d.hints&&d.hints.createElementsBehavior===!1||i(f))}),e.on("autoPlace.end",500,s=>{i(s.shape)});function i(s,d){(d||ul(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}fa.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],fa.prototype.activate=function(e){const t=Ka(e);if(t===void 0)return;const o={text:t};ot(o,this.getEditingBBox(e));const a={};return(ul(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&ot(a,{centerVertically:!0}),fl(e)&&ot(a,{autoResize:!0}),ot(o,{options:a}),o},fa.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),r={x:a.x+a.width/2,y:a.y+a.height/2},l={x:a.x,y:a.y},i=t.zoom(),s=this._textRenderer.getDefaultStyle(),d=this._textRenderer.getExternalStyle(),c=d.fontSize*i,f=d.lineHeight,p=s.fontSize*i,u=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(ul(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(ot(l,{width:a.width,height:a.height}),ot(h,{fontSize:p+"px",lineHeight:u,paddingTop:7*i+"px",paddingBottom:7*i+"px",paddingLeft:5*i+"px",paddingRight:5*i+"px"}));const g=90*i,m=7*i,w=4*i;if(o.labelTarget&&(ot(l,{width:g,height:a.height+m+w,x:r.x-g/2,y:a.y-m}),ot(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:w+"px"})),fl(o)&&!bd(o)&&!ra(o)){const k=wd(e),C=t.getAbsoluteBBox({x:k.x,y:k.y,width:0,height:0}),v=c+m+w;ot(l,{width:g,height:v,x:C.x-g/2,y:C.y-v/2}),ot(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:w+"px"})}return{bounds:l,style:h}},fa.prototype.update=function(e,t){let o;$C(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function $C(e){return!e||!e.trim()}var WC={__depends__:[TC,FC,Sr.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",fa]};function $n(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}$n.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},$n.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},$n.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},$n.prototype.getSnapLocations=function(){return this._snapLocations},$n.prototype.setSnapLocations=function(e){this._snapLocations=e},$n.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new hr,o.initDefaults(this._defaultSnaps)),o};function hr(){this._snapValues={}}hr.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},hr.prototype.snap=function(e,t,o,a){var r=this._snapValues[t];return r&&zw(e[o],r[o],a)},hr.prototype.initDefaults=function(e){var t=this;(0,R.forEach)(e||{},function(o,a){(0,R.forEach)(o,function(r){t.add(a,r)})})};var UC=1250;function sn(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){a.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],UC,function(r){var l=r.context,i=l.shape,s=l.snapContext,d=l.target;if(!(r.originalEvent&&sc(r.originalEvent))&&!(or(r)||!d)){var c=s.pointsForTarget(d);c.initialized||(c=a.addSnapTargetPoints(c,i,d),c.initialized=!0),o.snap(r,c)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}sn.$inject=["elementRegistry","eventBus","snapping"],sn.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,r=o.snapContext;r||(r=o.snapContext=new $n);var l;t.get(a.id)?l=jo(a,e):l={x:e.x+jo(a).x,y:e.y+jo(a).y};var i={x:l.x-a.width/2,y:l.y-a.height/2},s={x:l.x+a.width/2,y:l.y+a.height/2};return r.setSnapOrigin("mid",{x:l.x-e.x,y:l.y-e.y}),Vo(a)||(r.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},sn.prototype.addSnapTargetPoints=function(e,t,o){return(0,R.forEach)(this.getSnapTargets(t,o),function(a){if(Vo(a)){Vo(t)&&e.add("mid",jo(a));return}if(Ht(a)){if(a.waypoints.length<3)return;(0,R.forEach)(a.waypoints.slice(1,-1),function(r){e.add("mid",r)});return}e.add("mid",jo(a))}),!(0,R.isNumber)(t.x)||!(0,R.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",jo(t)),e},sn.prototype.getSnapTargets=function(e,t){return cu(t).filter(function(o){return!JC(o)})};function JC(e){return!!e.hidden}function Lo(e){e.invoke(sn,this)}(0,pn.default)(Lo,sn),Lo.$inject=["injector"],Lo.prototype.initSnap=function(e){return sn.prototype.initSnap.call(this,e)},Lo.prototype.addSnapTargetPoints=function(e,t,o){return sn.prototype.addSnapTargetPoints.call(this,e,t,o)},Lo.prototype.getSnapTargets=function(e,t){return sn.prototype.getSnapTargets.call(this,e,t)};var YC=1250;function pa(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],YC,function(a){var r=a.context,l=r.shape,i=l.parent,s=r.direction,d=r.snapContext;if(!(a.originalEvent&&sc(a.originalEvent))&&!or(a)){var c=d.pointsForTarget(i);c.initialized||(c=o.addSnapTargetPoints(c,l,i,s),c.initialized=!0),qC(s)&&yn(a,"x",a.x),XC(s)&&yn(a,"y",a.y),t.snap(a,c)}}),e.on(["resize.cleanup"],function(){t.hide()})}pa.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,r=t.snapContext;r||(r=t.snapContext=new $n);var l=Ou(o,a);return r.setSnapOrigin("corner",{x:l.x-e.x,y:l.y-e.y}),r},pa.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,R.forEach)(this.getSnapTargets(t,o),function(r){e.add("corner",Lw(r)),e.add("corner",Hw(r))}),e.add("corner",Ou(t,a)),e},pa.$inject=["eventBus","snapping"],pa.prototype.getSnapTargets=function(e,t){return cu(t).filter(function(o){return!KC(o,e)&&!Ht(o)&&!GC(o)&&!Vo(o)})};function Ou(e,t){var o=ut(e),a=qe(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function KC(e,t){return e.host===t}function GC(e){return!!e.hidden}function qC(e){return e==="n"||e==="s"}function XC(e){return e==="e"||e==="w"}var ZC=7,QC=1e3;function Wn(e){this._canvas=e,this._asyncHide=(0,R.debounce)((0,R.bind)(this.hide,this),QC)}Wn.$inject=["canvas"],Wn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),r={x:or(e,"x"),y:or(e,"y")};(0,R.forEach)(a,function(l){var i=o.getSnapOrigin(l),s={x:e.x+i.x,y:e.y+i.y};if((0,R.forEach)(["x","y"],function(d){var c;r[d]||(c=t.snap(s,l,d,ZC),c!==void 0&&(r[d]={value:c,originValue:c-i[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),(0,R.forEach)(["x","y"],function(l){var i=r[l];(0,R.isObject)(i)&&yn(e,l,i.originValue)})},Wn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,D.create)("path");return(0,D.attr)(o,{d:"M0,0 L0,0"}),(0,D.classes)(o).add("djs-snap-line"),(0,D.append)(t,o),{update:function(a){(0,R.isNumber)(a)?e==="horizontal"?(0,D.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,D.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,D.attr)(o,{display:"none"})}}},Wn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Wn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wn.prototype.hide=function(){(0,R.forEach)(this._snapLines,function(e){e.update()})};var ex={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",sn],resizeSnapping:["type",pa],snapping:["type",Wn]},tx={__depends__:[ex],__init__:["createMoveSnapping"],createMoveSnapping:["type",Lo]};function Oo(e){Mt.call(this,e),this.init()}Oo.$inject=["eventBus"],Xn(Oo,Mt),Oo.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){a.canExecute(r,t,function(l,i,s){return o(l)},!0)})},Oo.prototype.init=function(){};function ha(e){Oo.call(this,e)}ha.$inject=["eventBus"],(0,pn.default)(ha,Oo),ha.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},r=a.targetParent;if(a.targetAttach)return!1;r&&(o.parent=r);try{return zl(t,o)}finally{r&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return zl(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return sv(t)})},ha.prototype.canConnect=zl;function zl(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var nx={__init__:["myRuleProvider"],myRuleProvider:["type",ha]};function Hl(e,t,o,a,r,l,i){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=r,this._palette=l,this._myOptions=i,l.registerProvider(this)}Hl.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Hl.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,r=this._globalConnect,l=this._myOptions;function i(d,c,f,p,u){function h(g){const m=t.createShape(ot({type:d},u));e.start(g,m)}return{group:c,className:f,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(d){o.activateHand(d)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(d){a.activateSelection(d)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(d){r.toggle(d)}}},"tool-separator":{group:"tools",separator:!0}};for(const d in l.palette){const c=l.palette[d];s[d]=i(c.type,c.group,c.className,c.title,c.options)}return s};var ox={__init__:["paletteProvider"],paletteProvider:["type",Hl]},Gx=50,ax=250;function rx(e,t){t||(t={});function o(u){return u.source===e?1:-1}var a=t.defaultDistance||50,r=t.direction||"e",l=t.filter,i=t.getWeight||o,s=t.maxDistance||ax,d=t.reference||"start";l||(l=lx);function c(u,h){return r==="n"?d==="start"?qe(u).top-qe(h).bottom:d==="center"?qe(u).top-ut(h).y:qe(u).top-qe(h).top:r==="w"?d==="start"?qe(u).left-qe(h).right:d==="center"?qe(u).left-ut(h).x:qe(u).left-qe(h).left:r==="s"?d==="start"?qe(h).top-qe(u).bottom:d==="center"?ut(h).y-qe(u).bottom:qe(h).bottom-qe(u).bottom:d==="start"?qe(h).left-qe(u).right:d==="center"?ut(h).x-qe(u).right:qe(h).right-qe(u).right}var f=e.incoming.filter(l).map(function(u){var h=i(u),g=h<0?c(u.source,e):c(e,u.source);return{id:u.source.id,distance:g,weight:h}}),p=e.outgoing.filter(l).map(function(u){var h=i(u),g=h>0?c(e,u.target):c(u.target,e);return{id:u.target.id,distance:g,weight:h}});return(0,R.reduce)(f.concat(p).reduce(function(u,h){return u[h.id+"__weight_"+h.weight]=h,u},{}),function(u,h){var g=h.distance,m=h.weight;return g<0||g>s||(u[String(g)]||(u[String(g)]=0),u[String(g)]+=1*m,(!u.distance||u[u.distance]<u[String(g)])&&(u.distance=g)),u},{}).distance||a}function lx(){return!0}var ix=100;function Du(e,t,o){e.on("autoPlace",ix,function(a){var r=a.shape,l=a.source;return sx(l,r)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,r,l){e.fire("autoPlace.start",{source:a,shape:r});var i=e.fire("autoPlace",{source:a,shape:r}),s=t.appendShape(a,r,i,a.parent,l);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Du.$inject=["eventBus","modeling","canvas"];function sx(e,t,o){o||(o={});var a=o.defaultDistance||50,r=ut(e);return{x:qe(e).right+a+t.width/2,y:r.y}}function Iu(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Iu.$inject=["eventBus","selection"];var cx={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Du],autoPlaceSelectionBehavior:["type",Iu]},dx=10,ux=(e,t)=>e.type===t;function fx(e){return e.incoming.map(t=>t.source)}function px(e){return e.outgoing.map(t=>t.target)}function Ll(e){return px(e).concat(fx(e))}function hx(e){let t=Ll(e);return e.host&&(t=t.concat(Ll(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Ll(a)),[]))),t.filter(o=>o.type!=="myline")}function gx(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,R.find)(hx(e),r=>r===o?!1:Nn(r,a,dx)==="intersect")}function mx(e,t,o,a){let r;for(;r=gx(e,o,t);)o=a(t,o,r);return o}function yx(e){return function(t,o,a){const r={x:o.x,y:o.y};return["x","y"].forEach(l=>{const i=e[l];if(!i)return;const s=l==="x"?"width":"height",{margin:d,minDistance:c}=i;d<0?r[l]=Math.min(a[l]+d-t[s]/2,o[l]-c+d):r[l]=Math.max(a[l]+a[s]+d+t[s]/2,o[l]+c+d)}),r}}function vx(e,t){return bx(e,t)}function bx(e,t){const o=qe(e),a=ut(e),r=rx(e,{filter:s=>ux(s,"myline")}),l=30,i=80;return mx(e,t,{x:o.right+r+t.width/2,y:a.y+wx("left",i)},yx({y:{margin:l,minDistance:i}}))}function wx(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Fu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return vx(a,o)})}Fu.$inject=["eventBus"];var Cx={__depends__:[cx],__init__:["myAutoPlace"],myAutoPlace:["type",Fu]};function Ol(e,t,o,a,r,l,i){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=r,this._create=l,this._myOptions=i,t.registerProvider(this)}Ol.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ol.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,r=this._autoPlace,l=this._create,i=this._myOptions;function s(){o.removeElements([e])}function d(p,u,h){t.start(p,u,h)}function c(p,u,h,g){typeof h!="string"&&(g=h);function m(k,C){const v=a.createShape(ot({type:p},g));l.start(k,v,{source:C})}function w(k,C){const v=a.createShape(ot({type:p},g));r.append(C,v)}return{group:"model",className:u,title:h,action:{dragstart:m,click:w}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const f={};for(const p in i.palette)if(p!=="create.start-event"){const u=i.palette[p];f[p]=c(u.type,u.className,u.title,u.options)}return f.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:d,dragstart:d}},f.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},f};var xx={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ol]},kx=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{r("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{r("elementClick",T.element.businessObject)}),V.on("create.end",T=>{r("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{r("elementCreate",T.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},u=()=>{let V={__init__:["myOptions"],myOptions:["type",p]};s=new Ca.default({canvas:{container:l.value},modules:[Dw,qr,Ww,aC,kc,mw,sC,dC,uC,Nd,$c,xC,xu,RC,Jc,V,Cx,zd,WC,xx,ox,nx,tx,Ld]});const T=s.get("canvas"),P=s.get("elementFactory");c();const A=P.createRoot();T.setRootElement(A),f()};(0,n.onMounted)(()=>{u()});const h=V=>{const T=V==null?1:d+V;s.get("canvas").zoom(T),d=T},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},w=()=>(s.get("canvas").zoom(1),Od(s.get("elementRegistry").getAll())),k=V=>{s.clear(),c(),Dd(V,s)},C=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{c()},zoom:V=>{h(V)},redo:()=>{g()},undo:()=>{m()},getData:()=>w(),setData:V=>{k(V)},updateElemet:V=>{C(V)}}),(V,T)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:l,class:"j-work-flow"},null,512))}}),Sx=kx,$u=ve(hw),Wu=ve(Sx),Ex=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:l}=tt(),{formData:i}=Sn(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),d=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),f=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=x=>{r("rowChange",x)},m=()=>{const x={_i:Ft()};a.columns.forEach(E=>{const _=E.config?.valueRowKey||E.id||"";_&&(x[_]=kt(E.config?.defaultValue))}),h.value.push(x),r("change",{id:a.id,value:x,data:x,formData:i,tableData:h.value,type:"add"})},w=x=>{const E=h.value[x];h.value.splice(x,1),r("change",{id:a.id,value:E,data:E,formData:i,tableData:h.value,type:"delete"})},k=()=>{const x={isOk:!0,info:""};if(a.required&&h.value.length===0)return x.isOk=!1,x.info="请添加表格数据",x;const E=h.value.length,_=a.columns,V=_.length;for(let T=0;T<E;T++){const P=h.value[T];for(let A=0;A<V;A++){const N=_[A];if(v(N,T).display!==!1&&N.rule&&N.rule.length>0){const M=N.rule.length;for(let B=0;B<M;B++){const H=N.rule[B];if(H.pattern=H.pattern?H.pattern+"":"",H.pattern&&!St(P[N.prop||""])&&!new RegExp(H.pattern.substring(1,H.pattern.length-1)).test(P[N.prop||""]))return x.info=`${l("第")}${T+1}${l("行")},${l("第")}${A+1}${l("列")},${l(N.label)}:${l(H.message)}`,x.isOk=!1,x;if(H.required&&St(P[N.prop||""]))return x.isOk=!1,x.info=`${l("第")}${T+1}${l("行")},${l("第")}${A+1}${l("列")},${l(N.label)}:${l("不能为空")}`,x}}}}return x};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(x=>{x._i||(x._i=Ft())})):(h.value=[],r("update:modelValue",h.value)),(0,n.watch)(()=>a.modelValue,x=>{h.value=a.modelValue||[],h.value=x||[],h.value.forEach(E=>{E._i||(E._i=Ft())})},{deep:!0});const v=(x,E)=>$t({config:x.config||{},getCompConfig:x.getCompConfig,formData:i,row:h.value[E],getTableData:()=>h.value}),b=x=>{const E=x||a.labelWidth;return typeof E=="string"?E:typeof E=="number"?E+"px":E};t({validate:()=>k()});const{row:y}=wo();return Kn({getTableData:()=>h.value,rowChange:g,pRowData:y}),(x,E)=>{const _=(0,n.resolveComponent)("j-comp"),V=(0,n.resolveComponent)("el-form-item"),T=(0,n.resolveComponent)("el-col"),P=(0,n.resolveComponent)("el-row"),A=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},x.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(N,M)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:N._i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(P,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,B=>((0,n.openBlock)(),(0,n.createBlock)(T,{key:B.prop,span:B.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(B.getInputType?B.getInputType(N):B.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(V,{"label-width":b(B.config?.labelWidth),label:(0,n.unref)(l)(B.config?.label||""),extra:B.config?.labelExtra,required:B.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(_,(0,n.mergeProps)({ref_for:!0},B,{row:N}),null,16,["row"])]),_:2},1032,["label-width","label","extra","required"]),[[n.vShow,v(B,M).display!==!1]])]),_:2},1032,["span","style"]))),128))]),_:2},1032,["gutter"]),f.value&&(u.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",status:"danger",onClick:B=>w(M)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,type:"link",style:{"margin-right":"8px",padding:"0"},label:d.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),_x=Ex,Uu=ve(_x),Bx={class:"j-card-list-body"},Rx={class:"j-card-list-image-error"},Tx=["src"],Vx={key:1},Mx={key:0,class:"j-card-list-button-layer"},Nx={class:"j-card-list-main"},Ax=["title"],jx={class:"j-card-list-menulist"},Px={key:0,class:"j-card-list-pagination"},zx=(0,n.defineComponent)({name:"JCardList",__name:"card-list",props:{loadSrc:{type:Function,default:void 0},labelKey:{default:"f_Name"},dataSource:{default:()=>[]},buttons:{default:()=>[]},fallback:{default:""},isPage:{type:Boolean,default:!1},pageSizes:{default:void 0},pageTotal:{default:0},tablePage:{default:1},pageSize:{default:50},pageLayoutSimple:{type:Boolean,default:!1},setButton:{type:Function,default:void 0},maxBtns:{default:3},loading:{type:Boolean,default:!1},isRadio:{type:Boolean,default:!1},isMultiSelect:{type:Boolean,default:!1},rowKey:{default:"f_Id"},backgroundColor:{default:""},showBigEditButton:{type:Boolean,default:!1},cardWidth:{default:"25%"},cardHeight:{},cardAspectRatio:{default:258/184},imageFit:{default:"fill"}},emits:["click","loadPageData","update:pageSize","update:tablePage","selectionChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:l}=tt(),{openLayer:i}=En(),s=(0,n.computed)(()=>a.dataSource),d=(0,n.computed)(()=>s.value.map(A=>f(A))),c=(0,n.computed)(()=>a.buttons.find(A=>A.id==="edit")),f=A=>a.loadSrc?.(A)||"",p=(0,n.computed)(()=>({width:(typeof a.cardWidth=="number"?`${a.cardWidth}%`:a.cardWidth)||void 0})),u=A=>{const N=a.rowKey||"j_Id",M=N.split(",").map(B=>B.trim()).filter(Boolean);if(M.length<=1){const B=A[N];return B==null?"":String(B)}return M.map(B=>{const H=A[B];return H==null?"":String(H)}).join("::")},h=(A,N)=>u(A)||String(N),g=(0,n.ref)([]),m=(0,n.computed)({get(){return g.value[0]||""},set(A){const N=A==null?"":String(A);N&&(g.value=[N],r("selectionChange",{selections:g.value,rows:C()}))}}),w=A=>{const N=u(A);return N?g.value.includes(N):!1},k=(A,N)=>{const M=A[0],B=u(M);if(B){if(a.isRadio){g.value=[B],r("selectionChange",{selections:g.value,rows:C()});return}N?A.forEach(H=>{const W=u(H);W&&!g.value.includes(W)&&g.value.push(W)}):A.forEach(H=>{const W=u(H);W&&(g.value=g.value.filter(X=>X!==W))}),r("selectionChange",{selections:g.value,rows:C()})}},C=()=>s.value.filter(A=>g.value.includes(u(A))),v=()=>{g.value=[],r("selectionChange",{selections:g.value,rows:[]})},b=A=>{const N=[];let M=kt(a.buttons);a.showBigEditButton&&(M=M.filter(X=>X.id!=="edit")),M=M.filter(X=>X?.config?.display!==!1),A&&a.setButton&&(a.setButton({buttons:M,row:A}),M=M.filter(X=>X?.config?.display!==!1));let B=M.length,H=!1;a.maxBtns&&B>a.maxBtns&&(B=a.maxBtns,H=!0);const W={id:Ft(),label:"",config:{icon:"mdi:dots-horizontal",type:"text",notLabel:!0},children:[]};for(let X=0;X<B;X++){let fe=M[X];H&&X===B-1&&(fe=W),N.push(fe)}if(H&&a.maxBtns)for(let X=a.maxBtns-1;X<M.length;X++){const fe=M[X];W.children?.push(fe),fe.children&&(W.children?.push(...fe.children),delete fe.children)}return N},S=(A,N,M)=>{!A||A.config?.disabled||(A.click?.({data:N,openLayer:i}),r("click",A.id,{item:N,index:M,button:A}))},y=(0,n.computed)({get(){return a.pageSize},set(A){r("update:pageSize",A)}}),x=(0,n.computed)({get(){return a.tablePage},set(A){r("update:tablePage",A)}}),E=(0,n.computed)(()=>a.pageLayoutSimple?"prev, pager, next":"total, prev, pager, next, sizes, jumper"),_=(A,N)=>{r("loadPageData",{rows:N,page:A})};return t({clearSelection:()=>v(),toggleRowSelection:(A,N)=>k(A,N),getSelections:()=>C(),selections:g}),(A,N)=>{const M=(0,n.resolveComponent)("el-image"),B=(0,n.resolveComponent)("j-button"),H=(0,n.resolveComponent)("el-dropdown-item"),W=(0,n.resolveComponent)("el-dropdown-menu"),X=(0,n.resolveComponent)("el-dropdown"),fe=(0,n.resolveComponent)("el-tooltip"),J=(0,n.resolveComponent)("el-radio"),Y=(0,n.resolveComponent)("el-checkbox"),G=(0,n.resolveComponent)("el-pagination"),j=(0,n.resolveDirective)("loading");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-card-list",style:(0,n.normalizeStyle)({paddingBottom:e.isPage?"48px":void 0,backgroundColor:e.backgroundColor||"var(--j-color-bg)"})},[(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",Bx,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.value,(me,Pe)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:h(me,Pe),style:(0,n.normalizeStyle)([p.value,{padding:"4px"}])},[(0,n.createElementVNode)("div",{class:"j-card-list-item",style:(0,n.normalizeStyle)({aspectRatio:e.cardAspectRatio})},[(0,n.createVNode)(M,{class:"j-card-list-image",src:f(me),fit:e.imageFit,"preview-src-list":d.value,"initial-index":Pe,"preview-teleported":!0,"hide-on-click-modal":!0},{error:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Rx,[e.fallback?((0,n.openBlock)(),(0,n.createElementBlock)("img",{key:0,src:e.fallback},null,8,Tx)):((0,n.openBlock)(),(0,n.createElementBlock)("div",Vx,"加载失败"))])]),_:1},8,["src","fit","preview-src-list","initial-index"]),e.showBigEditButton&&c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Mx,[(0,n.createVNode)(B,{class:"j-card-list-edit-btn",type:"primary",label:(0,n.unref)(l)(c.value.label||"编辑"),onClick:pe=>S(c.value,me,Pe)},null,8,["label","onClick"])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Nx,[(0,n.createElementVNode)("div",{class:"j-card-list-title",title:String(me[e.labelKey]??"")},(0,n.toDisplayString)(String(me[e.labelKey]??"")),9,Ax),(0,n.createElementVNode)("div",jx,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(b(me),pe=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:pe.id},[pe.children?.length?((0,n.openBlock)(),(0,n.createBlock)(X,{key:0,trigger:"click"},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(W,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(pe.children,Ne=>((0,n.openBlock)(),(0,n.createBlock)(H,{key:Ne.id,disabled:Ne.config?.disabled,onClick:Fe=>S(Ne,me,Pe)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(l)(Ne.label||"")),1)]),_:2},1032,["disabled","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",icon:pe.config?.icon||"mdi:dots-horizontal",notLabel:!0},null,8,["icon"])]),_:2},1024)):((0,n.openBlock)(),(0,n.createBlock)(fe,{key:1,content:(0,n.unref)(l)(pe.label||"")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",icon:pe.config?.icon||"mdi:tool-outline",status:pe.config?.status,disabled:pe.config?.disabled,notLabel:!0,onClick:Ne=>S(pe,me,Pe)},null,8,["icon","status","disabled","onClick"])]),_:2},1032,["content"]))],64))),128))])]),e.isRadio?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"j-card-list-item-radio",onClick:N[1]||(N[1]=(0,n.withModifiers)(()=>{},["stop"]))},[(0,n.createVNode)(J,{style:{height:"14px"},modelValue:m.value,"onUpdate:modelValue":N[0]||(N[0]=pe=>m.value=pe),value:u(me)},null,8,["modelValue","value"])])):(0,n.createCommentVNode)("",!0),e.isMultiSelect?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:"j-card-list-item-checkbox",onClick:N[2]||(N[2]=(0,n.withModifiers)(()=>{},["stop"]))},[(0,n.createVNode)(Y,{style:{height:"14px"},"model-value":w(me),onChange:pe=>k([me],!!pe)},null,8,["model-value","onChange"])])):(0,n.createCommentVNode)("",!0)],4)],4))),128))])),[[j,e.loading]]),e.isPage?((0,n.openBlock)(),(0,n.createElementBlock)("div",Px,[(0,n.createVNode)(G,{"current-page":x.value,"onUpdate:currentPage":N[3]||(N[3]=me=>x.value=me),"page-size":y.value,"onUpdate:pageSize":N[4]||(N[4]=me=>y.value=me),"page-sizes":e.pageSizes||[50,100,200,500],total:e.pageTotal,layout:E.value,onChange:_},null,8,["current-page","page-size","page-sizes","total","layout"])])):(0,n.createCommentVNode)("",!0)],4)}}}),Hx=zx,Ju=ve(Hx),Lx=[$l,Ti,Vi,Mi,Ni,Ai,ji,Pi,zi,Hi,Li,Oi,Di,Ii,qi,Xi,Zi,Qi,es,Ri,ts,ns,os,ls,is,ss,xs,cs,ds,us,fs,ps,hs,gs,ms,ys,vs,bs,ws,Cs,Bs,Rs,Ts,Vs,Ns,As,js,Ps,zs,ks,Ss,_s,Hs,Ls,Os,Ds,Is,Fs,$s,Ws,Us,$u,Wu,Uu,Ju],Ox=e=>{Lx.forEach(t=>{e.component(t.name,t)})},Dx={install:Ox};O.EncryptionFactory=gi,O.EventBus=Tr,O.HashingFactory=Kf,O.INJECT_KEYS=Et,O.JAutoComplete=Di,O.JBarcode=ss,O.JButton=$l,O.JButtonSelect=Bs,O.JButtons=Ti,O.JCardList=Ju,O.JCascaderSelect=Hi,O.JCheckbox=Li,O.JCodeMirror=xs,O.JCollapse=Fs,O.JComp=Vs,O.JCount=cs,O.JCountUp=us,O.JDataPanel=fs,O.JDate=Mi,O.JDecoratedTitle=ws,O.JDialog=Xi,O.JDialogFull=Zi,O.JDivider=ps,O.JDrawer=Qi,O.JDynamicLayer=Ri,O.JEcharts=is,O.JEditor=$s,O.JForm=Ns,O.JFormItem=As,O.JGuid=Ps,O.JHpanel=hs,O.JIcon=ji,O.JInput=Vi,O.JInputButton=ms,O.JInputCards=Uu,O.JInputCode=ys,O.JInputColor=vs,O.JInputCount=ds,O.JInputDecoratedTitle=Cs,O.JInputLayer=Ls,O.JInputMap=Us,O.JInputRows=Hs,O.JInputTag=ts,O.JLayer=es,O.JLayerForm=Os,O.JLayout=Ii,O.JMap=Ws,O.JMenu=Ss,O.JNowTime=Ai,O.JNumber=Oi,O.JPage=js,O.JPanel=zs,O.JRadio=Pi,O.JRate=ns,O.JSelect=zi,O.JSlider=os,O.JSliderCaptcha=ks,O.JSwitch=Ds,O.JTable=qi,O.JTablePanel=_s,O.JTabs=Is,O.JTime=Ni,O.JTitle=bs,O.JTree=Rs,O.JTreeSelect=Ts,O.JUpload=ls,O.JVpanel=gs,O.JWorkflow=Wu,O.JWorkflowViewer=$u,O.assign=ot,O.buildShortUUID=ka,O.buildUUID=Ft,O.calcDate=ai,O.calcDateHours=Ef,O.calcDateText=_f,O.clearJson=bo,O.clone=$o,O.deepClone=kt,O.default=Dx,O.eventBus=qf,O.formatToDate=Uo,O.formatToDateTime=_a,O.fullScreenLoading=kn,O.getCompConfig=$t,O.getCompType=Ea,O.getDayText=Sf,O.getFunction=_r,O.getIsInputComp=Sa,O.getIsTableInputComp=ni,O.getLabel=oi,O.getObjType=Wl,O.getTextWidth=Jt,O.is=Fl,O.isArray=xa,O.isNullOrEmpty=St,O.isObject=ff,O.loadBMap=yi,O.lowerFirst=wf,O.myAesDecrypt=Gf,O.numberToChinese=Jl,O.numberToThousandSeparator=Yl,O.pagination=vf,O.paginationEx=Ul,O.set=Br,O.setGroupMap=Gl,O.toArray=Zl,O.toDecimal=Wo,O.toLeafArray=ti,O.toSimpleTree=Cf,O.toTree=ql,O.uniqueArray=bf,O.upFirst=Kl,O.useAppInject=tt,O.useAppProvide=Xf,O.useAuthPageInject=xi,O.useAuthPageProvide=ki,O.useCompInject=vi,O.useCompProvide=Mr,O.useFormInject=Sn,O.useFormProvide=Vr,O.useHMenuInject=wi,O.useHMenuProvide=Ci,O.useInject=en,O.useLayer=En,O.useLayerInject=Zf,O.useLayerProvide=Si,O.useMenuInject=Co,O.useMenuProvide=bi,O.usePageInject=Ei,O.usePageProvide=_i,O.useProvide=tn,O.useSortable=mi,O.useTableInject=wo,O.useTableProvide=Kn});
16
+ getCompValue)=>{ return ${x} }`;let E;const _=_r(x);if(_.res)try{E=_.fn(a,r,l,i,s,d,c,f,p,u,h,g,m,w,v)}catch(V){console.log(V,"计算组件公式运行错误")}else return console.log(_.msg),"";return Number.isNaN(E)?"":(o.decimal!==void 0&&(E=E.toFixed(o.decimal)),E)}),S=(0,n.computed)(()=>{let y=b.value;return o.thousandSeparator&&(y=Yl(y)),o.isChinese&&(y=Jl(y)),y});return(0,n.watch)(b,y=>{k("update:modelValue",y),k("change",{value:y,data:S.value})}),(y,x)=>{const E=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(E,{modelValue:S.value,"onUpdate:modelValue":x[0]||(x[0]=_=>S.value=_),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),dg=cg,cs=ve(dg),ug={class:"j-block j-input-count"},fg={class:"j-input-count-top"},pg={class:"j-input-count-tool"},hg={style:{"font-weight":"600"}},gg={class:"j-input-count-codebox"},mg={key:0,class:"j-input-count-cursor"},yg={key:0,class:"fun_color"},vg={key:1,class:"comp_color"},bg={key:2,class:"num_color"},wg={key:3,class:"j-input-count-cursor"},Cg={class:"j-input-count-bottom"},xg={class:"j-input-count-left"},kg={class:"mb-8px fw-600"},Sg={class:"j-input-count-right"},Eg={class:"j-input-count-funs"},_g={style:{"font-weight":"600",padding:"8px"}},Bg={class:"j-input-count-funs-content"},Rg={class:"j-input-count-fundes"},Tg={style:{"font-size":"14px","font-weight":"300"}},Vg=(0,n.defineComponent)({name:"JInputCount",__name:"input-count",props:{modelValue:String,list:{type:Array,default:()=>[]},type:{type:String,default:"primary"},size:{type:String},label:{type:String,default:"公式设置"}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=tt(),a=e,r=t,l=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4},{label:5,value:5},{label:6,value:6},{label:7,value:7},{label:8,value:8},{label:9,value:9},{label:0,value:0},{label:"i",value:"i"},{label:"+",value:"+"},{label:"-",value:"-"},{label:"*",value:"*"},{label:"/",value:"/"},{label:">",value:">"},{label:"<",value:"<"},{label:"=",value:"="},{label:"(",value:"("},{label:")",value:")"},{label:"[",value:"["},{label:"]",value:"]"},{label:"'",value:"'"},{label:'"',value:'"'},{label:",",value:","},{label:".",value:"."}],i=[{label:"ABS",value:"abs",des:["ABS函数可以获取一个数的绝对值","用法:ABS(数字)","示例:ABS(-8)可以返回8,也就是-8的绝对值"]},{label:"AVERAGE",value:"average",des:["AVERAGE函数可以获取一组数值的算术平均值","用法:AVERAGE(数字1,数字2,...)","示例:AVERAGE({语文成绩},{数学成绩}, {英语成绩})返回三门课程的平均分"]},{label:"CEILING",value:"ceiling",des:["CEILING函数可以将数字增大到最接近原值的指定因数的倍数","用法:CEILING(数字,因数)","示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字"]},{label:"COUNT",value:"count",des:["COUNT函数可以获取参数的数量","用法:COUNT(值,值,...)","示例:COUNT(小明,小王,小张,小李)返回4,也就是人员的数量"]},{label:"COUNTIF",value:"countif",des:["COUNTIF函数可以获取数组中满足条件的参数个数","用法:COUNTIF(数组,'条件')","示例:COUNTIF(子表单.性别, '女'),可得到子表单中性别填的是'女'的数据条数;COUNTIF([1,2,3,4],'>2'),可得到1,2,3,4中大于2的数字数量,结果为2。"]},{label:"FIXED",value:"fixed",des:["FIXED函数可将数字舍入到指定的小数位数并输出为文本","用法:FIXED(数字,小数位数)","示例:FIXED(3.1415,2)返回'3.14'"]},{label:"FLOOR",value:"floor",des:["FLOOR函数可将数字减小到最接近原值的指定因数的倍数","用法:FLOOR(数字,因数)","示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字"]},{label:"INT",value:"int",des:["INT函数可以获取一个数的整数部分","用法:INT(数字)","示例:INT(3.1415)返回3,也就是3.1415的整数部分"]},{label:"LARGE",value:"large",des:["LARGE函数可以获取数据集中第k个最大值","用法:LARGE(数组,k)","示例:LARGE({学生成绩.数学成绩},1)返回子表单'学生成绩'中排名第1的'数学成绩'"]},{label:"LOG",value:"log",des:["LOG函数可以根据指定底数返回数字的对数","用法:LOG(数字,底数)","示例:LOG(100,10)返回2,也就是以10为底数100的对数"]},{label:"MAX",value:"max",des:["MAX函数可以获取一组数值的最大值","用法:MAX(数字1,数字2,...)","示例:MAX({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最高分"]},{label:"MIN",value:"min",des:["MIN函数可以获取一组数值的最小值","用法:MIN(数字1,数字2,...)","示例:MIN({语文成绩},{数学成绩},{英语成绩})返回三门课程中的最低分"]},{label:"MOD",value:"mod",des:["MOD函数可以获取两数相除的余数","用法:MOD(被除数,除数)","示例:MOD(4,3)返回1,也就是4/3的余数"]},{label:"POWER",value:"power",des:["POWER函数可以获取数字乘幂的结果","用法:POWER(数字,指数)","示例:POWER(3,2)返回9,也就是3的2次方"]},{label:"PRODUCT",value:"product",des:["PRODUCT函数可以获取一组数值的乘积","用法:PRODUCT(数字1,数字2,...)","示例:PRODUCT({单价}, {数量})获取总价,也就是单价和数量的乘积"]},{label:"RAND",value:"rand",des:["RAND函数可返回大于等于0且小于1的均匀分布随机实数","用法:RAND()","示例:RAND()返回0.424656"]},{label:"ROUND",value:"round",des:["ROUND函数可以将数字四舍五入到指定的位数","用法:ROUND(数字,数字位数)","示例:ROUND(3.1485,2)返回3.15"]},{label:"SMALL",value:"small",des:["SMALL函数可以返回数据集中第k个最小值","用法:SMALL(数组,k)","示例:SMALL({学生成绩.数学成绩}, 1)返回子表单'学生成绩'中排名倒数第一的'数学成绩'"]},{label:"SQRT",value:"sqrt",des:["SQRT函数可以获取一个数字的正平方根","用法:SQRT(数字)","示例:SQRT(9)返回3,也就是9的正平方根"]},{label:"SUM",value:"sum",des:["SUM函数可以获取一组数值的总和","用法:SUM(数字1,数字2,...)","示例:SUM({语文成绩},{数学成绩}, {英语成绩})返回三门课程的总分"]},{label:"SUMPRODUCT",value:"sumproduct",des:["SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和","用法:SUMPRODUCT(数组,数组...)","示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值"]}],s=(0,n.ref)(!1),d=(0,n.ref)([]),c=(0,n.reactive)({cells:[],cursor:0}),f=(0,n.computed)({get(){return JSON.parse(a.modelValue||"[]")},set(y){r("update:modelValue",y.length>0?JSON.stringify(y):""),r("change",{value:y.length>0?JSON.stringify(y):"",data:y})}}),p=y=>{d.value=y},u=(y,x)=>{const E={value:y,type:x};if(c.cells.splice(c.cursor,0,E),c.cursor+=1,x==="fun"){const _={value:"(",type:x},V={value:")",type:x};c.cells.splice(c.cursor,0,_,V),c.cursor+=1}},h=()=>{c.cursor>0&&(c.cursor-=1)},g=()=>{c.cursor<c.cells.length&&(c.cursor+=1)},m=()=>{c.cursor>0&&(c.cells.splice(c.cursor-1,1),c.cursor-=1)},w=()=>{c.cells=[],c.cursor=0},k=()=>{c.cells=kt(f.value),c.cursor=c.cells.length,s.value=!0},C=()=>{f.value=c.cells,s.value=!1},v=()=>{c.cells=[],c.cursor=0,s.value=!1},b=(0,n.computed)(()=>{const y={};return a.list.forEach(x=>{x.children.forEach(E=>{y[E.value]=`${x.label}.${E.label}`})}),y}),S=y=>b.value[y]||y;return(y,x)=>{const E=(0,n.resolveComponent)("j-button"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("el-space"),T=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(E,(0,n.mergeProps)(y.$attrs,{type:e.type,size:e.size,label:e.label,onClick:k}),null,16,["type","size","label"]),(0,n.createVNode)(T,{visible:s.value,title:(0,n.unref)(o)("公式设置"),height:800,width:1200,onOk:C,onClosed:v},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",ug,[(0,n.createElementVNode)("div",fg,[(0,n.createElementVNode)("div",pg,[(0,n.createElementVNode)("span",hg,(0,n.toDisplayString)((0,n.unref)(o)("计算公式"))+"=",1),(0,n.createVNode)(V,null,{default:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{type:"text",onClick:h},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowLeft"})]),_:1}),(0,n.createVNode)(E,{type:"text",onClick:g},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(_,{icon:"arrowRight"})]),_:1}),(0,n.createVNode)(E,{type:"link",label:"退格",onClick:m}),(0,n.createVNode)(E,{type:"link",danger:"",label:"清空",onClick:w})]),_:1})]),(0,n.createElementVNode)("div",gg,[c.cells.length==0?((0,n.openBlock)(),(0,n.createElementBlock)("span",mg)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.cells,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:A},[P.type=="fun"?((0,n.openBlock)(),(0,n.createElementBlock)("span",yg,(0,n.toDisplayString)(P.value.toUpperCase()),1)):P.type=="comp"?((0,n.openBlock)(),(0,n.createElementBlock)("span",vg," #"+(0,n.toDisplayString)(S(P.value))+"# ",1)):P.type=="num"?((0,n.openBlock)(),(0,n.createElementBlock)("span",bg,(0,n.toDisplayString)(P.value),1)):(0,n.createCommentVNode)("",!0),A+1==c.cursor?((0,n.openBlock)(),(0,n.createElementBlock)("span",wg)):(0,n.createCommentVNode)("",!0)],64))),128))])]),(0,n.createVNode)(V,{class:"j-input-count-mid"},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(l,(P,A)=>(0,n.createVNode)(E,{key:A,label:P.label+"",onClick:N=>u(P.value,"num")},null,8,["label","onClick"])),64))]),_:1}),(0,n.createElementVNode)("div",Cg,[(0,n.createElementVNode)("div",xg,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.list,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:A},[(0,n.createElementVNode)("div",kg,(0,n.toDisplayString)((0,n.unref)(o)(P.label)),1),(0,n.createVNode)(V,{size:[8,8],wrap:"",style:{"margin-bottom":"16px"}},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(P.children,N=>((0,n.openBlock)(),(0,n.createBlock)(E,{key:N.value,onClick:M=>u(N.value,"comp"),label:(0,n.unref)(o)(N.label)},null,8,["onClick","label"]))),128))]),_:2},1024)],64))),128))]),(0,n.createElementVNode)("div",Sg,[(0,n.createElementVNode)("div",Eg,[(0,n.createElementVNode)("span",_g,(0,n.toDisplayString)((0,n.unref)(o)("函数列表")),1),(0,n.createElementVNode)("div",Bg,[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i,(P,A)=>(0,n.createVNode)(E,{type:"text",style:{"border-radius":"0","justify-content":"left"},key:A,onMouseover:N=>p(P.des),onClick:N=>u(P.value,"fun"),label:P.label},null,8,["onMouseover","onClick","label"])),64))])]),(0,n.createElementVNode)("div",Rg,[(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("ul",null,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(d.value,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)("li",{key:A,style:{"margin-bottom":"8px"}},[(0,n.createElementVNode)("span",Tg,(0,n.toDisplayString)((0,n.unref)(o)(P)),1)]))),128))])])])])])])]),_:1},8,["visible","title"])])}}}),Mg=Vg,ds=ve(Mg),Ng={key:0},Ag=(0,n.defineComponent)({name:"JCountUp",__name:"count-up",props:{animation:{type:Boolean,default:!0},startValue:{default:0},endValue:{},decimals:{default:0},duration:{default:2},options:{default:()=>({})},callback:{type:Function,default:void 0}},setup(e,{expose:t}){const o=e,a=(0,n.computed)(()=>({...o})),r=(0,n.ref)(),l=(0,n.ref)(null),i=(0,n.computed)(()=>o.options);(0,n.onMounted)(()=>{o.animation&&s()}),(0,n.watch)(()=>o.decimals,()=>{l.value&&l.value.update&&(l.value.options.decimalPlaces=o.decimals,l.value.reset(),l.value.update(o.endValue))},{deep:!0}),(0,n.watch)(()=>o.endValue,u=>{l.value&&l.value.update&&l.value.update(u)});const s=()=>{l.value||(i.value.startVal=o.startValue,i.value.decimalPlaces=o.decimals,i.value.duration=o.duration,l.value=new Ku.CountUp(r.value,Number(o.endValue),i.value),l.value.start(()=>{o.callback?.(l.value)}))};return(0,n.onUnmounted)(()=>{l.value=null}),(0,n.onBeforeUnmount)(()=>{l.value=null}),t({myProps:a,el:r,init:s,start:u=>{l.value&&l.value.start&&l.value.start(()=>{u?.(l.value)})},pauseResume:()=>{l.value&&l.value.pauseResume&&l.value.pauseResume()},reset:()=>{l.value&&l.value.reset&&l.value.reset()},update:u=>{l.value&&l.value.update&&l.value.update(u)}}),(u,h)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"el",ref:r},[e.animation?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("span",Ng,(0,n.toDisplayString)(e.endValue),1))],512))}}),jg=Ag,us=ve(jg),Pg={class:"j-block j-data-panel"},zg={key:0,class:"j-data-panel-header"},Hg={style:{color:"var(--j-color-text)","font-size":"14px","font-weight":"bold"}},Lg={class:"j-data-panel-header-right"},Og={class:"j-data-panel-body"},Dg=(0,n.defineComponent)({name:"JDataPanel",__name:"data-panel",props:{title:{default:void 0}},setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Pg,[e.title?((0,n.openBlock)(),(0,n.createElementBlock)("div",zg,[(0,n.createElementVNode)("div",Hg,(0,n.toDisplayString)(e.title),1),(0,n.createElementVNode)("div",Lg,[(0,n.renderSlot)(t.$slots,"titleRight")])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Og,[(0,n.renderSlot)(t.$slots,"default")])]))}}),Ig=Dg,fs=ve(Ig),Fg={class:"j-divider-content"},$g=(0,n.defineComponent)({name:"JDivider",__name:"divider",props:{content:{},borderStyle:{default:"solid"},size:{},color:{},contentPosition:{default:"center"}},setup(e){const t=e,o=(0,n.computed)(()=>{const r={color:t.color};return t.size&&Number(t.size)&&(r.fontSize=`${t.size}px`),r}),a=(0,n.computed)(()=>({borderTopStyle:t.borderStyle}));return(r,l)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`j-divider-container j-divider-${e.contentPosition}`),style:(0,n.normalizeStyle)(o.value)},[(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-left",style:(0,n.normalizeStyle)(a.value)},null,4),(0,n.createElementVNode)("div",Fg,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.content||""),1)]),(0,n.createElementVNode)("div",{class:"j-divider-line j-divider-line-right",style:(0,n.normalizeStyle)(a.value)},null,4)],6))}}),Wg=$g,ps=ve(Wg),Ug={class:"j-hpanel"},Jg={class:"j-hpanel-main"},Yg=(0,n.defineComponent)({name:"JHpanel",__name:"hpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Ug,[(0,n.renderSlot)(t.$slots,"left"),(0,n.createElementVNode)("div",Jg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"right")]))}}),Kg=Yg,hs=ve(Kg),Gg={class:"j-vpanel"},qg={class:"j-vpanel-main"},Xg=(0,n.defineComponent)({name:"JVpanel",__name:"vpanel",setup(e){return(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Gg,[(0,n.renderSlot)(t.$slots,"top"),(0,n.createElementVNode)("div",qg,[(0,n.renderSlot)(t.$slots,"default")]),(0,n.renderSlot)(t.$slots,"bottom")]))}}),Zg=Xg,gs=ve(Zg),Qg=(0,n.defineComponent)({name:"JInputButton",__name:"input-button",props:{modelValue:{},type:{},layerType:{},btnText:{default:"设置"},icon:{},title:{},size:{default:"default"},width:{default:1e3},height:{default:600},destroyOnClose:{type:Boolean,default:!1},open:{},ok:{},beforeClose:{},closed:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),l=(0,n.ref)(),i=async(f,p)=>{o.ok&&(f("保存数据中..."),l.value=await o.ok(),a("update:modelValue",l.value),a("change",{value:l.value}),p(),r.value.close())},s=()=>o.beforeClose?o.beforeClose(l.value):!0,d=()=>{o.closed?.()},c=()=>{r.value.open(o.title||o.btnText,o.layerType),setTimeout(()=>{o.open?.(l.value)},200)};return(0,n.watch)(()=>o.modelValue,f=>{l.value=f},{immediate:!0}),(f,p)=>{const u=(0,n.resolveComponent)("j-button"),h=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(u,(0,n.mergeProps)({style:{width:"auto"}},f.$attrs,{type:e.type,label:e.btnText,size:e.size,icon:e.icon,onClick:c}),null,16,["type","label","size","icon"]),(0,n.createVNode)(h,{ref_key:"layerRef",ref:r,height:e.height,width:e.width,"destroy-on-close":e.destroyOnClose,"btn-text":"确定","before-close":s,onOk:i,onClosed:d},{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(f.$slots,"default")]),_:3},8,["height","width","destroy-on-close"])],64)}}}),e0=Qg,ms=ve(e0),t0=(0,n.defineComponent)({name:"JInputCode",__name:"input-code",props:{modelValue:{},type:{},mode:{default:"application/json"},btnText:{default:"设置脚本"},icon:{},title:{},size:{},width:{default:1200},height:{default:600},example:{default:""},beforeClose:{},isHint:{type:Boolean,default:!1},handleHint:{}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.computed)({get:()=>o.modelValue,set:p=>{a("update:modelValue",p)}}),l=(0,n.ref)(""),i=p=>{l.value=p},s=()=>l.value,d=p=>o.beforeClose?o.beforeClose(p):!0,c=p=>{a("change",p)},f=(0,n.computed)(()=>o.modelValue&&o.modelValue.trim()?`${o.btnText}(已设置)`:o.btnText);return(p,u)=>{const h=(0,n.resolveComponent)("j-code-mirror"),g=(0,n.resolveComponent)("j-layout"),m=(0,n.resolveComponent)("j-input-button");return(0,n.openBlock)(),(0,n.createBlock)(m,{modelValue:r.value,"onUpdate:modelValue":u[1]||(u[1]=w=>r.value=w),type:e.type,"btn-text":f.value,title:e.title,size:e.size,icon:e.icon,width:e.width,height:e.height,"before-close":d,ok:s,open:i,onChange:c},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{"right-move":!1,right:560},(0,n.createSlots)({default:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=w=>l.value=w),mode:e.mode,"is-hint":e.isHint,"handle-hint":e.handleHint},null,8,["modelValue","mode","is-hint","handle-hint"])]),_:2},[e.example?{name:"right",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(h,{"model-value":e.example,mode:e.mode,readonly:""},null,8,["model-value","mode"])]),key:"0"}:void 0]),1024)]),_:1},8,["modelValue","type","btn-text","title","size","icon","width","height"])}}}),n0=t0,ys=ve(n0),o0=(0,n.defineComponent)({name:"JInputColor",__name:"input-color",props:{modelValue:{},placeholder:{default:"请选择颜色"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},onlyButton:{type:Boolean,default:!1},inputType:{default:"append"},showAlpha:{type:Boolean,default:!0},predefineColors:{default:()=>["#ff4500","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgba(255, 69, 0, 0.68)","rgb(255, 120, 0)","hsv(51, 100, 98)","hsva(120, 40, 94, 0.5)","hsl(181, 100%, 37%)","hsla(209, 100%, 56%, 0.73)","#c7158577"]},colorFormat:{default:"hex"},name:{},autofocus:{type:Boolean},tabindex:{},validateEvent:{type:Boolean,default:!0},inputStyle:{default:()=>({})}},emits:["update:modelValue","input","focus","blur","clear","change","color-change","active-change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.computed)({get(){return a.modelValue===null||a.modelValue===void 0?i.value:a.modelValue},set(m){i.value=m,r("update:modelValue",m),r("input",m)}}),d=m=>{r("input",m)},c=m=>{r("focus",m)},f=m=>{r("blur",m)},p=()=>{r("clear"),r("update:modelValue","")},u=m=>{r("change",m)},h=m=>{r("color-change",m),r("change",m)},g=m=>{r("active-change",m)};return t({focus:()=>{l.value?.focus()},blur:()=>{l.value?.blur()},select:()=>{l.value?.select()}}),(m,w)=>{const k=(0,n.resolveComponent)("el-color-picker"),C=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-input-color",{"j-input-color-only-button":e.onlyButton},{"j-input-color-disabled":e.disabled},`j-input-color-${e.size}`])},[(0,n.createVNode)(C,(0,n.mergeProps)({ref_key:"inputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=v=>s.value=v),placeholder:e.placeholder,size:e.size,readonly:e.readonly||e.onlyButton,clearable:e.readonly||e.onlyButton?!1:e.clearable,disabled:e.disabled,name:e.name,autofocus:e.autofocus,tabindex:e.tabindex,"validate-event":e.validateEvent,"input-style":e.inputStyle},m.$attrs,{onInput:d,onFocus:c,onBlur:f,onClear:p,onChange:u}),{[e.inputType]:(0,n.withCtx)(()=>[(0,n.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":w[0]||(w[0]=v=>s.value=v),size:e.size,disabled:e.disabled||e.readonly,"show-alpha":e.showAlpha,predefine:e.predefineColors,"color-format":e.colorFormat,onChange:h,onActiveChange:g},null,8,["modelValue","size","disabled","show-alpha","predefine","color-format"])]),_:2},1040,["modelValue","placeholder","size","readonly","clearable","disabled","name","autofocus","tabindex","validate-event","input-style"])],2)}}}),a0=o0,vs=ve(a0),r0=(0,n.defineComponent)({name:"JTitle",__name:"title",props:{title:{default:""},style:{default:void 0},class:{default:void 0},color:{default:void 0},size:{default:void 0},weight:{default:"normal"},align:{default:"left"}},setup(e){const t=e,o=(0,n.computed)(()=>t.class||""),a=(0,n.computed)(()=>{const r={...t.style};return t.color&&(r.color=t.color),t.size&&(typeof t.size=="number"?r.fontSize=`${t.size}px`:r.fontSize=t.size),t.weight&&(r.fontWeight=t.weight),t.align&&(r.textAlign=t.align),r});return(r,l)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-title",o.value]),style:(0,n.normalizeStyle)(a.value)},(0,n.toDisplayString)(e.title),7))}}),l0=r0,bs=ve(l0),i0={class:"j-decorated-title-wrapper1"},s0={class:"j-decorated-title-wrapper1-line"},c0={key:3,class:"j-decorated-title-wrapper2"},d0={class:"wrapper2"},u0={class:"wrapper2-line"},f0={key:4,class:"j-decorated-title-wrapper3"},p0={class:"wrapper3"},h0={class:"wrapper3-line"},g0={key:5,class:"j-decorated-title-wrapper4"},m0={class:"wrapper4"},y0={class:"wrapper4-center"},v0={key:6,class:"j-decorated-title-wrapper5"},b0={class:"wrapper5"},w0={class:"wrapper5-left"},C0={class:"wrapper5-right"},x0=(0,n.defineComponent)({name:"JDecoratedTitle",__name:"decorated-title",props:{title:{default:""},content:{},style:{default:void 0},class:{default:void 0},color:{default:void 0},contentColor:{},backgroundColor:{},size:{default:14},contentSize:{default:12},align:{default:void 0},weight:{default:"normal"},titleType:{default:"title1"}},setup(e){const{t}=tt(),o=e,a=(0,n.computed)(()=>o.class||""),r=(0,n.computed)(()=>({"font-size":o.size?`${["title5","title7","title8","title9"].includes(o.titleType)?14:o.size}px`:"","font-weight":o.weight,color:o.color})),l=(0,n.computed)(()=>({"font-size":o.contentSize?`${o.contentSize}px`:"",color:o.contentColor})),i=(0,n.computed)(()=>({"--el-border-style":o.titleType==="title3"?"solid":"dashed",borderColor:o.backgroundColor||"var(--j-color-primary)",margin:"0 !important"})),s=(0,n.computed)(()=>o.backgroundColor||"var(--j-color-primary-hover)"),d=(0,n.computed)(()=>({...o.style}));return(c,f)=>{const p=(0,n.resolveComponent)("el-divider");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-decorated-title",a.value]),style:(0,n.normalizeStyle)(d.value)},[e.titleType==="title2"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):["title3","title4"].includes(e.titleType||"")?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createVNode)(p,{class:"m-0",style:(0,n.normalizeStyle)(i.value)},null,8,["style"]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title5"?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createElementVNode)("div",i0,[(0,n.createElementVNode)("div",{class:"j-decorated-title-wrapper1-title",style:(0,n.normalizeStyle)([r.value,{backgroundColor:s.value}])},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",s0,[(0,n.createElementVNode)("div",{class:"wrapper-line",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram1",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram2",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper-pm wrapper-parallelogram3",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)([l.value,{textAlign:"left"}])},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)],64)):e.titleType==="title6"?((0,n.openBlock)(),(0,n.createElementBlock)("div",c0,[(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5),(0,n.createElementVNode)("div",d0,[(0,n.createElementVNode)("div",u0,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper2-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title7"?((0,n.openBlock)(),(0,n.createElementBlock)("div",f0,[(0,n.createElementVNode)("div",p0,[(0,n.createElementVNode)("div",h0,[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper3-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4)]),(0,n.createElementVNode)("p",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title8"?((0,n.openBlock)(),(0,n.createElementBlock)("div",g0,[(0,n.createElementVNode)("div",m0,[(0,n.createElementVNode)("div",{class:"wrapper4-bg",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",y0,[(0,n.createElementVNode)("div",{class:"wrapper4-center-label",style:(0,n.normalizeStyle)({backgroundColor:s.value})},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-triangle right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border left-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper4-center-border right-border",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):e.titleType==="title9"?((0,n.openBlock)(),(0,n.createElementBlock)("div",v0,[(0,n.createElementVNode)("div",b0,[(0,n.createElementVNode)("div",w0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-left-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-left-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[0]||(f[0]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-left-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-left-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-left-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)]),(0,n.createElementVNode)("div",{class:"wrapper5-center",style:(0,n.normalizeStyle)([{backgroundColor:s.value}])},[(0,n.createElementVNode)("span",{style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5)],4),(0,n.createElementVNode)("div",C0,[(0,n.createElementVNode)("div",{class:"wrapper5-triangle wrapper5-right-triangle",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-block wrapper5-right-block",style:(0,n.normalizeStyle)({backgroundColor:s.value})},null,4),f[1]||(f[1]=(0,n.createElementVNode)("div",{class:"wrapper5-square wrapper5-right-square"},null,-1)),(0,n.createElementVNode)("div",{class:"wrapper5-line1 wrapper5-right-line1",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4),(0,n.createElementVNode)("div",{class:"wrapper5-line2 wrapper5-right-line2",style:(0,n.normalizeStyle)({borderColor:s.value})},null,4)])]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.content||"")),5)])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:7,style:(0,n.normalizeStyle)(r.value)},(0,n.toDisplayString)((0,n.unref)(t)(e.title||"")),5))],6)}}}),k0=x0,ws=ve(k0),S0={class:"j-block"},E0={class:"j-input-decorated-title-wrapper mb-0px"},_0=(0,n.defineComponent)({name:"JInputDecoratedTitle",__name:"input-decorated-title",props:{modelValue:{default:"title1"},backgroundColor:{default:void 0},color:{default:void 0},weight:{default:void 0},contentColor:{default:void 0},align:{default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const{t:o}=tt(),a=t,r=(0,n.ref)(),l=c=>{r.value?.hide(),a("update:modelValue",c),a("change",c)},i=(0,n.ref)("mdi:chevron-down"),s=()=>{i.value="mdi:chevron-up"},d=()=>{i.value="mdi:chevron-down"};return(c,f)=>{const p=(0,n.resolveComponent)("j-decorated-title"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createElementBlock)("div",S0,[(0,n.createVNode)(h,{width:270,placement:"top-start",trigger:"click","popper-class":"j-input-decorated-title-popover",ref_key:"popoverRef",ref:r,onShow:s,onHide:d},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",E0,[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:e.modelValue,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align"]),(0,n.createVNode)(u,{icon:i.value,size:20},null,8,["icon"])])]),default:(0,n.withCtx)(()=>[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(8,g=>(0,n.createElementVNode)("div",{class:"j-input-decorated-title-wrapper",key:g},[(0,n.createVNode)(p,{title:(0,n.unref)(o)("这里是标题"),content:(0,n.unref)(o)("这里是信息描述"),titleType:`title${g}`,backgroundColor:e.backgroundColor,color:e.color,weight:e.weight,contentColor:e.contentColor,align:e.align,onClick:m=>l(`title${g}`)},null,8,["title","content","titleType","backgroundColor","color","weight","contentColor","align","onClick"])])),64))]),_:1},512)])}}}),B0=_0,Cs=ve(B0),R0=(0,n.defineComponent)({name:"JCodeMirror",__name:"code-mirror",props:{modelValue:{default:""},mode:{default:"javascript"},readonly:{type:Boolean,default:!1},height:{default:void 0},isHint:{type:Boolean,default:!1},handleHint:{type:Function,default:void 0},isScrollToBottom:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i=(0,n.ref)("");let s=null;const d=m=>{switch(m){case"application/javascript":case"javascript":case"text/javascript":return(0,yo.javascript)();case"css":case"text/css":return(0,Xu.css)();case"html":case"text/html":return(0,Zu.html)();case"json":case"application/json":return(0,Qu.json)();case"sql":case"text/x-sql":return(0,ef.sql)();case"xml":case"text/xml":return(0,tf.xml)();case"python":case"text/x-python":return(0,nf.python)();case"markdown":case"text/markdown":return(0,of.markdown)();case"java":case"text/x-java":return(0,af.java)();case"vue":case"text/x-vue":return(0,yo.javascript)({jsx:!0,typescript:!1});case"typescript":case"application/typescript":return(0,yo.javascript)({jsx:!1,typescript:!0});case"jsx":return(0,yo.javascript)({jsx:!0,typescript:!1});case"tsx":return(0,yo.javascript)({jsx:!0,typescript:!0});default:return(0,yo.javascript)()}},c=()=>{const m=[qu.basicSetup,(0,Qt.lineNumbers)(),(0,Qt.highlightActiveLineGutter)(),(0,Qt.highlightSpecialChars)(),(0,Cr.history)(),(0,Qt.drawSelection)(),(0,Qt.dropCursor)(),(0,vo.indentOnInput)(),(0,vo.bracketMatching)(),(0,wr.closeBrackets)(),(0,Qt.rectangularSelection)(),(0,vo.foldGutter)(),Qt.keymap.of([...wr.closeBracketsKeymap,...Cr.defaultKeymap,...Cr.historyKeymap,...vo.foldKeymap]),(0,vo.syntaxHighlighting)(vo.defaultHighlightStyle)];return m.push(d(a.mode)),a.readonly&&m.push(br.EditorState.readOnly.of(!0)),a.isHint&&a.handleHint&&m.push((0,wr.autocompletion)({override:[w=>{const k=w.matchBefore(/\w*/);if(!k||k.from===k.to)return null;const C=a.handleHint(k.text);return C.length===0?null:{from:k.from,options:C.map(v=>({label:typeof v=="string"?v:v.label||v.name||"",detail:typeof v=="string"?"":v.detail||"",type:typeof v=="string"?"variable":v.type||"variable",apply:typeof v=="string"?v:v.apply||v.name||v.label||""}))}}]})),m.push(Qt.EditorView.updateListener.of(w=>{if(w.docChanged){const k=w.state.doc.toString();i.value=k,r("update:modelValue",k),r("change",{value:k})}})),m},f=async()=>{l.value&&(s=new Qt.EditorView({state:br.EditorState.create({doc:a.modelValue,extensions:c()}),parent:l.value}),i.value=a.modelValue)},p=()=>{if(!s)return;const m=s.state.doc.toString();s&&s.destroy();const w=br.EditorState.create({doc:m,extensions:c()});l.value&&(s=new Qt.EditorView({state:w,parent:l.value}));const k=s.state.doc.toString();k!==a.modelValue&&s.dispatch({changes:{from:0,to:k.length,insert:a.modelValue}})},u=()=>{if(!s)return;const m=s.state.doc.length;s.dispatch({selection:{anchor:m,head:m},scrollIntoView:!0}),setTimeout(()=>{if(s){const w=s.state.doc.length;s.dispatch({selection:{anchor:w,head:w},scrollIntoView:!0})}},100)},h=()=>{let m=(0,Gu.format)(a.modelValue);m=m.replace(/{ JCODE_SASSID }/g,"{JCODE_SASSID}").replace(/{ JCODE_SASSID_NOTT }/g,"{JCODE_SASSID_NOTT}").replace(/{ JCODE_SASSID_NOTA }/g,"{JCODE_SASSID_NOTA}").replace(/@ /g,"@"),r("update:modelValue",m),r("change",{value:m})};let g=null;return(0,n.watch)(()=>a.modelValue,m=>{m!==i.value&&(i.value=m,s&&p(),setTimeout(()=>{s&&a.isScrollToBottom&&u()}))}),(0,n.watch)(()=>a.mode,()=>{s&&p()}),(0,n.onMounted)(async()=>{await(0,n.nextTick)(),await f(),typeof window<"u"&&window.ResizeObserver&&l.value&&(g=new ResizeObserver(()=>{s&&s.dispatch({scrollIntoView:!0})}),g.observe(l.value))}),(0,n.onUnmounted)(()=>{g&&l.value&&(g.unobserve(l.value),g.disconnect(),g=null),s&&(s.destroy(),s=null)}),t({sqlFormatter:h}),(m,w)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"codeWraperRef",ref:l,class:"j-code-mirror",style:(0,n.normalizeStyle)({height:e.height?`${e.height}px`:""})},null,4))}}),T0=R0,xs=ve(T0),V0=(0,n.defineComponent)({__name:"slider-captcha-action",props:{actionStyle:{},isPassing:{type:Boolean},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("actionRef"),r=(0,n.ref)("0"),l=(0,n.computed)(()=>{const{actionStyle:s,toLeft:d}=o;return{...s,left:d?"0":r.value,backgroundColor:"var(--j-color-bg-container)",borderRadius:i.value?"6px":void 0,transition:d?"all 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0}}),i=(0,n.computed)(()=>Number.parseInt(r.value)>10&&!o.isPassing);return t({getEl:()=>a.value,getStyle:()=>a?.value?.style,setLeft:s=>{r.value=s}}),(s,d)=>{const c=(0,n.resolveComponent)("j-icon");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"actionRef",ref:a,style:(0,n.normalizeStyle)(l.value),class:"j-slider-captcha-action",name:"captcha-action"},[e.isPassing?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:check-circle-outline"})):((0,n.openBlock)(),(0,n.createBlock)(c,{key:1,color:"var(--j-color-text-2)",class:"nav-checked",icon:"mdi:chevron-double-right"}))],4)}}}),M0=V0,N0=(0,n.defineComponent)({__name:"slider-captcha-bar",props:{barStyle:{},toLeft:{type:Boolean}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("barRef"),r=(0,n.ref)("0"),l=(0,n.computed)(()=>{const{barStyle:i,toLeft:s}=o;return{...i,width:s?"0":r.value,transition:s?"width 300ms cubic-bezier(0.4, 0, 0.2, 1)":void 0,backgroundColor:"var(--j-color-success)",position:"absolute",height:"100%"}});return t({getEl:()=>a.value,setWidth:i=>{r.value=i}}),(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,style:(0,n.normalizeStyle)(l.value)},null,4))}}),A0=N0,j0=(0,n.defineComponent)({__name:"slider-captcha-content",props:{contentStyle:{type:Object,default:()=>({})},isPassing:{type:Boolean,default:!1},animationDuration:{type:[String,Number],default:2},animationIterationCount:{type:[String,Number],default:"infinite"}},setup(e,{expose:t}){const o=e,a=(0,n.useTemplateRef)("contentRef"),r=(0,n.computed)(()=>{const{contentStyle:i}=o;return{...i,fontSize:"12px"}});t({getEl:()=>a.value});const l=(0,n.computed)(()=>({animation:`shine ${o.animationDuration}s linear ${o.animationIterationCount}`}));return(i,s)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"contentRef",ref:a,class:(0,n.normalizeClass)([{success:e.isPassing},"j-slider-captcha-content"]),style:(0,n.normalizeStyle)(r.value)},[(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)(l.value),class:"j-spine-text"},(0,n.toDisplayString)(e.isPassing?"验证成功":"请按住滑块拖动"),5)],6))}}),P0=j0,z0=(0,n.defineComponent)({name:"JSliderCaptcha",__name:"slider-captcha",props:(0,n.mergeModels)({class:{},actionStyle:{default:()=>({})},barStyle:{default:()=>({})},contentStyle:{default:()=>({})},wrapperStyle:{default:()=>({})},successText:{default:""},text:{default:""}},{modelValue:{type:Boolean,default:void 0},modelModifiers:{}}),emits:(0,n.mergeModels)(["end","move","start","success"],["update:modelValue"]),setup(e,{emit:t}){const o=e,a=t,r=(0,n.useModel)(e,"modelValue"),l=(0,n.reactive)({endTime:0,isMoving:!1,isPassing:!1,moveDistance:0,startTime:0,toLeft:!1}),i=(0,n.useTemplateRef)("wrapperRef"),s=(0,n.useTemplateRef)("barRef"),d=(0,n.useTemplateRef)("contentRef"),c=(0,n.useTemplateRef)("actionRef");(0,n.watch)(()=>l.isPassing,k=>{if(k){const{endTime:C,startTime:v}=l;a("success",{isPassing:k,time:((C-v)/1e3).toFixed(1)}),r.value=k}}),(0,n.watchEffect)(()=>{l.isPassing=!!r.value});function f(k){return"pageX"in k?k.pageX:"touches"in k&&k.touches[0]?k.touches[0].pageX:0}function p(k){l.isPassing||c.value&&(a("start",k),l.moveDistance=f(k)-Number.parseInt(c.value.getStyle().left.replace("px","")||"0",10),l.startTime=Date.now(),l.isMoving=!0)}function u(k){const C=i.value?.offsetWidth??220,v=k?.offsetWidth??40;return{actionWidth:v,offset:C-v-6,wrapperWidth:C}}function h(k){const{isMoving:C,moveDistance:v}=l;if(C){const b=(0,n.unref)(c),S=(0,n.unref)(s);if(!b||!S)return;const{actionWidth:y,offset:x,wrapperWidth:E}=u(b.getEl()),_=f(k)-v;a("move",{event:k,moveDistance:v,moveX:_}),_>0&&_<=x?(b.setLeft(`${_}px`),S.setWidth(`${_+y/2}px`)):_>x&&(b.setLeft(`${E-y}px`),S.setWidth(`${E-y/2}px`),m())}}function g(k){const{isMoving:C,isPassing:v,moveDistance:b}=l;if(C&&!v){a("end",k);const S=c.value,y=(0,n.unref)(s);if(!S||!y)return;const x=f(k)-b,{actionWidth:E,offset:_,wrapperWidth:V}=u(S.getEl());x<_?w():(S.setLeft(`${V-E}px`),y.setWidth(`${V-E/2}px`),m()),l.isMoving=!1}}function m(){l.endTime=Date.now(),l.isPassing=!0,l.isMoving=!1}function w(){l.isMoving=!1,l.isPassing=!1,l.moveDistance=0,l.toLeft=!1,l.startTime=0,l.endTime=0;const k=(0,n.unref)(c),C=(0,n.unref)(s),v=(0,n.unref)(d);!k||!C||!v||(v.getEl().style.width="100%",l.toLeft=!0,setTimeout(()=>{l.toLeft=!1,k.setLeft("0"),C.setWidth("0")},300))}return(k,C)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"wrapperRef",ref:i,class:(0,n.normalizeClass)(["j-slider-captcha slider-border",o.class]),style:(0,n.normalizeStyle)([{"background-color":"var(--j-color-bg)"},e.wrapperStyle]),onMouseleave:g,onMousemove:h,onMouseup:g,onTouchend:g,onTouchmove:h},[(0,n.createVNode)(A0,{ref_key:"barRef",ref:s,"bar-style":e.barStyle,"to-left":l.toLeft},null,8,["bar-style","to-left"]),(0,n.createVNode)(P0,{ref_key:"contentRef",ref:d,"content-style":e.contentStyle,"is-passing":l.isPassing},null,8,["content-style","is-passing"]),(0,n.createVNode)(M0,{ref_key:"actionRef",ref:c,"action-style":e.actionStyle,"is-passing":l.isPassing,"to-left":l.toLeft,onMousedown:p,onTouchstart:p},null,8,["action-style","is-passing","to-left"])],38))}}),H0=z0,ks=ve(H0),L0=(0,n.defineComponent)({name:"JSubMenu",__name:"index",props:{pId:{type:String}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{getMenuMap:r,toArray:l,activeMenu:i,theme:s}=Co(),{getHMoreMenus:d}=wi(),c=(0,n.ref)([]);o.pId==="moreId"?c.value=d.value:c.value=l(r()[o.pId||""]||[],[]);const f=g=>{const m=c.value.find(w=>w.active);m?.value!==g.value&&(m&&(m.active=!1),a("click",g))},{list:p,containerProps:u,wrapperProps:h}=(0,xr.useVirtualList)(c,{itemHeight:44});return(g,m)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-sub-menu-content",{"j-menu-dark":(0,n.unref)(s)==="dark"}],style:{"max-height":"calc(100vh - 80px)","border-radius":"8px"}},(0,n.unref)(u)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(h))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p),w=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:w.data.value,"parent-actives":(0,n.unref)(i)?.pid?.split(".")||[],item:w.data,"is-sub":"",onClick:f},null,8,["parent-actives","item"]))),128))],16)],16))}}),O0=L0,D0={class:"j-menu-item-label"},I0={class:"j-menu-item-label"},F0={key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow","sub"])},$0={class:"j-menu-item-label"},W0=(0,n.defineComponent)({name:"JMenuItem",__name:"index",props:{item:{type:Object,default:()=>({})},parentActives:{type:Array,default:()=>[]},collapsed:Boolean,isSub:Boolean,isHorizontal:Boolean,isVertical:Boolean},emits:["click"],setup(e,{emit:t}){const{t:o}=tt(),{activeMenuId:a}=Co(),r=t,l=i=>{r("click",i)};return(i,s)=>{const d=(0,n.resolveComponent)("j-icon"),c=(0,n.resolveComponent)("el-tooltip"),f=(0,n.resolveComponent)("el-popover");return e.collapsed&&!e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,placement:"right"},{content:(0,n.withCtx)(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1)]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}]),onClick:s[0]||(s[0]=(0,n.withModifiers)(p=>l(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",size:18},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",D0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2)]),_:1})):(e.collapsed||e.isSub||e.isHorizontal||e.isVertical)&&e.item.hasChildren?((0,n.openBlock)(),(0,n.createBlock)(f,{key:1,placement:e.isHorizontal?"bottom-start":"right-start","show-arrow":!1,width:"200px","popper-class":"j-sub-menu"},{reference:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*34+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),class:"j-menu-item-icon",size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",I0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren&&!e.isHorizontal&&!e.isVertical?((0,n.openBlock)(),(0,n.createElementBlock)("div",F0)):(0,n.createCommentVNode)("",!0)],6)],2)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(O0,{"p-id":e.item.value,onClick:l},null,8,["p-id"])]),_:1},8,["placement"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:(0,n.normalizeClass)(["j-menu-item",{collapsed:e.collapsed,sub:e.item.indent>0}]),onClick:s[1]||(s[1]=(0,n.withModifiers)(p=>l(e.item),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-menu-item-content",{active:e.item.value===(0,n.unref)(a),"p-active":e.parentActives.includes(e.item.value)}]),style:(0,n.normalizeStyle)({"padding-left":`${e.item.indent*24+16}px`})},[e.item.icon?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,icon:e.item.icon,class:"j-menu-item-icon",style:(0,n.normalizeStyle)({"margin-right":e.item.label&&(e.isSub||!e.isVertical)?"8px":0,"background-color":e.isVertical?e.item.color:"transparent"}),size:18},null,8,["icon","style"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",$0,(0,n.toDisplayString)((0,n.unref)(o)(e.item.label)),1),e.item.hasChildren?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)(["j-menu-item-arrow",{open:e.item.open}])},null,2)):(0,n.createCommentVNode)("",!0)],6)],2))}}}),Va=W0,U0=(0,n.defineComponent)({name:"JIMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]},collapsed:Boolean},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=f=>{a("click",f)},{list:s,containerProps:d,wrapperProps:c}=(0,xr.useVirtualList)((0,n.computed)(()=>o.menuList),{itemHeight:44});return(f,p)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu",{collapsed:e.collapsed,"j-menu-dark":(0,n.unref)(l)==="dark"}]},(0,n.unref)(d)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(c))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(s),u=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:u.data.value,"parent-actives":(0,n.unref)(r)?.pid?.split(".")||[],item:u.data,collapsed:e.collapsed,class:(0,n.normalizeClass)({"menu-item-entering":u.data.entering,"menu-item-leaving":u.data.leaving}),onClick:i},null,8,["parent-actives","item","collapsed","class"]))),128))],16)],16))}}),J0=U0,Y0=(0,n.defineComponent)({name:"JHMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=(0,n.ref)(),s=(0,n.ref)(0);let d=null;(0,n.onMounted)(()=>{typeof window<"u"&&window.ResizeObserver&&i.value&&(d=new ResizeObserver(()=>{i.value&&(s.value=i.value.offsetWidth)}),d.observe(i.value))});const c=(0,n.computed)(()=>{const h=[];let g=0,m=0;const w=o.menuList.length;return o.menuList.forEach(k=>{m++;const C=(Jt(k.label)||0)+32+16+4+8;g+=C,(m===w&&g<=s.value||m<w&&g+56<=s.value)&&h.push(k)}),h.length<o.menuList.length&&h.push({value:"moreId",icon:"more-outlined",label:"",hasChildren:!0,indent:0,open:!1,active:!1}),h}),f=(0,n.computed)(()=>{const h=[];let g=0;const m=c.value.length;return o.menuList.forEach(w=>{g++,g>=m&&h.push(w)}),h}),p=(0,n.computed)(()=>{const h=r.value?.pid?.split(".")||[];return(h.length>1&&f.value.findIndex(g=>g.value===h[1])>-1||f.value.findIndex(g=>g.value===r.value?.value)>-1)&&h.push("moreId"),h}),u=h=>{a("click",h)};return Ci({getHMoreMenus:f}),(0,n.onUnmounted)(()=>{d&&i.value&&(d.unobserve(i.value),d.disconnect(),d=null)}),(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"menuRef",ref:i,class:(0,n.normalizeClass)(["j-menu-horizontal",{"j-menu-dark":(0,n.unref)(l)==="dark"}])},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(c.value,m=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:m.value,"parent-actives":p.value,item:m,"is-horizontal":"",onClick:u},null,8,["parent-actives","item"]))),128))],2))}}),K0=Y0,G0=(0,n.defineComponent)({name:"JVMenu",__name:"index",props:{menuList:{type:Array,default:()=>[]}},emits:["click"],setup(e,{emit:t}){const o=e,a=t,{activeMenu:r,theme:l}=Co(),i=["var(--j-color-primary)","var(--j-color-success)","var(--j-color-warning)","var(--j-color-error)","#16c2c0","#9154de"],s=(0,n.computed)(()=>(o.menuList.forEach((h,g)=>{h.color=i[g%i.length]}),o.menuList)),d=(0,n.computed)(()=>r.value?.pid?.split(".")||[]),c=h=>{a("click",h)},{list:f,containerProps:p,wrapperProps:u}=(0,xr.useVirtualList)(s,{itemHeight:96});return(h,g)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({class:["j-menu-vertical",{"j-menu-dark":(0,n.unref)(l)==="dark"}]},(0,n.unref)(p)),[(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)((0,n.unref)(u))),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(f),m=>((0,n.openBlock)(),(0,n.createBlock)(Va,{key:m.data.value,"parent-actives":d.value,item:m.data,"is-vertical":"",onClick:c},null,8,["parent-actives","item"]))),128))],16)],16))}}),q0=G0,X0=(0,n.defineComponent)({name:"JMenu",__name:"menu",props:{menus:{type:Array,default:()=>[]},activeId:{type:String,default:void 0},collapsed:Boolean,theme:{type:String,default:"light"},mode:{type:String,default:"inline"}},emits:["click"],setup(e,{emit:t}){const o=e,a=t;let r={};const l=(0,n.ref)("");l.value=o.activeId||"";const i=(m,w,k,C,v)=>{k=k||[];for(let b=0,S=k.length;b<S;b++){const y=k[b],x={};x.pid=w,x.indent=C,l.value===y.value&&(x.active=!0),Object.keys(y).forEach(_=>{_!=="children"&&(x[_]=y[_])}),v&&v.includes(y.value)&&(x.open=!0),m.push(x);const E=y.children||[];E.length>0&&(x.hasChildren=!0,v||(r[x.value]=E),(!v||x.open&&!o.collapsed)&&i(m,`${w}.${x.value}`,E,C+1,v))}},s=(m,w)=>{const k=[];return i(k,"0",m,0,w),k},d=(0,n.ref)([]);let c=[];const f=()=>{r={},c=s(o.menus);const m=[];if(l.value&&o.mode==="inline"){const w=c.find(k=>k.value===l.value);w&&m.push(...w.pid.split("."))}d.value=s(o.menus,m)};(0,n.watch)(()=>o.menus,()=>{f()},{immediate:!0}),(0,n.watch)(()=>o.mode,()=>{f()});const p=()=>{if(d.value.find(m=>m.active)?.value!==l.value){const m=c.find(w=>w.value===l.value);if(m){const w=[];o.mode==="inline"&&w.push(...m.pid.split(".")),d.value=s(o.menus,w)}}},u=(0,n.computed)(()=>c.find(m=>m.value===l.value));(0,n.watch)(()=>o.activeId,()=>{l.value=o.activeId||"",p()}),(0,n.watch)(()=>o.collapsed,()=>{if(o.collapsed)d.value=s(o.menus,[]);else{const m=[];if(l.value){const w=c.find(k=>k.value===l.value);w&&m.push(...w.pid.split("."))}d.value=s(o.menus,m)}});const h=(0,n.computed)(()=>o.theme),g=m=>{if(console.log(m),m.hasChildren){if(o.collapsed)return;const w=[];w.push(...m.pid.split(".")),m.open||w.push(m.value);const k=s(o.menus,w),C=new Set(d.value.map(b=>b.value)),v=new Set(k.map(b=>b.value));k.forEach(b=>{C.has(b.value)||(b.entering=!0)}),d.value.forEach(b=>{v.has(b.value)||(b.leaving=!0)}),d.value=k,setTimeout(()=>{d.value.forEach(b=>{b.entering=!1,b.leaving=!1})},300)}else{if(l.value===m.value)return;l.value=m.value,a("click",m)}};return bi({getMenuMap:()=>r,toArray:s,activeMenu:u,activeMenuId:l,theme:h}),(m,w)=>e.mode==="inline"?((0,n.openBlock)(),(0,n.createBlock)(J0,{key:0,"menu-list":d.value,collapsed:e.collapsed,onClick:g},null,8,["menu-list","collapsed"])):e.mode==="horizontal"?((0,n.openBlock)(),(0,n.createBlock)(K0,{key:1,"menu-list":d.value,onClick:g},null,8,["menu-list"])):((0,n.openBlock)(),(0,n.createBlock)(q0,{key:2,"menu-list":d.value,onClick:g},null,8,["menu-list"]))}}),Z0=X0,Ss=ve(Z0),Q0={class:"j-keyword-panel"},em={key:0},tm={key:1,class:"columns-wrapper"},nm=(0,n.defineComponent)({name:"JKeywordPanel",__name:"keyword-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]}},{checkAll:{default:!0},checkAllModifiers:{},checkFields:{default:()=>[]},checkFieldsModifiers:{}}),emits:["update:checkAll","update:checkFields"],setup(e,{expose:t}){const{t:o}=tt(),a=e,r=(0,n.useModel)(e,"checkAll"),l=(0,n.useModel)(e,"checkFields"),i=(0,n.ref)(!1),s=(0,n.ref)(""),d=(0,n.computed)(()=>a.columns.filter(u=>u.config?.filter?.isSearchKeyword?s.value?u.config?.label?.indexOf(s.value)!=-1:!0:!1).map(u=>({label:u.config?.label,value:u.id}))),c=()=>{r.value||(r.value=!0,i.value=!1,l.value=[])},f=u=>{u.length>0?r.value=!1:r.value=!0};return t({init:()=>{r.value?i.value=!1:i.value=!0}}),(u,h)=>{const g=(0,n.resolveComponent)("j-icon"),m=(0,n.resolveComponent)("el-input"),w=(0,n.resolveComponent)("j-checkbox");return(0,n.openBlock)(),(0,n.createElementBlock)("div",Q0,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["range-item",{active:r.value}]),onClick:c},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索全部")),1),r.value?((0,n.openBlock)(),(0,n.createBlock)(g,{key:0,icon:"mdi:check"})):(0,n.createCommentVNode)("",!0)],2),(0,n.createElementVNode)("div",{class:"range-item",onClick:h[0]||(h[0]=k=>i.value=!i.value)},[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(o)("搜索特定字段")),1),(0,n.createVNode)(g,{icon:i.value?"mdi:keyboard-arrow-up":"mdi:keyboard-arrow-down"},null,8,["icon"])]),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",em,[(0,n.createVNode)(m,{modelValue:s.value,"onUpdate:modelValue":h[1]||(h[1]=k=>s.value=k),modelModifiers:{trim:!0},class:"no-border background",placeholder:(0,n.unref)(o)("搜索"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(g,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",tm,[(0,n.createVNode)(w,{modelValue:l.value,"onUpdate:modelValue":h[2]||(h[2]=k=>l.value=k),options:d.value,style:{display:"flex","flex-direction":"column"},onChange:f},null,8,["modelValue","options"])])):(0,n.createCommentVNode)("",!0)])}}}),om=nm,am={key:0,class:"title"},rm={class:"content"},lm={key:0,class:"field-wrapper fixed-field-wrapper"},im={class:"relation"},sm={style:{width:"72px"}},cm={class:"btn-wrapper"},dm={class:"field-wrapper"},um={class:"buttons"},fm=(0,n.defineComponent)({name:"JFilterPanel",__name:"filter-panel",props:(0,n.mergeModels)({columns:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]},searchList:{type:Array,default:()=>[]}},{relation:{default:"and"},relationModifiers:{},isPin:{default:!1},isPinModifiers:{}}),emits:(0,n.mergeModels)(["filter","close"],["update:relation","update:isPin"]),setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=(0,n.useModel)(e,"relation"),i=(0,n.useModel)(e,"isPin"),s=(0,n.ref)([]),d=(0,n.ref)([]),c=()=>{i.value=!i.value},f=[{id:"field",type:"j-select",getCompConfig:()=>({selectData:u.value.join(","),options:p.value}),config:{style:{width:i.value?"132px":"160px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",isShowTooltip:!0,isSelectOnlyone:!0,change:({value:S,row:y})=>{const x=r.columns.find(V=>V.id===S)?.config||{};let E="eq",_="text";["options"].includes(x.dataType||"")?E="in":["dateTime"].includes(x.type||"")?(E="range",_="dateTime"):["number"].includes(x.type||"")&&(_="number"),y.method=E,y.type=x.valueType||_,y.value=void 0}}},{id:"method",type:"j-select",getCompConfig:({row:S})=>{const y=r.columns.find(x=>x.id===S.field)?.config||{};return["options","switch","dataItem","dataView"].includes(y.dataType||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"in",label:"等于任意一个"},{value:"nin",label:"不等于任意一个"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["dateTime"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"range",label:"选择范围"},{value:"formula",label:"动态筛选"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:["number"].includes(y.type||"")?{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"gte",label:"大于等于"},{value:"lte",label:"小于等于"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}:{options:[{value:"eq",label:"等于"},{value:"ne",label:"不等于"},{value:"like",label:"包含"},{value:"unlike",label:"不包含"},{value:"empty",label:"为空"},{value:"not_empty",label:"不为空"}]}},config:{style:{width:i.value?"134px":"130px"},appendTo:i.value?void 0:".j-filter-panel",persistent:!1,dataType:"options",noBorder:!0,change:({row:S})=>{S.value=void 0}}},{id:"value",type:"input",getCompType:({row:S})=>{const y=r.columns.find(x=>x.id===S.field)?.config||{};if(["options","dataItem","switch"].includes(y.dataType||"")){if(["in","nin"].includes(S.method)||["eq","ne"].includes(S.method))return"j-select"}else{if(["dateTime"].includes(y.type||""))return["formula"].includes(S.method)?"j-select":"j-date";if(["number"].includes(y.type||""))return"j-number"}return"j-input"},getCompConfig:({row:S})=>{if(["empty","not_empty"].includes(S.method||""))return{display:!1};const y=r.columns.find(E=>E.id===S.field)?.config||{},x={display:!0,placeholder:"",clearable:!0,filterable:!0};return["in","nin"].includes(S.method||"")&&(x.multiple=!0,x.collapseTags=!0,x.collapseTagsTooltip=!0),["options","dataItem"].includes(y.dataType||"")?(x.collapseTags=!0,x.collapseTagsTooltip=!0,x.dataType=y.dataType,x.dataCode=y.dataCode,x.options=y.options):["switch"].includes(y.dataType||"")?(x.options=[],x.dataType="options",y.activeValue==null?x.options.push({label:"是",value:"1"}):x.options.push({label:"是",value:y.activeValue}),y.inactiveValue==null?x.options.push({label:"否",value:"0"}):x.options.push({label:"否",value:y.inactiveValue})):["dateTime"].includes(y.type||"")&&(["formula"].includes(S.method)?(x.placeholder="",x.options=[{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"明天",value:"tomorrow"},{label:"最近7天",value:"last7days"},{label:"最近30天",value:"last30days"},{label:"本周",value:"thisWeek"},{label:"上周",value:"lastWeek"},{label:"下周",value:"nextWeek"},{label:"本月",value:"thisMonth"},{label:"上月",value:"lastMonth"},{label:"下月",value:"nextMonth"},{label:"本季度",value:"thisQuarter"},{label:"上季度",value:"lastQuarter"},{label:"下季度",value:"nextQuarter"},{label:"今年",value:"thisYear"},{label:"去年",value:"lastYear"},{label:"明年",value:"nextYear"}],x.dataType="options"):(x.selectType="datetime",["range"].includes(S.method)?(x.selectType="datetimerange",x.startPlaceholder="开始时间",x.endPlaceholder="结束时间",x.defaultTime=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]):x.placeholder="")),x},config:{style:{width:i.value?"246px":"296px",flex:i.value?"auto":"1"},appendTo:i.value?void 0:".j-filter-panel"}}];(0,n.onMounted)(()=>{d.value=r.searchFieldList,s.value=r.searchList});const p=(0,n.computed)(()=>r.columns.filter(S=>!S.children?.length&&!S.config?.isNotFilter).map(S=>({label:S.config?.label,value:S.id,dataType:S.config?.dataType,options:S.config?.options}))),u=(0,n.computed)(()=>d.value.map(S=>S.field)),h=({data:S})=>{if(u.value.includes(S.value))return;const y=r.columns.find(_=>_.id===S.value)?.config||{};let x="eq",E="text";["options","dataItem"].includes(y.dataType||"")?x="in":["dateTime"].includes(y.type||"")&&(x="range",E="dateTime"),d.value.push({field:S.value,method:x,type:y.valueType||E})},g=o,m=()=>{d.value.length=0},w=()=>{i.value?g("filter"):g("close",!0)},k=()=>{d.value.forEach(S=>{S.value=void 0}),g("filter")},C=()=>d.value,v=(0,n.shallowRef)();return t({getSearchFields:C,getFixedSearchData:()=>v.value?.getFormData(!1)||{}}),(S,y)=>{const x=(0,n.resolveComponent)("j-icon"),E=(0,n.resolveComponent)("j-form"),_=(0,n.resolveComponent)("j-select"),V=(0,n.resolveComponent)("j-button-select"),T=(0,n.resolveComponent)("j-button"),P=(0,n.resolveComponent)("j-input-rows"),A=(0,n.resolveComponent)("el-tooltip");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-filter-panel",{"is-pin":i.value}])},[i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",am,[(0,n.createVNode)(x,{icon:"mdi:filter-outline"}),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选")),1)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",rm,[s.value.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",lm,[(0,n.createVNode)(E,{ref_key:"formRef",ref:v,schema:s.value,config:{labelWidth:80,labelPosition:i.value?"top":"left"}},null,8,["schema","config"])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",im,[(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("筛选出符合以下")),1),(0,n.createElementVNode)("div",sm,[(0,n.createVNode)(_,{modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=N=>l.value=N),teleported:!1,"no-border":!0,options:[{value:"and",label:"所有"},{value:"or",label:"任一"}]},null,8,["modelValue"])]),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(a)("条件的数据")),1)]),(0,n.createElementVNode)("div",cm,[(0,n.createVNode)(V,{label:"添加过滤条件",options:p.value,"model-value":u.value.join(","),onChange:h},null,8,["options","model-value"]),d.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:0,type:"text",danger:"",label:"删除全部",onClick:m})):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",dm,[(0,n.createVNode)(P,{modelValue:d.value,"onUpdate:modelValue":y[1]||(y[1]=N=>d.value=N),columns:f,"edit-config":{isAddBtn:!1},"is-wrap":i.value},null,8,["modelValue","is-wrap"])]),(0,n.createVNode)(A,{placement:"bottom",content:i.value?(0,n.unref)(a)("取消固定"):(0,n.unref)(a)("固定显示")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"pin-btn",onClick:c},[(0,n.createVNode)(x,{rotate:45,icon:i.value?"mdi:keep-off":"mdi:keep"},null,8,["icon"])])]),_:1},8,["content"])]),(0,n.createElementVNode)("div",um,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("筛选"),type:"primary",onClick:w},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("清空"),icon:"mdi:delete-sweep-outline",type:"text",onClick:k},null,8,["label"])])],2)}}}),Es=fm,pm={class:"j-order-panel"},hm={class:"content"},gm={class:"btn-wrapper"},mm={class:"field-wrapper"},ym={class:"buttons"},vm=(0,n.defineComponent)({name:"JOrderPanel",__name:"order-panel",props:{columns:{type:Array,default:()=>[]}},emits:["save","clear"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=o,i=(0,n.computed)(()=>r.columns.filter(g=>!g.children?.length&&g.config?.sorter?.isNot!==!0).map(g=>({label:g.config?.label,value:g.id}))),s=(0,n.ref)([]),d=(0,n.computed)(()=>s.value.map(g=>g.value)),c=[{id:"label",type:"j-title",getCompConfig:({row:g})=>({title:g?.label}),config:{style:{width:"180px"}}},{id:"sord",type:"j-radio",config:{dataType:"options",options:[{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],isButton:!0}}],f=({data:g})=>{d.value.includes(g.value)||s.value.push({label:g.label,value:g.value,sord:"ASC"})},p=g=>{s.value=JSON.parse(JSON.stringify(g))},u=()=>{l("save",JSON.parse(JSON.stringify(s.value)))},h=()=>{s.value=[],l("clear")};return t({init:p}),(g,m)=>{const w=(0,n.resolveComponent)("j-button-select"),k=(0,n.resolveComponent)("j-input-rows"),C=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",pm,[(0,n.createElementVNode)("div",hm,[(0,n.createElementVNode)("div",gm,[(0,n.createVNode)(w,{label:"添加排序规则",options:i.value,"model-value":d.value.join(","),onChange:f},null,8,["options","model-value"])]),(0,n.createElementVNode)("div",mm,[(0,n.createVNode)(k,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=v=>s.value=v),columns:c,"edit-config":{isAddBtn:!1,drag:!0}},null,8,["modelValue"])])]),(0,n.createElementVNode)("div",ym,[(0,n.createVNode)(C,{label:(0,n.unref)(a)("排序"),type:"primary",onClick:u},null,8,["label"]),s.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(C,{key:0,label:(0,n.unref)(a)("清空排序"),icon:"mdi:delete-sweep",type:"text",onClick:h},null,8,["label"])):(0,n.createCommentVNode)("",!0)])])}}}),bm=vm,wm={class:"j-column-panel"},Cm={class:"content"},xm={class:"search-wrapper"},km={class:"tree-wrapper"},Sm={class:"buttons"},Em=(0,n.defineComponent)({name:"JColumnPanel",__name:"column-panel",props:{columns:{type:Array,default:()=>[]},columnConfig:{type:Array}},emits:["save"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),r=e,l=o,i=(0,n.ref)(),s=(0,n.ref)(""),d={},c=(0,n.ref)([]),f=(0,n.ref)([]),p=(y,x)=>{const E=[],_=new Map;y.forEach(T=>{_.set(T.id||"",T),d[T.id||""]=T});const V=new Set;return x&&x.length>0&&x.forEach(T=>{const P=_.get(T.id);if(P){V.add(P.id||"");const A={id:P.id||"",label:P.config?.label||P.id||"",type:P.type,display:P.config?.display!==!1};P.children&&P.children.length>0&&(A.children=p(P.children,T.children)),E.push(A)}}),y.forEach(T=>{if(!V.has(T.id||"")){const P={id:T.id||"",label:T.config?.label||T.id||"",type:T.type,display:T.config?.display!==!1};T.children&&T.children.length>0&&(P.children=p(T.children)),E.push(P)}}),E},u=(y,x)=>x.length===0?y:y.map(E=>{const _=x.some(T=>E.label.toLowerCase().includes(T.toLowerCase())),V=E.children?u(E.children,x):[];return _||V.length>0?{...E,children:V.length>0?V:E.children}:null}).filter(Boolean),h=(0,n.computed)(()=>{if(!s.value)return f.value;const y=s.value.split(/\s+/).filter(Boolean);return u(f.value,y)}),g=(0,n.ref)([]),m=(0,n.computed)(()=>{const y=new Map;if(r.columnConfig&&r.columnConfig.length>0){const x=E=>{E.forEach(_=>{y.set(_.id,_),_.children&&x(_.children)})};x(r.columnConfig)}return y}),w=()=>{const y=x=>{const E=[];return x.forEach(_=>{let V=!0;if(m.value.size>0){const T=m.value.get(_.id||"");T?V=T.display:V=_.config?.display!==!1}else V=_.config?.display!==!1;V&&(E.push(_.id||""),_.children&&E.push(...y(_.children)))}),E};g.value=y(r.columns)},k=(y,{node:x})=>{y.includes(x.id)?g.value.push(x.id):g.value=g.value.filter(E=>E!==x.id)},C=(y,x,E)=>E==="inner"?!1:y.parent===x.parent,v=()=>{const y=x=>x.map(E=>{const _={...E,display:g.value.includes(E.id)};return E.children&&(_.children=y(E.children)),_});l("save",y(f.value))},b=()=>{if(w(),f.value=JSON.parse(JSON.stringify(c.value)),s.value="",i.value){const y=i.value;y.setCheck&&y.setCheck(g.value);const x=y.$refs?.treeRef||y;x?.setCheckedKeys&&x.setCheckedKeys(g.value)}l("save",void 0)};return t({init:()=>{w(),c.value=p(r.columns,r.columnConfig),f.value=JSON.parse(JSON.stringify(c.value))}}),(y,x)=>{const E=(0,n.resolveComponent)("j-icon"),_=(0,n.resolveComponent)("el-input"),V=(0,n.resolveComponent)("j-tree"),T=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)("div",wm,[(0,n.createElementVNode)("div",Cm,[(0,n.createElementVNode)("div",xm,[(0,n.createVNode)(_,{modelValue:s.value,"onUpdate:modelValue":x[0]||(x[0]=P=>s.value=P),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索 (多个关键词用空格隔开)"),clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",km,[(0,n.createVNode)(V,{ref_key:"treeRef",ref:i,list:h.value,"is-tree-data":!0,"default-checked-keys":g.value,"default-expand-all":!0,checkable:"","id-key":"id",draggable:!s.value,"allow-drop":C,check:k},null,8,["list","default-checked-keys","draggable"])])]),(0,n.createElementVNode)("div",Sm,[(0,n.createVNode)(T,{label:(0,n.unref)(a)("确定"),type:"primary",onClick:v},null,8,["label"]),(0,n.createVNode)(T,{label:(0,n.unref)(a)("重置"),icon:"mdi:restore",type:"text",onClick:b},null,8,["label"])])])}}}),_m=Em,Bm={class:"j-table-panel-left"},Rm={class:"j-table-panel-top"},Tm={class:"j-table-panel-top-right"},Vm={key:0,style:{width:"200px"}},Mm={class:"j-table-panel-main"},Nm={class:"j-table-panel-vnode-content"},Am={key:0,class:"j-table-panel-vnode-pagination"},jm={key:0,class:"j-table-panel-filter-panel"},Pm=(0,n.defineComponent)({name:"JTablePanel",__name:"table-panel",props:{viewMode:{type:String,default:"table"},modelValue:{type:Array,default:()=>[]},columns:{type:Array,required:!0,default:()=>[]},columnFilter:{type:Array,default:()=>[]},searchList:{type:Array,default:()=>[]},isTree:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},parentKey:{type:String,default:""},isShowNumber:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},selectStateKey:{type:String,default:""},multipleDisabled:{type:Function,default:null},isPage:{type:Boolean,default:!1},pageSizes:Array,pageSize:{type:Number,default:100},subColumns:{type:Array,default:()=>[]},isSubShowNumber:{type:Boolean,default:!0},subActions:{type:Array,default:()=>[]},loadChildren:{type:Function,default:null},rowKey:{type:String,default:void 0},sort:String,buttons:{type:Array,default:()=>[]},batchButtons:{type:Array,default:()=>[]},actions:{type:Array,default:()=>[]},actionsMaxCount:{type:Number,default:3},actionsLabel:{type:String,default:"操作"},actionFilter:{type:Function,default:null},loadData:Function,immediate:{type:Boolean,default:!0},noPadding:Boolean,highlightMode:{type:String,default:"row"},showFilterButton:{type:Boolean,default:!0},showOrderButton:{type:Boolean,default:!0},showColumnButton:{type:Boolean,default:!0},showRefreshButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},renderVNode:Function,renderVNodeClass:String,rowDrag:{type:Boolean,default:!1},cardLabelKey:{type:String,default:"f_Name"},cardLoadSrc:{type:Function,default:void 0},cardFallback:{type:String,default:""},cardBackgroundColor:{type:String,default:""},cardShowBigEditButton:{type:Boolean,default:!1},cardWidth:{type:Number,default:258},cardHeight:{type:Number,default:184},cardImageFit:{type:String,default:"fill"}},emits:["select","ready"],setup(e,{expose:t,emit:o}){const{t:a}=tt(),{openLayer:r}=En(),l=e,i=o;l.isMultiple&&!l.rowKey&&console.warn("rowKey is required when isMultiple is true");const s=(0,n.ref)(),d=(0,n.ref)(),c=(0,n.ref)([]),f=(0,n.ref)(0),p=(0,n.ref)(1),u=(0,n.ref)(l.pageSize||100),h=(0,n.ref)(0),g=(0,n.computed)(()=>h.value>0),m=(0,n.ref)([]),w=(0,n.ref)(!1),k=(0,n.computed)(()=>l.batchButtons&&l.batchButtons.length>0),C=(0,n.computed)(()=>m.value.length>0),v=(0,n.computed)(()=>k.value&&C.value&&l.isMultiple||w.value),b=(0,n.computed)(()=>!!l.loadData),S=(0,n.computed)(()=>!!l.loadData&&l.isPage&&!v.value),y=(0,n.computed)(()=>l.viewMode==="card"),x=(0,n.computed)(()=>w.value?m.value:c.value);k.value&&!l.isMultiple&&console.warn("batchButtons is only valid when isMultiple is true");const E=le=>l.rowKey?l.rowKey.split(",").map(ie=>le[ie.trim()]).join("::"):"",_=(le,ie)=>{if(!ie||ie.length===0)return le.filter(se=>se.config?.display!==!1).map(se=>se.children&&se.children.length>0?{...se,children:_(se.children)}:se);const Ve=new Map(le.map(se=>[se.id,se])),_e=[];return ie.forEach(se=>{const Je=Ve.get(se.id);if(Je){if(se.display){let Ct=Je;Je.children&&Je.children.length>0&&(Ct={...Je,children:_(Je.children,se.children)}),_e.push(Ct)}Ve.delete(se.id)}}),le.forEach(se=>{if(Ve.has(se.id)&&se.config?.display!==!1){let Je=se;se.children&&se.children.length>0&&(Je={...se,children:_(se.children)}),_e.push(Je)}}),_e},V=(0,n.computed)(()=>_(l.columns,$.value)),T=(0,n.computed)(()=>ti(l.columns,le=>le.config.label)),P=(0,n.ref)(""),A=(0,n.computed)(()=>T.value.some(le=>le.config?.filter?.isSearchKeyword)),N=(0,n.ref)(),M=(0,n.ref)(!0),B=(0,n.ref)([]),H=(0,n.computed)(()=>M.value?"搜索全部":`搜索范围:${T.value.filter(le=>B.value.includes(le.id)).map(le=>le.config?.label).join("、")}`),W=()=>{N.value.init()},X=(0,n.ref)(),fe=(0,n.ref)(!1),J=(0,n.ref)(!1),Y=(0,n.ref)(!1),G=(0,n.ref)([]),j=(0,n.ref)("and"),me=(0,n.ref)(),Pe=(0,n.ref)(!1),pe=(0,n.ref)([]),Ne=(0,n.ref)(),Fe=le=>{const ie=new Map(T.value.map(Ve=>[Ve.id,Ve.config?.label||Ve.id]));return le.split(",").map(Ve=>Ve.trim()).filter(Boolean).map(Ve=>{const[_e,se]=Ve.split(/\s+/),Je=(se||"ASC").toUpperCase()==="DESC"?"DESC":"ASC";return{label:ie.get(_e)||_e,value:_e,sord:Je}}).filter(Ve=>Ve.value)};(0,n.watch)([()=>l.sort,()=>T.value],([le])=>{const ie=(le||"").trim();if(ie){if(ie!==Ne.value){pe.value=Fe(ie),Ne.value=ie;return}const Ve=new Map(T.value.map(_e=>[_e.id,_e.config?.label||_e.id]));pe.value=pe.value.map(_e=>({..._e,label:Ve.get(_e.value)||_e.label||_e.value}));return}Ne.value&&(pe.value=[],Ne.value=void 0)},{immediate:!0});const Ge=()=>{me.value.init(pe.value)},Q=le=>{pe.value=le,Pe.value=!1,Wt()},ge=()=>{pe.value=[],Wt()},Re=(0,n.ref)(),rt=(0,n.ref)(!1),$=(0,n.ref)(),ae=(0,n.computed)(()=>$.value!=null),ye=()=>{Re.value?.init()},Ce=le=>{$.value=le,rt.value=!1},Me=(0,n.ref)(!1),Se=()=>{Me.value=!Me.value},Te=()=>{m.value=[],s.value&&(s.value.setSelection?.([]),w.value&&(w.value=!1,s.value.setRecords(c.value))),d.value?.clearSelection?.(),i("select",{selections:[],record:{},checked:!1,isMultiple:l.isMultiple})},We=()=>{w.value=!w.value,!y.value&&(w.value?s.value?.setRecords(m.value):s.value?.setRecords(c.value),s.value?.setSelection?.(m.value))},wt=(0,n.computed)(()=>{if(m.value.length>0&&l.isMultiple){const le=[{id:"selection_count",label:`已选${m.value.length}条`,config:{type:"text"}},{id:"toggle_selection",label:w.value?"全部":"仅选中",config:{type:"text"},click:We},{id:"clear_selection",label:"清空选中",config:{type:"text"},click:Te}],ie=l.batchButtons.map(Ve=>({...Ve,click:()=>{Ve.click&&Ve.click({data:m.value,openLayer:r})}}));return[...le,...ie]}return l.buttons}),Pt=(0,n.computed)(()=>wt.value.filter(le=>le.config?.display!==!1)),Rt=(0,n.ref)(null),Xe=(0,n.ref)(0),Nt=()=>{Xe.value=Rt.value?.clientWidth||0};let ct;(0,n.onMounted)(()=>{(0,n.nextTick)(Nt),ct=new ResizeObserver(()=>{Nt()}),Rt.value&&ct.observe(Rt.value)}),(0,n.onBeforeUnmount)(()=>{ct?.disconnect()}),(0,n.watch)(()=>Pt.value,()=>{(0,n.nextTick)(Nt)},{deep:!0}),(0,n.watch)(Me,()=>{(0,n.nextTick)(Nt)});const yt=(0,n.computed)(()=>{const le=Pt.value;if(le.length===0)return[];const ie=Xe.value;if(ie<=0)return le;const Ve=Math.max(0,ie-4),_e=(xt,Dt)=>xt.groupId||`__auto_${Dt}`,se=xt=>{if(xt.config?.notLabel===!0||!xt.label)return 28;const Dt=24,Tt=Jt(xt.label||"")||0,At=xt.config?.icon?18:0;return Math.ceil(Tt+Dt+At+2)};if((xt=>{let Dt=0,Tt=null;return xt.forEach((At,Io)=>{const ma=_e(At,Io);Tt!==null&&(Dt+=ma===Tt?-1:8),Dt+=se(At),Tt=ma}),Dt})(le)<=Ve)return le;const Ct={id:"__table_panel_more__",label:"",config:{icon:"mdi:dots-horizontal",notLabel:!0},children:[]},Bt=28,Ut=[];let Gt=0,uo=null;for(let xt=0;xt<le.length;xt++){const Dt=le[xt],Tt=_e(Dt,xt);let At=Gt;uo!==null&&(At+=Tt===uo?-1:8),At+=se(Dt);const Io=le.length-(xt+1)>0?(At>0?8:0)+Bt:0;if(At+Io<=Ve)Ut.push(Dt),Gt=At,uo=Tt;else break}const fo=le.slice(Ut.length);if(fo.length===0)return le;const Oe={...Ct,children:fo};return Ut.length===0?[Oe]:[...Ut,Oe]});let lt;const it=async le=>{h.value++;const ie={};le&&(lt=le),lt&&(ie.query=lt);try{const Ve={};Ve.rel=j.value,Ve.cond=(X.value?.getSearchFields?.()||G.value).filter(se=>se.value!==void 0&&se.value!==null&&se.value!==""||["empty","not_empty"].includes(se.method)).map(se=>({field:se.field,method:se.method,value:se.value,type:se.type})),Ve.cond.length>0?Y.value=!0:Y.value=!1,ie.filter=Ve;const _e=pe.value.map(se=>se.value+" "+se.sord).join(",");if(P.value&&(ie.keyword={value:P.value,fields:M.value?T.value.filter(se=>se.config?.filter?.isSearchKeyword).map(se=>se.id):(0,n.unref)(B)}),ie.fixedFilter=X.value?.getFixedSearchData?.()||{},l.loadData){if(l.isPage){ie.pagination={rows:(0,n.unref)(u),page:p.value,sort:_e||l.sort||l.rowKey};const se=await l.loadData(ie)||{};c.value=se.rows||[],f.value=se.records||0}else ie.sort=_e,c.value=await l.loadData(ie)||[],f.value=c.value.length;s.value?.setRecords(x.value),k.value?(m.value=[],w.value=!1,d.value?.clearSelection?.()):l.rowKey&&m.value.length>0&&(s.value?.setSelection?.(m.value),d.value?.selections&&(d.value.selections.value=m.value.map(se=>E(se)).filter(Boolean)))}else c.value=l.modelValue||[],f.value=c.value.length,s.value?.setRecords(x.value)}finally{h.value=Math.max(0,h.value-1)}};(0,n.watch)(()=>l.modelValue,async()=>{await it()}),(0,n.watch)(()=>y.value,async le=>{if(await(0,n.nextTick)(),!le){s.value?.setSelection?.(m.value);return}d.value?.selections&&(d.value.selections.value=m.value.map(ie=>E(ie)).filter(Boolean))});const Wt=async()=>{l.loadData&&(p.value=1,await it())},U=({rows:le,page:ie})=>{u.value=le,p.value=ie,it()},ue=le=>{U({rows:(0,n.unref)(u),page:le})},ee=le=>{U({rows:le,page:1})},ne=async()=>{m.value=[],w.value=!1,p.value=1,lt=void 0,await it()},he=async le=>{m.value=[],w.value=!1,await it(le)},Ee=async()=>{await ne()},Ae=le=>{i("ready",le)},Ue=({selections:le,record:ie,checked:Ve,isMultiple:_e})=>{let se=[];if(!l.isMultiple){m.value=le,i("select",{selections:le,record:ie,checked:Ve,isMultiple:_e});return}if(k.value)se=le;else if(!l.rowKey)se=le;else{const Je=new Map(le.map(Bt=>[E(Bt),Bt])),Ct=new Map(m.value.map(Bt=>[E(Bt),Bt]));c.value.forEach(Bt=>{const Ut=E(Bt);Je.has(Ut)?Ct.set(Ut,Je.get(Ut)):Ct.delete(Ut)}),se=Array.from(Ct.values())}m.value=se,i("select",{selections:se,record:ie,checked:Ve,isMultiple:_e}),w.value&&se.length===0?(w.value=!1,s.value&&s.value.setRecords(c.value)):w.value&&se.length>0&&s.value&&(s.value.setRecords(se),s.value.setSelection?.(se))},vt=le=>{m.value=le},et=le=>{m.value=[le],i("select",{selections:[le],record:le,checked:!0,isMultiple:!1})},bn=()=>{const le=m.value||[],ie=!y.value&&s.value?.getSelection?.()||[];if(ie.length===0)return le;if(!l.rowKey||le.length===0)return ie;const Ve=new Map(ie.map(se=>[E(se),se])),_e=le.map(se=>Ve.get(E(se))||se);return m.value=_e,_e},wn=le=>{if(m.value=le,y.value){d.value?.selections&&(d.value.selections.value=(le||[]).map(ie=>E(ie)).filter(Boolean));return}s.value?.setSelection?.(le)},Cn=()=>y.value?d.value:s.value,io=(0,n.computed)(()=>l.pageSizes||[100,200,500,1e3]),so=(0,n.computed)(()=>!!l.rowKey&&!l.isMultiple),Do=(0,n.computed)(()=>!!l.rowKey&&l.isMultiple),ga=({buttons:le,row:ie})=>{if(!l.actionFilter)return;const Ve=c.value.findIndex(_e=>E(_e)===E(ie));le.forEach(_e=>{const se=l.actionFilter?.({action:_e,record:ie,recordIndex:Ve,col:-1,row:Ve,table:s.value});if(se===!1){_e.config=_e.config||{},_e.config.display=!1;return}se&&typeof se=="object"&&(se.display!==void 0&&(_e.config=_e.config||{},_e.config.display=se.display),se.disabled!==void 0&&(_e.config=_e.config||{},_e.config.disabled=se.disabled))})},co=({selections:le,rows:ie})=>{if(!l.isMultiple){const _e=ie[0],se=_e?[_e]:[];m.value=se,i("select",{selections:se,record:_e||{},checked:!!_e,isMultiple:!1});return}let Ve=[];if(k.value||!l.rowKey)Ve=ie;else{const _e=new Set(le),se=new Map(m.value.map(Je=>[E(Je),Je]));c.value.forEach(Je=>{const Ct=E(Je);Ct&&(_e.has(Ct)?se.set(Ct,Je):se.delete(Ct))}),Ve=Array.from(se.values())}m.value=Ve,i("select",{selections:Ve,record:ie[0]||{},checked:Ve.length>0,isMultiple:!0}),w.value&&Ve.length===0&&(w.value=!1)};return(0,n.onMounted)(async()=>{l.immediate&&await he()}),t({refreshData:he,resetData:ne,getSelection:bn,setSelection:wn,clearSelection:()=>{Te()},getTableRef:Cn}),(le,ie)=>{const Ve=(0,n.resolveComponent)("j-buttons"),_e=(0,n.resolveComponent)("j-icon"),se=(0,n.resolveComponent)("el-popover"),Je=(0,n.resolveComponent)("el-tooltip"),Ct=(0,n.resolveComponent)("el-input"),Bt=(0,n.resolveComponent)("j-button"),Ut=(0,n.resolveComponent)("el-pagination"),Gt=(0,n.resolveComponent)("j-card-list"),uo=(0,n.resolveComponent)("j-table"),fo=(0,n.resolveDirective)("loading");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-table-panel-wrapper",{fullscreen:Me.value,"no-padding":e.noPadding||Me.value}])},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-table-panel",{"j-table-panel-fullscreen":Me.value}])},[(0,n.createElementVNode)("div",Bm,[(0,n.createElementVNode)("div",Rm,[(0,n.createElementVNode)("div",{ref_key:"topLeftRef",ref:Rt,class:"j-table-panel-top-left"},[(0,n.createVNode)(Ve,{list:yt.value},null,8,["list"])],512),(0,n.createElementVNode)("div",Tm,[b.value&&A.value&&!v.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Vm,[(0,n.createVNode)(Ct,{modelValue:P.value,"onUpdate:modelValue":ie[2]||(ie[2]=Oe=>P.value=Oe),modelModifiers:{trim:!0},placeholder:(0,n.unref)(a)("搜索数据"),clearable:"",class:"j-suffix",onKeyup:(0,n.withKeys)(Wt,["enter"]),onClear:Wt},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(_e,{icon:"mdi:search"})]),suffix:(0,n.withCtx)(()=>[(0,n.createVNode)(Je,{placement:"bottom",content:H.value},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{placement:"bottom-end","popper-style":"padding: 0",width:200,trigger:"click","show-arrow":!1,onShow:W,onHide:Wt},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(_e,{icon:"mdi:keyboard-arrow-down",style:{cursor:"pointer"}})]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(om,{ref_key:"keywordPanelRef",ref:N,"check-all":M.value,"onUpdate:checkAll":ie[0]||(ie[0]=Oe=>M.value=Oe),"check-fields":B.value,"onUpdate:checkFields":ie[1]||(ie[1]=Oe=>B.value=Oe),columns:T.value},null,8,["check-all","check-fields","columns"])]),_:1})])]),_:1},8,["content"])]),_:1},8,["modelValue","placeholder"])])):(0,n.createCommentVNode)("",!0),b.value&&e.showFilterButton&&!fe.value&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(se,{key:1,visible:J.value,"onUpdate:visible":ie[6]||(ie[6]=Oe=>J.value=Oe),placement:"bottom","popper-style":"padding: 0",width:664,trigger:"click",persistent:!1,onHide:Wt},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{icon:"mdi:filter-outline",label:"筛选",type:"text",class:(0,n.normalizeClass)({active:Y.value})},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(Es,{ref_key:"filterPanelRef",ref:X,"is-pin":fe.value,"onUpdate:isPin":ie[3]||(ie[3]=Oe=>fe.value=Oe),relation:j.value,"onUpdate:relation":ie[4]||(ie[4]=Oe=>j.value=Oe),"search-list":e.searchList,"search-field-list":G.value,columns:T.value,onFilter:Wt,onClose:ie[5]||(ie[5]=Oe=>J.value=!1)},null,8,["is-pin","relation","search-list","search-field-list","columns"])]),_:1},8,["visible"])):(0,n.createCommentVNode)("",!0),b.value&&e.showOrderButton&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:2,placement:"bottom",content:(0,n.unref)(a)("排序")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{visible:Pe.value,"onUpdate:visible":ie[7]||(ie[7]=Oe=>Pe.value=Oe),placement:"bottom","popper-style":"padding: 0",width:380,trigger:"click",onShow:Ge},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{class:(0,n.normalizeClass)({active:pe.value.length>0}),type:"text",icon:"mdi:sort"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(bm,{ref_key:"orderPanelRef",ref:me,columns:T.value,onSave:Q,onClear:ge},null,8,["columns"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showColumnButton&&!v.value&&!e.renderVNode&&!y.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:3,placement:"bottom",content:(0,n.unref)(a)("显示字段")},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",null,[(0,n.createVNode)(se,{visible:rt.value,"onUpdate:visible":ie[8]||(ie[8]=Oe=>rt.value=Oe),placement:"bottom","popper-style":"padding: 0",width:400,trigger:"click",onShow:ye},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{class:(0,n.normalizeClass)({active:ae.value}),type:"text",icon:"mdi:table-headers-eye"},null,8,["class"])]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(_m,{ref_key:"columnPanelRef",ref:Re,columns:e.columns,"column-config":$.value,onSave:Ce},null,8,["columns","column-config"])]),_:1},8,["visible"])])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showRefreshButton&&!v.value?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:4,placement:"bottom",content:(0,n.unref)(a)("刷新")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{type:"text",icon:"mdi:refresh",onClick:Ee})]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0),e.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)(Je,{key:5,placement:"bottom",content:Me.value?(0,n.unref)(a)("退出全屏"):(0,n.unref)(a)("全屏")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Bt,{type:"text",icon:Me.value?"mdi:fullscreen-exit":"mdi:fullscreen",onClick:Se},null,8,["icon"])]),_:1},8,["content"])):(0,n.createCommentVNode)("",!0)])]),(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",Mm,[e.renderVNode?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(["j-block","j-table-panel-vnode",e.renderVNodeClass])},[(0,n.createElementVNode)("div",Nm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(x.value,(Oe,xt)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.renderVNode(Oe)),{key:E(Oe)||xt,onClick:Dt=>et(Oe)},null,8,["onClick"]))),128))]),S.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Am,[ie[16]||(ie[16]=(0,n.createElementVNode)("div",null,null,-1)),(0,n.createVNode)(Ut,{"current-page":p.value,"onUpdate:currentPage":ie[9]||(ie[9]=Oe=>p.value=Oe),"page-size":u.value,"onUpdate:pageSize":ie[10]||(ie[10]=Oe=>u.value=Oe),"page-sizes":e.pageSizes||[100,200,500,1e3],total:f.value,layout:"total, prev, pager, next, sizes",onCurrentChange:ue,onSizeChange:ee},null,8,["current-page","page-size","page-sizes","total"])])):(0,n.createCommentVNode)("",!0)],2)):y.value?((0,n.openBlock)(),(0,n.createBlock)(Gt,{key:1,ref_key:"cardListRef",ref:d,"data-source":x.value,"load-src":e.cardLoadSrc,"label-key":e.cardLabelKey,buttons:e.actions,fallback:e.cardFallback,"is-page":S.value,"page-sizes":io.value,"page-total":f.value,"table-page":p.value,"onUpdate:tablePage":ie[11]||(ie[11]=Oe=>p.value=Oe),"page-size":u.value,"onUpdate:pageSize":ie[12]||(ie[12]=Oe=>u.value=Oe),"max-btns":e.actionsMaxCount,"row-key":e.rowKey,"is-radio":so.value,"is-multi-select":Do.value,"background-color":e.cardBackgroundColor,"show-big-edit-button":e.cardShowBigEditButton,"card-width":e.cardWidth,"card-height":e.cardHeight,"image-fit":e.cardImageFit,"set-button":ga,onLoadPageData:U,onSelectionChange:co},null,8,["data-source","load-src","label-key","buttons","fallback","is-page","page-sizes","page-total","table-page","page-size","max-btns","row-key","is-radio","is-multi-select","background-color","show-big-edit-button","card-width","card-height","image-fit"])):((0,n.openBlock)(),(0,n.createBlock)(uo,{key:2,ref_key:"tableRef",ref:s,"table-page":p.value,"onUpdate:tablePage":ie[13]||(ie[13]=Oe=>p.value=Oe),columns:V.value,"column-filter":e.columnFilter,"sub-columns":e.subColumns,records:x.value,"is-tree":e.isTree,"default-expand-all":e.defaultExpandAll,"parent-key":e.parentKey,"is-show-number":e.isShowNumber,"is-sub-show-number":e.isSubShowNumber,"is-multiple":e.isMultiple&&!!e.rowKey,"select-state-key":e.selectStateKey,"multiple-disabled":e.multipleDisabled,"is-page":S.value,"page-sizes":e.pageSizes,"page-size":e.pageSize,"page-total":f.value,"row-key":e.rowKey,actions:e.actions,"sub-actions":e.subActions,"actions-max-count":e.actionsMaxCount,"actions-label":e.actionsLabel,"action-filter":e.actionFilter,"highlight-mode":e.highlightMode,"load-children":e.loadChildren,"row-drag":e.rowDrag,onLoadPageData:U,onReady:Ae,onSelectionChanged:Ue,onSelectRecordsChanged:vt},null,8,["table-page","columns","column-filter","sub-columns","records","is-tree","default-expand-all","parent-key","is-show-number","is-sub-show-number","is-multiple","select-state-key","multiple-disabled","is-page","page-sizes","page-size","page-total","row-key","actions","sub-actions","actions-max-count","actions-label","action-filter","highlight-mode","load-children","row-drag"]))])),[[fo,g.value]])]),b.value&&e.showFilterButton&&fe.value&&!v.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",jm,[(0,n.createVNode)(Es,{ref_key:"filterPanelRef",ref:X,"is-pin":fe.value,"onUpdate:isPin":ie[14]||(ie[14]=Oe=>fe.value=Oe),relation:j.value,"onUpdate:relation":ie[15]||(ie[15]=Oe=>j.value=Oe),"search-list":e.searchList,"search-field-list":G.value,columns:T.value,onFilter:Wt},null,8,["is-pin","relation","search-list","search-field-list","columns"])])):(0,n.createCommentVNode)("",!0)],2)],2)}}}),zm=Pm,_s=ve(zm),Hm={class:"j-button-select"},Lm={class:"search-wraper"},Om={class:"options-wraper"},Dm=["onClick"],Im=(0,n.defineComponent)({name:"JButtonSelect",__name:"button-select",props:{modelValue:{default:void 0},label:{default:"添加"},popoverWidth:{default:240},options:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=tt(),l=(0,n.ref)(""),i=(0,n.computed)(()=>l.value===""?o.options:o.options.filter(c=>(c.label||"").includes(l.value))),s=(0,n.computed)(()=>o.modelValue?(o.modelValue+"").split(",").filter(Boolean):[]),d=c=>{if(c.disabled||s.value.includes(c.value))return;const f=[...s.value,c.value].join(",");a("update:modelValue",f),a("change",{value:f,data:c})};return(c,f)=>{const p=(0,n.resolveComponent)("j-button"),u=(0,n.resolveComponent)("j-icon"),h=(0,n.resolveComponent)("el-input"),g=(0,n.resolveComponent)("el-popover");return(0,n.openBlock)(),(0,n.createBlock)(g,{teleported:!1,placement:"bottom-start","popper-style":"padding: 0",width:e.popoverWidth,trigger:"click","show-arrow":!1,offset:4},{reference:(0,n.withCtx)(()=>[(0,n.createVNode)(p,{style:{"justify-content":"flex-start",padding:"4px 0",border:"0"},icon:"mdi:add",label:e.label,type:"link"},null,8,["label"])]),default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Hm,[(0,n.createElementVNode)("div",Lm,[(0,n.createVNode)(h,{modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=m=>l.value=m),modelModifiers:{trim:!0},placeholder:(0,n.unref)(r)("搜索"),class:"no-border",clearable:""},{prefix:(0,n.withCtx)(()=>[(0,n.createVNode)(u,{icon:"mdi:search"})]),_:1},8,["modelValue","placeholder"])]),(0,n.createElementVNode)("div",Om,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,m=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:m.value,class:(0,n.normalizeClass)(["option-item",{active:s.value.includes(m.value)||m.disabled}]),onClick:(0,n.withModifiers)(w=>d(m),["stop"])},[m.icon?((0,n.openBlock)(),(0,n.createBlock)(u,{key:0,class:"j-button-select-icon",icon:m.icon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(r)(m.label)),1)],10,Dm))),128))])])]),_:1},8,["width"])}}}),Fm=Im,Bs=ve(Fm),$m={class:"j-tree-item-text"},Wm={key:2,class:"j-tree-item-button-group"},Um={key:1,class:"j-block",style:{display:"flex","align-items":"center","justify-content":"center"}},Jm=(0,n.defineComponent)({name:"JTree",__name:"tree",props:{loadData:Function,afterLoadData:Function,click:Function,immediate:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},defaultCheckedKeys:{type:Array,default:()=>[]},defaultExpandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},highlightCurrent:{type:Boolean,default:!0},filterNode:Function,renderAfterExpand:{type:Boolean,default:!0},iconKey:{type:String,default:"nodeIcon"},iconColorKey:{type:String,default:"nodeIconColor"},list:{type:Array},dataType:String,dataCode:String,checkable:Boolean,checkStrictly:{type:Boolean,default:!1},check:Function,emptyDes:{type:String,default:"暂无数据"},defaultIcon:{type:String,default:""},defaultIconColor:{type:String,default:""},treeButtons:{type:Array,default:()=>[]},filterButton:Function,buttonDefaultIcon:{type:String,default:""},buttonIconColor:{type:String,default:""},runFlow:{type:Function},nodeClickFlow:{type:String},isHeightAuto:{type:Boolean,default:!1},theme:{type:String,default:"default"},draggable:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!1},allowDrop:Function},emits:["node-drop"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:l,t:i}=tt(),{getDataByComp:s,loadDataByComp:d}=l(),c=(0,n.ref)(),f=(0,n.ref)(!1),p=(0,n.ref)(""),u=(0,n.ref)([]),h={children:"children",label:"label",disabled:"disabled"},g=(0,n.computed)(()=>s?s({config:a})||[]:[]),m=(0,n.computed)(()=>a.dataCode||a.dataType?g.value:a.list?(0,n.unref)(a.list):u.value),w=async()=>{f.value=!0,a.loadData&&(u.value=await a.loadData()||[]),d&&await d({type:"j-tree",config:a}),f.value=!1,(0,n.nextTick)(()=>{a.afterLoadData&&a.afterLoadData(m.value||[])})},k=(N,M=!0)=>{c.value?.setCurrentKey(N,M)},C=()=>c.value?.getCurrentKey(),v=(N,M=!1)=>{c.value?.setCheckedKeys(N,M)},b=(N=!1)=>c.value?.getCheckedKeys(N),S=async(N,M,B,H)=>{if(p.value=N.value,a.nodeClickFlow&&a.runFlow){const W=JSON.parse(a.nodeClickFlow);await a.runFlow(W,{value:N.value})}a.click&&a.click(N.value,N,H)},y=(N,{checkedKeys:M,checkedNodes:B,halfCheckedKeys:H,halfCheckedNodes:W})=>{a.check&&a.check(M,{node:N,checkedNodes:B,halfCheckedKeys:H,halfCheckedNodes:W})},x=(N,M,B,H)=>{r("node-drop",N,M,B,H)},E=N=>{const M=kt(a.treeButtons);return N&&a.filterButton?a.filterButton({buttons:M,node:N}):M},{openLayer:_}=En(),V=(N,M)=>{N.config?.disabled||N.click&&N.click({data:M,openLayer:_})},T=(0,n.ref)(""),P=(N,M)=>{T.value=N?M.value:""},A=(N,M,B)=>a.allowDrop?a.allowDrop(N,M,B):!(B=="inner"&&!M.data.canInner);return(0,n.onMounted)(async()=>{(a.immediate&&a.loadData||a.dataType||a.dataCode)&&await w()}),(0,n.watch)(()=>a.dataCode||a.dataType,()=>{w()}),t({refreshData:w,setValue:k,getValue:C,setCheck:v,getCheck:b}),(N,M)=>{const B=(0,n.resolveComponent)("j-icon"),H=(0,n.resolveComponent)("j-button"),W=(0,n.resolveComponent)("el-dropdown-item"),X=(0,n.resolveComponent)("el-dropdown-menu"),fe=(0,n.resolveComponent)("el-dropdown"),J=(0,n.resolveComponent)("el-tree"),Y=(0,n.resolveComponent)("el-empty"),G=(0,n.resolveDirective)("loading");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(["j-block","j-tree",{"j-tree-menu":e.theme==="menu"}]),style:{"min-height":"60px"}},[!f.value&&m.value.length>0?((0,n.openBlock)(),(0,n.createBlock)(J,{key:0,ref_key:"treeRef",ref:c,"node-key":"value","default-checked-keys":e.defaultCheckedKeys,"default-expanded-keys":e.defaultExpandedKeys,"current-node-key":p.value,data:m.value,"default-expand-all":e.defaultExpandAll,"show-checkbox":e.checkable,props:h,"highlight-current":e.highlightCurrent,accordion:e.accordion,"filter-node-method":e.filterNode,"render-after-expand":e.renderAfterExpand,draggable:e.draggable,"allow-drop":A,"expand-on-click-node":e.expandOnClickNode,"check-strictly":e.checkStrictly,onNodeClick:S,onCheck:y,onNodeDrop:x},{default:(0,n.withCtx)(({node:j})=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["j-tree-item-wraper",{"is-focus":T.value===j.data.value}])},[j.data.openIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,class:"j-tree-item-open-icon",size:18,icon:j.data.openIcon,color:j.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),j.data[e.iconKey]||e.defaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:1,class:"j-tree-item-default-icon",size:18,icon:j.data[e.iconKey]||e.defaultIcon||"",color:j.data[e.iconColorKey]||e.defaultIconColor||""},null,8,["icon","color"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",$m,(0,n.toDisplayString)(j.label),1),E(j.data).length?((0,n.openBlock)(),(0,n.createElementBlock)("div",Wm,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(E(j.data),(me,Pe)=>((0,n.openBlock)(),(0,n.createBlock)(fe,{key:Pe,trigger:"click",onVisibleChange:pe=>P(pe,j.data)},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(X,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(me.children,(pe,Ne)=>((0,n.openBlock)(),(0,n.createBlock)(W,{key:Ne,disabled:pe.disabled,divided:pe.divided,onClick:(0,n.withModifiers)(Fe=>V(pe,j.data),["stop"])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",{class:"j-flex-item",style:(0,n.normalizeStyle)({color:pe.danger?"var(--j-color-danger)":pe.color||e.buttonIconColor||"var(--j-color-text-2)"})},[pe.icon||e.buttonDefaultIcon?((0,n.openBlock)(),(0,n.createBlock)(B,{key:0,icon:pe.icon||e.buttonDefaultIcon},null,8,["icon"])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",null,(0,n.toDisplayString)((0,n.unref)(i)(pe.label)),1)],4)]),_:2},1032,["disabled","divided","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(H,{icon:me.icon,type:"text"},null,8,["icon"])]),_:2},1032,["onVisibleChange"]))),128))])):(0,n.createCommentVNode)("",!0)],2)]),_:1},8,["default-checked-keys","default-expanded-keys","current-node-key","data","default-expand-all","show-checkbox","highlight-current","accordion","filter-node-method","render-after-expand","draggable","expand-on-click-node","check-strictly"])):((0,n.openBlock)(),(0,n.createElementBlock)("div",Um,[(0,n.createVNode)(Y,{description:(0,n.unref)(i)(e.emptyDes)},null,8,["description"])]))],2)),[[G,f.value]])}}}),Ym=Jm,Rs=ve(Ym),Km=(0,n.defineComponent)({name:"JTreeSelect",__name:"tree-select",props:{modelValue:{},options:{},lazy:{type:Boolean,default:!1},load:{},checkStrictly:{type:Boolean,default:!0},renderAfterExpand:{type:Boolean,default:!0},props:{default:()=>({children:"children",label:"label",value:"value"})},size:{default:"default"},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},placeholder:{default:"请选择"},dataType:{default:""},dataCode:{default:""},labelKey:{default:""},valueKey:{default:""},pidKey:{default:""},idKey:{default:""}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,{useData:a}=tt(),{getDataByComp:r}=a(),l=(0,n.computed)(()=>r?r({type:"j-tree-select",config:o})||[]:[]),i=(0,n.computed)(()=>{if(!(o.lazy&&o.load))return o.options?o.options:o.dataCode||o.dataType?l.value:[]}),s=t,d=(0,n.computed)({get(){return o.modelValue},set(f){s("update:modelValue",f)}}),c=f=>{s("change",f)};return(f,p)=>{const u=(0,n.resolveComponent)("el-tree-select");return(0,n.openBlock)(),(0,n.createBlock)(u,{modelValue:d.value,"onUpdate:modelValue":p[0]||(p[0]=h=>d.value=h),style:{width:"100%"},data:i.value,lazy:e.lazy,load:e.load,"check-strictly":e.checkStrictly,"render-after-expand":e.renderAfterExpand,props:o,size:e.size,disabled:e.disabled||e.readonly,clearable:e.clearable,placeholder:e.placeholder,onChange:c},null,8,["modelValue","data","lazy","load","check-strictly","render-after-expand","size","disabled","clearable","placeholder"])}}}),Gm=Km,Ts=ve(Gm),Vs=ve(Ji),qm=kr.default;async function Xm(e,t,o){const a={...o};delete a.ruleIndex,delete a.trigger;const r=new qm({[e]:[a]});let l=[];try{await r.validate({[e]:t})}catch(i){i.errors?l=i.errors.map(({message:s})=>s):l=[a.message||"校验错误"]}return l.length>0?l[0]:""}async function Zm(e,t,o){const a=o.map((r,l)=>({...r,ruleIndex:l})).sort(({warningOnly:r,ruleIndex:l},{warningOnly:i,ruleIndex:s})=>!!r==!!i?l-s:r?1:-1);for(let r=0;r<a.length;r+=1){const l=a[r];"pattern"in l&&(t+="");const i=await Xm(e,t,l);if(i!=="")return{name:e,errors:i}}}function Qm(e,t){const o=(l,i,s,d,c)=>{Object.keys(i).forEach(f=>{let p=f;s&&(p=`${s}.${f}`);const u=i[f],{rules:h,myGridtableId:g}=t(p,s?i:void 0,()=>d,c);if(h.length){const m=a(p,u,h);l.push(m)}g&&u.forEach(m=>{o(l,m,g,u,s?i:void 0)})})},a=(l,i,s)=>Zm(l,i,s);return{validateForm:async()=>{const l=(0,n.unref)(e),i=[];o(i,l,"");const s=await Promise.all(i),d={};return s.forEach(c=>{c&&(d[c.name]={msg:c.errors})}),d},validateField:a}}var Ms=({data:e,actions:t,utils:o,inputParams:a,notRunActions:r})=>{const l=s=>e.filter(d=>d.source===s).map(d=>d.target),i=async s=>{s=s||"start";const d=e.find(c=>c.id===s);if(d.config.type==="start"){const c=l(s);for(let f=0;f<c.length;f++)await i(c[f])}else{const c=t[d.config.type];c&&await c(d.config,o,async f=>{if(f=f||{},f.nodeId=s,f.next!==!1){const p=l(f.nodeId);for(let u=0;u<p.length;u++)await i(p[u])}},a,f=>{r[f]={data:e,inputParams:a}})}};return{run:i}},ey=(0,n.defineComponent)({name:"JForm",__name:"form",props:{config:{type:Object,default:()=>({})},isAutoSize:{type:Boolean,default:!0},schema:{type:Array,default:()=>[]},readonly:{type:Boolean,default:!1},actions:{type:Object,default:()=>({})}},emits:["change"],setup(e,{expose:t,emit:o}){const a=e,r=o,{useData:l,existField:i,httpGet:s,httpPost:d,success:c,warning:f,error:p,info:u,t:h}=tt();let g;l&&(g=l());const m=U=>{p&&p(U)},w=(0,n.ref)(!1),k=(0,n.computed)(()=>a.config?.gutter||16),C=(0,n.computed)(()=>a.config?.span||24),v=(0,n.computed)(()=>a.config?.labelWidth),b=(0,n.computed)(()=>a.config?.labelPosition||"right"),S=(0,n.computed)(()=>E.length===1&&(E[0].type==="j-tabs"||E[0].type==="j-layout"||E[0].config?.isAutoWindow)),y=(0,n.reactive)({}),x=(0,n.ref)({}),E=(0,n.reactive)([]),_={};let V={},T={},P=[],A={},N={},M=!1,B=0,H;const W=()=>new Promise(U=>{const ue=globalThis.requestAnimationFrame;typeof ue=="function"?ue(()=>U()):setTimeout(()=>U(),0)}),X=U=>{const ue=globalThis.requestIdleCallback;typeof ue=="function"?ue(()=>U()):setTimeout(()=>U(),0)},fe=()=>{const U={};return Object.keys(y).forEach(ue=>{U[ue]=y[ue]}),U},J=()=>{M||(A=kt(N),M=!0)},Y=async U=>{w.value&&me&&(U.getTableData||Br(me,U.config.valueIdKey||U.id,U.formData[U.config.valueIdKey||U.id])),r("change",U),_[U.id]?.config?.codeChange&&await it(JSON.parse(_[U.id]?.config?.codeChange),{param:U}),a.config?.codeChange&&await it(JSON.parse(a.config?.codeChange),{param:U})},G=U=>Sa(_[U]?.type||"")&&!_[U]?.config?.notInput||_[U]?.config?.isInput,j=U=>["j-table","j-table-panel","j-input-rows","j-input-cards"].includes(_[U]?.type||"");let me;const Pe=(U,ue)=>{Object.keys(U).forEach(ee=>{const ne=U[ee];ue&&(ee=ue+"."+ee),ne!=null&&typeof ne=="object"&&!xa(ne)&&Pe(ne,ee),y[ee]=ne})},pe=(U,ue)=>{let ee=U.id;return ee||(U.config?.table&&U.config?.field?ee=`${U.config.table}.${U.config.field}`:U.config?.table?ee=U.config?.table:U.config?.field&&(ee=U.config?.field),ue&&(ee=`${ue}.${ee}`)),ee||ka("j")},Ne=(U,ue,ee,ne="")=>{U.forEach(he=>{he.id=pe(he,ne);const Ee={id:he.id,slot:he.slot,type:he.type||"",getCompType:he.getCompType,getCompConfig:he.getCompConfig,config:{},children:[]};ue.push(Ee);const{children:Ae}=he;$o(Ee,he,["children","config"]),$o(Ee.config,he.config||{},[]),a.config.size&&Ee.config.size===void 0&&(Ee.config.size=a.config.size),_[he.id]&&console.warn("有重复的组件id:"+he.id),_[he.id]=Ee,a.readonly===!0&&(Ee.config.readonly=!0);let Ue=!1,vt;ne!==""&&(Ue=!0,Ee.config.parentTableId=ne,vt=_[ne]?.config?.table);const et=Ee.config||{};if(G(he.id))!ee&&Ue===!1&&(et?.defaultValue===0?y[he.id]=et?.defaultValue:y[he.id]=et?.defaultValue||void 0),et.table&&et.field?V[`${et.table}_${et.field}`.toLowerCase()]=he.id:et.field&&(Ue?V[`${vt}_${et.field}`.toLowerCase()]=he.id:V[`${et.field}`.toLowerCase()]=he.id);else if(Ue&&et.field)V[`${vt}_${et.field}`.toLowerCase()]=he.id;else if(j(he.id))!ee&&!et.isSubTable&&(y[he.id]=[]),et.table&&(V[et.table.toLowerCase()||""]=he.id),et.isSubTable||P.push(Ee);else if(et?.defaultValue)y[he.id]=et?.defaultValue;else if(he.type==="collapse"&&et?.isExpand){const bn=[];(et?.groups||[]).forEach(wn=>{bn.push(wn.i)}),y[he.id]=bn}Ae&&Ae.length>0&&Ne(Ae,Ee.children,ee,j(Ee.id)?Ee.id:ne)})},Fe=async(U,ue)=>{const ee=++B,ne=w.value;w.value=!1,ne&&await(0,n.nextTick)();const he=!!ue;if(E.length=0,V=Object.create(null),T=Object.create(null),P=[],me=ue,bo(y),bo(_),he&&Pe(ue,""),Ne(U,E,he),N=fe(),M=!1,A=N,X(()=>{ee===B&&(A=kt(N),M=!0)}),await(0,n.nextTick)(),w.value=!0,await(0,n.nextTick)(),await W(),a.config?.codeInit){const Ee=a.config.codeInit;let Ae;H?.raw===Ee?Ae=H.obj:(Ae=JSON.parse(Ee),H={raw:Ee,obj:Ae}),await it(Ae,{param:{}})}},Ge=(U,ue,ee)=>{const ne=[];return ue.forEach(he=>{const Ee={};Object.keys(he).forEach(Ae=>{if(!ee||ee(Ae,he[Ae],U)){const Ue=Se(Ae);if(Ue?.type==="j-table"||Ue?.type==="j-table-panel")Ee[Ue?.id||""]=Ge(Ae,he[Ae],ee);else{let vt=V[`${U}_${Ae}`.toLowerCase()]||Ae;vt=vt.indexOf(".")!==-1?vt.split(".")[1]:vt,Ee[vt]=he[Ae]}}}),ne.push(Ee)}),ne},Q=(U,ue)=>{Object.keys(U||{}).forEach(ee=>{let ne=U[ee];const he=Se(ee);if(he===void 0)ne&&(xa(ne)&&(ne=ne[0]||{}),typeof ne=="object"?Object.keys(ne).forEach(Ee=>{if(!ue||ue(ee,ne[Ee],ee)){let Ae=Ee;ee!=="main"&&(Ae=`${ee}_${Ee}`),T[Ae]=ee,y[V[Ae.toLowerCase()]||Ee]=ne[Ee]}}):y[ee]=ne);else if(j(he.id||"")){if(!Array.isArray(ne)){console.warn("表格数据不是数组:"+ee);return}ne?.length>0?y[V[ee.toLowerCase()]||ee]=Ge(ee,ne,ue):y[V[ee.toLowerCase()]||ee]=[]}else(!ue||ue(ee,ne,ee))&&(y[V[ee.toLowerCase()]||ee]=ne)}),me&&Object.keys(y).forEach(ee=>{const ne=Se(ee);(ne===void 0||!["j-tabs","j-collapse"].includes(ne.type||""))&&Br(me,ee,y[ee])})},ge=new Set(["parentRow","_i","_compTypeByRender"]),Re=(U,ue=!1)=>{const ee={};return Object.keys(U).forEach(ne=>{if(ge.has(ne))return;const he=_[ne];if(he){const Ee=he.config?.table,Ae=he.config?.field;if(ue)Ae?ee[Ae]=U[ne]:ee[ne]=U[ne];else if(j(ne)){const Ue=[];U[ne].forEach(vt=>{Ue.push(Re(vt,!0))}),ee[Ee||ne]=Ue}else Ee&&Ae?(ee[Ee]=ee[Ee]||{},ee[Ee][Ae]=U[ne]):Ae&&(ee[Ae]=U[ne])}else ue?ne!=="_X_ROW_KEY"&&ne!=="_isHover"&&(ee[ne]=U[ne]):T[ne]?(ee[T[ne]]=ee[T[ne]]||{},ee[T[ne]][ne.replace(`${T[ne]}_`,"")]=U[ne]):ee[ne]=U[ne]}),ee},rt=(U=!0)=>U?Re(y):y,$=(U,ue,ee,ne)=>{let he=_[U];if(he==null){const Ae=U.split(".");he=_[Ae[Ae.length-1]]||{}}if(!he)return{};const Ee=$t({config:he.config||{},getCompConfig:he.getCompConfig,formData:y,getTableData:ee,row:ue,pRowData:ne});return Ee._componentId=he?.id,Ee},ae=(U,ue,ee,ne)=>{const he=$(U,ue,ee,ne);if(he.isNotRule!==!0&&he.display!==!1){const Ee=he.rule||[],Ae=Ee.find(Ue=>Ue.type==="only");return Ae&&(Ae.validator=async(Ue,vt)=>{if(vt&&!await i({table:Ue.table,key:Ue.key,keyName:Ue.keyName,field:Ue.field,keyValue:Ue.getKeyValue?Ue.getKeyValue():"",value:vt,paramNames:Ue.paramNames,getParams:Ue.getParams,withProjectId:Ue.withProjectId,getValue:Ue.getValue,formData:y}))throw h(Ue.message)||h("数据值重复")}),{rules:Ee,myGridtableId:j(he._componentId)?he._componentId:""}}return{rules:[],myGridtableId:""}},{validateForm:ye}=Qm(y,ae),Ce=async()=>{x.value={};const U=await ye();return Object.keys(U).length>0?(x.value=U,m(`${h(_[Object.keys(U)[0]]?.config?.label)}:${h(U[Object.keys(U)[0]].msg)}`),!1):!0},Me=()=>{x.value={},J(),bo(y),Object.keys(A||{}).forEach(U=>{y[U]=A[U]})},Se=U=>{let ue=_[U];return ue===void 0&&V[U.toLowerCase()]&&(ue=_[V[U.toLowerCase()]]),ue},Te=({id:U,i:ue,value:ee,type:ne})=>{if(ne==="add")y[U].push(ee);else if(ne==="delete")y[U].splice(ue,1);else{const he=Se(U);he&&(he.config.parentTableId?y[he.config.parentTableId][ue][U]=ee:y[U]=ee)}},We=({id:U,i:ue})=>{const ee=Se(U);if(ee){if(ee.config.parentTableId){const ne=y[ee.config.parentTableId],he=ee.id?ee.id.replace(`${ee.config.parentTableId}.`,""):"";if(ue!=null)return(ne[ue]||{})[he||""];const Ee=[];return ne&&ne.forEach(Ae=>{Ee.push(Ae[he||""])}),Ee}if(j(ee.id||"")){const ne=[];return y[ee.id||""].forEach(he=>{ne.push(Re(he,!0))}),ne}return y[ee.id||""]}if(y[U])return y[U]},wt=async({id:U,i:ue})=>{const ee=We({id:U,i:ue}),ne=Se(U);if(ne&&g?.getLabel)if(ue!==void 0){const he=ee[ue],Ee=y[ne.config.parentTableId||""][ue],Ae=$t({config:ne.config,getCompConfig:ne.getCompConfig,formData:y,tableData:y[ne.config.parentTableId||""],row:Ee});return await g?.getLabel({value:he,config:Ae,formData:y,tableData:y[ne.config.parentTableId||""],row:Ee})}else{const he=$t({config:ne.config,getCompConfig:ne.getCompConfig,formData:y});return await g?.getLabel({value:ee,config:he,formData:y})}return ee},Pt=async(U,ue)=>g?.loadViewDataList?await g?.loadViewDataList(U,ue,!1):[],Rt=U=>(U.set=Te,U.get=We,U.setFormData=Q,U.getFormData=rt,U.getLabel=wt,U.getViewData=Pt,U.getDateNow=ue=>_a(new Date,ue||"YYYY-MM-DD HH:mm:ss"),U.httpGet=s||(()=>{console.log("当前状态不支持")}),U.httpPost=d||(()=>{console.log("当前状态不支持")}),U.loading=ue=>{kn(ue)},U.showMsg=({text:ue,type:ee})=>{switch(ee){case"success":c&&c(ue);break;case"warning":f&&f(ue);break;case"error":p&&p(ue);break;case"info":u&&u(ue);break;default:u&&u(ue);break}},U),Xe=async(U,ue)=>{if(U&&U.trim()){U=`async (jcode) => {${U}}`;const{res:ee,fn:ne}=_r(U);ee&&await ne(Rt(ue))}},Nt=async()=>{a.config?.codeAfterSetData&&await it(JSON.parse(a.config?.codeAfterSetData),{param:{}})},ct=async()=>{a.config?.codeBeforeSave&&await it(JSON.parse(a.config?.codeBeforeSave),{param:{}})},yt=async()=>{a.config?.codeAfterSave&&await it(JSON.parse(a.config?.codeAfterSave),{param:{}})};a.schema&&Fe(a.schema);const lt={},it=async(U,ue)=>{const{run:ee}=Ms({data:U,actions:a.actions,utils:{showLoading:kn,executeEvent:Xe},inputParams:ue,notRunActions:lt});await ee()};return Vr({formData:y,components:_,errorFields:x,isAutoWindow:S,gutter:k,span:C,labelWidth:v,labelPosition:b,getValue:We,formChange:Y,runFlow:it,runFlowByNotRunActions:async U=>{const ue=lt[U];ue&&(delete lt[U],await it(ue.data,ue.inputParams))}}),Mr({contextType:"form"}),Kn({}),t({init:Fe,reset:Me,validate:Ce,setValue:Te,getValue:We,getLabel:wt,setFormData:Q,getFormData:rt,afterSetData:Nt,beforeSave:ct,afterSave:yt}),(U,ue)=>{const ee=(0,n.resolveComponent)("j-form-item"),ne=(0,n.resolveComponent)("el-row"),he=(0,n.resolveComponent)("el-form");return w.value?((0,n.openBlock)(),(0,n.createBlock)(he,{key:0,class:(0,n.normalizeClass)(["j-form",e.isAutoSize&&"j-block",e.isAutoSize&&"j-form-auto"]),"label-position":b.value,"label-width":v.value,size:e.config?.size,onSubmit:ue[0]||(ue[0]=(0,n.withModifiers)(()=>{},["prevent"]))},{default:(0,n.withCtx)(()=>[S.value?((0,n.openBlock)(),(0,n.createBlock)(ee,(0,n.mergeProps)({key:0},E[0],{"is-not-col":""}),null,16)):((0,n.openBlock)(),(0,n.createBlock)(ne,{key:1,gutter:k.value},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(E,Ee=>((0,n.openBlock)(),(0,n.createBlock)(ee,(0,n.mergeProps)({key:Ee.id},{ref_for:!0},Ee),null,16))),128))]),_:1},8,["gutter"]))]),_:1},8,["class","label-position","label-width","size"])):(0,n.createCommentVNode)("",!0)}}}),ty=ey,Ns=ve(ty),As=ve(Ui),ny={class:"j-page"},oy=(0,n.defineComponent)({name:"JPage",__name:"page",props:{schema:{type:Array,default:()=>[]},noPadding:{type:Boolean,deflaut:!1},actions:{type:Object,default:()=>({})}},setup(e,{expose:t}){const o=e,a=(0,n.ref)(!1),r=(0,n.reactive)([]),l={},i=(0,n.reactive)({}),s=(C,v)=>{C.forEach(b=>{b.id=b.id||ka("c");const S={id:b.id,slot:b.slot,type:b.type||"",getCompConfig:b.getCompConfig,getCompType:b.getCompType},{children:y}=b;l[b.id]=S,S.config=[],$o(S.config,b.config||{},["defaultValue"]),b?.config?.defaultValue!==void 0&&(i[b.id]=b.config.defaultValue),v.push(S),y&&y.length>0&&(S.children=[],s(y,S.children))})},d=C=>{a.value=!1,r.splice(0,r.length),bo(l),bo(i),s(C,r),(0,n.nextTick)(()=>{a.value=!0})};o.schema&&d(o.schema);const{openLayer:c}=En(),f={},p=async(C,v)=>{const{run:b}=Ms({data:C,actions:o.actions,utils:{showLoading:kn,openLayer:c,call:m},inputParams:v,notRunActions:f});await b()},u=async C=>{const v=f[C];v&&(delete f[C],await p(v.data,v.inputParams))},h=new Tr,g=new Map,m=(C,v,b,...S)=>{if(b?.immediate){const y=g.get(C)||new Map;y.set(v,S),g.set(C,y)}return h.emit(C,v,...S)},w=(C,v)=>{h.on(C,v);const b=g.get(C);b&&(g.delete(C),b.forEach((S,y)=>{v(y,...S||[])}))},k=(C,v)=>{h.off(C,v)};return _i({registerMethod:(C,v)=>(w(C,v),()=>{k(C,v)}),runFlow:p,runFlowByNotRunActions:u}),Mr({contextType:"page"}),t({init:d,call:m,on:w,off:k}),(C,v)=>{const b=(0,n.resolveComponent)("j-comp");return(0,n.openBlock)(),(0,n.createElementBlock)("div",ny,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(r,S=>((0,n.openBlock)(),(0,n.createBlock)(b,{key:S.id,id:S.id,type:S.type,config:S.config,children:S.children},null,8,["id","type","config","children"]))),128))])}}}),ay=oy,js=ve(ay),ry=(0,n.defineComponent)({name:"JGuid",__name:"guid",props:{modelValue:{default:void 0},size:{default:"default"}},emits:["update:modelValue"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)("");return(0,n.watch)(()=>o.modelValue,l=>{l?r.value=l:(r.value=Ft(),a("update:modelValue",r.value))},{immediate:!0}),(l,i)=>{const s=(0,n.resolveComponent)("el-input");return(0,n.openBlock)(),(0,n.createBlock)(s,{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=d=>r.value=d),readonly:"",size:e.size},null,8,["modelValue","size"])}}}),ly=ry,Ps=ve(ly),iy={key:0,class:"j-panel-top"},sy=["title"],cy={style:{margin:"0","font-size":"14px"}},dy={key:1},uy={key:1,class:"j-panel-bottom"},fy=(0,n.defineComponent)({name:"JPanel",__name:"panel",props:{title:{},toolBtns:{default:()=>[]},bootmBtns:{default:()=>[]},bootmRightBtns:{default:()=>[]},bodyStyle:{default:()=>({padding:"8px"})},noPadding:{type:Boolean,default:!1},notTitle:{type:Boolean,default:!1},flexWidth:{},height:{},unit:{default:"%"},notSetWidth:{type:Boolean,default:!1},size:{default:"default"}},setup(e){const{openLayer:t}=En(),o=a=>{a.config?.disabled||a.click&&a.click({openLayer:t})};return(a,r)=>{const l=(0,n.resolveComponent)("j-button"),i=(0,n.resolveComponent)("el-tooltip"),s=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-block",style:(0,n.normalizeStyle)({padding:e.noPadding?void 0:"4px",width:(e.notSetWidth?100:e.flexWidth||100)+"%",height:`${e.height?e.height+(e.unit||"%"):"100%"}`})},[(0,n.createElementVNode)("div",{class:"j-panel",style:(0,n.normalizeStyle)({"border-radius":e.noPadding?"0px":"4px"})},[e.title&&!e.notTitle||e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",iy,[e.notTitle?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"j-panel-top-left",title:e.title||""},[(0,n.renderSlot)(a.$slots,"title",{},()=>[(0,n.createElementVNode)("span",cy,(0,n.toDisplayString)(e.title||""),1)])],8,sy)),e.toolBtns&&e.toolBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("span",dy,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.toolBtns,d=>((0,n.openBlock)(),(0,n.createBlock)(i,{key:d.id,placement:"top",content:d.label||""},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(l,(0,n.mergeProps)({ref_for:!0},d.config,{onClick:c=>o(d),type:"text",size:e.size}),null,16,["onClick","size"])]),_:2},1032,["content"]))),128))])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{class:"j-panel-body",style:(0,n.normalizeStyle)(e.bodyStyle)},[(0,n.renderSlot)(a.$slots,"default")],4),e.bootmBtns&&e.bootmBtns.length>0||e.bootmRightBtns&&e.bootmRightBtns.length>0?((0,n.openBlock)(),(0,n.createElementBlock)("div",uy,[(0,n.createVNode)(s,{list:e.bootmBtns},null,8,["list"]),(0,n.createVNode)(s,{list:e.bootmRightBtns},null,8,["list"])])):(0,n.createCommentVNode)("",!0)],4)],4)}}}),py=fy,zs=ve(py),hy={class:"j-input-rows"},gy={key:0,class:"j-input-rows-num"},my={key:1,class:"j-input-rows-char"},yy=(0,n.defineComponent)({name:"JInputRows",__name:"input-rows",props:{modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},isCompact:{type:Boolean,default:!1},showNum:{type:Boolean,default:!1},showChar:{type:Boolean,default:!1},isWrap:{type:Boolean,default:!1},id:{type:String,default:""},actions:{type:Array,default:()=>[]}},emits:["update:modelValue","change","rowChange"],setup(e,{emit:t}){const o=y=>y==null,a=e,r=t,{formData:l}=Sn(),i=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),s=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),d=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),c=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),f=(0,n.computed)(()=>a.editConfig.readonly),p=(0,n.computed)(()=>a.editConfig.drag),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)(),g=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=(0,n.ref)([]);a.modelValue&&a.modelValue.length>0?(m.value=a.modelValue||[],m.value.forEach(y=>{y._i||(y._i=Ft())})):(m.value=[],r("update:modelValue",m.value)),(0,n.watch)(()=>a.modelValue,y=>{m.value=a.modelValue||[],m.value=y||[],m.value.forEach(x=>{x._i||(x._i=Ft())})},{deep:!0});const k=y=>{const x={};return!a.isCompact&&y.config?.colWidth&&(x.width=`${y.config.colWidth}px`),x},C=()=>{const y={_i:Ft()};a.columns.forEach(x=>{const E=x.config?.valueRowKey||x.id||"";x.type==="j-layer-form"?x.config?.defaultValue&&Object.prototype.toString.call(x.config.defaultValue)==="[object Object]"&&Object.assign(y,kt(x.config?.defaultValue)):E&&(y[E]=kt(x.config?.defaultValue))}),m.value.push(y),r("change",{id:a.id,value:y,data:y,formData:l,tableData:m.value,type:"add"})},v=y=>{const x=m.value[y];m.value.splice(y,1),r("change",{id:a.id,value:x,data:x,formData:l,tableData:m.value,type:"delete"})},b=y=>{r("rowChange",y)};(0,n.onMounted)(()=>{if(!p.value||!h.value)return;const y=h.value,{initSortable:x}=mi(y,{handle:".j-input-rows-drag",onEnd:E=>{const{oldIndex:_,newIndex:V}=E;if(o(_)||o(V)||_===V||_<0||V<0)return;const T=m.value.splice(_,1)[0];m.value.splice(V,0,T),r("change",{id:a.id,value:T,data:T,formData:l,tableData:m.value,type:"sort"})}});x()});const{row:S}=wo();return Kn({getTableData:()=>m.value,rowChange:b,pRowData:S}),(y,x)=>{const E=(0,n.resolveComponent)("j-comp"),_=(0,n.resolveComponent)("j-icon"),V=(0,n.resolveComponent)("j-button"),T=(0,n.resolveComponent)("j-buttons");return(0,n.openBlock)(),(0,n.createElementBlock)("div",hy,[(0,n.createElementVNode)("div",{ref_key:"inputRowsRef",ref:h,class:"j-input-rows-container"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(m.value,(P,A)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:P._i+A,class:(0,n.normalizeClass)([e.isCompact?"j-space-compact":"j-space",{"j-space-wrap":e.isWrap}])},[e.showNum?((0,n.openBlock)(),(0,n.createElementBlock)("div",gy,(0,n.toDisplayString)(A+1),1)):(0,n.createCommentVNode)("",!0),e.showChar?((0,n.openBlock)(),(0,n.createElementBlock)("div",my,(0,n.toDisplayString)(g[A%26]),1)):(0,n.createCommentVNode)("",!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,N=>((0,n.openBlock)(),(0,n.createBlock)(E,(0,n.mergeProps)({key:N.id,ref_for:!0},N,{row:P,style:k(N)}),null,16,["row","style"]))),128)),p.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:2,class:"j-input-rows-drag",icon:"mdi:drag"})):(0,n.createCommentVNode)("",!0),c.value&&(u.value||m.value.length>1)&&!f.value?((0,n.openBlock)(),(0,n.createBlock)(_,{key:3,icon:"mdi:delete-outline",class:"j-input-rows-delete",onClick:N=>v(A)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)],2))),128))],512),!f.value&&i.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":d.value}),class:"j-input-rows-actions"},[i.value?((0,n.openBlock)(),(0,n.createBlock)(V,{key:0,type:"link",style:{"margin-right":"8px"},label:s.value,icon:"mdi:add",onClick:C},null,8,["label"])):(0,n.createCommentVNode)("",!0),e.actions&&e.actions.length>0?((0,n.openBlock)(),(0,n.createBlock)(T,{key:1,list:e.actions},null,8,["list"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)])}}}),vy=yy,Hs=ve(vy),by={class:"j-input-layer"},wy=(0,n.defineComponent)({name:"JInputLayer",__name:"input-layer",props:{modelValue:{default:""},icon:{default:"mdi:library-edit-outline"},width:{default:800},layerWidth:{},height:{default:600},title:{},placeholder:{default:"请选择"},isMultiSelect:{type:Boolean,default:!1},valueKey:{default:"value"},labelKey:{default:"label"},idKey:{},pidKey:{default:"value"},isTree:{type:Boolean,default:!1},isPage:{type:Boolean,default:!1},sidx:{},columns:{default:()=>[]},loadLayerData:{},renderVNode:{},renderVNodeClass:{},getText:{},beforeOpen:{},readonly:{type:Boolean,default:!1},size:{default:"default"},clearable:{type:Boolean,default:!0},defaultExpandAll:{type:Boolean,default:!0},mode:{default:"serve"},searchList:{default:()=>[]},onlyButton:{type:Boolean,default:!1},buttonLabel:{},buttonType:{},buttonShape:{},buttonStatus:{},buttonBlock:{type:Boolean},notButtonLabel:{type:Boolean},buttonLoading:{type:[Boolean,Object]},isSaveSelectData:{type:Boolean,default:!1},buttons:{default:()=>[]}},emits:["update:modelValue","change"],setup(e,{expose:t,emit:o}){const a=C=>!!(C==null||typeof C=="string"&&C.trim()===""||Array.isArray(C)&&C.length===0),r=e,l=o,i=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.computed)(()=>!!r.renderVNode&&!r.isMultiSelect),f=(0,n.computed)({get(){return r.modelValue},set(C){l("update:modelValue",C)}}),p=(0,n.computed)({get(){return a(f.value)?"":r.getText?r.getText(f.value)||d.value||f.value:d.value||f.value},set(C){C||h()}}),u=async()=>{r.readonly||r.beforeOpen&&await r.beforeOpen()===!1||i.value.open()},h=()=>{d.value="",f.value="",l("change",{value:"",data:void 0})},g=async({checked:C})=>{c.value&&C&&(await(0,n.nextTick)(),await m())},m=async()=>{if(!s.value)return;const C=s.value.getSelection();if(r.isMultiSelect){const v=[],b=[];C.forEach(S=>{const y=S[r.labelKey],x=S[r.valueKey];v.push(y!=null?String(y):""),x===0||x?b.push(String(x)):b.push("")}),d.value=v.join(","),f.value=b.join(","),l("change",{value:b.join(","),data:C})}else if(C.length>0){const v=C[0],b=v[r.labelKey],S=v[r.valueKey];d.value=b!=null?String(b):"";const y=S!=null?String(S):"";f.value=y,l("change",{value:y,data:v})}else d.value="",f.value="",l("change",{value:"",data:void 0});i.value.close()},w=()=>{s.value&&s.value.clearSelection&&s.value.clearSelection()};return t({getTablePanelRef:()=>s.value}),(C,v)=>{const b=(0,n.resolveComponent)("j-button"),S=(0,n.resolveComponent)("el-input"),y=(0,n.resolveComponent)("j-table-panel"),x=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)("div",by,[e.onlyButton?((0,n.openBlock)(),(0,n.createBlock)(b,{key:1,type:e.buttonType,size:e.size,label:e.buttonLabel,icon:e.icon,shape:e.buttonShape,status:e.buttonStatus,block:e.buttonBlock,"not-label":e.notButtonLabel,loading:e.buttonLoading,onClick:u},null,8,["type","size","label","icon","shape","status","block","not-label","loading"])):((0,n.openBlock)(),(0,n.createBlock)(S,{key:0,modelValue:p.value,"onUpdate:modelValue":v[0]||(v[0]=E=>p.value=E),placeholder:e.placeholder,readonly:e.readonly,size:e.size,clearable:!e.readonly&&e.clearable,onClick:u,onClear:h},(0,n.createSlots)({_:2},[e.readonly?void 0:{name:"append",fn:(0,n.withCtx)(()=>[(0,n.createVNode)(b,{icon:e.icon,onClick:u},null,8,["icon"])]),key:"0"}]),1032,["modelValue","placeholder","readonly","size","clearable"])),(0,n.createVNode)(x,{ref_key:"layerRef",ref:i,title:e.title||e.placeholder,width:e.layerWidth||e.width,height:e.height,"has-btns":!c.value,"btn-text":"确定",onOk:m,onClosed:w},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{ref_key:"tableRef",ref:s,columns:e.columns,"search-list":e.searchList,"row-key":e.valueKey,"is-tree":e.isTree,"is-page":e.isPage,sort:e.sidx,"is-multiple":e.isMultiSelect,"load-data":e.loadLayerData,"render-v-node":e.renderVNode,"render-v-node-class":e.renderVNodeClass,immediate:!0,onSelect:g},null,8,["columns","search-list","row-key","is-tree","is-page","sort","is-multiple","load-data","render-v-node","render-v-node-class"])]),_:1},8,["title","width","height","has-btns"])])}}}),Cy=wy,Ls=ve(Cy),xy=(0,n.defineComponent)({name:"JLayerForm",__name:"layer-form",props:{icon:{type:String,default:"mdi:form-outline"},type:{type:String,default:"default"},status:{type:String,default:"normal"},label:{type:String,default:"设置"},size:{type:String,default:"default"},layerLabel:{type:String,default:"设置"},layerHeight:{type:Number,default:400},layerWidth:{type:Number,default:600},formConfig:{type:Object,default:()=>({})},schema:{type:Array,default:()=>[]},row:{type:Object,default:()=>({})}},setup(e){const{t}=tt(),o=(0,n.ref)(!1),a=()=>{o.value=!0};return(r,l)=>{const i=(0,n.resolveComponent)("j-button"),s=(0,n.resolveComponent)("j-dialog");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(i,(0,n.mergeProps)(r.$attrs,{type:e.type,size:e.size,icon:e.icon,status:e.status,label:e.label,onClick:a}),null,16,["type","size","icon","status","label"]),(0,n.createVNode)(s,{visible:o.value,"onUpdate:visible":l[0]||(l[0]=d=>o.value=d),title:(0,n.unref)(t)(e.layerLabel||"设置"),height:e.layerHeight||400,width:e.layerWidth||600,"has-btns":!1},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(Gi,{schema:e.schema,"form-config":e.formConfig},null,8,["schema","form-config"])]),_:1},8,["visible","title","height","width"])],64)}}}),ky=xy,Os=ve(ky),Sy=(0,n.defineComponent)({name:"JSwitch",inheritAttrs:!1,__name:"switch",props:{modelValue:{type:[Boolean,String,Number],default:!1},size:{},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},activeText:{},inactiveText:{},activeIcon:{},inactiveIcon:{},activeActionIcon:{},inactiveActionIcon:{},width:{default:40},inlinePrompt:{type:Boolean,default:!1},name:{},validateEvent:{type:Boolean,default:!0},beforeChange:{},id:{},tabindex:{},ariaLabel:{},loading:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,r=(c,f)=>{if(c===void 0)return c;const p=typeof f;if(p===typeof c)return c;if(p==="number"){if(typeof c=="boolean")return c?1:0;const u=Number(c);return Number.isNaN(u)?c?1:0:u}if(p==="string")return typeof c=="boolean"&&(f==="1"||f==="0")?c?"1":"0":String(c);if(p==="boolean"){if(typeof c=="string"){const u=c.trim().toLowerCase();if(u==="false"||u==="0"||u==="")return!1;if(u==="true"||u==="1")return!0}return typeof c=="number"?c!==0:!!c}return c},l=(0,n.computed)(()=>r(o.activeValue,o.modelValue)),i=(0,n.computed)(()=>r(o.inactiveValue,o.modelValue)),s=(0,n.computed)({get(){return o.modelValue},set(c){a("update:modelValue",c)}}),d=c=>{a("change",c)};return(0,n.onMounted)(()=>{o.autoFocus&&!o.readonly&&setTimeout(()=>{const c=s.value===l.value?i.value:l.value;s.value=c,d(c)},100)}),(c,f)=>{const p=(0,n.resolveComponent)("el-switch");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{id:e.id,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=u=>s.value=u),size:e.size,width:e.width,"inline-prompt":e.inlinePrompt,"active-icon":e.activeIcon,"inactive-icon":e.inactiveIcon,"active-action-icon":e.activeActionIcon,"inactive-action-icon":e.inactiveActionIcon,"active-text":e.activeText,"inactive-text":e.inactiveText,"active-value":l.value,"inactive-value":i.value,name:e.name,"validate-event":e.validateEvent,"before-change":e.beforeChange,tabindex:e.tabindex,"aria-label":e.ariaLabel,loading:e.loading,disabled:e.disabled||e.readonly,onChange:d}),(0,n.createSlots)({_:2},[c.$slots["active-action"]?{name:"active-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"active-action")]),key:"0"}:void 0,c.$slots["inactive-action"]?{name:"inactive-action",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"inactive-action")]),key:"1"}:void 0,c.$slots.active?{name:"active",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"active")]),key:"2"}:void 0,c.$slots.inactive?{name:"inactive",fn:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"inactive")]),key:"3"}:void 0]),1040,["id","modelValue","size","width","inline-prompt","active-icon","inactive-icon","active-action-icon","inactive-action-icon","active-text","inactive-text","active-value","inactive-value","name","validate-event","before-change","tabindex","aria-label","loading","disabled"])}}}),Ey=Sy,Ds=ve(Ey),_y=(0,n.defineComponent)({name:"JTabs",__name:"tabs",props:{modelValue:{},type:{default:""},closable:{type:Boolean,default:!1},addable:{type:Boolean,default:!1},editable:{type:Boolean,default:!1},tabPosition:{default:"top"},stretch:{type:Boolean,default:!1},beforeLeave:{},isFill:{type:Boolean}},emits:["update:modelValue","tab-click","tab-change","tab-remove","tab-add","edit"],setup(e,{emit:t}){const o=t,a=c=>{o("update:modelValue",c)},r=(c,f)=>{o("tab-click",c,f)},l=c=>{o("tab-change",c)},i=c=>{o("tab-remove",c)},s=()=>{o("tab-add")},d=(c,f)=>{o("edit",c,f)};return(c,f)=>{const p=(0,n.resolveComponent)("el-tabs");return(0,n.openBlock)(),(0,n.createBlock)(p,(0,n.mergeProps)(c.$attrs,{class:{isFill:e.isFill},"model-value":e.modelValue,type:e.type,closable:e.closable,addable:e.addable,editable:e.editable,"tab-position":e.tabPosition,stretch:e.stretch,"before-leave":e.beforeLeave,"onUpdate:modelValue":a,onTabClick:r,onTabChange:l,onTabRemove:i,onTabAdd:s,onEdit:d}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(c.$slots,"default")]),_:3},16,["class","model-value","type","closable","addable","editable","tab-position","stretch","before-leave"])}}}),By=_y,Is=ve(By),Ry=(0,n.defineComponent)({name:"JCollapse",__name:"collapse",props:{modelValue:{default:()=>[]},accordion:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=t,a=l=>{o("update:modelValue",l)},r=l=>{o("change",l)};return(l,i)=>{const s=(0,n.resolveComponent)("el-collapse");return(0,n.openBlock)(),(0,n.createBlock)(s,(0,n.mergeProps)(l.$attrs,{"model-value":e.modelValue,accordion:e.accordion,onChange:r,"onUpdate:modelValue":a}),{default:(0,n.withCtx)(()=>[(0,n.renderSlot)(l.$slots,"default")]),_:3},16,["model-value","accordion"])}}}),Ty=Ry,Fs=ve(Ty),Vy={class:"j-editor"},My=(0,n.defineComponent)({name:"JEditor",__name:"editor",props:{value:{type:String,default:""},height:{type:[String,Number],default:300},options:{type:Object,default:()=>({})},placeholder:{type:String,default:void 0},readonly:{type:Boolean,default:!1},isUploadImg:{type:Boolean,default:!0},token:{type:String,default:""},apiUrl:{type:String,default:""}},emits:["update:value","change"],setup(e,{emit:t}){const o=e,a=t,r=(0,n.ref)(),l=(0,n.ref)(),i=(0,n.shallowRef)(),s=(0,n.computed)(()=>({height:typeof o.height=="number"?`${o.height}px`:o.height,overflowY:"hidden"}));let d=!1;const c=p=>{if(!p)return"";let u=p;return o.apiUrl&&o.token&&(u=u.replace(/{jcode_img_api}/g,`${o.apiUrl}/data/file/`).replace(/{jcode_img_token}/g,`token=${o.token}`)),u},f=p=>{if(!p)return"";let u=p;if(o.apiUrl){const h=`${o.apiUrl}/data/file/`;u=u.split(h).join("{jcode_img_api}"),o.token&&(u=u.split(`token=${o.token}`).join("{jcode_img_token}"))}return u};return(0,n.onMounted)(()=>{const p={placeholder:o.placeholder||"请输入内容...",readOnly:o.readonly,MENU_CONF:{},...o.options};p.onChange=h=>{if(d)return;const g=f(h.getHtml());a("update:value",g),a("change",{value:g})};const u=(0,Dl.createEditor)({selector:r.value,html:c(o.value),config:p,mode:"default"});i.value=u,(0,Dl.createToolbar)({editor:u,selector:l.value,mode:"default"})}),(0,n.watch)(()=>o.value,p=>{const u=i.value;if(u){const h=u.getHtml(),g=c(p);f(h)!==p&&(d=!0,u.setHtml(g),d=!1)}}),(0,n.watch)(()=>o.readonly,p=>{const u=i.value;u&&(p?u.disable():u.enable())}),(0,n.onBeforeUnmount)(()=>{const p=i.value;p?.destroy()}),(p,u)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",Vy,[(0,n.createElementVNode)("div",{ref_key:"toolbarRef",ref:l,class:"j-editor-toolbar"},null,512),(0,n.createElementVNode)("div",{ref_key:"editorRef",ref:r,class:"j-editor-content",style:(0,n.normalizeStyle)(s.value)},null,4)]))}}),Ny=My,$s=ve(Ny),Ay={key:0,class:"j-map-loading"},jy=(0,n.defineComponent)({name:"JMap",__name:"map",props:{address:String,lng:Number,lat:Number,height:{type:String,default:"300px"},mapKey:{type:String,default:""}},emits:["update:address","update:lng","update:lat","change"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(!0),i=(0,n.ref)();let s=null,d=null,c=null,f=null;const p=async()=>{l.value=!0;try{s=await yi(a.mapKey)}catch(k){console.error("Failed to load Baidu Map:",k),l.value=!1;return}if(d!=null){h(a.lng,a.lat),l.value=!1;return}if(!i.value)return;d=new s.Map(i.value,{enableMapClick:!1});const w=new s.Point(121.480248,31.236276);d.centerAndZoom(w,17),c=new s.Marker(w,{enableDragging:!0}),d.addOverlay(c),c.addEventListener("dragend",k=>{u(k.point)}),d.addControl(new s.NavigationControl({anchor:window.BMAP_ANCHOR_TOP_RIGHT,type:window.BMAP_NAVIGATION_CONTROL_SMALL})),f=new s.GeolocationControl({anchor:window.BMAP_ANCHOR_BOTTOM_LEFT}),f.addEventListener("locationSuccess",k=>{u(k.point)}),f.addEventListener("locationError",k=>{alert(k.message)}),d.addControl(f),d.addEventListener("click",k=>{u(k.point)}),d.enableScrollWheelZoom(!0),h(a.lng,a.lat),l.value=!1},u=w=>{new s.Geocoder().getLocation(w,k=>{c.setPosition(w),d.panTo(w),r("update:address",k.address),r("update:lng",w.lng),r("update:lat",w.lat),r("change",{value:{address:k.address,lng:w.lng,lat:w.lat}})})},h=(w,k)=>{if(w&&k&&s){const C=new s.Point(w,k);c&&c.setPosition(C),d&&d.panTo(C)}};let g=null;return t({setPoint:h,querySearchAsync:(w,k)=>{!d||!s||(g||(g=new s.LocalSearch(d,{onSearchComplete:C=>{const v=[];if(C){const b=C.getCurrentNumPois();for(let S=0;S<b;S++)v.push(C.getPoi(S))}k(v)}})),g.search(w))}}),(0,n.onMounted)(()=>{p()}),(w,k)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-map",style:(0,n.normalizeStyle)({height:e.height})},[l.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Ay,[(0,n.createVNode)(Yn,{icon:"mdi:loading",class:"is-loading",size:30})])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",{ref_key:"mapRef",ref:i,class:"j-map-container"},null,512)],4))}}),Py=jy,Ws=ve(Py),zy=(0,n.defineComponent)({name:"JInputMap",__name:"input-map",props:{modelValue:{type:[String],default:null},placeholder:{type:String,default:"请选择"},readonly:Boolean,size:{type:String},clearable:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const o=e,a=t,{t:r}=tt(),l=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.ref)(),d=(0,n.ref)(""),c=(0,n.ref)(0),f=(0,n.ref)(0),p=(0,n.ref)(""),u=(0,n.computed)(()=>{let b=o.modelValue||"";if(o.modelValue===null&&(b=(0,n.unref)(p)),St(b))return{address:"",lng:0,lat:0};const S=b.split(",");return{address:S[0],lng:parseFloat(S[1]),lat:parseFloat(S[2])}}),h=(0,n.computed)({get(){return u.value.address},set(){p.value="",a("update:modelValue",void 0)}}),g=()=>{i.value.blur()},m=()=>{i.value.blur(),d.value=u.value.address,c.value=u.value.lng,f.value=u.value.lat,l.value.open("请选择地址"),setTimeout(()=>{s.value?.call("map","setPoint",null,c.value,f.value)},100)},w=(0,n.ref)([]),k=[{type:"j-layout",config:{class:["j-block"]},children:[{type:"div",slot:"top",config:{style:{padding:"8px"}},children:[{type:"el-autocomplete",config:{style:{width:"100%"},placeholder:r("请填写详细地址"),modelValue:d,value:d,fetchSuggestions:async(b,S)=>{S((0,n.unref)(w))},onInput:async b=>{d.value=b,s.value?.call("map","querySearchAsync",null,b,S=>{w.value=S.map(y=>({...y,value:`(${y.title}): ${y.address}`}))})},onSelect:b=>{d.value=`(${b.title})${b.address}`,c.value=b.point.lng,f.value=b.point.lat,s.value?.call("map","setPoint",null,b.point.lng,b.point.lat)}},children:[{slot:"option",config:{h:b=>(0,n.h)("div",{},[(0,n.h)("div",{style:{color:"var(--j-color-text)","font-size":"14px"}},b.title),(0,n.h)("div",{style:{color:"var(--color-text-secondary)","font-size":"12px","margin-bottom":"4px"}},b.address)])}}]}]},{type:"j-map",id:"map",config:{address:d,lng:c,lat:f,height:"100%",onChange:b=>{d.value=b.value.address,c.value=b.value.lng,f.value=b.value.lat}}}]}],C=()=>{!St(d.value)&&!St(c.value)&&!St(f.value)?(p.value=`${d.value},${c.value},${f.value}`,a("update:modelValue",p.value),a("change",p.value)):(a("update:modelValue",void 0),a("change",void 0)),l.value.close()},v=()=>{};return(b,S)=>{const y=(0,n.resolveComponent)("j-button"),x=(0,n.resolveComponent)("el-input"),E=(0,n.resolveComponent)("j-page"),_=(0,n.resolveComponent)("j-layer");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(x,{modelValue:h.value,"onUpdate:modelValue":S[0]||(S[0]=V=>h.value=V),placeholder:e.placeholder?(0,n.unref)(r)(e.placeholder):void 0,readonly:e.readonly,size:e.size,clearable:e.readonly?!1:e.clearable,onFocus:g,ref_key:"inputRef",ref:i,class:"j-input-layer"},{append:(0,n.withCtx)(()=>[(0,n.createVNode)(y,{icon:"mdi:map-marker-outline",disabled:e.readonly,size:e.size,onClick:m},null,8,["disabled","size"])]),_:1},8,["modelValue","placeholder","readonly","size","clearable"]),(0,n.createElementVNode)("div",(0,n.normalizeProps)((0,n.guardReactiveProps)(b.$attrs)),null,16),(0,n.createVNode)(_,{ref_key:"layerRef",ref:l,width:900,height:500,"btn-text":"确认",destroyOnClose:!1,onOk:C,onClosed:v,style:{height:"0"}},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(E,{style:{padding:"0"},schema:k,ref_key:"indexRef",ref:s},null,512)]),_:1},512)],64)}}}),Hy=zy,Us=ve(Hy);function Js(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ko(e){return e.originalEvent||e.srcEvent}function Ar(e){Js(e),Js(ko(e))}function So(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}var Ys=1500;function Ks(e,t,o){var a=this,r=o.get("dragging",!1);function l(i){if(!i.hover){var s=i.originalEvent,d=a._findTargetGfx(s),c=d&&e.get(d);d&&c&&(i.stopPropagation(),r.hover({element:c,gfx:d}),r.move(s))}}r&&t.on("drag.start",function(i){t.once("drag.move",Ys,function(s){l(s)})}),(function(){var i,s;t.on("element.hover",function(d){i=d.gfx,s=d.element}),t.on("element.hover",Ys,function(d){s&&t.fire("element.out",{element:s,gfx:i})}),t.on("element.out",function(){i=null,s=null})})(),this._findTargetGfx=function(i){var s,d;if(i instanceof MouseEvent)return s=So(i),d=document.elementFromPoint(s.x,s.y),Ly(d)}}Ks.$inject=["elementRegistry","eventBus","injector"];function Ly(e){return(0,Z.closest)(e,"svg, .djs-element",!0)}var Oy={__init__:["hoverFix"],hoverFix:["type",Ks]};function Gs(){return/mac/i.test(navigator.platform)}function qs(e,t){return(ko(e)||e).button===t}function _n(e){return qs(e,0)}function Dy(e){return qs(e,1)}function Xs(e){var t=ko(e)||e;return _n(e)?Gs()?t.metaKey:t.ctrlKey:!1}function jr(e){var t=ko(e)||e;return _n(e)&&t.shiftKey}function Yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Iy(e){return["M",e.x,e.y]}function Pr(e){return["L",e.x,e.y]}function Fy(e,t,o){return["C",e.x,e.y,t.x,t.y,o.x,o.y]}function $y(e,t){const o=e.length,a=[Iy(e[0])];for(let r=1;r<o;r++){const l=e[r-1],i=e[r],s=e[r+1];if(!s||!t){a.push(Pr(i));continue}const d=Math.min(t,zr(i.x-l.x,i.y-l.y),zr(s.x-i.x,s.y-i.y));if(!d){a.push(Pr(i));continue}const c=Ma(i,l,d),f=Ma(i,l,d*.5),p=Ma(i,s,d),u=Ma(i,s,d*.5);a.push(Pr(c)),a.push(Fy(f,u,p))}return a}function Ma(e,t,o){const a=t.x-e.x,r=t.y-e.y,l=o/zr(a,r);return{x:e.x+a*l,y:e.y+r*l}}function zr(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Hr(e,t,o){(0,R.isNumber)(t)&&(o=t,t=null),t||(t={});const a=(0,D.create)("path",t);return(0,R.isNumber)(o)&&(a.dataset.cornerRadius=String(o)),Zs(a,e)}function Zs(e,t){return(0,D.attr)(e,{d:Yo($y(t,parseInt(e.dataset.cornerRadius,10)||0))}),e}function Wy(e){return!0}function Na(e){return _n(e)||Dy(e)}var Qs=500;function ec(e,t,o){var a=this;function r(y,x,E){if(!s(y,x)){var _,V,T;E?V=t.getGraphics(E):(_=x.delegateTarget||x.target,_&&(V=_,E=t.get(V))),!(!V||!E)&&(T=e.fire(y,{element:E,gfx:V,originalEvent:x}),T===!1&&(x.stopPropagation(),x.preventDefault()))}}var l={};function i(y){return l[y]}function s(y,x){return!(c[y]||_n)(x)}var d={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},c={"element.contextmenu":Wy,"element.mousedown":Na,"element.mouseup":Na,"element.click":Na,"element.dblclick":Na};function f(y,x,E){var _=d[y];if(!_)throw new Error("unmapped DOM event name <"+y+">");return r(_,x,E)}var p="svg, .djs-element";function u(y,x,E,_){var V=l[E]=function(T){r(E,T)};_&&(c[E]=_),V.$delegate=Z.delegate.bind(y,p,x,V)}function h(y,x,E){var _=i(E);_&&Z.delegate.unbind(y,x,_.$delegate)}function g(y){(0,R.forEach)(d,function(x,E){u(y,E,x)})}function m(y){(0,R.forEach)(d,function(x,E){h(y,E,x)})}e.on("canvas.destroy",function(y){m(y.svg)}),e.on("canvas.init",function(y){g(y.svg)}),e.on(["shape.added","connection.added"],function(y){var x=y.element,E=y.gfx;e.fire("interactionEvents.createHit",{element:x,gfx:E})}),e.on(["shape.changed","connection.changed"],Qs,function(y){var x=y.element,E=y.gfx;e.fire("interactionEvents.updateHit",{element:x,gfx:E})}),e.on("interactionEvents.createHit",Qs,function(y){var x=y.element,E=y.gfx;a.createDefaultHit(x,E)}),e.on("interactionEvents.updateHit",function(y){var x=y.element,E=y.gfx;a.updateDefaultHit(x,E)});var w=v("djs-hit djs-hit-stroke"),k=v("djs-hit djs-hit-click-stroke"),C={all:v("djs-hit djs-hit-all"),"click-stroke":k,stroke:w,"no-move":v("djs-hit djs-hit-no-move")};function v(y,x){return x=(0,R.assign)({stroke:"white",strokeWidth:15},x||{}),o.cls(y,["no-fill","no-border"],x)}function b(y,x){var E=C[x];if(!E)throw new Error("invalid hit type <"+x+">");return(0,D.attr)(y,E),y}function S(y,x){(0,D.append)(y,x)}this.removeHits=function(y){(0,R.forEach)((0,Z.queryAll)(".djs-hit",y),D.remove)},this.createDefaultHit=function(y,x){var E=y.waypoints,_=y.isFrame,V;return E?this.createWaypointsHit(x,E):(V=_?"stroke":"all",this.createBoxHit(x,V,{width:y.width,height:y.height}))},this.createWaypointsHit=function(y,x){var E=Hr(x);return b(E,"stroke"),S(y,E),E},this.createBoxHit=function(y,x,E){E=(0,R.assign)({x:0,y:0},E);var _=(0,D.create)("rect");return b(_,x),(0,D.attr)(_,E),S(y,_),_},this.updateDefaultHit=function(y,x){var E=(0,Z.query)(".djs-hit",x);if(E)return y.waypoints?Zs(E,y.waypoints):(0,D.attr)(E,{width:y.width,height:y.height}),E},this.fire=r,this.triggerMouseEvent=f,this.mouseHandler=i,this.registerEvent=u,this.unregisterEvent=h}ec.$inject=["eventBus","elementRegistry","styles"];var Lr={__init__:["interactionEvents"],interactionEvents:["type",ec]};function Eo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=[];var o=this;e.on(["shape.remove","connection.remove"],function(a){var r=a.element;o.deselect(r)}),e.on(["diagram.clear","root.set"],function(a){o.select(null)})}Eo.$inject=["eventBus","canvas"],Eo.prototype.deselect=function(e){var t=this._selectedElements,o=t.indexOf(e);if(o!==-1){var a=t.slice();t.splice(o,1),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:t})}},Eo.prototype.get=function(){return this._selectedElements},Eo.prototype.isSelected=function(e){return this._selectedElements.indexOf(e)!==-1},Eo.prototype.select=function(e,t){var o=this._selectedElements,a=o.slice();(0,R.isArray)(e)||(e=e?[e]:[]);var r=this._canvas,l=r.getRootElement();e=e.filter(function(i){return l===r.findRoot(i)}),t?(0,R.forEach)(e,function(i){o.indexOf(i)===-1&&o.push(i)}):this._selectedElements=o=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:a,newSelection:o})};var tc="hover",nc="selected";function oc(e,t){this._canvas=e;function o(r,l){e.addMarker(r,l)}function a(r,l){e.removeMarker(r,l)}t.on("element.hover",function(r){o(r.element,tc)}),t.on("element.out",function(r){a(r.element,tc)}),t.on("selection.changed",function(r){function l(c){a(c,nc)}function i(c){o(c,nc)}var s=r.oldSelection,d=r.newSelection;(0,R.forEach)(s,function(c){d.indexOf(c)===-1&&l(c)}),(0,R.forEach)(d,function(c){s.indexOf(c)===-1&&i(c)})})}oc.$inject=["canvas","eventBus"];function ac(e,t,o,a){e.on("create.end",500,function(r){var l=r.context,i=l.canExecute,s=l.elements,d=(l.hints||{}).autoSelect;if(i){if(d===!1)return;(0,R.isArray)(d)?t.select(d):t.select(s.filter(Uy))}}),e.on("connect.end",500,function(r){var l=r.context.connection;l&&t.select(l)}),e.on("shape.move.end",500,function(r){var l=r.previousSelection||[],i=a.get(r.context.shape.id);(0,R.find)(l,function(s){return i.id===s.id})||t.select(i)}),e.on("element.click",function(r){if(_n(r)){var l=r.element;l===o.getRootElement()&&(l=null);var i=t.isSelected(l),s=t.get().length>1,d=jr(r);if(i&&s)return d?t.deselect(l):t.select(l);i?t.deselect(l):t.select(l,d)}})}ac.$inject=["eventBus","selection","canvas","elementRegistry"];function Uy(e){return!e.hidden}var _o={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Lr],selection:["type",Eo],selectionVisuals:["type",oc],selectionBehavior:["type",ac]},Jy=/^djs-cursor-.*$/;function Or(e){var t=(0,Z.classes)(document.body);t.removeMatching(Jy),e&&t.add("djs-cursor-"+e)}function rc(){Or(null)}var Yy=5e3;function lc(e,t){t=t||"element.click";function o(){return!1}return e.once(t,Yy,o),function(){e.off(t,o)}}function ic(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bo(e,t){return{x:e.x-t.x,y:e.y-t.y}}function sc(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function cc(e,t){return e=(0,R.isArray)(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}var Ro=Math.round,dc="djs-drag-active";function Gn(e){e.preventDefault()}function Ky(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Gy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function uc(e,t,o,a){var r={threshold:5,trapClick:!0},l;function i(v){var b=t.viewbox(),S=t._container.getBoundingClientRect();return{x:b.x+(v.x-S.left)/b.scale,y:b.y+(v.y-S.top)/b.scale}}function s(v,b){b=b||l;var S=e.createEvent((0,R.assign)({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,S)===!1?!1:e.fire(b.prefix+"."+v,S)}function d(v){var b=v.filter(function(S){return a.get(S.id)});b.length&&o.select(b)}function c(v,b){var S=l.payload,y=l.displacement,x=l.globalStart,E=So(v),_=Bo(E,x),V=l.localStart,T=i(E),P=Bo(T,V);if(!l.active&&(b||Gy(_)>l.threshold)){if((0,R.assign)(S,{x:Ro(V.x+y.x),y:Ro(V.y+y.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return w();l.active=!0,l.keepSelection||(S.previousSelection=o.get(),o.select(null)),l.cursor&&Or(l.cursor),t.addMarker(t.getRootElement(),dc)}Ar(v),l.active&&((0,R.assign)(S,{x:Ro(T.x+y.x),y:Ro(T.y+y.y),dx:Ro(P.x),dy:Ro(P.y)},{originalEvent:v}),s("move"))}function f(v){var b,S=!0;l.active&&(v&&(l.payload.originalEvent=v,Ar(v)),S=s("end")),S===!1&&s("rejected"),b=k(S!==!0),s("ended",b)}function p(v){cc("Escape",v)&&(Gn(v),w())}function u(v){var b;l.active&&(b=lc(e),setTimeout(b,400),Gn(v)),f(v)}function h(v){c(v)}function g(v){var b=l.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function m(v){s("out");var b=l.payload;b.hoverGfx=null,b.hover=null}function w(v){var b;if(l){var S=l.active;S&&s("cancel"),b=k(v),S&&s("canceled",b)}}function k(v){var b,S;s("cleanup"),rc(),l.trapClick?S=u:S=f,Z.event.unbind(document,"mousemove",c),Z.event.unbind(document,"dragstart",Gn),Z.event.unbind(document,"selectstart",Gn),Z.event.unbind(document,"mousedown",S,!0),Z.event.unbind(document,"mouseup",S,!0),Z.event.unbind(document,"keyup",p),Z.event.unbind(document,"touchstart",h,!0),Z.event.unbind(document,"touchcancel",w,!0),Z.event.unbind(document,"touchmove",c,!0),Z.event.unbind(document,"touchend",f,!0),e.off("element.hover",g),e.off("element.out",m),t.removeMarker(t.getRootElement(),dc);var y=l.payload.previousSelection;return v!==!1&&y&&!o.get().length&&d(y),b=l,l=null,b}function C(v,b,S,y){l&&w(!1),typeof b=="string"&&(y=S,S=b,b=null),y=(0,R.assign)({},r,y||{});var x=y.data||{},E,_,V,T,P;y.trapClick?T=u:T=f,v?(E=ko(v)||v,_=So(v),Ar(v),E.type==="dragstart"&&Gn(E)):(E=null,_={x:0,y:0}),V=i(_),b||(b=V),P=Ky(E),l=(0,R.assign)({prefix:S,data:x,payload:{},globalStart:_,displacement:Bo(b,V),localStart:V,isTouch:P},y),y.manual||(P?(Z.event.bind(document,"touchstart",h,!0),Z.event.bind(document,"touchcancel",w,!0),Z.event.bind(document,"touchmove",c,!0),Z.event.bind(document,"touchend",f,!0)):(Z.event.bind(document,"mousemove",c),Z.event.bind(document,"dragstart",Gn),Z.event.bind(document,"selectstart",Gn),Z.event.bind(document,"mousedown",T,!0),Z.event.bind(document,"mouseup",T,!0)),Z.event.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",m)),s("init"),y.autoActivate&&c(v,!0)}e.on("diagram.destroy",w),this.init=C,this.move=c,this.hover=g,this.out=m,this.end=f,this.cancel=w,this.context=function(){return l},this.setOptions=function(v){(0,R.assign)(r,v)}}uc.$inject=["eventBus","canvas","selection","elementRegistry"];var qn={__depends__:[Oy,_o],dragging:["type",uc]};function Dr(e){return e.childNodes[0]}function Aa(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Aa.prototype.next=function(){return this._prefix+ ++this._counter};var qy=new Aa("ps"),Xy=["marker-start","marker-mid","marker-end"],Zy=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Bn(e,t,o,a){this._elementRegistry=e,this._canvas=o,this._styles=a}Bn.$inject=["elementRegistry","eventBus","canvas","styles"],Bn.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Bn.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Bn.prototype.addDragger=function(e,t,o,a="djs-dragger"){o=o||this.getGfx(e);var r=(0,D.clone)(o),l=o.getBoundingClientRect();return this._cloneMarkers(Dr(r),a),(0,D.attr)(r,this._styles.cls(a,[],{x:l.top,y:l.left})),(0,D.append)(t,r),(0,D.attr)(r,"data-preview-support-element-id",e.id),r},Bn.prototype.addFrame=function(e,t){var o=(0,D.create)("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return(0,D.append)(t,o),(0,D.attr)(o,"data-preview-support-element-id",e.id),o},Bn.prototype._cloneMarkers=function(e,t="djs-dragger",o=e){var a=this;e.childNodes&&e.childNodes.forEach(r=>{a._cloneMarkers(r,t,o)}),nv(e)&&Xy.forEach(function(r){if((0,D.attr)(e,r)){var l=Qy(e,r,a._canvas.getContainer());l&&a._cloneMarker(o,e,l,r,t)}})},Bn.prototype._cloneMarker=function(e,t,o,a,r="djs-dragger"){var l=[o.id,r,qy.next()].join("-"),i=(0,Z.query)("marker#"+o.id,e);e=e||this._canvas._svg;var s=i||(0,D.clone)(o);s.id=l,(0,D.classes)(s).add(r);var d=(0,Z.query)(":scope > defs",e);d||(d=(0,D.create)("defs"),(0,D.append)(e,d)),(0,D.append)(d,s),(0,D.attr)(t,a,tv(s.id))};function Qy(e,t,o){return(0,Z.query)("marker#"+ev((0,D.attr)(e,t)),o||document)}function ev(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function tv(e){return"url(#"+e+")"}function nv(e){return Zy.indexOf(e.nodeName)!==-1}var Ir={__init__:["previewSupport"],previewSupport:["type",Bn]};function Fr(e){this._commandStack=e.get("commandStack",!1)}Fr.$inject=["injector"],Fr.prototype.allowed=function(e,t){var o=!0,a=this._commandStack;return a&&(o=a.canExecute(e,t)),o===void 0?!0:o};var To={__init__:["rules"],rules:["type",Fr]};function ov(e){return(0,R.filter)(e,function(t){return!(0,R.find)(e,function(o){return o!==t&&fc(t,o)})})}function fc(e,t){if(t){if(e===t)return t;if(e.parent)return fc(e.parent,t)}}function pc(e,t,o){var a=!o||e.indexOf(t)===-1;return a&&e.push(t),a}function $r(e,t,o){o=o||0,(0,R.isArray)(e)||(e=[e]),(0,R.forEach)(e,function(a,r){var l=t(a,r,o);(0,R.isArray)(l)&&l.length&&$r(l,t,o+1)})}function av(e,t,o){var a=[],r=[];return $r(e,function(l,i,s){pc(a,l,t);var d=l.children;if((o===-1||s<o)&&d&&pc(r,d,t))return d}),a}function rv(e,t){return av(e,!t,-1)}function lv(e,t,o){(0,R.isUndefined)(t)&&(t=!0),(0,R.isObject)(t)&&(o=t,t=!0),o=o||{};var a=Ko(o.allShapes),r=Ko(o.allConnections),l=Ko(o.enclosedElements),i=Ko(o.enclosedConnections),s=Ko(o.topLevel,t&&(0,R.groupBy)(e,function(f){return f.id}));function d(f){s[f.source.id]&&s[f.target.id]&&(s[f.id]=[f]),a[f.source.id]&&a[f.target.id]&&(i[f.id]=l[f.id]=f),r[f.id]=f}function c(f){if(l[f.id]=f,f.waypoints)i[f.id]=r[f.id]=f;else return a[f.id]=f,(0,R.forEach)(f.incoming,d),(0,R.forEach)(f.outgoing,d),f.children}return $r(e,c),{allShapes:a,allConnections:r,topLevel:s,enclosedConnections:i,enclosedElements:l}}function nn(e,t){t=!!t,(0,R.isArray)(e)||(e=[e]);var o,a,r,l;return(0,R.forEach)(e,function(i){var s=i;i.waypoints&&!t&&(s=nn(i.waypoints,!0));var d=s.x,c=s.y,f=s.height||0,p=s.width||0;(d<o||o===void 0)&&(o=d),(c<a||a===void 0)&&(a=c),(d+p>r||r===void 0)&&(r=d+p),(c+f>l||l===void 0)&&(l=c+f)}),{x:o,y:a,height:l-a,width:r-o}}function hc(e,t){var o={};return(0,R.forEach)(e,function(a){var r=a;r.waypoints&&(r=nn(r)),!(0,R.isNumber)(t.y)&&r.x>t.x&&(o[a.id]=a),!(0,R.isNumber)(t.x)&&r.y>t.y&&(o[a.id]=a),r.x>t.x&&r.y>t.y&&((0,R.isNumber)(t.width)&&(0,R.isNumber)(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!(0,R.isNumber)(t.width)||!(0,R.isNumber)(t.height))&&(o[a.id]=a)}),o}function iv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sv(e){return!!(e&&e.isFrame)}function Ko(e,t){return(0,R.assign)({},e||{},t||{})}function Ht(e){return(0,R.isObject)(e)&&(0,R.has)(e,"waypoints")}function Vo(e){return(0,R.isObject)(e)&&(0,R.has)(e,"labelTarget")}var cv="drop-ok",gc="drop-not-ok",mc="attach-ok",yc="new-parent",vc="create",dv=2e3;function bc(e,t,o,a,r){function l(d,c,f,p,u){if(!c)return!1;d=(0,R.filter)(d,function(C){var v=C.labelTarget;return!C.parent&&!(Vo(C)&&d.indexOf(v)!==-1)});var h=(0,R.find)(d,function(C){return!Ht(C)}),g=!1,m=!1,w=!1;Cc(d)&&(g=r.allowed("shape.attach",{position:f,shape:h,target:c})),g||(Cc(d)?w=r.allowed("shape.create",{position:f,shape:h,source:p,target:c}):w=r.allowed("elements.create",{elements:d,position:f,target:c}));var k=u.connectionTarget;return w||g?(h&&p&&(m=r.allowed("connection.create",{source:k===p?h:p,target:k===p?p:h,hints:{targetParent:c,targetAttach:g}})),{attach:g,connect:m}):w===null||g===null?null:!1}function i(d,c){[mc,cv,gc,yc].forEach(function(f){f===c?e.addMarker(d,f):e.removeMarker(d,f)})}o.on(["create.move","create.hover"],function(d){var c=d.context,f=c.elements,p=d.hover,u=c.source,h=c.hints||{};if(!p){c.canExecute=!1,c.target=null;return}wc(d);var g={x:d.x,y:d.y},m=c.canExecute=p&&l(f,p,g,u,h);p&&m!==null&&(c.target=p,m&&m.attach?i(p,mc):i(p,m?yc:gc))}),o.on(["create.end","create.out","create.cleanup"],function(d){var c=d.hover;c&&i(c,null)}),o.on("create.end",function(d){var c=d.context,f=c.source,p=c.shape,u=c.elements,h=c.target,g=c.canExecute,m=g&&g.attach,w=g&&g.connect,k=c.hints||{};if(g===!1||!h)return!1;wc(d);var C={x:d.x,y:d.y};w?p=a.appendShape(f,p,C,h,{attach:m,connection:w===!0?{}:w,connectionTarget:k.connectionTarget}):(u=a.createElements(u,C,h,(0,R.assign)({},k,{attach:m})),p=(0,R.find)(u,function(v){return!Ht(v)})),(0,R.assign)(c,{elements:u,shape:p}),(0,R.assign)(d,{elements:u,shape:p})});function s(){var d=t.context();d&&d.prefix===vc&&t.cancel()}o.on("create.init",function(){o.on("elements.changed",s),o.once(["create.cancel","create.end"],dv,function(){o.off("elements.changed",s)})}),this.start=function(d,c,f){(0,R.isArray)(c)||(c=[c]);var p=(0,R.find)(c,function(h){return!Ht(h)});if(p){f=(0,R.assign)({elements:c,hints:{},shape:p},f||{}),(0,R.forEach)(c,function(h){(0,R.isNumber)(h.x)||(h.x=0),(0,R.isNumber)(h.y)||(h.y=0)});var u=nn((0,R.filter)(c,function(h){return!h.hidden}));(0,R.forEach)(c,function(h){Ht(h)&&(h.waypoints=(0,R.map)(h.waypoints,function(g){return{x:g.x-u.x-u.width/2,y:g.y-u.y-u.height/2}})),(0,R.assign)(h,{x:h.x-u.x-u.width/2,y:h.y-u.y-u.height/2})}),t.init(d,vc,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:c,context:f}})}}}bc.$inject=["canvas","dragging","eventBus","modeling","rules"];function wc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function Cc(e){return e&&e.length===1&&!Ht(e[0])}function uv(e,t,o,a,r){var l=(0,D.createTransform)();l.setTranslate(t,o);var i=(0,D.createTransform)();i.setRotate(a||0,0,0);var s=(0,D.createTransform)();s.setScale(r||1,r||1),(0,D.transform)(e,[l,i,s])}function on(e,t,o){var a=(0,D.createTransform)();a.setTranslate(t,o),(0,D.transform)(e,a)}function fv(e,t){var o=(0,D.createTransform)();o.setRotate(t,0,0),(0,D.transform)(e,o)}var pv=750;function xc(e,t,o,a,r){function l(i){var s=(0,D.create)("g");(0,D.attr)(s,r.cls("djs-drag-group",["no-events"]));var d=(0,D.create)("g");return i.forEach(function(c){var f;c.hidden||(c.waypoints?(f=o._createContainer("connection",d),o.drawConnection(Dr(f),c)):(f=o._createContainer("shape",d),o.drawShape(Dr(f),c),on(f,c.x,c.y)),a.addDragger(c,s,f))}),s}t.on("create.move",pv,function(i){var s=i.hover,d=i.context,c=d.elements,f=d.dragGroup;f||(f=d.dragGroup=l(c));var p;s?(f.parentNode||(p=e.getActiveLayer(),(0,D.append)(p,f)),on(f,i.x,i.y)):(0,D.remove)(f)}),t.on("create.cleanup",function(i){var s=i.context.dragGroup;s&&(0,D.remove)(s)})}xc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var kc={__depends__:[qn,Ir,To,_o],__init__:["create","createPreview"],create:["type",bc],createPreview:["type",xc]};function Go(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wr(e,t,o,a){if(typeof a>"u"&&(a=5),!e||!t||!o)return!1;var r=(t.x-e.x)*(o.y-e.y)-(t.y-e.y)*(o.x-e.x),l=Go(e,t);return Math.abs(r/l)<=a}var hv=2;function Rn(e,t){var o=Array.from(arguments).flat();for(const[a,r]of Object.entries({x:"v",y:"h"}))if(gv(a,o))return r;return!1}function gv(e,t){const o=t[0];return(0,R.every)(t,function(a){return Math.abs(o[e]-a[e])<=hv})}function Sc(e,t,o){return o=o||0,e.x>t.x-o&&e.y>t.y-o&&e.x<t.x+t.width+o&&e.y<t.y+t.height+o}function Ur(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var mv=/,?([a-z]),?/gi,Ec=parseFloat,ht=Math,Tn=ht.PI,an=ht.min,rn=ht.max,_c=ht.pow,Vn=ht.abs,yv=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,vv=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/gi,Bc=Array.isArray||function(e){return e instanceof Array};function bv(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wv(e,t){for(var o=0,a=e.length;o<a;o++)if(e[o]===t)return e.push(e.splice(o,1)[0])}function Cv(e){function t(){var o=Array.prototype.slice.call(arguments,0).join("␀"),a=t.cache=t.cache||{},r=t.count=t.count||[];return bv(a,o)?(wv(r,o),a[o]):(r.length>=1e3&&delete a[r.shift()],r.push(o),a[o]=e(...arguments),a[o])}return t}function xv(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return String(e).replace(yv,function(a,r,l){var i=[],s=r.toLowerCase();for(l.replace(vv,function(d,c){c&&i.push(+c)}),s=="m"&&i.length>2&&(o.push([r,...i.splice(0,2)]),s="l",r=r=="m"?"l":"L");i.length>=t[s]&&(o.push([r,...i.splice(0,t[s])]),!!t[s]););}),o.toString=Yr,o}function kv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(typeof a=="string"&&a!==a.toUpperCase())return!1}return!0}function Sv(e){for(var t=0,o=e.length;t<o;t++){var a=e[t][0];if(a!=="M"&&a!=="C")return!1}return!0}function Jr(e,t,o,a){return arguments.length===1&&(t=e.y,o=e.width,a=e.height,e=e.x),{x:e,y:t,width:o,height:a,x2:e+o,y2:t+a}}function Yr(){return this.join(",").replace(mv,"$1")}function Ev(e){for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)for(var r=e[o],l=t[o]=new Array(r.length),i=0,s=r.length;i<s;i++)l[i]=r[i];return t.toString=Yr,t}function Rc(e,t,o,a,r,l,i,s,d){var c=1-d,f=_c(c,3),p=_c(c,2),u=d*d*d,h=f*e+p*3*d*o+c*3*d*d*r+u*i,g=f*t+p*3*d*a+c*3*d*d*l+u*s;return{x:ja(h),y:ja(g)}}function Tc(e){var t=Mv(...e);return Jr(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Mn(e,t,o){return t>=e.x&&t<=e.x+e.width&&o>=e.y&&o<=e.y+e.height}function _v(e,t){return e=Jr(e),t=Jr(t),Mn(t,e.x,e.y)||Mn(t,e.x2,e.y)||Mn(t,e.x,e.y2)||Mn(t,e.x2,e.y2)||Mn(e,t.x,t.y)||Mn(e,t.x2,t.y)||Mn(e,t.x,t.y2)||Mn(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Vc(e,t,o,a,r){return e*(e*(-3*t+9*o-9*a+3*r)+6*t-12*o+6*a)-3*t+3*o}function Mc(e,t,o,a,r,l,i,s,d){d==null&&(d=1),d=d>1?1:d<0?0:d;for(var c=d/2,f=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,g=0;g<f;g++){var m=c*p[g]+c,w=Vc(m,e,o,r,i),k=Vc(m,t,a,l,s),C=w*w+k*k;h+=u[g]*ht.sqrt(C)}return c*h}function Bv(e,t,o,a,r,l,i,s){if(!(rn(e,o)<an(r,i)||an(e,o)>rn(r,i)||rn(t,a)<an(l,s)||an(t,a)>rn(l,s))){var d=(e*a-t*o)*(r-i)-(e-o)*(r*s-l*i),c=(e*a-t*o)*(l-s)-(t-a)*(r*s-l*i),f=(e-o)*(l-s)-(t-a)*(r-i);if(f){var p=ja(d/f),u=ja(c/f),h=+p.toFixed(2),g=+u.toFixed(2);if(!(h<+an(e,o).toFixed(2)||h>+rn(e,o).toFixed(2)||h<+an(r,i).toFixed(2)||h>+rn(r,i).toFixed(2)||g<+an(t,a).toFixed(2)||g>+rn(t,a).toFixed(2)||g<+an(l,s).toFixed(2)||g>+rn(l,s).toFixed(2)))return{x:p,y:u}}}}function ja(e){return Math.round(e*1e11)/1e11}function Rv(e,t,o){if(!_v(Tc(e),Tc(t)))return o?0:[];var a=Mc(...e),r=Mc(...t),l=Ac(e)?1:~~(a/5)||1,i=Ac(t)?1:~~(r/5)||1,s=new Array(l+1),d=new Array(i+1),c={},f=o?0:[],p,u;for(p=0;p<l+1;p++){var h=Rc(...e,p/l);s[p]={x:h.x,y:h.y,t:p/l}}for(p=0;p<i+1;p++)h=Rc(...t,p/i),d[p]={x:h.x,y:h.y,t:p/i};for(p=0;p<l;p++)for(u=0;u<i;u++){var g=s[p],m=s[p+1],w=d[u],k=d[u+1],C=Vn(m.x-g.x)<.01?"y":"x",v=Vn(k.x-w.x)<.01?"y":"x",b=Bv(g.x,g.y,m.x,m.y,w.x,w.y,k.x,k.y),S;if(b){if(S=b.x.toFixed(9)+"#"+b.y.toFixed(9),c[S])continue;c[S]=!0;var y=g.t+Vn((b[C]-g[C])/(m[C]-g[C]))*(m.t-g.t),x=w.t+Vn((b[v]-w[v])/(k[v]-w[v]))*(k.t-w.t);y>=0&&y<=1&&x>=0&&x<=1&&(o?f++:f.push({x:b.x,y:b.y,t1:y,t2:x}))}}return f}function Nc(e,t,o){e=zc(e),t=zc(t);for(var a,r,l,i,s,d,c,f,p,u,h=o?0:[],g=0,m=e.length;g<m;g++){var w=e[g];if(w[0]=="M")a=s=w[1],r=d=w[2];else{w[0]=="C"?(p=[a,r,...w.slice(1)],a=p[6],r=p[7]):(p=[a,r,a,r,s,d,s,d],a=s,r=d);for(var k=0,C=t.length;k<C;k++){var v=t[k];if(v[0]=="M")l=c=v[1],i=f=v[2];else{v[0]=="C"?(u=[l,i,...v.slice(1)],l=u[6],i=u[7]):(u=[l,i,l,i,c,f,c,f],l=c,i=f);var b=Rv(p,u,o);if(o)h+=b;else{for(var S=0,y=b.length;S<y;S++)b[S].segment1=g,b[S].segment2=k,b[S].bez1=p,b[S].bez2=u;h=h.concat(b)}}}}}return h}function Tv(e){return Bc(e)&&Bc(e[0])}function Vv(e){if(kv(e))return e;var t=new Array(e.length),o=0,a=0,r=0,l=0,i=0,s;e[0][0]=="M"&&(o=+e[0][1],a=+e[0][2],r=o,l=a,i++,t[0]=["M",o,a]);for(var d,c,f=i,p=e.length;f<p;f++){if(c=e[f],s=c[0],t[f]=d=new Array(c.length),s!=s.toUpperCase())switch(d[0]=s.toUpperCase(),d[0]){case"A":d[1]=c[1],d[2]=c[2],d[3]=c[3],d[4]=c[4],d[5]=c[5],d[6]=+c[6]+o,d[7]=+c[7]+a;break;case"V":d[1]=+c[1]+a;break;case"H":d[1]=+c[1]+o;break;case"M":r=+c[1]+o,l=+c[2]+a;default:for(var u=1,h=c.length;u<h;u++)d[u]=+c[u]+(u%2?o:a)}else for(var g=0,m=c.length;g<m;g++)d[g]=c[g];switch(s=s.toUpperCase(),d[0]){case"Z":o=+r,a=+l;break;case"H":o=d[1];break;case"V":a=d[1];break;case"M":r=d[d.length-2],l=d[d.length-1];default:o=d[d.length-2],a=d[d.length-1]}}return t.toString=Yr,t}function Ac(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Pa(e,t,o,a){return[e,t,o,a,o,a]}function jc(e,t,o,a,r,l){var i=.3333333333333333,s=2/3;return[i*e+s*o,i*t+s*a,i*r+s*o,i*l+s*a,r,l]}function Pc(e,t,o,a,r,l,i,s,d,c){var f=Tn*120/180,p=Tn/180*(+r||0),u=[],h,g=Cv(function(pe,Ne,Fe){return{x:pe*ht.cos(Fe)-Ne*ht.sin(Fe),y:pe*ht.sin(Fe)+Ne*ht.cos(Fe)}});if(c)x=c[0],E=c[1],S=c[2],y=c[3];else{h=g(e,t,-p),e=h.x,t=h.y,h=g(s,d,-p),s=h.x,d=h.y;var m=(e-s)/2,w=(t-d)/2,k=m*m/(o*o)+w*w/(a*a);k>1&&(k=ht.sqrt(k),o=k*o,a=k*a);var C=o*o,v=a*a,b=(l==i?-1:1)*ht.sqrt(Vn((C*v-C*w*w-v*m*m)/(C*w*w+v*m*m))),S=b*o*w/a+(e+s)/2,y=b*-a*m/o+(t+d)/2,x=ht.asin(((t-y)/a).toFixed(9)),E=ht.asin(((d-y)/a).toFixed(9));x=e<S?Tn-x:x,E=s<S?Tn-E:E,x<0&&(x=Tn*2+x),E<0&&(E=Tn*2+E),i&&x>E&&(x=x-Tn*2),!i&&E>x&&(E=E-Tn*2)}var _=E-x;if(Vn(_)>f){var V=E,T=s,P=d;E=x+f*(i&&E>x?1:-1),s=S+o*ht.cos(E),d=y+a*ht.sin(E),u=Pc(s,d,o,a,r,0,i,T,P,[E,V,S,y])}_=E-x;var A=ht.cos(x),N=ht.sin(x),M=ht.cos(E),B=ht.sin(E),H=ht.tan(_/4),W=4/3*o*H,X=4/3*a*H,fe=[e,t],J=[e+W*N,t-X*A],Y=[s+W*B,d-X*M],G=[s,d];if(J[0]=2*fe[0]-J[0],J[1]=2*fe[1]-J[1],c)return[J,Y,G].concat(u);u=[J,Y,G].concat(u).join().split(",");for(var j=[],me=0,Pe=u.length;me<Pe;me++)j[me]=me%2?g(u[me-1],u[me],p).y:g(u[me],u[me+1],p).x;return j}function Mv(e,t,o,a,r,l,i,s){for(var d=[],c=[[],[]],f,p,u,h,g,m,w,k,C=0;C<2;++C){if(C==0?(p=6*e-12*o+6*r,f=-3*e+9*o-9*r+3*i,u=3*o-3*e):(p=6*t-12*a+6*l,f=-3*t+9*a-9*l+3*s,u=3*a-3*t),Vn(f)<1e-12){if(Vn(p)<1e-12)continue;h=-u/p,0<h&&h<1&&d.push(h);continue}w=p*p-4*u*f,k=ht.sqrt(w),!(w<0)&&(g=(-p+k)/(2*f),0<g&&g<1&&d.push(g),m=(-p-k)/(2*f),0<m&&m<1&&d.push(m))}for(var v=d.length,b=v,S;v--;)h=d[v],S=1-h,c[0][v]=S*S*S*e+3*S*S*h*o+3*S*h*h*r+h*h*h*i,c[1][v]=S*S*S*t+3*S*S*h*a+3*S*h*h*l+h*h*h*s;return c[0][b]=e,c[1][b]=t,c[0][b+1]=i,c[1][b+1]=s,c[0].length=c[1].length=b+2,{x0:an(...c[0]),y0:an(...c[1]),x1:rn(...c[0]),y1:rn(...c[1])}}function zc(e){if(Tv(e)||(e=xv(e)),Sv(e))return e;for(var t=Ev(Vv(e)),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(u,h,g){var m,w;if(!u)return["C",h.x,h.y,h.x,h.y,h.x,h.y];switch(!(u[0]in{T:1,Q:1})&&(h.qx=h.qy=null),u[0]){case"M":h.X=u[1],h.Y=u[2];break;case"A":u=["C",...Pc(h.x,h.y,...u.slice(1))];break;case"S":g=="C"||g=="S"?(m=h.x*2-h.bx,w=h.y*2-h.by):(m=h.x,w=h.y),u=["C",m,w,...u.slice(1)];break;case"T":g=="Q"||g=="T"?(h.qx=h.x*2-h.qx,h.qy=h.y*2-h.qy):(h.qx=h.x,h.qy=h.y),u=["C",...jc(h.x,h.y,h.qx,h.qy,u[1],u[2])];break;case"Q":h.qx=u[1],h.qy=u[2],u=["C",...jc(h.x,h.y,u[1],u[2],u[3],u[4])];break;case"L":u=["C",...Pa(h.x,h.y,u[1],u[2])];break;case"H":u=["C",...Pa(h.x,h.y,u[1],h.y)];break;case"V":u=["C",...Pa(h.x,h.y,h.x,u[1])];break;case"Z":u=["C",...Pa(h.x,h.y,h.X,h.Y)];break}return u},r=function(u,h){if(u[h].length>7){u[h].shift();for(var g=u[h];g.length;)l[h]="A",u.splice(h++,0,["C",...g.splice(0,6)]);u.splice(h,1),c=t.length}},l=[],i="",s="",d=0,c=t.length;d<c;d++){t[d]&&(i=t[d][0]),i!="C"&&(l[d]=i,d&&(s=l[d-1])),t[d]=a(t[d],o,s),l[d]!="A"&&i=="C"&&(l[d]="C"),r(t,d);var f=t[d],p=f.length;o.x=f[p-2],o.y=f[p-1],o.bx=Ec(f[p-4])||o.x,o.by=Ec(f[p-3])||o.y}return t}function Nv(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function qo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function qe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Av(e){return qo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function jv(e){for(var t=e.waypoints,o=t.reduce(function(s,d,c){var f=t[c-1];if(f){var p=s[s.length-1],u=p&&p.endLength||0,h=Hv(f,d);s.push({start:f,end:d,startLength:u,endLength:u+h,length:h})}return s},[]),a=o.reduce(function(s,d){return s+d.length},0)/2,r=0,l=o[r];l.endLength<a;)l=o[++r];var i=(a-l.startLength)/l.length;return{x:l.start.x+(l.end.x-l.start.x)*i,y:l.start.y+(l.end.y-l.start.y)*i}}function ut(e){return Ht(e)?jv(e):Av(e)}function Nn(e,t,o){o=o||0,(0,R.isObject)(o)||(o={x:o,y:o});var a=qe(e),r=qe(t),l=a.bottom+o.y<=r.top,i=a.left-o.x>=r.right,s=a.top-o.y>=r.bottom,d=a.right+o.x<=r.left,c=l?"top":s?"bottom":null,f=d?"left":i?"right":null;return f&&c?c+"-"+f:f||c||"intersect"}function Kr(e,t,o){var a=Pv(e,t);return a.length===1||a.length===2&&Go(a[0],a[1])<1?qo(a[0]):a.length>1?(a=(0,R.sortBy)(a,function(r){var l=Math.floor(r.t2*100)||1;return l=100-l,l=(l<10?"0":"")+l,r.segment2+"#"+l}),qo(a[o?0:a.length-1])):null}function Pv(e,t){return Nc(e,t)}function zv(e){e=e.slice();for(var t=0,o,a,r;e[t];)o=e[t],a=e[t-1],r=e[t+1],Go(o,r)===0||Wr(a,r,o)?e.splice(t,1):t++;return e}function Hv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lc(e,t,o,a){function r(i,s){return a.allowed("connection.create",{source:i,target:s})}function l(i,s){return r(s,i)}e.on("connect.hover",function(i){var s=i.context,d=s.start,c=i.hover,f;if(s.hover=c,f=s.canExecute=r(d,c),!(0,R.isNil)(f)){if(f!==!1){s.source=d,s.target=c;return}f=s.canExecute=l(d,c),!(0,R.isNil)(f)&&f!==!1&&(s.source=c,s.target=d)}}),e.on(["connect.out","connect.cleanup"],function(i){var s=i.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(i){var s=i.context,d=s.canExecute,c=s.connectionStart,f={x:i.x,y:i.y},p=s.source,u=s.target;if(!d)return!1;var h=null,g={connectionStart:Gr(s)?f:c,connectionEnd:Gr(s)?c:f};(0,R.isObject)(d)&&(h=d),s.connection=o.connect(p,u,h,g)}),this.start=function(i,s,d,c){(0,R.isObject)(d)||(c=d,d=ut(s)),t.init(i,"connect",{autoActivate:c,data:{shape:s,context:{start:s,connectionStart:d}}})}}Lc.$inject=["eventBus","dragging","modeling","rules"];function Gr(e){var t=e.hover,o=e.source,a=e.target;return t&&o&&t===o&&o!==a}var Lv=1100,Ov=900,Oc="connect-ok",Dc="connect-not-ok";function Ic(e,t,o){var a=e.get("connectionPreview",!1);a&&t.on("connect.move",function(r){var l=r.context,i=l.canExecute,s=l.hover,d=l.source,c=l.start,f=l.startPosition,p=l.target,u=l.connectionStart||f,h=l.connectionEnd||{x:r.x,y:r.y},g=u,m=h;Gr(l)&&(g=h,m=u),a.drawPreview(l,i,{source:d||c,target:p||s,connectionStart:g,connectionEnd:m})}),t.on("connect.hover",Ov,function(r){var l=r.context,i=r.hover,s=l.canExecute;s!==null&&o.addMarker(i,s?Oc:Dc)}),t.on(["connect.out","connect.cleanup"],Lv,function(r){var l=r.hover;l&&(o.removeMarker(l,Oc),o.removeMarker(l,Dc))}),a&&t.on("connect.cleanup",function(r){a.cleanUp(r.context)})}Ic.$inject=["injector","eventBus","canvas"];var qr={__depends__:[_o,To,qn],__init__:["connectPreview"],connect:["type",Lc],connectPreview:["type",Ic]},Dv=15;function Fc(e,t){var o;function a(s){return i(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,a):e.off("element.mousedown",a)});function r(s){var d=o.start,c=o.button,f=So(s),p=Bo(f,d);!o.dragging&&Iv(p)>Dv&&(o.dragging=!0,c===0&&lc(e),Or("grab")),o.dragging&&(p=Bo(f,o.last||o.start),t.scroll({dx:p.x,dy:p.y}),o.last=f),s.preventDefault()}function l(s){Z.event.unbind(document,"mousemove",r),Z.event.unbind(document,"mouseup",l),o=null,rc()}function i(s){if(!(0,Z.closest)(s.target,".djs-draggable")){var d=s.button;if(!(d>=2||s.ctrlKey||s.shiftKey||s.altKey))return o={button:d,start:So(s)},Z.event.bind(document,"mousemove",r),Z.event.bind(document,"mouseup",l),!0}}this.isActive=function(){return!!o}}Fc.$inject=["eventBus","canvas"];function Iv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}var $c={__init__:["moveCanvas"],moveCanvas:["type",Fc]};function Xr(e){return Math.log(e)/Math.log(10)}function Wc(e,t){var o=Xr(e.min),a=Xr(e.max);return(Math.abs(o)+Math.abs(a))/t}function Fv(e,t){return Math.max(e.min,Math.min(e.max,t))}var $v=Math.sign||function(e){return e>=0?1:-1},Zr={min:.2,max:4},Uc=10,Wv=.1,Uv=.75;function ln(e,t,o){e=e||{},this._enabled=!1,this._canvas=o,this._container=o._container,this._handleWheel=(0,R.bind)(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Uv;var a=this;t.on("canvas.mouseover",function(){a._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){a._init(!1)})}ln.$inject=["config.zoomScroll","eventBus","canvas"],ln.prototype.scroll=function(t){this._canvas.scroll(t)},ln.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ln.prototype.zoom=function(t,o){var a=Wc(Zr,Uc*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Wv&&(this._zoom(t,o,a),this._totalDelta=0)},ln.prototype._handleWheel=function(t){if(this._enabled){var o=this._container;t.preventDefault();var a=t.ctrlKey||Gs()&&t.metaKey,r=t.shiftKey,l=-1*this._scale,i;if(a?l*=t.deltaMode===0?.02:.32:l*=t.deltaMode===0?1:16,a){var s=o.getBoundingClientRect(),d={x:t.clientX-s.left,y:t.clientY-s.top};i=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*$v(t.deltaY)*l,this.zoom(i,d)}else r?i={dx:l*t.deltaY,dy:0}:i={dx:l*t.deltaX,dy:l*t.deltaY},this.scroll(i)}},ln.prototype.stepZoom=function(t,o){var a=Wc(Zr,Uc);this._zoom(t,o,a)},ln.prototype._zoom=function(e,t,o){var a=this._canvas,r=e>0?1:-1,l=Xr(a.zoom()),i=Math.round(l/o)*o;i+=o*r;var s=Math.pow(10,i);a.zoom(Fv(Zr,s),t)},ln.prototype.toggle=function(t){var o=this._container,a=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Z.event[t?"bind":"unbind"](o,"wheel",a,!1),this._enabled=t,t},ln.prototype._init=function(e){this.toggle(e)};var Jc={__init__:["zoomScroll"],zoomScroll:["type",ln]};function at(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}at.$inject=["eventBus","injector"],at.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const o={command:e,context:t};this._pushAction(o),this._internalExecute(o),this._popAction()},at.prototype.canExecute=function(e,t){const o={command:e,context:t},a=this._getHandler(e);let r=this._fire(e,"canExecute",o);if(r===void 0){if(!a)return!1;a.canExecute&&(r=a.canExecute(t))}return r},at.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},at.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},at.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},at.prototype.register=function(e,t){this._setHandler(e,t)},at.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const o=this._injector.instantiate(t);this.register(e,o)},at.prototype.canUndo=function(){return!!this._getUndoAction()},at.prototype.canRedo=function(){return!!this._getRedoAction()},at.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},at.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},at.prototype._internalUndo=function(e){const t=e.command,o=e.context,a=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),a.revert&&this._markDirty(a.revert(o)),this._revertedAction(e),this._fire(t,"reverted",e)})},at.prototype._fire=function(e,t,o){arguments.length<3&&(o=t,t=null);const a=t?[e+"."+t,t]:[e];let r;o=this._eventBus.createEvent(o);for(const l of a)if(r=this._eventBus.fire("commandStack."+l,o),o.cancelBubble)break;return r},at.prototype._createId=function(){return this._uid++},at.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},at.prototype._internalExecute=function(e,t){const o=e.command,a=e.context,r=this._getHandler(o);if(!r)throw new Error("no command handler registered for <"+o+">");this._pushAction(e),t||(this._fire(o,"preExecute",e),r.preExecute&&r.preExecute(a),this._fire(o,"preExecuted",e)),this._atomicDo(()=>{this._fire(o,"execute",e),r.execute&&this._markDirty(r.execute(a)),this._executedAction(e,t),this._fire(o,"executed",e)}),t||(this._fire(o,"postExecute",e),r.postExecute&&r.postExecute(a),this._fire(o,"postExecuted",e)),this._popAction()},at.prototype._pushAction=function(e){const t=this._currentExecution,o=t.actions,a=o[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=a&&a.id||this._createId()),o.push(e)},at.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,o=e.actions,a=e.dirty;o.pop(),o.length||(this._eventBus.fire("elements.changed",{elements:(0,R.uniqueBy)("id",a.reverse())}),a.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},at.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=(0,R.isArray)(e)?e:[e],t.dirty=t.dirty.concat(e))},at.prototype._executedAction=function(e,t){const o=++this._stackIdx;t||this._stack.splice(o,this._stack.length,e)},at.prototype._revertedAction=function(e){this._stackIdx--},at.prototype._getHandler=function(e){return this._handlerMap[e]},at.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var Jv={commandStack:["type",at]};function Xn(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function za(e,t){if(!e||!t)return-1;var o=e.indexOf(t);return o!==-1&&e.splice(o,1),o}function An(e,t,o){if(!(!e||!t)){typeof o!="number"&&(o=-1);var a=e.indexOf(t);if(a!==-1){if(a===o)return;if(o!==-1)e.splice(a,1);else return}o!==-1?e.splice(o,0,t):e.push(t)}}function Qr(e,t){return!e||!t?-1:e.indexOf(t)}function Mo(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(e){for(var o;o=e[0];)t(o);return e}}var Yv=1e3;function Mt(e){this._eventBus=e}Mt.$inject=["eventBus"];function Kv(e,t){return function(o){return e.call(t||null,o.context,o.command,o)}}Mt.prototype.on=function(e,t,o,a,r,l){if(((0,R.isFunction)(t)||(0,R.isNumber)(t))&&(l=r,r=a,a=o,o=t,t=null),(0,R.isFunction)(o)&&(l=r,r=a,a=o,o=Yv),(0,R.isObject)(r)&&(l=r,r=!1),!(0,R.isFunction)(a))throw new Error("handlerFn must be a function");(0,R.isArray)(e)||(e=[e]);var i=this._eventBus;(0,R.forEach)(e,function(s){var d=["commandStack",s,t].filter(function(c){return c}).join(".");i.on(d,o,r?Kv(a,l):a,l)})},Mt.prototype.canExecute=gn("canExecute"),Mt.prototype.preExecute=gn("preExecute"),Mt.prototype.preExecuted=gn("preExecuted"),Mt.prototype.execute=gn("execute"),Mt.prototype.executed=gn("executed"),Mt.prototype.postExecute=gn("postExecute"),Mt.prototype.postExecuted=gn("postExecuted"),Mt.prototype.revert=gn("revert"),Mt.prototype.reverted=gn("reverted");function gn(e){return function(o,a,r,l,i){((0,R.isFunction)(o)||(0,R.isNumber)(o))&&(i=l,l=r,r=a,a=o,o=null),this.on(o,e,a,r,l,i)}}var Gv=250,Yc=1400;function el(e,t,o){Mt.call(this,t);var a=e.get("movePreview",!1);t.on("shape.move.start",Yc,function(r){var l=r.context,i=l.shapes,s=l.validatedShapes;l.shapes=Kc(i),l.validatedShapes=Kc(s)}),a&&t.on("shape.move.start",Gv,function(r){var l=r.context,i=l.shapes,s=[];(0,R.forEach)(i,function(d){(0,R.forEach)(d.labels,function(c){!c.hidden&&l.shapes.indexOf(c)===-1&&s.push(c),d.labelTarget&&s.push(d)})}),(0,R.forEach)(s,function(d){a.makeDraggable(l,d,!0)})}),this.preExecuted("elements.move",Yc,function(r){var l=r.context.closure,i=l.enclosedElements,s=[];(0,R.forEach)(i,function(d){(0,R.forEach)(d.labels,function(c){i[c.id]||s.push(c)})}),l.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var l=r.context;Mo((l.connection||l.shape).labels,function(i){o.removeShape(i,{nested:!0})})}),this.execute("shape.delete",function(r){var l=r.context,i=l.shape,s=i.labelTarget;s&&(l.labelTargetIndex=Qr(s.labels,i),l.labelTarget=s,i.labelTarget=null)}),this.revert("shape.delete",function(r){var l=r.context,i=l.shape,s=l.labelTarget,d=l.labelTargetIndex;s&&(An(s.labels,i,d),i.labelTarget=s)})}Xn(el,Mt),el.$inject=["injector","eventBus","modeling"];function Kc(e){return(0,R.filter)(e,function(t){return e.indexOf(t.labelTarget)===-1})}var qv={__init__:["labelSupport"],labelSupport:["type",el]};function Gc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function qc(e,t){if(t){let o=e;return Object.keys(t).forEach(a=>{o=o.replace(new RegExp(`{${a}}`,"g"),t[a])}),o}return e}function Xv(e,t,o,a){var r=o.inverse;return Object.defineProperty(e,"remove",{value:function(l){var i=this.indexOf(l);return i!==-1&&(this.splice(i,1),t.unset(l,r,a)),l}}),Object.defineProperty(e,"contains",{value:function(l){return this.indexOf(l)!==-1}}),Object.defineProperty(e,"add",{value:function(l,i){var s=this.indexOf(l);if(typeof i>"u"){if(s!==-1)return;i=this.length}s!==-1&&this.splice(s,1),this.splice(i,0,l),s===-1&&t.set(l,r,a)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function Zv(e){return e.__refs_collection===!0}function Qv(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Xc(e,t,o){var a=Xv(o[t.name]||[],e,t,o);Object.defineProperty(o,t.name,{enumerable:t.enumerable,value:a}),a.length&&a.forEach(function(r){e.set(r,t.inverse,o)})}function eb(e,t,o){var a=t.inverse,r=o[t.name];Object.defineProperty(o,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(l){if(l!==r){var i=r;r=null,i&&e.unset(i,a,o),r=l,e.set(r,a,o)}}})}function Kt(e,t){if(!(this instanceof Kt))return new Kt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Kt.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Xc(this,t,e):eb(this,t,e)},Kt.prototype.ensureRefsCollection=function(e,t){var o=e[t.name];return Zv(o)||Xc(this,t,e),o},Kt.prototype.ensureBound=function(e,t){Qv(e,t)||this.bind(e,t)},Kt.prototype.unset=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(o):e[t.name]=void 0)},Kt.prototype.set=function(e,t,o){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(o):e[t.name]=o)};var tl=new Kt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Zc=new Kt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Qc=new Kt({name:"attachers",collection:!0},{name:"host"}),ed=new Kt({name:"outgoing",collection:!0},{name:"source"}),td=new Kt({name:"incoming",collection:!0},{name:"target"});function No(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,o=this.labels;!e&&t?o.remove(t):o.add(e,0)}}),tl.bind(this,"parent"),Zc.bind(this,"labels"),ed.bind(this,"outgoing"),td.bind(this,"incoming")}function Xo(){No.call(this),tl.bind(this,"children"),Qc.bind(this,"host"),Qc.bind(this,"attachers")}Xn(Xo,No);function nd(){No.call(this),tl.bind(this,"children")}Xn(nd,Xo);function od(){Xo.call(this),Zc.bind(this,"labelTarget")}Xn(od,Xo);function ad(){No.call(this),ed.bind(this,"source"),td.bind(this,"target")}Xn(ad,No);var tb={connection:ad,shape:Xo,label:od,root:nd};function nb(e,t){var o=tb[e];if(!o)throw new Error("unknown type: <"+e+">");return(0,R.assign)(new o,t)}function ob(e){return e instanceof No}function jn(){this._uid=12}jn.prototype.createRoot=function(e){return this.create("root",e)},jn.prototype.createLabel=function(e){return this.create("label",e)},jn.prototype.createShape=function(e){return this.create("shape",e)},jn.prototype.createConnection=function(e){return this.create("connection",e)},jn.prototype.create=function(e,t){return t=(0,R.assign)({},t||{}),t.id||(t.id=e+"_"+this._uid++),nb(e,t)};var ab={width:90,height:20};function Zn(){jn.call(this),this._translate=qc}(0,pn.default)(Zn,jn),Zn.$inject=[],Zn.prototype.baseCreate=jn.prototype.create,Zn.prototype.create=function(e,t){return e==="label"?this.baseCreate(e,ot({type:"label"},ab,t)):this.createFlowElement(e,t)},Zn.prototype.createFlowElement=function(e,t){if(t==null||t===void 0||t==="")return this.baseCreate(e,t);t.businessObject=t.businessObject||{id:Gc()},e==="connection"&&(t.type="myline");const{businessObject:o}=t;o.type=t.type;const a=this._getDefaultSize(o.type);return t=ot({businessObject:o,id:o.id},a,t),this.baseCreate(e,t)},Zn.prototype._getDefaultSize=function(e){let t={width:100,height:80};switch(e){case"startEvent":case"endEvent":case"myEvent":t={width:36,height:36};break;case"gatewayAnd":case"gatewayXor":case"gatewayInclusive":t={width:50,height:50};break;case"subprocess":case"userTask":case"scriptTask":t={width:100,height:80};break}return t};function Ha(e,t){this._modeling=e,this._canvas=t}Ha.$inject=["modeling","canvas"],Ha.prototype.preExecute=function(e){var t=this._modeling,o=e.elements,a=e.alignment;(0,R.forEach)(o,function(r){var l={x:0,y:0};(0,R.isDefined)(a.left)?l.x=a.left-r.x:(0,R.isDefined)(a.right)?l.x=a.right-r.width-r.x:(0,R.isDefined)(a.center)?l.x=a.center-Math.round(r.width/2)-r.x:(0,R.isDefined)(a.top)?l.y=a.top-r.y:(0,R.isDefined)(a.bottom)?l.y=a.bottom-r.height-r.y:(0,R.isDefined)(a.middle)&&(l.y=a.middle-Math.round(r.height/2)-r.y),t.moveElements([r],l,r.parent)})},Ha.prototype.postExecute=function(e){};function La(e){this._modeling=e}La.$inject=["modeling"],La.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var o=e.target||t.parent,a=e.shape,r=e.hints||{};a=e.shape=this._modeling.createShape(a,e.position,o,{attach:r.attach}),e.shape=a},La.prototype.postExecute=function(e){var t=e.hints||{};rb(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function rb(e,t){return(0,R.some)(e.outgoing,function(o){return o.target===t})}function Oa(e,t){this._canvas=e,this._layouter=t}Oa.$inject=["canvas","layouter"],Oa.prototype.execute=function(e){var t=e.connection,o=e.source,a=e.target,r=e.parent,l=e.parentIndex,i=e.hints;if(!o||!a)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=o,t.target=a,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,i)),this._canvas.addConnection(t,r,l),t},Oa.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Da=Math.round;function nl(e){this._modeling=e}nl.$inject=["modeling"],nl.prototype.preExecute=function(e){var t=e.elements,o=e.parent,a=e.parentIndex,r=e.position,l=e.hints,i=this._modeling;(0,R.forEach)(t,function(f){(0,R.isNumber)(f.x)||(f.x=0),(0,R.isNumber)(f.y)||(f.y=0)});var s=nn((0,R.filter)(t,function(f){return!f.hidden}));(0,R.forEach)(t,function(f){Ht(f)&&(f.waypoints=(0,R.map)(f.waypoints,function(p){return{x:Da(p.x-s.x-s.width/2+r.x),y:Da(p.y-s.y-s.height/2+r.y)}})),(0,R.assign)(f,{x:Da(f.x-s.x-s.width/2+r.x),y:Da(f.y-s.y-s.height/2+r.y)})});var d=ov(t),c={};(0,R.forEach)(t,function(f){if(Ht(f)){c[f.id]=(0,R.isNumber)(a)?i.createConnection(c[f.source.id],c[f.target.id],a,f,f.parent||o,l):i.createConnection(c[f.source.id],c[f.target.id],f,f.parent||o,l);return}var p=(0,R.assign)({},l);d.indexOf(f)===-1&&(p.autoResize=!1),Vo(f)&&(p=(0,R.omit)(p,["attach"])),c[f.id]=(0,R.isNumber)(a)?i.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,a,p):i.createShape(f,(0,R.pick)(f,["x","y","width","height"]),f.parent||o,p)}),e.elements=(0,R.values)(c)};var rd=Math.round;function Pn(e){this._canvas=e}Pn.$inject=["canvas"],Pn.prototype.execute=function(e){var t=e.shape,o=e.position,a=e.parent,r=e.parentIndex;if(!a)throw new Error("parent required");if(!o)throw new Error("position required");return o.width!==void 0?(0,R.assign)(t,o):(0,R.assign)(t,{x:o.x-rd(t.width/2),y:o.y-rd(t.height/2)}),this._canvas.addShape(t,a,r),t},Pn.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Zo(e){Pn.call(this,e)}Xn(Zo,Pn),Zo.$inject=["canvas"];var lb=Pn.prototype.execute;Zo.prototype.execute=function(e){var t=e.shape;return sb(t),t.labelTarget=e.labelTarget,lb.call(this,e)};var ib=Pn.prototype.revert;Zo.prototype.revert=function(e){return e.shape.labelTarget=null,ib.call(this,e)};function sb(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qo(e,t){this._canvas=e,this._modeling=t}Qo.$inject=["canvas","modeling"],Qo.prototype.preExecute=function(e){var t=this._modeling,o=e.connection;Mo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})})},Qo.prototype.execute=function(e){var t=e.connection,o=t.parent;return e.parent=o,e.parentIndex=Qr(o.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qo.prototype.revert=function(e){var t=e.connection,o=e.parent,a=e.parentIndex;return t.source=e.source,t.target=e.target,An(o.children,t,a),this._canvas.addConnection(t,o),t};function ol(e,t){this._modeling=e,this._elementRegistry=t}ol.$inject=["modeling","elementRegistry"],ol.prototype.postExecute=function(e){var t=this._modeling,o=this._elementRegistry,a=e.elements;(0,R.forEach)(a,function(r){o.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ea(e,t){this._canvas=e,this._modeling=t}ea.$inject=["canvas","modeling"],ea.prototype.preExecute=function(e){var t=this._modeling,o=e.shape;Mo(o.incoming,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.outgoing,function(a){t.removeConnection(a,{nested:!0})}),Mo(o.children,function(a){Ht(a)?t.removeConnection(a,{nested:!0}):t.removeShape(a,{nested:!0})})},ea.prototype.execute=function(e){var t=this._canvas,o=e.shape,a=o.parent;return e.oldParent=a,e.oldParentIndex=Qr(a.children,o),t.removeShape(o),o},ea.prototype.revert=function(e){var t=this._canvas,o=e.shape,a=e.oldParent,r=e.oldParentIndex;return An(a.children,o,r),t.addShape(o,a),o};function Ia(e){this._modeling=e}Ia.$inject=["modeling"];var ld={x:"y",y:"x"};Ia.prototype.preExecute=function(e){var t=this._modeling,o=e.groups,a=e.axis,r=e.dimension;function l(w,k){w.range.min=Math.min(k[a],w.range.min),w.range.max=Math.max(k[a]+k[r],w.range.max)}function i(w){return w[a]+w[r]/2}function s(w){return w.length-1}function d(w){return w.max-w.min}function c(w,k){var C={y:0};C[a]=w-i(k),C[a]&&(C[ld[a]]=0,t.moveElements([k],C,k.parent))}var f=o[0],p=s(o),u=o[p],h,g,m=0;(0,R.forEach)(o,function(w,k){var C,v,b;if(w.elements.length<2){k&&k!==o.length-1&&(l(w,w.elements[0]),m+=d(w.range));return}C=(0,R.sortBy)(w.elements,a),v=C[0],k===p&&(v=C[s(C)]),b=i(v),w.range=null,(0,R.forEach)(C,function(S){if(c(b,S),w.range===null){w.range={min:S[a],max:S[a]+S[r]};return}l(w,S)}),k&&k!==o.length-1&&(m+=d(w.range))}),g=Math.abs(u.range.min-f.range.max),h=Math.round((g-m)/(o.length-1)),!(h<o.length-1)&&(0,R.forEach)(o,function(w,k){var C={},v;w===f||w===u||(v=o[k-1],w.range.max=0,(0,R.forEach)(w.elements,function(b,S){C[ld[a]]=0,C[a]=v.range.max-b[a]+h,w.range.min!==b[a]&&(C[a]+=b[a]-w.range.min),C[a]&&t.moveElements([b],C,b.parent),w.range.max=Math.max(b[a]+b[r],S?w.range.max:0)}))})},Ia.prototype.postExecute=function(e){};function Fa(e,t){this._layouter=e,this._canvas=t}Fa.$inject=["layouter","canvas"],Fa.prototype.execute=function(e){var t=e.connection,o=t.waypoints;return(0,R.assign)(e,{oldWaypoints:o}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Fa.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function al(){}al.prototype.execute=function(e){var t=e.connection,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,l=t.parent;return e.oldParent=l,e.oldParentIndex=za(l.children,t),An(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(i){i.x+=o.x,i.y+=o.y,i.original&&(i.original.x+=o.x,i.original.y+=o.y)}),t},al.prototype.revert=function(e){var t=e.connection,o=t.parent,a=e.oldParent,r=e.oldParentIndex,l=e.delta;return za(o.children,t),An(a.children,t,r),t.parent=a,(0,R.forEach)(t.waypoints,function(i){i.x-=l.x,i.y-=l.y,i.original&&(i.original.x-=l.x,i.original.y-=l.y)}),t};function $a(e,t,o){var a=ic(t),r=ic(o),l=Bo(e,a),i={x:l.x*(o.width/t.width),y:l.y*(o.height/t.height)};return qo({x:r.x+i.x,y:r.y+i.y})}function rl(e,t,o){var a=Wa(e),r=sd(a,t),l=a[0];return r.length?r[r.length-1]:$a(l.original||l,o,t)}function ll(e,t,o){var a=Wa(e),r=sd(a,t),l=a[a.length-1];return r.length?r[0]:$a(l.original||l,o,t)}function il(e,t,o){var a=Wa(e),r=id(t,o),l=a[0];return $a(l.original||l,r,t)}function sl(e,t,o){var a=Wa(e),r=id(t,o),l=a[a.length-1];return $a(l.original||l,r,t)}function id(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Wa(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function sd(e,t){return(0,R.filter)((0,R.map)(e,db),function(o){return cb(o,t)})}function cb(e,t){return Nn(t,e,1)==="intersect"}function db(e){return e.original||e}function cl(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}cl.prototype.add=function(e,t){return this.addAll([e],t)},cl.prototype.addAll=function(e,t){var o=lv(e,!!t,this);return(0,R.assign)(this,o),this};function ta(e){this._modeling=e}ta.prototype.moveRecursive=function(e,t,o){return e?this.moveClosure(this.getClosure(e),t,o):[]},ta.prototype.moveClosure=function(e,t,o,a,r){var l=this._modeling,i=e.allShapes,s=e.allConnections,d=e.enclosedConnections,c=e.topLevel,f=!1;r&&r.parent===o&&(f=!0),(0,R.forEach)(i,function(p){l.moveShape(p,t,c[p.id]&&!f&&o,{recurse:!1,layout:!1})}),(0,R.forEach)(s,function(p){var u=!!i[p.source.id],h=!!i[p.target.id];d[p.id]&&u&&h?l.moveConnection(p,t,c[p.id]&&!f&&o):l.layoutConnection(p,{connectionStart:u&&il(p,p.source,t),connectionEnd:h&&sl(p,p.target,t)})})},ta.prototype.getClosure=function(e){return new cl().addAll(e,!0)};function Ua(e){this._helper=new ta(e)}Ua.$inject=["modeling"],Ua.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ua.prototype.postExecute=function(e){var t=e.hints,o;t&&t.primaryShape&&(o=t.primaryShape,t.oldParent=o.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,o)};function Qn(e){this._modeling=e,this._helper=new ta(e)}Qn.$inject=["modeling"],Qn.prototype.execute=function(e){var t=e.shape,o=e.delta,a=e.newParent||t.parent,r=e.newParentIndex,l=t.parent;return e.oldBounds=(0,R.pick)(t,["x","y","width","height"]),e.oldParent=l,e.oldParentIndex=za(l.children,t),An(a.children,t,r),(0,R.assign)(t,{parent:a,x:t.x+o.x,y:t.y+o.y}),t},Qn.prototype.postExecute=function(e){var t=e.shape,o=e.delta,a=e.hints,r=this._modeling;a.layout!==!1&&((0,R.forEach)(t.incoming,function(l){r.layoutConnection(l,{connectionEnd:sl(l,t,o)})}),(0,R.forEach)(t.outgoing,function(l){r.layoutConnection(l,{connectionStart:il(l,t,o)})})),a.recurse!==!1&&this.moveChildren(e)},Qn.prototype.revert=function(e){var t=e.shape,o=e.oldParent,a=e.oldParentIndex,r=e.delta;return An(o.children,t,a),(0,R.assign)(t,{parent:o,x:t.x-r.x,y:t.y-r.y}),t},Qn.prototype.moveChildren=function(e){var t=e.delta,o=e.shape;this._helper.moveRecursive(o.children,t,null)},Qn.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function na(e){this._modeling=e}na.$inject=["modeling"],na.prototype.execute=function(e){var t=e.newSource,o=e.newTarget,a=e.connection,r=e.dockingOrPoints;if(!t&&!o)throw new Error("newSource or newTarget required");return(0,R.isArray)(r)&&(e.oldWaypoints=a.waypoints,a.waypoints=r),t&&(e.oldSource=a.source,a.source=t),o&&(e.oldTarget=a.target,a.target=o),a},na.prototype.postExecute=function(e){var t=e.connection,o=e.newSource,a=e.newTarget,r=e.dockingOrPoints,l=e.hints||{},i={};l.connectionStart&&(i.connectionStart=l.connectionStart),l.connectionEnd&&(i.connectionEnd=l.connectionEnd),l.layoutConnection!==!1&&(o&&(!a||l.docking==="source")&&(i.connectionStart=i.connectionStart||cd((0,R.isArray)(r)?r[0]:r)),a&&(!o||l.docking==="target")&&(i.connectionEnd=i.connectionEnd||cd((0,R.isArray)(r)?r[r.length-1]:r)),l.newWaypoints&&(i.waypoints=l.newWaypoints),this._modeling.layoutConnection(t,i))},na.prototype.revert=function(e){var t=e.oldSource,o=e.oldTarget,a=e.oldWaypoints,r=e.connection;return t&&(r.source=t),o&&(r.target=o),a&&(r.waypoints=a),r};function cd(e){return e.original||e}function mn(e,t){this._modeling=e,this._rules=t}mn.$inject=["modeling","rules"],mn.prototype.preExecute=function(e){var t=this,o=this._modeling,a=this._rules,r=e.oldShape,l=e.newData,i=e.hints||{},s;function d(g,m,w){return a.allowed("connection.reconnect",{connection:w,source:g,target:m})}var c={x:l.x,y:l.y},f={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(l,c,r.parent,i),r.host&&o.updateAttachment(s,r.host);var p;i.moveChildren!==!1&&(p=r.children.slice(),o.moveElements(p,{x:0,y:0},s,i));var u=r.incoming.slice(),h=r.outgoing.slice();(0,R.forEach)(u,function(g){var m=g.source;d(m,s,g)&&t.reconnectEnd(g,s,ll(g,s,f),i)}),(0,R.forEach)(h,function(g){var m=g.target;d(s,m,g)&&t.reconnectStart(g,s,rl(g,s,f),i)})},mn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},mn.prototype.execute=function(e){},mn.prototype.revert=function(e){},mn.prototype.createShape=function(e,t,o,a){return this._modeling.createShape(e,t,o,a)},mn.prototype.reconnectStart=function(e,t,o,a){this._modeling.reconnectStart(e,t,o,a)},mn.prototype.reconnectEnd=function(e,t,o,a){this._modeling.reconnectEnd(e,t,o,a)};function oa(e){this._modeling=e}oa.$inject=["modeling"],oa.prototype.execute=function(e){var t=e.shape,o=e.newBounds,a=e.minBounds;if(o.x===void 0||o.y===void 0||o.width===void 0||o.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(a&&(o.width<a.width||o.height<a.height))throw new Error("width and height cannot be less than minimum height and width");if(!a&&o.width<10||o.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t},oa.prototype.postExecute=function(e){var t=this._modeling,o=e.shape,a=e.oldBounds;(e.hints||{}).layout!==!1&&((0,R.forEach)(o.incoming,function(r){t.layoutConnection(r,{connectionEnd:ll(r,o,a)})}),(0,R.forEach)(o.outgoing,function(r){t.layoutConnection(r,{connectionStart:rl(r,o,a)})}))},oa.prototype.revert=function(e){var t=e.shape,o=e.oldBounds;return(0,R.assign)(t,{width:o.width,height:o.height,x:o.x,y:o.y}),t};function ub(e,t){var o=[];return(0,R.forEach)(e.concat(t),function(a){var r=a.incoming,l=a.outgoing;(0,R.forEach)(r.concat(l),function(i){var s=i.source,d=i.target;(aa(e,s)||aa(e,d)||aa(t,s)||aa(t,d))&&(aa(o,i)||o.push(i))})}),o}function aa(e,t){return e.indexOf(t)!==-1}function fb(e,t,o){var a=e.x,r=e.y,l=e.width,i=e.height,s=o.x,d=o.y;switch(t){case"n":return{x:a,y:r+d,width:l,height:i-d};case"s":return{x:a,y:r,width:l,height:i+d};case"w":return{x:a+s,y:r,width:l-s,height:i};case"e":return{x:a,y:r,width:l+s,height:i};default:throw new Error("unknown direction: "+t)}}function zn(e){this._modeling=e}zn.$inject=["modeling"],zn.prototype.preExecute=function(e){var t=e.delta,o=e.direction,a=e.movingShapes,r=e.resizingShapes,l=e.start,i={};this.moveShapes(a,t),(0,R.forEach)(r,function(s){i[s.id]=hb(s)}),this.resizeShapes(r,t,o),this.updateConnectionWaypoints(ub(a,r),t,o,l,a,r,i)},zn.prototype.execute=function(){},zn.prototype.revert=function(){},zn.prototype.moveShapes=function(e,t){var o=this;(0,R.forEach)(e,function(a){o._modeling.moveShape(a,t,null,{autoResize:!1,layout:!1,recurse:!1})})},zn.prototype.resizeShapes=function(e,t,o){var a=this;(0,R.forEach)(e,function(r){var l=fb(r,o,t);a._modeling.resizeShape(r,l,null,{attachSupport:!1,autoResize:!1,layout:!1})})},zn.prototype.updateConnectionWaypoints=function(e,t,o,a,r,l,i){var s=this,d=r.concat(l);(0,R.forEach)(e,function(c){var f=c.source,p=c.target,u=pb(c),h=ud(o),g={};Hn(d,f)&&Hn(d,p)?(u=(0,R.map)(u,function(m){return fd(m,a,o)&&(m[h]=m[h]+t[h]),m.original&&fd(m.original,a,o)&&(m.original[h]=m.original[h]+t[h]),m}),s._modeling.updateWaypoints(c,u,{labelBehavior:!1})):(Hn(d,f)||Hn(d,p))&&(Hn(r,f)?g.connectionStart=il(c,f,t):Hn(r,p)?g.connectionEnd=sl(c,p,t):Hn(l,f)?g.connectionStart=rl(c,f,i[f.id]):Hn(l,p)&&(g.connectionEnd=ll(c,p,i[p.id])),s._modeling.layoutConnection(c,g))})};function dd(e){return(0,R.assign)({},e)}function pb(e){return(0,R.map)(e.waypoints,function(t){return t=dd(t),t.original&&(t.original=dd(t.original)),t})}function ud(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function fd(e,t,o){var a=ud(o);if(/e|s/.test(o))return e[a]>t;if(/n|w/.test(o))return e[a]<t}function Hn(e,t){return e.indexOf(t)!==-1}function hb(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ja(e){this._modeling=e}Ja.$inject=["modeling"],Ja.prototype.execute=function(e){var t=e.shape,o=t.children;e.oldChildrenVisibility=pd(o),t.collapsed=!t.collapsed;var a=hd(o,t.collapsed);return[t].concat(a)},Ja.prototype.revert=function(e){var t=e.shape,o=e.oldChildrenVisibility,a=t.children,r=gd(a,o);return t.collapsed=!t.collapsed,[t].concat(r)};function pd(e){var t={};return(0,R.forEach)(e,function(o){t[o.id]=o.hidden,o.children&&(t=(0,R.assign)({},t,pd(o.children)))}),t}function hd(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t,o=o.concat(a),a.children&&(o=o.concat(hd(a.children,a.collapsed||t)))}),o}function gd(e,t){var o=[];return(0,R.forEach)(e,function(a){a.hidden=t[a.id],o=o.concat(a),a.children&&(o=o.concat(gd(a.children,t)))}),o}function Ya(e){this._modeling=e}Ya.$inject=["modeling"],Ya.prototype.execute=function(e){var t=e.shape,o=e.newHost,a=t.host;return e.oldHost=a,e.attacherIdx=md(a,t),yd(o,t),t.host=o,t},Ya.prototype.revert=function(e){var t=e.shape,o=e.newHost,a=e.oldHost,r=e.attacherIdx;return t.host=a,md(o,t),yd(a,t,r),t};function md(e,t){return za(e&&e.attachers,t)}function yd(e,t,o){if(e){var a=e.attachers;a||(e.attachers=a=[]),An(a,t,o)}}function dl(){}dl.prototype.execute=function(e){var t=e.connection,o=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=o,t},dl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ke(e,t,o){this._eventBus=e,this._elementFactory=t,this._commandStack=o;var a=this;e.on("diagram.init",function(){a.registerHandlers(o)})}Ke.$inject=["eventBus","elementFactory","commandStack"],Ke.prototype.getHandlers=function(){return{"shape.append":La,"shape.create":Pn,"shape.delete":ea,"shape.move":Qn,"shape.resize":oa,"shape.replace":mn,"shape.toggleCollapse":Ja,spaceTool:zn,"label.create":Zo,"connection.create":Oa,"connection.delete":Qo,"connection.move":al,"connection.layout":Fa,"connection.updateWaypoints":dl,"connection.reconnect":na,"elements.create":nl,"elements.move":Ua,"elements.delete":ol,"elements.distribute":Ia,"elements.align":Ha,"element.updateAttachment":Ya}},Ke.prototype.registerHandlers=function(e){(0,R.forEach)(this.getHandlers(),function(t,o){e.registerHandler(o,t)})},Ke.prototype.moveShape=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=null);var l={shape:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("shape.move",l)},Ke.prototype.updateAttachment=function(e,t){var o={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",o)},Ke.prototype.moveElements=function(e,t,o,a){a=a||{};var r=a.attach,l=o,i;r===!0?(i=o,l=o.parent):r===!1&&(i=null);var s={shapes:e,delta:t,newParent:l,newHost:i,hints:a};this._commandStack.execute("elements.move",s)},Ke.prototype.moveConnection=function(e,t,o,a,r){typeof a=="object"&&(r=a,a=void 0);var l={connection:e,delta:t,newParent:o,newParentIndex:a,hints:r||{}};this._commandStack.execute("connection.move",l)},Ke.prototype.layoutConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",o)},Ke.prototype.createConnection=function(e,t,o,a,r,l){typeof o=="object"&&(l=r,r=a,a=o,o=void 0),a=this._create("connection",a);var i={source:e,target:t,parent:r,parentIndex:o,connection:a,hints:l};return this._commandStack.execute("connection.create",i),i.connection},Ke.prototype.createShape=function(e,t,o,a,r){typeof a!="number"&&(r=a,a=void 0),r=r||{};var l=r.attach,i,s;e=this._create("shape",e),l?(i=o.parent,s=o):i=o;var d={position:t,shape:e,parent:i,parentIndex:a,host:s,hints:r};return this._commandStack.execute("shape.create",d),d.shape},Ke.prototype.createElements=function(e,t,o,a,r){(0,R.isArray)(e)||(e=[e]),typeof a!="number"&&(r=a,a=void 0),r=r||{};var l={position:t,elements:e,parent:o,parentIndex:a,hints:r};return this._commandStack.execute("elements.create",l),l.elements},Ke.prototype.createLabel=function(e,t,o,a){o=this._create("label",o);var r={labelTarget:e,position:t,parent:a||e.parent,shape:o};return this._commandStack.execute("label.create",r),r.shape},Ke.prototype.appendShape=function(e,t,o,a,r){r=r||{},t=this._create("shape",t);var l={source:e,position:o,target:a,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",l),l.shape},Ke.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ke.prototype.distributeElements=function(e,t,o){var a={groups:e,axis:t,dimension:o};this._commandStack.execute("elements.distribute",a)},Ke.prototype.removeShape=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",o)},Ke.prototype.removeConnection=function(e,t){var o={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",o)},Ke.prototype.replaceShape=function(e,t,o){var a={oldShape:e,newData:t,hints:o||{}};return this._commandStack.execute("shape.replace",a),a.newShape},Ke.prototype.alignElements=function(e,t){var o={elements:e,alignment:t};this._commandStack.execute("elements.align",o)},Ke.prototype.resizeShape=function(e,t,o,a){var r={shape:e,newBounds:t,minBounds:o,hints:a};this._commandStack.execute("shape.resize",r)},Ke.prototype.createSpace=function(e,t,o,a,r){var l={delta:o,direction:a,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",l)},Ke.prototype.updateWaypoints=function(e,t,o){var a={connection:e,newWaypoints:t,hints:o||{}};this._commandStack.execute("connection.updateWaypoints",a)},Ke.prototype.reconnect=function(e,t,o,a,r){var l={connection:e,newSource:t,newTarget:o,dockingOrPoints:a,hints:r||{}};this._commandStack.execute("connection.reconnect",l)},Ke.prototype.reconnectStart=function(e,t,o,a){a||(a={}),this.reconnect(e,t,e.target,o,(0,R.assign)(a,{docking:"source"}))},Ke.prototype.reconnectEnd=function(e,t,o,a){a||(a={}),this.reconnect(e,e.source,t,o,(0,R.assign)(a,{docking:"target"}))},Ke.prototype.connect=function(e,t,o,a){return this.createConnection(e,t,o||{},e.parent,a)},Ke.prototype._create=function(e,t){return ob(t)?t:this._elementFactory.create(e,t)},Ke.prototype.toggleCollapse=function(e,t){var o={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",o)};function vd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ul(e,t){if(!e||!t||!Array.isArray(t))return!1;const o=e.type||e.businessObject&&e.businessObject.type;return t.includes(o)}function gb(e,t){Array.isArray(e)&&e.forEach(t)}function Ka(e){const t=e.businessObject;if(t)return t.name||""}function mb(e,t){const o=e.businessObject;return o.name=t,e}var yb={width:90,height:20},Kx=15;function fl(e){return["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(e.type)}function bd(e){return ra(e.label)}function vb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)],r=bb(e),l=Math.atan((a.y-o.y)/(a.x-o.x));let{x:i,y:s}=r;return Math.abs(l)<Math.PI/2?s-=15:i+=15,{x:i,y:s}}function bb(e){const t=e.length/2-1,o=e[Math.floor(t)],a=e[Math.ceil(t+.01)];return{x:o.x+(a.x-o.x)/2,y:o.y+(a.y-o.y)/2}}function wd(e){return e.waypoints?vb(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+yb.height/2}}function ra(e){return e&&!!e.labelTarget}var wb={width:0,height:0};function Cd(e,t){function o(s,d){const c=s.label||s,f=s.labelTarget||s;return mb(c,d,f!==c),[c,f]}function a(s){const{element:d,newLabel:c}=s,{businessObject:f}=d;if(!ra(d)&&fl(d)&&!bd(d)&&!xd(c)){let u=wd(d);u={x:u.x,y:u.y+7},e.createLabel(d,u,{id:f.id+"_label",businessObject:f})}}function r(s){return s.oldLabel=Ka(s.element),o(s.element,s.newLabel)}function l(s){return o(s.element,s.oldLabel)}function i(s){const{element:d,newLabel:c}=s,f=d.label||d,p=s.hints||{};let{newBounds:u}=s;if(!ra(f))return;if(ra(f)&&xd(c)){p.removeShape!==!1&&e.removeShape(f,{unsetLabel:!1});return}const h=Ka(f);typeof u>"u"&&(u=t.getExternalLabelBounds(f,h)),u&&e.resizeShape(f,u,wb)}this.preExecute=a,this.execute=r,this.revert=l,this.postExecute=i}Cd.$inject=["modeling","textRenderer"];function xd(e){return!e||!e.trim()}function la(e,t,o){Ke.call(this,e,t,o)}(0,pn.default)(la,Ke),la.$inject=["eventBus","elementFactory","commandStack"],la.prototype.getHandlers=function(){const e=Ke.prototype.getHandlers.call(this);return e["element.updateLabel"]=Cd,e},la.prototype.updateLabel=function(e,t,o,a){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:o,hints:a||{}})};function pl(e,t){Mt.call(this,e);function o(a){const{context:r}=a,l=r.hints||{};let i;!r.cropped&&l.createElementsBehavior!==!1&&(i=r.connection,i.waypoints=t.getCroppedWaypoints(i),r.cropped=!0)}this.executed(["connection.layout","connection.create"],o)}(0,pn.default)(pl,Mt),pl.$inject=["eventBus","connectionDocking"];function kd(){}kd.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ut(t.source||e.source),t.connectionEnd||ut(t.target||e.target)]};var Ga=20,Cb=5,qa=Math.round,Sd=20,xb={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function kb(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Sb(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ed(e,t,o){var a=Nn(t,e,Cb),r=o.split(":")[0],l=qa((t.x-e.x)/2+e.x),i=qa((t.y-e.y)/2+e.y),s,d,c=Sb(r,a),f=/h|r|l/.test(r),p=!1,u=!1;return c?(s=f?{x:l,y:e.y}:{x:e.x,y:i},d=f?"h:h":"v:v"):(p=kb(a,r),d=f?"h:v":"v:h",p?f?(u=i===e.y,s={x:e.x+Ga*(/l/.test(r)?-1:1),y:u?i+Ga:i}):(u=l===e.x,s={x:u?l+Ga:l,y:e.y+Ga*(/t/.test(r)?-1:1)}):s={x:l,y:i}),{waypoints:hl(e,s,d).concat(s),directions:d,turnNextDirections:u}}function Eb(e,t,o){return Ed(e,t,o)}function _b(e,t,o){var a=Ed(t,e,_d(o));return{waypoints:a.waypoints.slice().reverse(),directions:_d(a.directions),turnNextDirections:a.turnNextDirections}}function Bb(e,t){var o=e.directions.split(":")[1],a=t.directions.split(":")[0];e.turnNextDirections&&(o=o=="h"?"v":"h"),t.turnNextDirections&&(a=a=="h"?"v":"h");var r=o+":"+a;return{waypoints:hl(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}function _d(e){return e.split(":").reverse().join(":")}function Rb(e,t,o){var a=qa((t.x-e.x)/2+e.x),r=qa((t.y-e.y)/2+e.y);if(o==="h:v")return[{x:t.x,y:e.y}];if(o==="v:h")return[{x:e.x,y:t.y}];if(o==="h:h")return[{x:a,y:e.y},{x:a,y:t.y}];if(o==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function hl(e,t,o){if(o=o||"h:h",!Hb(o))throw new Error("unknown directions: <"+o+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Rd(o)){var a=Eb(e,t,o),r=_b(e,t,o),l=Bb(a,r);return[].concat(a.waypoints,l.waypoints,r.waypoints)}return Rb(e,t,o)}function Tb(e,t,o){var a=hl(e,t,o);return a.unshift(e),a.push(t),Vd(a)}function Vb(e,t,o,a,r){var l=(0,R.without)(r&&r.preferredLayouts||[],"straight")[0]||"h:h",i=Nn(e,t,xb[l]||0),s=zb(i,l);o=o||ut(e),a=a||ut(t);var d=s.split(":");return Tb(Td(o,e,d[0],Lb(i)),Td(a,t,d[1],i),s)}function Mb(e,t,o,a,r,l){(0,R.isArray)(o)&&(r=o,l=a,o=ut(e),a=ut(t)),l=(0,R.assign)({preferredLayouts:[]},l),r=r||[];var i=l.preferredLayouts.indexOf("straight")!==-1&&Ab(e,t,o,a,l);return i||(i=l.connectionEnd&&Pb(t,e,a,r),i)||(i=l.connectionStart&&jb(e,t,o,r),i)?i:!l.connectionStart&&!l.connectionEnd&&r&&r.length?r:Vb(e,t,o,a,l)}function Nb(e,t,o){return e>=t&&e<=o}function Bd(e,t,o){return Nb(t[e],o[e],o[e]+o[{x:"width",y:"height"}[e]])}function Ab(e,t,o,a,r){var l={},i,s=Nn(e,t);return/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(i="x"),/left|right/.test(s)&&(i="y"),r.preserveDocking==="target"?Bd(i,a,e)?(l[i]=a[i],[{x:l.x!==void 0?l.x:o.x,y:l.y!==void 0?l.y:o.y,original:{x:l.x!==void 0?l.x:o.x,y:l.y!==void 0?l.y:o.y}},{x:a.x,y:a.y}]):null:Bd(i,o,t)?(l[i]=o[i],[{x:o.x,y:o.y},{x:l.x!==void 0?l.x:a.x,y:l.y!==void 0?l.y:a.y,original:{x:l.x!==void 0?l.x:a.x,y:l.y!==void 0?l.y:a.y}}]):null):null}function jb(e,t,o,a){return gl(e,t,o,a)}function Pb(e,t,o,a){var r=a.slice().reverse();return r=gl(e,t,o,r),r?r.reverse():null}function gl(e,t,o,a){function r(f){return f.length<3?!0:f.length>4?!1:!!(0,R.find)(f,function(p,u){var h=f[u-1];return h&&Go(p,h)<3})}function l(f,p,u){switch(Rn(p,f)){case"v":return{x:u.x,y:f.y};case"h":return{x:f.x,y:u.y}}return{x:f.x,y:f.y}}function i(f,p,u){var h;for(h=f.length-2;h!==0;h--)if(Sc(f[h],p,Sd)||Sc(f[h],u,Sd))return f.slice(h);return f}if(r(a))return null;var s=a[0],d=a.slice(),c;return d[0]=o,d[1]=l(d[1],s,o),c=i(d,e,t),c!==d&&(d=gl(e,t,o,c)),d&&Rn(d)?null:d}function zb(e,t){if(Rd(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function Hb(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Rd(e){return e&&/t|r|b|l/.test(e)}function Lb(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Td(e,t,o,a){if(o==="h"&&(o=/left/.test(a)?"l":"r"),o==="v"&&(o=/top/.test(a)?"t":"b"),o==="t")return{original:e,x:e.x,y:t.y};if(o==="r")return{original:e,x:t.x+t.width,y:e.y};if(o==="b")return{original:e,x:e.x,y:t.y+t.height};if(o==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+o+">")}function Vd(e){return e.reduce(function(t,o,a){var r=t[t.length-1],l=e[a+1];return Wr(r,l,o,0)||t.push(o),t},[])}function ml(){}(0,pn.default)(ml,kd);var eo=(e,t)=>e.type===t;ml.prototype.layoutConnection=function(e,t){t||(t={});const o=t.source||e.source,a=t.target||e.target,r=t.waypoints||e.waypoints;let{connectionStart:l,connectionEnd:i}=t,s,d;return i===void 0&&(l=Xa(r&&r[0],o),i=Xa(r&&r[r.length-1],a)),l||(l=Xa(r&&r[0],o)),i||(i=Xa(r&&r[r.length-1],a)),eo(e,"myline")&&(o===a?s={preferredLayouts:Ob(o,e)}:eo(o,"gatewayAnd")||eo(o,"gatewayXor")||eo(o,"gatewayInclusive")?s={preferredLayouts:["v:h"]}:eo(a,"gatewayAnd")||eo(a,"gatewayXor")||eo(a,"gatewayInclusive")?s={preferredLayouts:["h:v"]}:s={preferredLayouts:["h:h"]}),s&&(s=ot(s,t),d=Vd(Mb(o,a,l,i,r,s))),d||[l,i]};function Xa(e,t){return e?e.original||e:ut(t)}function Ob(e,t){const{waypoints:o}=t,a=o&&o.length&&Nn(o[0],e);return a==="top"?["t:r"]:a==="right"?["r:b"]:a==="left"?["l:t"]:["b:l"]}function Md(e){return(0,R.assign)({original:e.point.original||e.point},e.actual)}function Ln(e,t){this._elementRegistry=e,this._graphicsFactory=t}Ln.$inject=["elementRegistry","graphicsFactory"],Ln.prototype.getCroppedWaypoints=function(e,t,o){t=t||e.source,o=o||e.target;var a=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,o),l=e.waypoints.slice(a.idx+1,r.idx);return l.unshift(Md(a)),l.push(Md(r)),l},Ln.prototype.getDockingPoint=function(e,t,o){var a=e.waypoints,r=o?0:a.length-1,l=a[r];return{point:l,actual:this._getIntersection(t,e,o)||l,idx:r}},Ln.prototype._getIntersection=function(e,t,o){return Kr(this._getShapePath(e),this._getConnectionPath(t),o)},Ln.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Ln.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Ln.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Nd={__depends__:[Jv,qv,_o],__init__:["modeling","elementUpdater"],modeling:["type",la],layouter:["type",ml],elementUpdater:["type",pl],elementFactory:["type",Zn],connectionDocking:["type",Ln]},Db=1e3;function to(e,t){var o=this;t=t||Db,e.on(["render.shape","render.connection"],t,function(a,r){var l=a.type,i=r.element,s=r.gfx,d=r.attrs;if(o.canRender(i))return l==="render.shape"?o.drawShape(s,i,d):o.drawConnection(s,i,d)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(a,r){if(o.canRender(r))return a.type==="render.getShapePath"?o.getShapePath(r):o.getConnectionPath(r)})}to.prototype.canRender=function(e){},to.prototype.drawShape=function(e,t){},to.prototype.drawConnection=function(e,t){},to.prototype.getShapePath=function(e){},to.prototype.getConnectionPath=function(e){};function Ib(e){return e.businessObject}function Za(e,t){return e.businessObject.strokeWidth||t||1}function Zt(e,t){return e.businessObject.fillColor||t||"var(--j-color-bg-container)"}function ft(e,t){return e.businessObject.strokeColor||t||"var(--j-color-text)"}function Fb(e){const t=e.x+e.width/2,o=e.y+e.height/2,a=e.width/2;return Yo([["M",t,o],["m",0,-a],["a",a,a,0,1,1,0,2*a],["a",a,a,0,1,1,0,-2*a],["z"]])}function $b(e,t){const{x:o,y:a,width:r,height:l}=e;return Yo([["M",o+t,a],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,l-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-l],["a",t,t,0,0,1,t,-t],["z"]])}function Wb(e){const{x:t,y:o,width:a,height:r}=e,l=a/2,i=r/2;return Yo([["M",t+l,o],["l",l,i],["l",-l,i],["l",-l,-i],["z"]])}function Ub(e){const{x:t,y:o,width:a,height:r}=e;return Yo([["M",t,o],["l",a,0],["l",0,r],["l",-a,0],["z"]])}var yl=10,vl=.95,On=(e,t)=>e.type===t;function no(e,t,o,a,r,l,i){to.call(this,e,i);const s="var(--j-color-bg-container)",d="var(--j-color-text)",c={};Object.keys(l.palette).forEach(M=>{const B=l.palette[M];c[B.type]=B.options});const{computeStyle:f}=t;function p(M){return N[M]}function u(M){return t.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2})}function h(M){return t.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:d,strokeWidth:2,fill:"white"})}function g(M,B,H,W){H=u(H);const X=Hr(B,H,W);return(0,D.append)(M,X),X}function m(M,B,H){return g(M,B,H,5)}function w(M,B,H,W,X){vd(W)&&(X=W,W=0),W=W||0,X=f(X,{stroke:d,strokeWidth:2,fill:s}),X.fill==="none"&&delete X.fillOpacity;const fe=B/2,J=H/2,Y=(0,D.create)("circle");return(0,D.attr)(Y,{cx:fe,cy:J,r:Math.round((B+H)/4-W)}),(0,D.attr)(Y,X),(0,D.append)(M,Y),Y}function k(M,B,H,W,X,fe){vd(X)&&(fe=X,X=0),X=X||0,fe=f(fe,{stroke:d,strokeWidth:2,fill:s});const J=(0,D.create)("rect");return(0,D.attr)(J,{x:X,y:X,width:B-X*2,height:H-X*2,rx:W,ry:W}),(0,D.attr)(J,fe),(0,D.append)(M,J),J}function C(M,B,H){H=f(H,["no-fill"],{strokeWidth:2,stroke:d});const W=(0,D.create)("path");return(0,D.attr)(W,{d:B}),(0,D.attr)(W,H),(0,D.append)(M,W),W}function v(M,B,H,W){const X=B/2,fe=H/2,J=[{x:X,y:0},{x:B,y:fe},{x:X,y:H},{x:0,y:fe}].map(G=>G.x+","+G.y).join(" ");W=f(W,{stroke:d,strokeWidth:2,fill:s});const Y=(0,D.create)("polygon");return(0,D.attr)(Y,{points:J}),(0,D.attr)(Y,W),(0,D.append)(M,Y),Y}function b(M,B,H,W){return C(B,H,ot({"data-marker":M},W))}function S(M,B,H){H=ot({size:{width:100}},H);const W=r.createText(B||"",H);return(0,D.classes)(W).add("djs-label"),(0,D.append)(M,W),W}function y(M,B,H){return S(M,Ib(B).name,{box:B,align:H,padding:5,style:{fill:ft(B,d)}})}function x(M,B){const H={width:90,height:30,x:B.width/2+B.x,y:B.height/2+B.y};return S(M,Ka(B),{box:H,fitBox:!0,style:ot({},r.getExternalStyle(),{fill:ft(B,d)})})}function E(M,B,H){const W=H&&H.indexOf("SubProcessMarker")!==-1;let X;W?X={seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:X={seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},gb(H,fe=>{p(fe)(M,B,X)})}function _(M){return M.replace(/[^0-9a-zA-z]+/g,"_")}function V(M,B){const{ref:H={x:0,y:0},scale:W=1,element:X,parentGfx:fe=a._svg}=B,J=(0,D.create)("marker",{id:M,viewBox:"0 0 20 20",refX:H.x,refY:H.y,markerWidth:20*W,markerHeight:20*W,orient:"auto"});(0,D.append)(J,X);let Y=(0,Z.query)(":scope > defs",fe);Y||(Y=(0,D.create)("defs"),(0,D.append)(fe,Y)),(0,D.append)(Y,J)}function T(M,B,H,W){const X=B+"-"+_(H)+"-"+_(W)+"-"+Gc();return P(M,X,B,H,W),"url(#"+X+")"}function P(M,B,H,W,X){H==="sequenceflow-end"&&V(B,{element:(0,D.create)("path",{d:"M 1 5 L 11 10 L 1 15 Z",...h({fill:X,stroke:X,strokeWidth:1})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),H==="messageflow-start"&&V(B,{element:(0,D.create)("circle",{cx:6,cy:6,r:3.5,...h({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:6,y:6},parentGfx:M}),H==="messageflow-end"&&V(B,{element:(0,D.create)("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...h({fill:W,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})}),ref:{x:8.5,y:5},parentGfx:M}),H==="association-start"&&V(B,{element:(0,D.create)("path",{d:"M 11 5 L 1 10 L 11 15",...u({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:1,y:10},scale:.5,parentGfx:M}),H==="association-end"&&V(B,{element:(0,D.create)("path",{d:"M 1 5 L 11 10 L 1 15",...u({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})}),ref:{x:11,y:10},scale:.5,parentGfx:M}),H==="conditional-flow-marker"&&V(B,{element:(0,D.create)("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...h({fill:W,stroke:X})}),ref:{x:-1,y:10},scale:.5,parentGfx:M}),H==="conditional-default-flow-marker"&&V(B,{element:(0,D.create)("path",{d:"M 6 4 L 10 16",...h({stroke:X,fill:"none"})}),ref:{x:0,y:10},scale:.5,parentGfx:M})}function A(M,B,H,W){const X=c[B.type]?.icon||B.icon;X&&C(M,o.getScaledPath(X,{abspos:{x:H,y:W}}),{strokeWidth:0,fill:ft(B,c[B.type]?.iconFill||B.iconFill)})}const N={event(M,B,H){return"fillOpacity"in H||(H.fillOpacity=vl),w(M,B.width,B.height,H)},startEvent(M,B){const H={fill:Zt(B,c.startEvent?.fill||B.fill),stroke:ft(B,c.startEvent?.stroke||B.stroke),strokeWidth:Za(B,c.startEvent?.strokeWidth||B.strokeWidth)},W=p("event")(M,B,H);return A(M,B,18,18),W},endEvent(M,B){const H=p("event")(M,B,{strokeWidth:Za(B,c.endEvent?.strokeWidth||B.strokeWidth||4),fill:Zt(B,c.endEvent?.fill||B.fill),stroke:ft(B,c.endEvent?.stroke||B.stroke)});return A(M,B,18,18),H},gateway(M,B){const H={fillOpacity:vl,strokeWidth:Za(B,c[B.type]?.strokeWidth||B.strokeWidth||4),fill:Zt(B,c[B.type]?.fill||B.fill),stroke:ft(B,c[B.type]?.stroke||B.stroke)};return v(M,B.width,B.height,H)},gatewayAnd(M,B){const H=p("gateway")(M,B);return C(M,o.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:c[B.type]?.width||B.width,containerHeight:c[B.type]?.height||B.height,position:{mx:.47,my:.29}}),{strokeWidth:1,fill:ft(B,c[B.type]?.iconFill||B.iconFill),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},gatewayXor(M,B){const H=p("gateway")(M,B);return C(M,o.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:B.width,containerHeight:B.height,position:{mx:.32,my:.3}}),{strokeWidth:1,fill:ft(B,c[B.type]?.iconFill||B.iconFill),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},gatewayInclusive(M,B){const H=p("gateway")(M,B);return w(M,B.width,B.height,B.height*.24,{strokeWidth:2.5,fill:ft(B,s),stroke:ft(B,c[B.type]?.iconFill||B.iconFill)}),H},activity(M,B,H){return H=H||{},"fillOpacity"in H||(H.fillOpacity=vl),k(M,B.width,B.height,yl,H)},task(M,B){const H={fill:Zt(B,s),stroke:ft(B,d)},W=p("activity")(M,B,H);return y(M,B,"center-middle"),E(M,B),W},userTask(M,B){const H=p("task")(M,B),W=15,X=12;return C(M,o.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:Zt(B,s),stroke:ft(B,d)}),C(M,o.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:Zt(B,s),stroke:ft(B,d)}),C(M,o.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:X}}),{strokeWidth:.5,fill:ft(B,d),stroke:ft(B,d)}),H},scriptTask(M,B){const H=p("task")(M,B);return C(M,o.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:ft(B,d)}),H},SubProcessMarker(M,B){on(k(M,14,14,0,{strokeWidth:1,fill:Zt(B,s),stroke:ft(B,d)}),B.width/2-7.5,B.height-20),b("sub-process",M,o.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:B.width,containerHeight:B.height,position:{mx:(B.width/2-7.5)/B.width,my:(B.height-20)/B.height}}),{fill:Zt(B,s),stroke:ft(B,d)})},subprocess(M,B,H){H=ot({fill:Zt(B,s),stroke:ft(B,d)},H);const W=p("activity")(M,B,H);return y(M,B,"center-middle"),E(M,B,["SubProcessMarker"]),W},label(M,B){return x(M,B)},myline(M,B){const H=Zt(B,l.lineStroke||s),W=ft(B,l.lineStroke||d);return m(M,B.waypoints,{markerEnd:T(M,"sequenceflow-end",H,W),stroke:W})},default(M,B){const H={strokeWidth:Za(B,c[B.type]?.strokeWidth||B.strokeWidth||1),fill:Zt(B,c[B.type]?.fill||B.fill),stroke:ft(B,c[B.type]?.stroke||B.stroke)},W=k(M,B.width,B.height,B.radius||yl,H);return y(M,B,"center-middle"),E(M,B),A(M,B,B.iconX,B.iconY),W}};this.handlers=N,this._drawPath=C}(0,pn.default)(no,to),no.$inject=["eventBus","styles","pathMap","canvas","textRenderer","myOptions"],no.prototype.canRender=function(){return!0},no.prototype.drawShape=function(e,t){const{type:o}=t;return(this.handlers[o]||this.handlers.default)(e,t)},no.prototype.drawConnection=function(e,t){const{type:o}=t,a=this.handlers[o];return a(e,t)},no.prototype.getShapePath=function(e){return On(e,"startEvent")||On(e,"endEvent")?Fb(e):On(e,"userTask")||On(e,"scriptTask")||On(e,"subprocess")?$b(e,yl):On(e,"gatewayAnd")||On(e,"gatewayXor")||On(e,"gatewayInclusive")?Wb(e):Ub(e)};var Jb=0,Yb={width:150,height:50};function Kb(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Gb(e){return(0,R.isObject)(e)?(0,R.assign)({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var bl=null;function qb(){return bl||(bl=document.createElement("canvas").getContext("2d")),bl}function Xb(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Ad(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ad(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Zb(e,t){var o=qb();if(!o)return{width:0,height:0};o.font=Xb(t),"letterSpacing"in o&&(o.letterSpacing=Ad(t.letterSpacing)||"0px");var a=e==="",r=a?"dummy":e.replace(/\s+$/,""),l=o.measureText(r);return{width:a?0:l.width,height:"fontBoundingBoxAscent"in l?l.fontBoundingBoxAscent+l.fontBoundingBoxDescent:l.actualBoundingBoxAscent+l.actualBoundingBoxDescent}}function Qb(e,t,o){for(var a=e.shift(),r=a,l;;){if(l=Zb(r,o),l.width=r?l.width:0,r===" "||r===""||l.width<Math.round(t)||r.length<2)return ew(e,r,a,l);r=nw(r,l.width,t)}}function ew(e,t,o,a){if(t.length<o.length){var r=o.slice(t.length).trim();e.unshift(r)}return{width:a.width,height:a.height,text:t}}var jd="­";function tw(e,t){var o=e.split(/(\s|-|\u00AD)/g),a,r=[],l=0;if(o.length>1)for(;a=o.shift();)if(a.length+l<t)r.push(a),l+=a.length;else{(a==="-"||a===jd)&&r.pop();break}var i=r[r.length-1];return i&&i===jd&&(r[r.length-1]="-"),r.join("")}function nw(e,t,o){var a=Math.max(e.length*(o/t),1),r=tw(e,a);return r||(r=e.slice(0,Math.max(Math.round(a-1),1))),r}function Qa(e){this._config=(0,R.assign)({},{size:Yb,padding:Jb,style:{},align:"center-top"},e||{})}Qa.prototype.createText=function(e,t){return this.layoutText(e,t).element},Qa.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Qa.prototype.layoutText=function(e,t){for(var o=(0,R.assign)({},this._config.size,t.box),a=(0,R.assign)({},this._config.style,t.style),r=Kb(t.align||this._config.align),l=Gb(t.padding!==void 0?t.padding:this._config.padding),i=t.fitBox||!1,s=ow(a),d=e.split(/\u00AD?\r?\n/),c=[],f=o.width-l.left-l.right;d.length;)c.push(Qb(d,f,a));r.vertical==="middle"&&(l.top=l.bottom=0);var p=(0,R.reduce)(c,function(m,w,k){return m+(s||w.height)},0)+l.top+l.bottom,u=(0,R.reduce)(c,function(m,w,k){return w.width>m?w.width:m},0),h=l.top;r.vertical==="middle"&&(h+=(o.height-p)/2),h-=(s||c[0].height)/4;var g=(0,D.create)("text");return(0,D.attr)(g,a),(0,R.forEach)(c,function(m){var w;switch(h+=s||m.height,r.horizontal){case"left":w=l.left;break;case"right":w=(i?u:f)-l.right-m.width;break;default:w=Math.max(((i?u:f)-m.width)/2+l.left,0)}var k=(0,D.create)("tspan");(0,D.attr)(k,{x:w,y:h}),k.textContent=m.text,(0,D.append)(g,k)}),{dimensions:{width:u,height:p},element:g}};function ow(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var aw=12,rw=1.2,lw=30;function Pd(e){const t=ot({fontFamily:"Arial, sans-serif",fontSize:aw,fontWeight:"normal",lineHeight:rw},e&&e.defaultStyle||{}),o=ot({},t,{fontSize:parseInt(t.fontSize,10)-1},e&&e.externalStyle||{}),a=new Qa({style:t});this.getExternalLabelBounds=function(r,l){const i=a.getDimensions(l,{box:{width:90,height:30,x:r.width/2+r.x,y:r.height/2+r.y},style:o});return{x:Math.round(r.x+r.width/2-i.width/2),y:Math.round(r.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}},this.getTextAnnotationBounds=function(r,l){const i=a.getDimensions(l,{box:r,style:t,align:"left-top",padding:5});return{x:r.x,y:r.y,width:r.width,height:Math.max(lw,Math.round(i.height))}},this.createText=function(r,l){return a.createText(r,l||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return o}}Pd.$inject=["config.textRenderer"];function iw(){this.pathMap={GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,o){let a,r;o.abspos?(a=o.abspos.x,r=o.abspos.y):(a=o.containerWidth*o.position.mx,r=o.containerHeight*o.position.my);let l={};typeof t=="object"?(l=t,l.d.indexOf("{mx},{my}")===-1&&(l.d="m {mx},{my}"+l.d),l.width&&(a-=l.width/2),l.height&&(r-=l.height/2)):l=this.pathMap[t];const i={};if(o.position){const s=o.containerHeight/l.height*o.yScaleFactor,d=o.containerWidth/l.width*o.xScaleFactor;for(let c=0;c<l.heightElements.length;c++)i["y"+c]=l.heightElements[c]*s;for(let c=0;c<l.widthElements.length;c++)i["x"+c]=l.widthElements[c]*d}return uw(l.d,{mx:a,my:r,e:i})}}var sw=/\{([^}]+)\}/g,cw=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function dw(e,t,o){let a=o;return t.replace(cw,(r,l,i,s,d)=>{l=l||s,a&&(l in a&&(a=a[l]),typeof a=="function"&&d&&(a=a()))}),a=(a==null||a===o?e:a)+"",a}function uw(e,t){return String(e).replace(sw,(o,a)=>dw(o,a,t))}var zd={__init__:["myRenderer"],myRenderer:["type",no],textRenderer:["type",Pd],pathMap:["type",iw]};function Hd(e,t){return ot({id:e.id,type:e.type,businessObject:e},t)}function fw(e,t,o){const a=e.waypoint;return!a||a.length<2?[ut(t),ut(o)]:a.map(r=>({x:r.x,y:r.y}))}function Dn(e,t,o,a,r,l){this._eventBus=e,this._canvas=o,this._elementFactory=a,this._elementRegistry=r,this._translate=qc,this._textRenderer=l,this._modeling=t}Dn.$inject=["eventBus","modeling","canvas","elementFactory","elementRegistry","textRenderer"],Dn.prototype.add=function(e){let t;const{label:o}=e;if(o&&(o.id=e.id,o.name=e.name,delete e.label),e.type==="myline"){const a=this._getSource(e),r=this._getTarget(e);t=this._elementFactory.createConnection(Hd(e,{source:a,target:r,waypoints:fw(e,a,r)})),this._canvas.addConnection(t)}else{const a=this._elementFactory._getDefaultSize(e.type);t=this._elementFactory.createShape(Hd(e,{x:Math.round(e.x),y:Math.round(e.y),width:a.width,height:a.height,isFrame:!1})),this._canvas.addShape(t)}return o&&t&&this.addLabel(o,t),t},Dn.prototype.addLabel=function(e,t){const o=this._elementFactory.createLabel({id:e.id+"_label",labelTarget:t,type:"label",x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height),businessObject:e});return this._canvas.addShape(o,t.parent)},Dn.prototype.update=function(e,t){const o=this._elementRegistry.get(e);o.businessObject=ot(o.businessObject,t),t.type==="myline"?(this._canvas.removeConnection(o),this._canvas.addConnection(o,o.parent)):(this._canvas.removeShape(o),this._canvas.addShape(o,o.parent));const a=this._elementRegistry.get(e+"_label");if(a)a.businessObject=o.businessObject,this._canvas.removeShape(a),this._canvas.addShape(a,o.parent);else{const{name:r}=t;if(r&&["startEvent","myEvent","endEvent","gatewayAnd","gatewayXor","gatewayInclusive","myline"].includes(t.type)){const l={x:t.x+12,y:t.y+42,width:10,height:10,name:r,id:e},i=this._textRenderer.getExternalLabelBounds(l,t.name);this._modeling.resizeShape(l,i,{width:0,height:0}),o&&this.addLabel(l,o)}}},Dn.prototype._getSource=function(e){return this._getElement(e.from)},Dn.prototype._getTarget=function(e){return this._getElement(e.to)},Dn.prototype._getElement=function(e){return this._elementRegistry.get(e)};var Ld={myImporter:["type",Dn]},Od=e=>{const t=[];return e.forEach(o=>{if(o.type!==void 0){const a=o.businessObject;if(o.type==="myline")o.source&&o.target&&(a.from=o.source.id,a.to=o.target.id,a.waypoint=o.waypoints.map(r=>({x:r.x,y:r.y})),t.push(a));else if(o.type!=="label")a.x=o.x,a.y=o.y,t.push(a);else{const r=t.find(l=>l.id===a.id);r&&(r.name=a.name||"",r.label={x:o.x,y:o.y,height:o.height,width:o.width})}}}),t},Dd=(e,t)=>{const o=t.get("myImporter"),a=e.filter(l=>l.type!=="myline"),r=e.filter(l=>l.type==="myline");a.forEach(l=>{o.add(l)}),r.forEach(l=>{o.add(l)})},pw=(0,n.defineComponent)({name:"JWorkflowViewer",__name:"workflow-viewer",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const y=s.get("eventBus");y.on("element.dblclick",x=>{r("elementDblclick",x.element.businessObject)}),y.on("element.click",x=>{r("elementClick",x.element.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},u=()=>{let y={__init__:["myOptions"],myOptions:["type",p]};s=new Ca.default({canvas:{container:l.value},modules:[qr,kc,Nd,$c,Jc,y,zd,Ld]});const x=s.get("canvas"),E=s.get("elementFactory");c();const _=E.createRoot();x.setRootElement(_),f()};(0,n.onMounted)(()=>{u()});const h=y=>{const x=y==null?1:d+y;s.get("canvas").zoom(x),d=x},g=()=>(s.get("canvas").zoom(1),Od(s.get("elementRegistry").getAll())),m=y=>{s.clear(),c(),Dd(y,s)},w=y=>{s.get("myImporter").update(y.id,y)};return t({reset:()=>{c()},zoom:y=>{h(y)},getData:()=>g(),setData:y=>{m(y)},updateElemet:y=>{w(y)}}),(y,x)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:l,class:"j-work-flow"},null,512))}}),hw=pw;function wl(e){return e&&e[e.length-1]}function Id(e){return e.y}function Fd(e){return e.x}var gw={left:Fd,center:Fd,right:function(e){return e.x+e.width},top:Id,middle:Id,bottom:function(e){return e.y+e.height}};function Ao(e,t){this._modeling=e,this._rules=t}Ao.$inject=["modeling","rules"],Ao.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],o="x",a="width";return t.indexOf(e)!==-1&&(o="y",a="height"),{axis:o,dimension:a}},Ao.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ao.prototype._alignmentPosition=function(e,t){var o=this._getOrientationDetails(e),a=o.axis,r=o.dimension,l={},i={},s=!1,d,c,f;function p(u,h){return Math.round((u[a]+h[a]+h[r])/2)}if(this._isType(e,["left","top"]))l[e]=t[0][a];else if(this._isType(e,["right","bottom"]))f=wl(t),l[e]=f[a]+f[r];else if(this._isType(e,["center","middle"])){if((0,R.forEach)(t,function(u){var h=u[a]+Math.round(u[r]/2);i[h]?i[h].elements.push(u):i[h]={elements:[u],center:h}}),d=(0,R.sortBy)(i,function(u){return u.elements.length>1&&(s=!0),u.elements.length}),s)return l[e]=wl(d).center,l;c=t[0],t=(0,R.sortBy)(t,function(u){return u[a]+u[r]}),f=wl(t),l[e]=p(c,f)}return l},Ao.prototype.trigger=function(e,t){var o=this._modeling,a,r=(0,R.filter)(e,function(d){return!(d.waypoints||d.host||d.labelTarget)});if(a=this._rules.allowed("elements.align",{elements:r}),(0,R.isArray)(a)&&(r=a),!(r.length<2||!a)){var l=gw[t],i=(0,R.sortBy)(r,l),s=this._alignmentPosition(t,i);o.alignElements(i,s)}};var mw={__init__:["alignElements"],alignElements:["type",Ao]},er=Math.round,yw=Math.max;function vw(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function bw(e){var t=[];return e.forEach(function(o,a){t.push([a===0?"M":"L",o.x,o.y])}),t}var $d=10;function ww(e,t){var o,a;for(o=0;a=e[o];o++)if(Go(a,t)<=$d)return{point:e[o],bendpoint:!0,index:o};return null}function Cw(e,t){var o=Nc(vw(t,$d),bw(e)),a=o[0],r=o[o.length-1],l;return a?a!==r?a.segment2!==r.segment2?(l=yw(a.segment2,r.segment2)-1,{point:e[l],bendpoint:!0,index:l}):{point:{x:er(a.x+r.x)/2,y:er(a.y+r.y)/2},index:a.segment2}:{point:{x:er(a.x),y:er(a.y)},index:a.segment2}:null}function xw(e,t){return ww(e,t)||Cw(e,t)}function kw(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Sw(e,t,o){var a=[{n:e[0]-o[0],lambda:t[0]},{n:e[1]-o[1],lambda:t[1]}],r=a[0].n*t[0]+a[1].n*t[1],l=a[0].lambda*t[0]+a[1].lambda*t[1];return-r/l}function Wd(e,t){var o=t[0],a=t[1],r={x:a.x-o.x,y:a.y-o.y},l=Sw([o.x,o.y],[r.x,r.y],[e.x,e.y]);return{x:o.x+l*r.x,y:o.y+l*r.y}}function Ew(e,t){var o=Wd(e,t);return kw({x:o.x-e.x,y:o.y-e.y})}var Ud="djs-bendpoint",Jd="djs-segment-dragger";function _w(e,t){var o=So(t),a=e._container.getBoundingClientRect(),r={x:a.left,y:a.top},l=e.viewbox();return{x:l.x+(o.x-r.x)/l.scale,y:l.y+(o.y-r.y)/l.scale}}function Cl(e,t,o){return xw(t,_w(e,o))}function xl(e,t){var o=(0,D.create)("g");(0,D.classes)(o).add(Ud),(0,D.append)(e,o);var a=(0,D.create)("circle");(0,D.attr)(a,{cx:0,cy:0,r:4}),(0,D.classes)(a).add("djs-visual"),(0,D.append)(o,a);var r=(0,D.create)("circle");return(0,D.attr)(r,{cx:0,cy:0,r:10}),(0,D.classes)(r).add("djs-hit"),(0,D.append)(o,r),t&&(0,D.classes)(o).add(t),o}function Bw(e,t,o,a){var r=(0,D.create)("g");(0,D.append)(e,r);var l=18,i=6,s=11,d=Tw(t,o,a),c=i+s,f=(0,D.create)("rect");(0,D.attr)(f,{x:-l/2,y:-i/2,width:l,height:i}),(0,D.classes)(f).add("djs-visual"),(0,D.append)(r,f);var p=(0,D.create)("rect");return(0,D.attr)(p,{x:-d/2,y:-c/2,width:d,height:c}),(0,D.classes)(p).add("djs-hit"),(0,D.append)(r,p),fv(r,a==="v"?90:0,0,0),r}function Yd(e,t,o){var a=(0,D.create)("g"),r=Ur(t,o),l=Rn(t,o);return(0,D.append)(e,a),Bw(a,t,o,l),(0,D.classes)(a).add(Jd),(0,D.classes)(a).add(l==="h"?"horizontal":"vertical"),on(a,r.x,r.y),a}function kl(e){return Math.abs(Math.round(e*2/3))}function Rw(e,t){return Wd(e,Vw(e,t))}function Tw(e,t,o){var a=t.x-e.x,r=t.y-e.y;return kl(o==="h"?a:r)}function Vw(e,t){for(var o=t.waypoints,a=1/0,r,l=0;l<o.length-1;l++){var i=o[l],s=o[l+1],d=Ew(e,[i,s]);d<a&&(a=d,r=l)}return[o[r],o[r+1]]}function Sl(e){return CSS.escape(e)}function Kd(e,t,o,a,r){function l(v,b,S){var y=v.index,x=v.point,E,_,V,T,P,A;return y<=0||v.bendpoint?!1:(E=b[y-1],_=b[y],V=Ur(E,_),T=Rn(E,_),P=Math.abs(x.x-V.x),A=Math.abs(x.y-V.y),T&&P<=S&&A<=S)}function i(v,b){var S=v.waypoints,y,x,E,_;return b.index<=0||b.bendpoint||(y={start:S[b.index-1],end:S[b.index]},x=Rn(y.start,y.end),!x)?null:(x==="h"?E=y.end.x-y.start.x:E=y.end.y-y.start.y,_=kl(E)/2,_)}function s(v,b){var S=b.waypoints,y=Cl(t,S,v),x;if(y)return x=i(b,y),l(y,S,x)?r.start(v,b,y.index):a.start(v,b,y.index,!y.bendpoint),!0}function d(v,b,S){Z.event.bind(v,b,function(y){o.triggerMouseEvent(b,y,S),y.stopPropagation()})}function c(v,b){var S=t.getLayer("overlays"),y=(0,Z.query)('.djs-bendpoints[data-element-id="'+Sl(v.id)+'"]',S);return!y&&b&&(y=(0,D.create)("g"),(0,D.attr)(y,{"data-element-id":v.id}),(0,D.classes)(y).add("djs-bendpoints"),(0,D.append)(S,y),d(y,"mousedown",v),d(y,"click",v),d(y,"dblclick",v)),y}function f(v,b){return(0,Z.query)('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(S,y){var x=xl(v);(0,D.append)(v,x),on(x,S.x,S.y)}),xl(v,"floating")}function u(v,b){for(var S=b.waypoints,y,x,E,_=1;_<S.length;_++)y=S[_-1],x=S[_],Rn(y,x)&&(E=Yd(v,y,x),(0,D.attr)(E,{"data-segment-idx":_}),d(E,"mousemove",b))}function h(v){(0,R.forEach)((0,Z.queryAll)("."+Ud,v),function(b){(0,D.remove)(b)})}function g(v){(0,R.forEach)((0,Z.queryAll)("."+Jd,v),function(b){(0,D.remove)(b)})}function m(v){var b=c(v);return b||(b=c(v,!0),p(b,v),u(b,v)),b}function w(v){var b=c(v);b&&(g(b),h(b),u(b,v),p(b,v))}function k(v,b){var S=(0,Z.query)(".floating",v),y=b.point;S&&on(S,y.x,y.y)}function C(v,b,S){var y=f(b.index,v),x=S[b.index-1],E=S[b.index],_=b.point,V=Ur(x,E),T=Rn(x,E),P,A;y&&(P=Mw(y),A={x:_.x-V.x,y:_.y-V.y},T==="v"&&(A={x:A.y,y:A.x}),on(P,A.x,A.y))}e.on("connection.changed",function(v){w(v.element)}),e.on("connection.remove",function(v){var b=c(v.element);b&&(0,D.remove)(b)}),e.on("element.marker.update",function(v){var b=v.element,S;b.waypoints&&(S=m(b),v.add?(0,D.classes)(S).add(v.marker):(0,D.classes)(S).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,S=b.waypoints,y,x;if(S){if(y=c(b,!0),x=Cl(t,S,v.originalEvent),!x)return;k(y,x),x.bendpoint||C(y,x,S)}}),e.on("element.mousedown",function(v){if(_n(v)){var b=v.originalEvent,S=v.element;if(S.waypoints)return s(b,S)}}),e.on("selection.changed",function(v){var b=v.newSelection[0];b&&b.waypoints&&m(b)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&(m(b),o.registerEvent(v.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(v){o.unregisterEvent(v.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(v){var b=v.element,S=v.newId;if(b.waypoints){var y=c(b);y&&(0,D.attr)(y,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=w,this.getBendpointsContainer=c,this.getSegmentDragger=f}Kd.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function Mw(e){return(0,Z.query)(".djs-visual",e)}var Gd=Math.round,oo="reconnectStart",ao="reconnectEnd",ia="updateWaypoints";function El(e,t,o,a,r,l){this._injector=e,this.start=function(i,s,d,c){var f=o.getGraphics(s),p=s.source,u=s.target,h=s.waypoints,g;!c&&d===0?g=oo:!c&&d===h.length-1?g=ao:g=ia;var m=g===ia?"connection.updateWaypoints":"connection.reconnect",w=r.allowed(m,{connection:s,source:p,target:u});w===!1&&(w=r.allowed(m,{connection:s,source:u,target:p})),w!==!1&&a.init(i,"bendpoint.move",{data:{connection:s,connectionGfx:f,context:{allowed:w,bendpointIndex:d,connection:s,source:p,target:u,insert:c,type:g}}})},t.on("bendpoint.move.hover",function(i){var s=i.context,d=s.connection,c=d.source,f=d.target,p=i.hover,u=s.type;s.hover=p;var h;if(p){var g=u===ia?"connection.updateWaypoints":"connection.reconnect";if(h=s.allowed=r.allowed(g,{connection:d,source:u===oo?p:c,target:u===ao?p:f}),h){s.source=u===oo?p:c,s.target=u===ao?p:f;return}h===!1&&(h=s.allowed=r.allowed(g,{connection:d,source:u===ao?p:f,target:u===oo?p:c})),h&&(s.source=u===ao?p:f,s.target=u===oo?p:c)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(i){var s=i.context,d=s.type;s.hover=null,s.source=null,s.target=null,d!==ia&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(i){var s=i.context,d=s.allowed,c=s.bendpointIndex,f=s.connection,p=s.insert,u=f.waypoints.slice(),h=s.source,g=s.target,m=s.type,w=s.hints||{},k={x:Gd(i.x),y:Gd(i.y)};if(!d)return!1;m===ia?(p?u.splice(c,0,k):u[c]=k,w.bendpointMove={insert:p,bendpointIndex:c},u=this.cropWaypoints(f,u),l.updateWaypoints(f,zv(u),w)):(m===oo?(w.docking="source",tr(s)&&(w.docking="target",w.newWaypoints=u.reverse())):m===ao&&(w.docking="target",tr(s)&&(w.docking="source",w.newWaypoints=u.reverse())),l.reconnect(f,h,g,k,w))},this)}El.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],El.prototype.cropWaypoints=function(e,t){var o=this._injector.get("connectionDocking",!1);if(!o)return t;var a=e.waypoints;return e.waypoints=t,e.waypoints=o.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=a,t};function tr(e){var t=e.hover,o=e.source,a=e.target,r=e.type;if(r===oo)return t&&a&&t===a&&o!==a;if(r===ao)return t&&o&&t===o&&o!==a}var Nw="reconnectStart",Aw="reconnectEnd",qd="updateWaypoints",sa="connect-ok",nr="connect-not-ok",Xd="connect-hover",Zd="djs-updating",Qd="djs-dragging",eu=1100;function tu(e,t,o,a){this._injector=t;var r=t.get("connectionPreview",!1);o.on("bendpoint.move.start",function(l){var i=l.context,s=i.bendpointIndex,d=i.connection,c=i.insert,f=d.waypoints,p=f.slice();i.waypoints=f,c&&p.splice(s,0,{x:l.x,y:l.y}),d.waypoints=p,(0,D.classes)(i.draggerGfx=xl(a.getLayer("overlays"))).add("djs-dragging"),a.addMarker(d,Qd),a.addMarker(d,Zd)}),o.on("bendpoint.move.hover",function(l){var i=l.context,s=i.allowed,d=i.hover,c=i.type;if(d){if(a.addMarker(d,Xd),c===qd)return;s?(a.removeMarker(d,nr),a.addMarker(d,sa)):s===!1&&(a.removeMarker(d,sa),a.addMarker(d,nr))}}),o.on(["bendpoint.move.out","bendpoint.move.cleanup"],eu,function(l){var i=l.context,s=i.hover,d=i.target;s&&(a.removeMarker(s,Xd),a.removeMarker(s,d?sa:nr))}),o.on("bendpoint.move.move",function(l){var i=l.context,s=i.allowed,d=i.bendpointIndex,c=i.draggerGfx,f=i.hover,p=i.type,u=i.connection,h=u.source,g=u.target,m=u.waypoints.slice(),w={x:l.x,y:l.y},k=i.hints||{},C={};r&&(k.connectionStart&&(C.connectionStart=k.connectionStart),k.connectionEnd&&(C.connectionEnd=k.connectionEnd),p===Nw?tr(i)?(C.connectionEnd=C.connectionEnd||w,C.source=g,C.target=f||h,m=m.reverse()):(C.connectionStart=C.connectionStart||w,C.source=f||h,C.target=g):p===Aw?tr(i)?(C.connectionStart=C.connectionStart||w,C.source=f||g,C.target=h,m=m.reverse()):(C.connectionEnd=C.connectionEnd||w,C.source=h,C.target=f||g):(C.noCropping=!0,C.noLayout=!0,m[d]=w),p===qd&&(m=e.cropWaypoints(u,m)),C.waypoints=m,r.drawPreview(i,s,C)),on(c,l.x,l.y)},this),o.on(["bendpoint.move.end","bendpoint.move.cancel"],eu,function(l){var i=l.context,s=i.connection,d=i.draggerGfx,c=i.hover,f=i.target;s.waypoints=i.waypoints,(0,D.remove)(d),a.removeMarker(s,Zd),a.removeMarker(s,Qd),c&&(a.removeMarker(c,sa),a.removeMarker(c,f?sa:nr)),r&&r.cleanUp(i)})}tu.$inject=["bendpointMove","injector","eventBus","canvas"];var nu="connect-hover",ou="djs-updating";function au(e,t,o){return _l(e,t,e[t]+o)}function _l(e,t,o){return{x:t==="x"?o:e.x,y:t==="y"?o:e.y}}function jw(e,t,o,a){var r=Math.max(t[a],o[a]),l=Math.min(t[a],o[a]),i=20;return _l(t,a,Math.min(Math.max(l+i,e[a]),r-i))}function ru(e){return e==="x"?"y":"x"}function lu(e,t,o){var a,r;return e.original?e.original:(a=ut(t),r=ru(o),_l(e,r,a[r]))}function iu(e,t,o,a,r,l){var i=e.get("connectionDocking",!1);this.start=function(p,u,h){var g,m=o.getGraphics(u),w=h-1,k=h,C=u.waypoints,v=C[w],b=C[k],S=Cl(o,C,p),y=Rn(v,b),x,E;y&&(x=y==="v"?"x":"y",w===0&&(v=lu(v,u.source,x)),k===C.length-1&&(b=lu(b,u.target,x)),S?E=S.point:E={x:(v.x+b.x)/2,y:(v.y+b.y)/2},g={connection:u,segmentStartIndex:w,segmentEndIndex:k,segmentStart:v,segmentEnd:b,axis:x,dragPosition:E},a.init(p,E,"connectionSegment.move",{cursor:x==="x"?"resize-ew":"resize-ns",data:{connection:u,connectionGfx:m,context:g}}))};function s(p,u){if(!i)return u;var h=p.waypoints,g;return p.waypoints=u,g=i.getCroppedWaypoints(p),p.waypoints=h,g}function d(p){r.update("connection",p.connection,p.connectionGfx)}function c(p,u,h){var g=p.newWaypoints,m=g[p.segmentStartIndex+u],w=g[p.segmentEndIndex+u],k=jw(h,m,w,ru(p.axis));on(p.draggerGfx,k.x,k.y)}function f(p,u){var h=0;return{waypoints:p.filter(function(g,m){return Wr(p[m-1],p[m+1],g)?(h=m<=u?h-1:h,!1):!0}),segmentOffset:h}}t.on("connectionSegment.move.start",function(p){var u=p.context,h=p.connection,g=o.getLayer("overlays");u.originalWaypoints=h.waypoints.slice(),u.draggerGfx=Yd(g,u.segmentStart,u.segmentEnd),(0,D.classes)(u.draggerGfx).add("djs-dragging"),o.addMarker(h,ou)}),t.on("connectionSegment.move.move",function(p){var u=p.context,h=u.connection,g=u.segmentStartIndex,m=u.segmentEndIndex,w=u.segmentStart,k=u.segmentEnd,C=u.axis,v=u.originalWaypoints.slice(),b=au(w,C,p["d"+C]),S=au(k,C,p["d"+C]),y=v.length,x=0;v[g]=b,v[m]=S;var E,_;g<2&&(E=Nn(h.source,b),g===1?E==="intersect"&&(v.shift(),v[0]=b,x--):E!=="intersect"&&(v.unshift(w),x++)),m>y-3&&(_=Nn(h.target,S),m===y-2?_==="intersect"&&(v.pop(),v[v.length-1]=S):_!=="intersect"&&v.push(k)),u.newWaypoints=h.waypoints=s(h,v),c(u,x,p),u.newSegmentStartIndex=g+x,d(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,o.addMarker(p.hover,nu)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var u=p.context.hover;u&&o.removeMarker(u,nu)}),t.on("connectionSegment.move.cleanup",function(p){var u=p.context,h=u.connection;u.draggerGfx&&(0,D.remove)(u.draggerGfx),o.removeMarker(h,ou)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var u=p.context,h=u.connection;h.waypoints=u.originalWaypoints,d(p)}),t.on("connectionSegment.move.end",function(p){var u=p.context,h=u.connection,g=u.newWaypoints,m=u.newSegmentStartIndex;g=g.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var w=f(g,m),k=w.waypoints,C=s(h,k),v=w.segmentOffset,b={segmentMove:{segmentStartIndex:u.segmentStartIndex,newSegmentStartIndex:m+v}};l.updateWaypoints(h,C,b)})}iu.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Pw=Math.abs,su=Math.round;function zw(e,t,o){o=o===void 0?10:o;var a,r;for(a=0;a<t.length;a++)if(r=t[a],Pw(r-e)<=o)return r}function Hw(e){return{x:e.x,y:e.y}}function Lw(e){return{x:e.x+e.width,y:e.y+e.height}}function jo(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:su(e.x+e.width/2),y:su(e.y+e.height/2)}}function or(e,t){var o=e.snapped;return o?typeof t=="string"?o[t]:o.x&&o.y:!1}function yn(e,t,o){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof o!="number"&&o!==!1)throw new Error("value must be Number or false");var a,r=e[t],l=e.snapped=e.snapped||{};return o===!1?l[t]=!1:(l[t]=!0,a=o-r,e[t]+=a,e["d"+t]+=a),r}function cu(e){return e.children||[]}var Ow=Math.abs,du=Math.round,Bl=10;function uu(e){function t(l,i){if((0,R.isArray)(l)){for(var s=l.length;s--;)if(Ow(l[s]-i)<=Bl)return l[s]}else{l=+l;var d=i%l;if(d<Bl)return i-d;if(d>l-Bl)return i-d+l}return i}function o(l,i){if(l.waypoints)return Rw(i,l);if(l.width)return{x:du(l.width/2+l.x),y:du(l.height/2+l.y)}}function a(l){var i=l.context,s=i.snapPoints,d=i.connection,c=d.waypoints,f=i.segmentStart,p=i.segmentStartIndex,u=i.segmentEnd,h=i.segmentEndIndex,g=i.axis;if(s)return s;var m=[c[p-1],f,u,c[h+1]];return p<2&&m.unshift(o(d.source,l)),h>c.length-3&&m.unshift(o(d.target,l)),i.snapPoints=s={horizontal:[],vertical:[]},(0,R.forEach)(m,function(w){w&&(w=w.original||w,g==="y"&&s.horizontal.push(w.y),g==="x"&&s.vertical.push(w.x))}),s}e.on("connectionSegment.move.move",1500,function(l){var i=a(l),s=l.x,d=l.y,c,f;if(i){c=t(i.vertical,s),f=t(i.horizontal,d);var p=s-c,u=d-f;(0,R.assign)(l,{dx:l.dx-p,dy:l.dy-u,x:c,y:f}),(p||i.vertical.indexOf(s)!==-1)&&yn(l,"x",c),(u||i.horizontal.indexOf(d)!==-1)&&yn(l,"y",f)}});function r(l){var i=l.snapPoints,s=l.connection.waypoints,d=l.bendpointIndex;if(i)return i;var c=[s[d-1],s[d+1]];return l.snapPoints=i={horizontal:[],vertical:[]},(0,R.forEach)(c,function(f){f&&(f=f.original||f,i.horizontal.push(f.y),i.vertical.push(f.x))}),i}e.on(["connect.hover","connect.move","connect.end"],1500,function(l){var i=l.context.hover,s=i&&o(i,l);!Ht(i)||!s||!s.x||!s.y||(yn(l,"x",s.x),yn(l,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(l){var i=l.context,s=r(i),d=i.hover,c=d&&o(d,l),f=l.x,p=l.y,u,h;if(s){u=t(c?s.vertical.concat([c.x]):s.vertical,f),h=t(c?s.horizontal.concat([c.y]):s.horizontal,p);var g=f-u,m=p-h;(0,R.assign)(l,{dx:l.dx-g,dy:l.dy-m,x:l.x-g,y:l.y-m}),(g||s.vertical.indexOf(f)!==-1)&&yn(l,"x",u),(m||s.horizontal.indexOf(p)!==-1)&&yn(l,"y",h)}})}uu.$inject=["eventBus"];var Dw={__depends__:[qn,To],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Kd],bendpointMove:["type",El],bendpointMovePreview:["type",tu],connectionSegmentMove:["type",iu],bendpointSnapping:["type",uu]},Iw="djs-dragger";function vn(e,t,o,a){this._canvas=t,this._graphicsFactory=o,this._elementFactory=a,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}vn.$inject=["injector","canvas","graphicsFactory","elementFactory"],vn.prototype.drawPreview=function(e,t,o){o=o||{};var a=e.connectionPreviewGfx,r=e.getConnection,l=o.source,i=o.target,s=o.waypoints,d=o.connectionStart,c=o.connectionEnd,f=o.noLayout,p=o.noCropping,u=o.noNoop,h,g=this;if(a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),(0,D.clear)(a),r||(r=e.getConnection=Fw(function(m,w,k){return g.getConnection(m,w,k)})),t&&(h=r(t,l,i)),!h){!u&&this.drawNoopPreview(a,o);return}h.waypoints=s||[],this._layouter&&!f&&(h.waypoints=this._layouter.layoutConnection(h,{source:l,target:i,connectionStart:d,connectionEnd:c,waypoints:o.waypoints||h.waypoints})),(!h.waypoints||!h.waypoints.length)&&(h.waypoints=[l?ut(l):d,i?ut(i):c]),this._connectionDocking&&(l||i)&&!p&&(h.waypoints=this._connectionDocking.getCroppedWaypoints(h,l,i)),this._graphicsFactory.drawConnection(a,h,{stroke:"var(--element-dragger-color)"})},vn.prototype.drawNoopPreview=function(e,t){var o=t.source,a=t.target,r=t.connectionStart||ut(o),l=t.connectionEnd||ut(a),i=this.cropWaypoints(r,l,o,a);(0,D.append)(e,this.createNoopConnection(i[0],i[1]))},vn.prototype.cropWaypoints=function(e,t,o,a){var r=this._graphicsFactory,l=o&&r.getShapePath(o),i=a&&r.getShapePath(a),s=r.getConnectionPath({waypoints:[e,t]});return e=o&&Kr(l,s,!0)||e,t=a&&Kr(i,s,!1)||t,[e,t]},vn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&(0,D.remove)(e.connectionPreviewGfx)},vn.prototype.getConnection=function(e){var t=$w(e);return this._elementFactory.createConnection(t)},vn.prototype.createConnectionPreviewGfx=function(){var e=(0,D.create)("g");return(0,D.attr)(e,{pointerEvents:"none"}),(0,D.classes)(e).add(Iw),(0,D.append)(this._canvas.getActiveLayer(),e),e},vn.prototype.createNoopConnection=function(e,t){return Hr([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Fw(e){var t={};return function(o){var a=JSON.stringify(o),r=t[a];return r||(r=t[a]=e.apply(null,arguments)),r}}function $w(e){return(0,R.isObject)(e)?e:{}}var Ww={__init__:["connectionPreview"],connectionPreview:["type",vn]},Uw=new Aa("ov"),Jw=500;function _t(e,t,o,a){this._eventBus=t,this._canvas=o,this._elementRegistry=a,this._ids=Uw,this._overlayDefaults=(0,R.assign)({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Yw(o.getContainer()),this._init()}_t.$inject=["config.overlays","eventBus","canvas","elementRegistry"],_t.prototype.get=function(e){if((0,R.isString)(e)&&(e={id:e}),(0,R.isString)(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?(0,R.filter)(t.overlays,(0,R.matchPattern)({type:e.type})):t.overlays.slice():[]}else return e.type?(0,R.filter)(this._overlays,(0,R.matchPattern)({type:e.type})):e.id?this._overlays[e.id]:null},_t.prototype.add=function(e,t,o){if((0,R.isObject)(t)&&(o=t,t=null),e.id||(e=this._elementRegistry.get(e)),!o.position)throw new Error("must specifiy overlay position");if(!o.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var a=this._ids.next();return o=(0,R.assign)({},this._overlayDefaults,o,{id:a,type:t,element:e,html:o.html}),this._addOverlay(o),a},_t.prototype.remove=function(e){var t=this.get(e)||[];(0,R.isArray)(t)||(t=[t]);var o=this;(0,R.forEach)(t,function(a){var r=o._getOverlayContainer(a.element,!0);if(a&&((0,Z.remove)(a.html),(0,Z.remove)(a.htmlContainer),delete a.htmlContainer,delete a.element,delete o._overlays[a.id]),r){var l=r.overlays.indexOf(a);l!==-1&&r.overlays.splice(l,1)}})},_t.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},_t.prototype.show=function(){ar(this._overlayRoot)},_t.prototype.hide=function(){ar(this._overlayRoot,!1)},_t.prototype.clear=function(){this._overlays={},this._overlayContainers=[],(0,Z.clear)(this._overlayRoot)},_t.prototype._updateOverlayContainer=function(e){var t=e.element,o=e.html,a=t.x,r=t.y;if(t.waypoints){var l=nn(t);a=l.x,r=l.y}fu(o,a,r),(0,Z.attr)(e.html,"data-container-id",t.id)},_t.prototype._updateOverlay=function(e){var t=e.position,o=e.htmlContainer,a=e.element,r=t.left,l=t.top;if(t.right!==void 0){var i;a.waypoints?i=nn(a).width:i=a.width,r=t.right*-1+i}if(t.bottom!==void 0){var s;a.waypoints?s=nn(a).height:s=a.height,l=t.bottom*-1+s}fu(o,r||0,l||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_t.prototype._createOverlayContainer=function(e){var t=(0,Z.domify)('<div class="djs-overlays" />');(0,Z.assignStyle)(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var o={html:t,element:e,overlays:[]};return this._updateOverlayContainer(o),this._overlayContainers.push(o),o},_t.prototype._updateRoot=function(e){var t=e.scale||1,o="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";pu(this._overlayRoot,o)},_t.prototype._getOverlayContainer=function(e,t){var o=(0,R.find)(this._overlayContainers,function(a){return a.element===e});return!o&&!t?this._createOverlayContainer(e):o},_t.prototype._addOverlay=function(e){var t=e.id,o=e.element,a=e.html,r,l;a.get&&a.constructor.prototype.jquery&&(a=a.get(0)),(0,R.isString)(a)&&(a=(0,Z.domify)(a)),l=this._getOverlayContainer(o),r=(0,Z.domify)('<div class="djs-overlay" data-overlay-id="'+t+'">'),(0,Z.assignStyle)(r,{position:"absolute"}),r.appendChild(a),e.type&&(0,Z.classes)(r).add("djs-overlay-"+e.type);var i=this._canvas.findRoot(o),s=this._canvas.getRootElement();ar(r,i===s),e.htmlContainer=r,l.overlays.push(e),l.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},_t.prototype._updateOverlayVisibilty=function(e,t){var o=e.show,a=this._canvas.findRoot(e.element),r=o&&o.minZoom,l=o&&o.maxZoom,i=e.htmlContainer,s=this._canvas.getRootElement(),d=!0;(a!==s||o&&((0,R.isDefined)(r)&&r>t.scale||(0,R.isDefined)(l)&&l<t.scale))&&(d=!1),ar(i,d),this._updateOverlayScale(e,t)},_t.prototype._updateOverlayScale=function(e,t){var o=e.scale,a,r,l=e.htmlContainer,i,s="";o!==!0&&(o===!1?(a=1,r=1):(a=o.min,r=o.max),(0,R.isDefined)(a)&&t.scale<a&&(i=(1/t.scale||1)*a),(0,R.isDefined)(r)&&t.scale>r&&(i=(1/t.scale||1)*r)),(0,R.isDefined)(i)&&(s="scale("+i+","+i+")"),pu(l,s)},_t.prototype._updateOverlaysVisibilty=function(e){var t=this;(0,R.forEach)(this._overlays,function(o){t._updateOverlayVisibilty(o,e)})},_t.prototype._init=function(){var e=this._eventBus,t=this;function o(a){t._updateRoot(a),t._updateOverlaysVisibilty(a),t.show()}e.on("canvas.viewbox.changing",function(a){t.hide()}),e.on("canvas.viewbox.changed",function(a){o(a.viewbox)}),e.on(["shape.remove","connection.remove"],function(a){var r=a.element;(0,R.forEach)(t.get({element:r}),function(s){t.remove(s.id)});var l=t._getOverlayContainer(r);if(l){(0,Z.remove)(l.html);var i=t._overlayContainers.indexOf(l);i!==-1&&t._overlayContainers.splice(i,1)}}),e.on("element.changed",Jw,function(a){var r=a.element,l=t._getOverlayContainer(r,!0);l&&((0,R.forEach)(l.overlays,function(i){t._updateOverlay(i)}),t._updateOverlayContainer(l))}),e.on("element.marker.update",function(a){var r=t._getOverlayContainer(a.element,!0);r&&(0,Z.classes)(r.html)[a.add?"add":"remove"](a.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function Yw(e){var t=(0,Z.domify)('<div class="djs-overlay-container" />');return(0,Z.assignStyle)(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function fu(e,t,o){(0,Z.assignStyle)(e,{left:t+"px",top:o+"px"})}function ar(e,t){e.style.display=t===!1?"none":""}function pu(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(o){e.style[o+"transform"]=t})}var Kw={__init__:["overlays"],overlays:["type",_t]},Gw=new Aa;function Po(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Po.$inject=["eventBus"],Po.prototype.schedule=function(e,t=Gw.next()){this.cancel(t);const o=this._schedule(e,t);return this._scheduled[t]=o,o.promise},Po.prototype._schedule=function(e,t){const o=qw();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{o.resolve(e())}catch(a){o.reject(a)}}catch(a){console.error("Scheduler#_schedule execution failed",a)}}),promise:o.promise}},Po.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Po.prototype._cancel=function(e){clearTimeout(e.executionId)};function qw(){const e={};return e.promise=new Promise((t,o)=>{e.resolve=t,e.reject=o}),e}var Xw={scheduler:["type",Po]},Zw="djs-element-hidden",rr=".entry",Qw=1e3,hu=8,eC=300;function gt(e,t,o,a){this._canvas=e,this._elementRegistry=t,this._eventBus=o,this._scheduler=a,this._current=null,this._init()}gt.$inject=["canvas","elementRegistry","eventBus","scheduler"],gt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var o=t.newSelection,a=o.length?o.length===1?o[0]:o:null;a?e.open(a,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var o=t.elements,a=e._current;if(a){var r=a.target,l=(0,R.isArray)(r)?r:[r];if(l.filter(function(s){return o.includes(s)}).length){e.close();var i=l.filter(function(s){return e._elementRegistry.get(s.id)});i.length&&e._updateAndOpen(i.length>1?i:i[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var o=t.element,a=e._current;((0,R.isArray)(a.target)?a.target:[a.target]).includes(o)&&e._updateVisibility()}}),this._container=this._createContainer()},gt.prototype._createContainer=function(){var e=(0,Z.domify)('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},gt.prototype.registerProvider=function(e,t){t||(t=e,e=Qw),this._eventBus.on("contextPad.getProviders",e,function(o){o.providers.push(t)})},gt.prototype.getEntries=function(e){var t=this._getProviders(),o=(0,R.isArray)(e)?"getMultiElementContextPadEntries":"getContextPadEntries",a={};return(0,R.forEach)(t,function(r){if((0,R.isFunction)(r[o])){var l=r[o](e);(0,R.isFunction)(l)?a=l(a):(0,R.forEach)(l,function(i,s){a[s]=i})}}),a},gt.prototype.trigger=function(e,t,o){var a=this,r,l,i=t.delegateTarget||t.target;if(!i)return t.preventDefault();if(r=(0,Z.attr)(i,"data-action"),l=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){a._mouseout=a.triggerEntry(r,"hover",l,o)},eC);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,l,o)},gt.prototype.triggerEntry=function(e,t,o,a){if(this.isShown()){var r=this._current.target,l=this._current.entries[e];if(l){var i=l.action;if(this._eventBus.fire("contextPad.trigger",{entry:l,event:o})!==!1){if((0,R.isFunction)(i)){if(t==="click")return i(o,r,a)}else if(i[t])return i[t](o,r,a);o.preventDefault()}}}},gt.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},gt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},gt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),o=this._createHtml(e),a;(0,R.forEach)(t,function(r,l){var i=r.group||"default",s=(0,Z.domify)(r.html||'<div class="entry" draggable="true"></div>'),d;(0,Z.attr)(s,"data-action",l),d=(0,Z.query)("[data-group="+Sl(i)+"]",o),d||(d=(0,Z.domify)('<div class="group"></div>'),(0,Z.attr)(d,"data-group",i),o.appendChild(d)),d.appendChild(s),r.className&&tC(s,r.className),r.title&&(0,Z.attr)(s,"title",r.title),r.imageUrl&&(a=(0,Z.domify)("<img>"),(0,Z.attr)(a,"src",r.imageUrl),a.style.width="100%",a.style.height="100%",s.appendChild(a))}),(0,Z.classes)(o).add("open"),this._current={entries:t,html:o,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},gt.prototype._createHtml=function(e){var t=this,o=(0,Z.domify)('<div class="djs-context-pad"></div>');return Z.delegate.bind(o,rr,"click",function(a){t.trigger("click",a)}),Z.delegate.bind(o,rr,"dragstart",function(a){t.trigger("dragstart",a)}),Z.delegate.bind(o,rr,"mouseover",function(a){t.trigger("mouseover",a)}),Z.delegate.bind(o,rr,"mouseout",function(a){t.trigger("mouseout",a)}),Z.event.bind(o,"mousedown",function(a){a.stopPropagation()}),this._container.appendChild(o),this._eventBus.fire("contextPad.create",{target:e,pad:o}),o},gt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&oC(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},gt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},gt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var o=t.target;return(0,R.isArray)(e)!==(0,R.isArray)(o)?!1:(0,R.isArray)(e)?e.length===o.length&&(0,R.every)(e,function(a){return o.includes(a)}):o===e},gt.prototype.isShown=function(){return this.isOpen()&&(0,Z.classes)(this._current.html).has("open")},gt.prototype.show=function(){this.isOpen()&&((0,Z.classes)(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},gt.prototype.hide=function(){this.isOpen()&&((0,Z.classes)(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},gt.prototype._getPosition=function(e){if(!(0,R.isArray)(e)&&Ht(e)){var t=this._canvas.viewbox(),o=nC(e),a=o.x*t.scale-t.x*t.scale,r=o.y*t.scale-t.y*t.scale;return{left:a+hu*this._canvas.zoom(),top:r}}var l=this._canvas.getContainer().getBoundingClientRect(),i=this._getTargetBounds(e);return{left:i.right-l.left+hu*this._canvas.zoom(),top:i.top-l.top}},gt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,o=this._getPosition(this._current.target);"x"in o&&"y"in o?(t.style.left=o.x+"px",t.style.top=o.y+"px"):["top","right","bottom","left"].forEach(function(a){a in o&&(t.style[a]=o[a]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},gt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,o=this._current.target;((0,R.isArray)(o)?o:[o]).some(function(a){return t._canvas.hasMarker(a,Zw)})?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},gt.prototype._getTargetBounds=function(e){var t=this;return((0,R.isArray)(e)?e:[e]).map(function(o){return t._canvas.getGraphics(o)}).reduce(function(o,a){const r=a.getBoundingClientRect();return o.top=Math.min(o.top,r.top),o.right=Math.max(o.right,r.right),o.bottom=Math.max(o.bottom,r.bottom),o.left=Math.min(o.left,r.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function tC(e,t){var o=(0,Z.classes)(e);t=(0,R.isArray)(t)?t:t.split(/\s+/g),t.forEach(function(a){o.add(a)})}function nC(e){return e.waypoints[e.waypoints.length-1]}function oC(e,t){return e=(0,R.isArray)(e)?e:[e],t=(0,R.isArray)(t)?t:[t],e.length===t.length&&(0,R.every)(e,function(o){return t.includes(o)})}var aC={__depends__:[Lr,Xw,Kw],contextPad:["type",gt]},rC=250;function ro(e){this._eventBus=e,this._tools=[],this._active=null}ro.$inject=["eventBus"],ro.prototype.registerTool=function(e,t){var o=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);o.push(e),this.bindEvents(e,t)},ro.prototype.isActive=function(e){return e&&this._active===e},ro.prototype.length=function(e){return this._tools.length},ro.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ro.prototype.bindEvents=function(e,t){var o=this._eventBus,a=[];o.on(t.tool+".init",function(r){if(!r.context.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),(0,R.forEach)(t,function(r){a.push(r+".ended"),a.push(r+".canceled")}),o.on(a,rC,function(r){this._active&&(lC(r)||this.setActive(null))},this)};function lC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&(0,Z.closest)(t,'.group[data-group="tools"]')}var Rl={__depends__:[qn],__init__:["toolManager"],toolManager:["type",ro]};function Tl(e){var t=this;this._lastMoveEvent=null;function o(a){t._lastMoveEvent=a}e.on("canvas.init",function(a){(t._svg=a.svg).addEventListener("mousemove",o)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",o)})}Tl.$inject=["eventBus"],Tl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||iC(0,0)};function iC(e,t){var o=document.createEvent("MouseEvent"),a=e,r=t,l=e,i=t;return o.initMouseEvent&&o.initMouseEvent("mousemove",!0,!0,window,0,a,r,l,i,!1,!1,!1,!1,0,null),o}var Vl={__init__:["mouse"],mouse:["type",Tl]},Ml=1500,gu="grab";function zo(e,t,o,a,r,l){this._dragging=o,this._mouse=l;var i=this,s=a.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Ml,function(d){if(Xs(d))return i.activateMove(d.originalEvent,!0),!1}),s&&s.addListener(Ml,function(d){if(!(!mu(d.keyEvent)||i.isActive())){var c=i._mouse.getLastMoveEvent();i.activateMove(c,!!c)}},"keyboard.keydown"),s&&s.addListener(Ml,function(d){!mu(d.keyEvent)||!i.isActive()||i.toggle()},"keyboard.keyup"),e.on("hand.end",function(d){var c=d.originalEvent.target;if(!d.hover&&!(c instanceof SVGElement))return!1;e.once("hand.ended",function(){i.activateMove(d.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(d){var c=t.viewbox().scale;t.scroll({dx:d.dx*c,dy:d.dy*c})}),e.on("hand.move.end",function(d){var c=d.context.reactivate;return!Xs(d)&&c&&e.once("hand.move.ended",function(f){i.activateHand(f.originalEvent,!0,!0)}),!1})}zo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],zo.prototype.activateMove=function(e,t,o){typeof t=="object"&&(o=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:gu,data:{context:o||{}}})},zo.prototype.activateHand=function(e,t,o){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:gu,data:{context:{reactivate:o}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function mu(e){return cc("Space",e)}var sC={__depends__:[Rl,Vl],__init__:["handTool"],handTool:["type",zo]},yu="crosshair",vu="selected",cC="djs-dragging-active-lasso";function In(e,t,o,a,r,l,i){this._selection=r,this._dragging=o,this._mouse=i;var s=this,d={create:function(p){var u=t.getActiveLayer(),h=p.frame=(0,D.create)("rect");(0,D.attr)(h,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),(0,D.append)(u,h),c(!0),this.update(p)},update:function(p){var u=p.frame,h=p.bbox;u&&h&&(0,D.attr)(u,{x:h.x,y:h.y,width:h.width,height:h.height});var g=p.marked,m=p.lastMarked;if(g&&m){for(const w of m)g.has(w)||t.removeMarker(w,vu);for(const w of g)m.has(w)||t.addMarker(w,vu)}},remove:function(p){this.update(p),p.frame&&(0,D.remove)(p.frame),c(!1)}};function c(p){(0,D.classes)(t.getContainer()).toggle(cC,p)}function f(p){var u=a.getAll();return new Set((0,R.values)(hc(u,p)))}l.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var u=p.originalEvent.target;!p.hover&&!(u instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var u=p.context;s._select(Array.from(u.marked))}),e.on("lasso.start",function(p){var u=p.context;u.bbox=bu(p),u.add=jr(p),u.lastMarked=new Set(r.get()),u.add?u.marked=u.lastMarked:u.marked=new Set,u.initialMarked=u.marked,d.create(u)}),e.on("lasso.move",function(p){var u=p.context,h=f(u.bbox=bu(p)),g=u.initialMarked.union(h);u.lastMarked=u.marked,u.marked=g,d.update(u)}),e.on("lasso.cleanup",function(p){var u=p.context;u.lastMarked=u.marked,u.marked=new Set(r.get()),d.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(jr(p))return s.activateLasso(p.originalEvent),!0})}In.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],In.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:yu,data:{context:{}},keepSelection:!0})},In.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:yu,data:{context:{}},keepSelection:!0})},In.prototype._select=function(e){this._selection.select(e)},In.prototype.select=function(e,t,o=[]){var a=(0,R.values)(hc(e,t));this._select([...o,...a])},In.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},In.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function bu(e){var t={x:e.x-e.dx,y:e.y-e.dy},o={x:e.x,y:e.y},a;return t.x<=o.x&&t.y<o.y||t.x<o.x&&t.y<=o.y?a={x:t.x,y:t.y,width:o.x-t.x,height:o.y-t.y}:t.x>=o.x&&t.y<o.y||t.x>o.x&&t.y<=o.y?a={x:o.x,y:t.y,width:t.x-o.x,height:o.y-t.y}:t.x<=o.x&&t.y>o.y||t.x<o.x&&t.y>=o.y?a={x:t.x,y:o.y,width:o.x-t.x,height:t.y-o.y}:t.x>=o.x&&t.y>o.y||t.x>o.x&&t.y>=o.y?a={x:o.x,y:o.y,width:t.x-o.x,height:t.y-o.y}:a={x:o.x,y:o.y,width:0,height:0},a}var dC={__depends__:[Rl,Vl],__init__:["lassoTool"],lassoTool:["type",In]},wu="connect-ok",Cu="connect-not-ok";function Ho(e,t,o,a,r,l,i){var s=this;this._dragging=t,this._rules=l,this._mouse=i,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(d){var c=d.context,f=d.hover,p=c.canStartConnect=s.canStartConnect(f);p!==null&&(c.startTarget=f,a.addMarker(f,p?wu:Cu))}),e.on(["global-connect.out","global-connect.cleanup"],function(d){var c=d.context.startTarget,f=d.context.canStartConnect;c&&a.removeMarker(c,f?wu:Cu)}),e.on(["global-connect.ended"],function(d){var c=d.context.startTarget,f={x:d.x,y:d.y};if(s.canStartConnect(c))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),o.start(null,c,f)}),!1})}Ho.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ho.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ho.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var uC={__depends__:[qr,To,qn,Rl,Vl],globalConnect:["type",Ho]},fC=500,pC=1e3;function lo(e,t){this._eventBus=e,this.offset=5;var o=t.cls("djs-outline",["no-fill"]),a=this;function r(l){var i=(0,D.create)("rect");return(0,D.attr)(i,(0,R.assign)({x:0,y:0,rx:4,width:100,height:100},o)),i}e.on(["shape.added","shape.changed"],fC,function(l){var i=l.element,s=l.gfx,d=(0,Z.query)(".djs-outline",s);d||(d=a.getOutline(i)||r(s),(0,D.append)(s,d)),a.updateShapeOutline(d,i)}),e.on(["connection.added","connection.changed"],function(l){var i=l.element,s=l.gfx,d=(0,Z.query)(".djs-outline",s);d||(d=r(s),(0,D.append)(s,d)),a.updateConnectionOutline(d,i)})}lo.prototype.updateShapeOutline=function(e,t){var o=!1,a=this._getProviders();a.length&&(0,R.forEach)(a,function(r){o=o||r.updateOutline(t,e)}),o||(0,D.attr)(e,{x:-this.offset,y:-this.offset,width:t.width+this.offset*2,height:t.height+this.offset*2})},lo.prototype.updateConnectionOutline=function(e,t){var o=nn(t);(0,D.attr)(e,{x:o.x-this.offset,y:o.y-this.offset,width:o.width+this.offset*2,height:o.height+this.offset*2})},lo.prototype.registerProvider=function(e,t){t||(t=e,e=pC),this._eventBus.on("outline.getProviders",e,function(o){o.providers.push(t)})},lo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},lo.prototype.getOutline=function(e){var t;return(0,R.forEach)(this._getProviders(),function(o){(0,R.isFunction)(o.getOutline)&&(t=t||o.getOutline(e))}),t},lo.$inject=["eventBus","styles","elementRegistry"];var lr=6;function Nl(e,t,o){this._canvas=t;var a=this;e.on("element.changed",function(r){o.isSelected(r.element)&&a._updateMultiSelectionOutline(o.get())}),e.on("selection.changed",function(r){var l=r.newSelection;a._updateMultiSelectionOutline(l)})}Nl.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");(0,D.clear)(t);var o=e.length>1;if((0,D.classes)(this._canvas.getContainer())[o?"add":"remove"]("djs-multi-select"),!!o){var a=hC(nn(e)),r=(0,D.create)("rect");(0,D.attr)(r,(0,R.assign)({rx:3},a)),(0,D.classes)(r).add("djs-selection-outline"),(0,D.append)(t,r)}},Nl.$inject=["eventBus","canvas","selection"];function hC(e){return{x:e.x-lr,y:e.y-lr,width:e.width+lr*2,height:e.height+lr*2}}var xu={__depends__:[_o],__init__:["outline","multiSelectionOutline"],outline:["type",lo],multiSelectionOutline:["type",Nl]},gC=500,mC=1250,yC=1500,ir=Math.round;function vC(e){return{x:e.x+ir(e.width/2),y:e.y+ir(e.height/2)}}function ku(e,t,o,a,r){function l(s,d,c,f){return r.allowed("elements.move",{shapes:s,delta:d,position:c,target:f})}e.on("shape.move.start",yC,function(s){var d=s.context,c=s.shape,f=a.get().slice();f.indexOf(c)===-1&&(f=[c]),f=bC(f),(0,R.assign)(d,{shapes:f,validatedShapes:f,shape:c})}),e.on("shape.move.start",mC,function(s){var d=s.context,c=d.validatedShapes;if(!(d.canExecute=l(c)))return!1}),e.on("shape.move.move",gC,function(s){var d=s.context,c=d.validatedShapes,f=s.hover,p={x:s.dx,y:s.dy},u=l(c,p,{x:s.x,y:s.y},f);if(d.delta=p,d.canExecute=u,u===null){d.target=null;return}d.target=f}),e.on("shape.move.end",function(s){var d=s.context,c=d.delta,f=d.canExecute,p=f==="attach",u=d.shapes;if(f===!1)return!1;c.x=ir(c.x),c.y=ir(c.y),!(c.x===0&&c.y===0)&&o.moveElements(u,c,d.target,{primaryShape:d.shape,attach:p})}),e.on("element.mousedown",function(s){if(_n(s)){var d=ko(s);if(!d)throw new Error("must supply DOM mousedown event");return i(d,s.element)}});function i(s,d,c,f){if((0,R.isObject)(c)&&(f=c,c=!1),!(d.waypoints||!d.parent)&&!(0,D.classes)(s.target).has("djs-hit-no-move")){var p=vC(d);return t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:c,data:{shape:d,context:f||{}}}),!0}}this.start=i}ku.$inject=["eventBus","dragging","modeling","selection","rules"];function bC(e){var t=(0,R.groupBy)(e,"id");return(0,R.filter)(e,function(o){for(;o=o.parent;)if(t[o.id])return!1;return!0})}var Su=499,Al="djs-dragging",Eu="drop-ok",_u="drop-not-ok",Bu="new-parent",Ru="attach-ok";function Tu(e,t,o,a){function r(d){return wC(l(d))}function l(d){var c=rv(d,!0),f=c.flatMap(u=>(u.incoming||[]).concat(u.outgoing||[])),p=c.concat(f);return[...new Set(p)]}function i(d,c){[Ru,Eu,_u,Bu].forEach(function(f){f===c?t.addMarker(d,f):t.removeMarker(d,f)})}function s(d,c,f){a.addDragger(c,d.dragGroup),f&&t.addMarker(c,Al),d.allDraggedElements?d.allDraggedElements.push(c):d.allDraggedElements=[c]}e.on("shape.move.start",Su,function(d){var c=d.context,f=c.shapes,p=c.allDraggedElements,u=r(f);if(!c.dragGroup){var h=(0,D.create)("g");(0,D.attr)(h,o.cls("djs-drag-group",["no-events"])),(0,D.append)(t.getActiveLayer(),h),c.dragGroup=h}u.forEach(function(g){a.addDragger(g,c.dragGroup)}),p?p=(0,R.flatten)([p,l(f)]):p=l(f),(0,R.forEach)(p,function(g){t.addMarker(g,Al)}),c.allDraggedElements=p,c.differentParents=CC(f)}),e.on("shape.move.move",Su,function(d){var c=d.context,f=c.dragGroup,p=c.target,u=c.shape.parent,h=c.canExecute;p&&(h==="attach"?i(p,Ru):c.canExecute&&u&&p.id!==u.id?i(p,Bu):i(p,c.canExecute?Eu:_u)),on(f,d.dx,d.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(d){var c=d.context.target;c&&i(c,null)}),e.on("shape.move.cleanup",function(d){var c=d.context,f=c.allDraggedElements,p=c.dragGroup;(0,R.forEach)(f,function(u){t.removeMarker(u,Al)}),p&&(0,D.remove)(p)}),this.makeDraggable=s}Tu.$inject=["eventBus","canvas","styles","previewSupport"];function wC(e){return(0,R.filter)(e,function(t){return Ht(t)?(0,R.find)(e,(0,R.matchPattern)({id:t.source.id}))&&(0,R.find)(e,(0,R.matchPattern)({id:t.target.id})):!0})}function CC(e){return(0,R.size)((0,R.groupBy)(e,function(t){return t.parent&&t.parent.id}))!==1}var xC={__depends__:[Lr,_o,xu,To,qn,Ir],__init__:["move","movePreview"],move:["type",ku],movePreview:["type",Tu]},Vu=".djs-palette-toggle",Mu=".entry",kC=Vu+", "+Mu,jl="djs-palette-",SC="shown",Pl="open",Nu="two-column",EC=1e3;function mt(e,t){this._eventBus=e,this._canvas=t;var o=this;e.on("tool-manager.update",function(a){var r=a.tool;o.updateToolHighlight(r)}),e.on("i18n.changed",function(){o._update()}),e.on("diagram.init",function(){o._diagramInitialized=!0,o._rebuild()})}mt.$inject=["eventBus","canvas"],mt.prototype.registerProvider=function(e,t){t||(t=e,e=EC),this._eventBus.on("palette.getProviders",e,function(o){o.providers.push(t)}),this._rebuild()},mt.prototype.getEntries=function(){return this._getProviders().reduce(BC,{})},mt.prototype._rebuild=function(){this._diagramInitialized&&this._getProviders().length&&(this._container||this._init(),this._update())},mt.prototype._init=function(){var e=this,t=this._eventBus,o=this._getParentContainer(),a=this._container=(0,Z.domify)(mt.HTML_MARKUP);o.appendChild(a),(0,Z.classes)(o).add(jl+SC),Z.delegate.bind(a,kC,"click",function(r){var l=r.delegateTarget;if((0,Z.matches)(l,Vu))return e.toggle();e.trigger("click",r)}),Z.event.bind(a,"mousedown",function(r){r.stopPropagation()}),Z.delegate.bind(a,Mu,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:a})},mt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},mt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),o=this._container,a=this._eventBus,r,l=(0,Z.classes)(o),i=(0,Z.classes)(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),l.toggle(Nu,r),i.toggle(jl+Nu,r),"open"in e&&(l.toggle(Pl,e.open),i.toggle(jl+Pl,e.open)),a.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},mt.prototype._update=function(){var e=(0,Z.query)(".djs-palette-entries",this._container),t=this._entries=this.getEntries();(0,Z.clear)(e),(0,R.forEach)(t,function(o,a){var r=o.group||"default",l=(0,Z.query)("[data-group="+Sl(r)+"]",e);l||(l=(0,Z.domify)('<div class="group"></div>'),(0,Z.attr)(l,"data-group",r),e.appendChild(l));var i=(0,Z.domify)(o.html||(o.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'));if(l.appendChild(i),!o.separator&&((0,Z.attr)(i,"data-action",a),o.title&&(0,Z.attr)(i,"title",o.title),o.className&&_C(i,o.className),o.imageUrl)){var s=(0,Z.domify)("<img>");(0,Z.attr)(s,"src",o.imageUrl),i.appendChild(s)}}),this.open()},mt.prototype.trigger=function(e,t,o){var a,r,l=t.delegateTarget||t.target;return l?(a=(0,Z.attr)(l,"data-action"),r=t.originalEvent||t,this.triggerEntry(a,e,r,o)):t.preventDefault()},mt.prototype.triggerEntry=function(e,t,o,a){var r=this._entries[e],l;if(r&&(l=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:o})!==!1)){if((0,R.isFunction)(l)){if(t==="click")return l(o,a)}else if(l[t])return l[t](o,a);o.preventDefault()}},mt.prototype._layoutChanged=function(){this._toggleState({})},mt.prototype._needsCollapse=function(e,t){return e<Object.keys(t).length*46+50},mt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},mt.prototype.open=function(){this._toggleState({open:!0})},mt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},mt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},mt.prototype.updateToolHighlight=function(e){var t,o;this._toolsContainer||(t=(0,Z.query)(".djs-palette-entries",this._container),this._toolsContainer=(0,Z.query)("[data-group=tools]",t)),o=this._toolsContainer,(0,R.forEach)(o.children,function(a){var r=a.getAttribute("data-action");if(r){var l=(0,Z.classes)(a);r=r.replace("-tool",""),l.contains("entry")&&r===e?l.add("highlighted-entry"):l.remove("highlighted-entry")}})},mt.prototype.isOpen=function(){return(0,Z.classes)(this._container).has(Pl)},mt.prototype._getParentContainer=function(){return this._canvas.getContainer()},mt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function _C(e,t){var o=(0,Z.classes)(e);((0,R.isArray)(t)?t:t.split(/\s+/g)).forEach(function(a){o.add(a)})}function BC(e,t){var o=t.getPaletteEntries();return(0,R.isFunction)(o)?o(e):((0,R.forEach)(o,function(a,r){e[r]=a}),e)}var RC={__init__:["palette"],palette:["type",mt]};function Au(e,t,o,a){e.on("element.changed",function(r){var l=r.element;(l.parent||l===t.getRootElement())&&(r.gfx=o.getGraphics(l)),r.gfx&&e.fire(iv(l)+".changed",r)}),e.on("elements.changed",function(r){var l=r.elements;l.forEach(function(i){e.fire("element.changed",{element:i})}),a.updateContainments(l)}),e.on("shape.changed",function(r){a.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){a.update("connection",r.element,r.gfx)})}Au.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var TC={__init__:["changeSupport"],changeSupport:["type",Au]},sr=Math.max,cr=Math.min,VC=20;function MC(e,t,o){var a=o.x,r=o.y,l={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(l.y=e.y+r,l.height=e.height-r):t.indexOf("s")!==-1&&(l.height=e.height+r),t.indexOf("e")!==-1?l.width=e.width+a:t.indexOf("w")!==-1&&(l.x=e.x+a,l.width=e.width-a),l}function dr(e,t,o){var a=t[e],r=o.min&&o.min[e],l=o.max&&o.max[e];return(0,R.isNumber)(r)&&(a=(/top|left/.test(e)?cr:sr)(a,r)),(0,R.isNumber)(l)&&(a=(/top|left/.test(e)?sr:cr)(a,l)),a}function NC(e,t){if(!t)return e;var o=qe(e);return Hc({top:dr("top",o,t),right:dr("right",o,t),bottom:dr("bottom",o,t),left:dr("left",o,t)})}function AC(e,t,o,a){var r=qe(t),l={top:/n/.test(e)?r.bottom-o.height:r.top,left:/w/.test(e)?r.right-o.width:r.left,bottom:/s/.test(e)?r.top+o.height:r.bottom,right:/e/.test(e)?r.left+o.width:r.right},i=a?qe(a):l;return Hc({top:cr(l.top,i.top),left:cr(l.left,i.left),bottom:sr(l.bottom,i.bottom),right:sr(l.right,i.right)})}function ca(e,t){return typeof e<"u"?e:VC}function jC(e,t){var o,a,r,l;return typeof t=="object"?(o=ca(t.left),a=ca(t.right),r=ca(t.top),l=ca(t.bottom)):o=a=r=l=ca(t),{x:e.x-o,y:e.y-r,width:e.width+o+a,height:e.height+r+l}}function PC(e){return!(e.waypoints||e.type==="label")}function zC(e,t){var o;if(e.length===void 0?o=(0,R.filter)(e.children,PC):o=e,o.length)return jC(nn(o),t)}var ju=10;function da(e,t,o,a){this._dragging=a,this._rules=t;var r=this;function l(d,c){var f=d.shape,p=d.direction,u=d.resizeConstraints,h;d.delta=c,h=MC(f,p,c),d.newBounds=NC(h,u),d.canExecute=r.canResize(d)}function i(d){var c=d.resizeConstraints,f=d.minBounds;c===void 0&&(f===void 0&&(f=r.computeMinResizeBox(d)),d.resizeConstraints={min:qe(f)})}function s(d){var c=d.shape,f=d.canExecute,p=d.newBounds;if(f){if(p=Nv(p),!HC(c,p))return;o.resizeShape(c,p)}}e.on("resize.start",function(d){i(d.context)}),e.on("resize.move",function(d){var c={x:d.dx,y:d.dy};l(d.context,c)}),e.on("resize.end",function(d){s(d.context)})}da.prototype.canResize=function(e){var t=this._rules,o=(0,R.pick)(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",o)},da.prototype.activate=function(e,t,o){var a=this._dragging,r,l;if(typeof o=="string"&&(o={direction:o}),r=(0,R.assign)({shape:t},o),l=r.direction,!l)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");a.init(e,Pu(t,l),"resize",{autoActivate:!0,cursor:LC(l),data:{shape:t,context:r}})},da.prototype.computeMinResizeBox=function(e){var t=e.shape,o=e.direction;return AC(o,t,e.minDimensions||{width:ju,height:ju},zC(t,e.childrenBoxPadding))},da.$inject=["eventBus","rules","modeling","dragging"];function HC(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pu(e,t){var o=ut(e),a=qe(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function LC(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var zu="djs-resizing",Hu="resize-not-ok",OC=500;function Lu(e,t,o){function a(l){var i=l.shape,s=l.newBounds,d=l.frame;d||(d=l.frame=o.addFrame(i,t.getActiveLayer()),t.addMarker(i,zu)),s.width>5&&(0,D.attr)(d,{x:s.x,width:s.width}),s.height>5&&(0,D.attr)(d,{y:s.y,height:s.height}),l.canExecute?(0,D.classes)(d).remove(Hu):(0,D.classes)(d).add(Hu)}function r(l){var i=l.shape;l.frame&&(0,D.remove)(l.frame),t.removeMarker(i,zu)}e.on("resize.move",OC,function(l){a(l.context)}),e.on("resize.cleanup",function(l){r(l.context)})}Lu.$inject=["eventBus","canvas","previewSupport"];var ur=-6,fr=8,pr=20,ua="djs-resizer",DC=["n","w","s","e","nw","ne","se","sw"];function Fn(e,t,o,a){this._resize=a,this._canvas=t;var r=this;e.on("selection.changed",function(l){var i=l.newSelection;r.removeResizers(),i.length===1&&(0,R.forEach)(i,(0,R.bind)(r.addResizer,r))}),e.on("shape.changed",function(l){var i=l.element;o.isSelected(i)&&(r.removeResizers(),r.addResizer(i))})}Fn.prototype.makeDraggable=function(e,t,o){var a=this._resize;function r(l){_n(l)&&a.activate(l,e,o)}Z.event.bind(t,"mousedown",r),Z.event.bind(t,"touchstart",r)},Fn.prototype._createResizer=function(e,t,o,a){var r=this._getResizersParent(),l=IC(a),i=(0,D.create)("g");(0,D.classes)(i).add(ua),(0,D.classes)(i).add(ua+"-"+e.id),(0,D.classes)(i).add(ua+"-"+a),(0,D.append)(r,i);var s=(0,D.create)("rect");(0,D.attr)(s,{x:-fr/2+l.x,y:-fr/2+l.y,width:fr,height:fr}),(0,D.classes)(s).add(ua+"-visual"),(0,D.append)(i,s);var d=(0,D.create)("rect");return(0,D.attr)(d,{x:-pr/2+l.x,y:-pr/2+l.y,width:pr,height:pr}),(0,D.classes)(d).add(ua+"-hit"),(0,D.append)(i,d),uv(i,t,o),i},Fn.prototype.createResizer=function(e,t){var o=Pu(e,t),a=this._createResizer(e,o.x,o.y,t);this.makeDraggable(e,a,t)},Fn.prototype.addResizer=function(e){var t=this;Ht(e)||!this._resize.canResize({shape:e})||(0,R.forEach)(DC,function(o){t.createResizer(e,o)})},Fn.prototype.removeResizers=function(){(0,D.clear)(this._getResizersParent())},Fn.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Fn.$inject=["eventBus","canvas","selection","resize"];function IC(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-ur:e.indexOf("w")!==-1&&(t.x=ur),e.indexOf("s")!==-1?t.y=-ur:e.indexOf("n")!==-1&&(t.y=ur),t}var FC={__depends__:[To,qn,Ir],__init__:["resize","resizePreview","resizeHandles"],resize:["type",da],resizePreview:["type",Lu],resizeHandles:["type",Fn]};function fa(e,t,o,a,r,l){this._canvas=t,this._modeling=a,this._textRenderer=l,o.registerProvider(this),e.on("element.dblclick",s=>{i(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open"],()=>{o.isActive()&&o.complete()}),e.on(["commandStack.changed"],()=>{o.isActive()&&o.cancel()}),e.on("directEditing.activate",()=>{r.removeResizers()}),e.on("create.end",500,s=>{const{context:d,isTouch:c}=s,f=d.shape,{canExecute:p}=s.context;c||p&&(d.hints&&d.hints.createElementsBehavior===!1||i(f))}),e.on("autoPlace.end",500,s=>{i(s.shape)});function i(s,d){(d||ul(s,["userTask","scriptTask","subprocess"])||s.isDirectEdit)&&o.activate(s)}}fa.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],fa.prototype.activate=function(e){const t=Ka(e);if(t===void 0)return;const o={text:t};ot(o,this.getEditingBBox(e));const a={};return(ul(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&ot(a,{centerVertically:!0}),fl(e)&&ot(a,{autoResize:!0}),ot(o,{options:a}),o},fa.prototype.getEditingBBox=function(e){const t=this._canvas,o=e.label||e,a=t.getAbsoluteBBox(o),r={x:a.x+a.width/2,y:a.y+a.height/2},l={x:a.x,y:a.y},i=t.zoom(),s=this._textRenderer.getDefaultStyle(),d=this._textRenderer.getExternalStyle(),c=d.fontSize*i,f=d.lineHeight,p=s.fontSize*i,u=s.lineHeight,h={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(ul(e,["userTask","scriptTask","subprocess"])||e.isDirectEdit)&&(ot(l,{width:a.width,height:a.height}),ot(h,{fontSize:p+"px",lineHeight:u,paddingTop:7*i+"px",paddingBottom:7*i+"px",paddingLeft:5*i+"px",paddingRight:5*i+"px"}));const g=90*i,m=7*i,w=4*i;if(o.labelTarget&&(ot(l,{width:g,height:a.height+m+w,x:r.x-g/2,y:a.y-m}),ot(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:w+"px"})),fl(o)&&!bd(o)&&!ra(o)){const k=wd(e),C=t.getAbsoluteBBox({x:k.x,y:k.y,width:0,height:0}),v=c+m+w;ot(l,{width:g,height:v,x:C.x-g/2,y:C.y-v/2}),ot(h,{fontSize:c+"px",lineHeight:f,paddingTop:m+"px",paddingBottom:w+"px"})}return{bounds:l,style:h}},fa.prototype.update=function(e,t){let o;$C(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function $C(e){return!e||!e.trim()}var WC={__depends__:[TC,FC,Sr.default],__init__:["labelEditingProvider"],labelEditingProvider:["type",fa]};function $n(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}$n.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},$n.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},$n.prototype.addDefaultSnap=function(e,t){var o=this._defaultSnaps[e];o||(o=this._defaultSnaps[e]=[]),o.push(t)},$n.prototype.getSnapLocations=function(){return this._snapLocations},$n.prototype.setSnapLocations=function(e){this._snapLocations=e},$n.prototype.pointsForTarget=function(e){var t=e.id||e,o=this._targets[t];return o||(o=this._targets[t]=new hr,o.initDefaults(this._defaultSnaps)),o};function hr(){this._snapValues={}}hr.prototype.add=function(e,t){var o=this._snapValues[e];o||(o=this._snapValues[e]={x:[],y:[]}),o.x.indexOf(t.x)===-1&&o.x.push(t.x),o.y.indexOf(t.y)===-1&&o.y.push(t.y)},hr.prototype.snap=function(e,t,o,a){var r=this._snapValues[t];return r&&zw(e[o],r[o],a)},hr.prototype.initDefaults=function(e){var t=this;(0,R.forEach)(e||{},function(o,a){(0,R.forEach)(o,function(r){t.add(a,r)})})};var UC=1250;function sn(e,t,o){var a=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){a.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],UC,function(r){var l=r.context,i=l.shape,s=l.snapContext,d=l.target;if(!(r.originalEvent&&sc(r.originalEvent))&&!(or(r)||!d)){var c=s.pointsForTarget(d);c.initialized||(c=a.addSnapTargetPoints(c,i,d),c.initialized=!0),o.snap(r,c)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){o.hide()})}sn.$inject=["elementRegistry","eventBus","snapping"],sn.prototype.initSnap=function(e){var t=this._elementRegistry,o=e.context,a=o.shape,r=o.snapContext;r||(r=o.snapContext=new $n);var l;t.get(a.id)?l=jo(a,e):l={x:e.x+jo(a).x,y:e.y+jo(a).y};var i={x:l.x-a.width/2,y:l.y-a.height/2},s={x:l.x+a.width/2,y:l.y+a.height/2};return r.setSnapOrigin("mid",{x:l.x-e.x,y:l.y-e.y}),Vo(a)||(r.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},sn.prototype.addSnapTargetPoints=function(e,t,o){return(0,R.forEach)(this.getSnapTargets(t,o),function(a){if(Vo(a)){Vo(t)&&e.add("mid",jo(a));return}if(Ht(a)){if(a.waypoints.length<3)return;(0,R.forEach)(a.waypoints.slice(1,-1),function(r){e.add("mid",r)});return}e.add("mid",jo(a))}),!(0,R.isNumber)(t.x)||!(0,R.isNumber)(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",jo(t)),e},sn.prototype.getSnapTargets=function(e,t){return cu(t).filter(function(o){return!JC(o)})};function JC(e){return!!e.hidden}function Lo(e){e.invoke(sn,this)}(0,pn.default)(Lo,sn),Lo.$inject=["injector"],Lo.prototype.initSnap=function(e){return sn.prototype.initSnap.call(this,e)},Lo.prototype.addSnapTargetPoints=function(e,t,o){return sn.prototype.addSnapTargetPoints.call(this,e,t,o)},Lo.prototype.getSnapTargets=function(e,t){return sn.prototype.getSnapTargets.call(this,e,t)};var YC=1250;function pa(e,t){var o=this;e.on(["resize.start"],function(a){o.initSnap(a)}),e.on(["resize.move","resize.end"],YC,function(a){var r=a.context,l=r.shape,i=l.parent,s=r.direction,d=r.snapContext;if(!(a.originalEvent&&sc(a.originalEvent))&&!or(a)){var c=d.pointsForTarget(i);c.initialized||(c=o.addSnapTargetPoints(c,l,i,s),c.initialized=!0),qC(s)&&yn(a,"x",a.x),XC(s)&&yn(a,"y",a.y),t.snap(a,c)}}),e.on(["resize.cleanup"],function(){t.hide()})}pa.prototype.initSnap=function(e){var t=e.context,o=t.shape,a=t.direction,r=t.snapContext;r||(r=t.snapContext=new $n);var l=Ou(o,a);return r.setSnapOrigin("corner",{x:l.x-e.x,y:l.y-e.y}),r},pa.prototype.addSnapTargetPoints=function(e,t,o,a){return(0,R.forEach)(this.getSnapTargets(t,o),function(r){e.add("corner",Lw(r)),e.add("corner",Hw(r))}),e.add("corner",Ou(t,a)),e},pa.$inject=["eventBus","snapping"],pa.prototype.getSnapTargets=function(e,t){return cu(t).filter(function(o){return!KC(o,e)&&!Ht(o)&&!GC(o)&&!Vo(o)})};function Ou(e,t){var o=ut(e),a=qe(e),r={x:o.x,y:o.y};return t.indexOf("n")!==-1?r.y=a.top:t.indexOf("s")!==-1&&(r.y=a.bottom),t.indexOf("e")!==-1?r.x=a.right:t.indexOf("w")!==-1&&(r.x=a.left),r}function KC(e,t){return e.host===t}function GC(e){return!!e.hidden}function qC(e){return e==="n"||e==="s"}function XC(e){return e==="e"||e==="w"}var ZC=7,QC=1e3;function Wn(e){this._canvas=e,this._asyncHide=(0,R.debounce)((0,R.bind)(this.hide,this),QC)}Wn.$inject=["canvas"],Wn.prototype.snap=function(e,t){var o=e.context.snapContext,a=o.getSnapLocations(),r={x:or(e,"x"),y:or(e,"y")};(0,R.forEach)(a,function(l){var i=o.getSnapOrigin(l),s={x:e.x+i.x,y:e.y+i.y};if((0,R.forEach)(["x","y"],function(d){var c;r[d]||(c=t.snap(s,l,d,ZC),c!==void 0&&(r[d]={value:c,originValue:c-i[d]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),(0,R.forEach)(["x","y"],function(l){var i=r[l];(0,R.isObject)(i)&&yn(e,l,i.originValue)})},Wn.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),o=(0,D.create)("path");return(0,D.attr)(o,{d:"M0,0 L0,0"}),(0,D.classes)(o).add("djs-snap-line"),(0,D.append)(t,o),{update:function(a){(0,R.isNumber)(a)?e==="horizontal"?(0,D.attr)(o,{d:"M-100000,"+a+" L+100000,"+a,display:""}):(0,D.attr)(o,{d:"M "+a+",-100000 L "+a+", +100000",display:""}):(0,D.attr)(o,{display:"none"})}}},Wn.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wn.prototype.showSnapLine=function(e,t){var o=this.getSnapLine(e);o&&o.update(t),this._asyncHide()},Wn.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wn.prototype.hide=function(){(0,R.forEach)(this._snapLines,function(e){e.update()})};var ex={__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",sn],resizeSnapping:["type",pa],snapping:["type",Wn]},tx={__depends__:[ex],__init__:["createMoveSnapping"],createMoveSnapping:["type",Lo]};function Oo(e){Mt.call(this,e),this.init()}Oo.$inject=["eventBus"],Xn(Oo,Mt),Oo.prototype.addRule=function(e,t,o){var a=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){a.canExecute(r,t,function(l,i,s){return o(l)},!0)})},Oo.prototype.init=function(){};function ha(e){Oo.call(this,e)}ha.$inject=["eventBus"],(0,pn.default)(ha,Oo),ha.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return!!(t&&t.type!=""&&t.type!=null&&t.type!=null)}),this.addRule("connection.create",function(e){var t=e.source,o=e.target,a=e.hints||{},r=a.targetParent;if(a.targetAttach)return!1;r&&(o.parent=r);try{return zl(t,o)}finally{r&&(o.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,o=e.source,a=e.target;return zl(o,a,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.create",function(e){var t=e.target,o=e.shape;return t.parent&&(t=parent),!(o.type=="startEvent"&&(!t.children||t.children.find(a=>a.type==o.type)!=null))}),this.addRule("shape.resize",function(e){var t=e.shape;return sv(t)})},ha.prototype.canConnect=zl;function zl(e,t,o){return t.type&&e.type&&e.type!="endEvent"?e.id==t.id?!1:{type:"myline"}:!1}var nx={__init__:["myRuleProvider"],myRuleProvider:["type",ha]};function Hl(e,t,o,a,r,l,i){this._create=e,this._elementFactory=t,this._handTool=o,this._lassoTool=a,this._globalConnect=r,this._palette=l,this._myOptions=i,l.registerProvider(this)}Hl.$inject=["create","elementFactory","handTool","lassoTool","globalConnect","palette","myOptions"],Hl.prototype.getPaletteEntries=function(){const e=this._create,t=this._elementFactory,o=this._handTool,a=this._lassoTool,r=this._globalConnect,l=this._myOptions;function i(d,c,f,p,u){function h(g){const m=t.createShape(ot({type:d},u));e.start(g,m)}return{group:c,className:f,title:p,action:{dragstart:h,click:h}}}const s={"hand-tool":{group:"tools",className:"icon-hand-tool",title:"激活手动工具",action:{click(d){o.activateHand(d)}}},"lasso-tool":{group:"tools",className:"icon-lasso-tool",title:"激活套索工具",action:{click(d){a.activateSelection(d)}}},"global-connect-tool":{group:"tools",className:"icon-line-tool",title:"激活连线工具",action:{click(d){r.toggle(d)}}},"tool-separator":{group:"tools",separator:!0}};for(const d in l.palette){const c=l.palette[d];s[d]=i(c.type,c.group,c.className,c.title,c.options)}return s};var ox={__init__:["paletteProvider"],paletteProvider:["type",Hl]},Gx=50,ax=250;function rx(e,t){t||(t={});function o(u){return u.source===e?1:-1}var a=t.defaultDistance||50,r=t.direction||"e",l=t.filter,i=t.getWeight||o,s=t.maxDistance||ax,d=t.reference||"start";l||(l=lx);function c(u,h){return r==="n"?d==="start"?qe(u).top-qe(h).bottom:d==="center"?qe(u).top-ut(h).y:qe(u).top-qe(h).top:r==="w"?d==="start"?qe(u).left-qe(h).right:d==="center"?qe(u).left-ut(h).x:qe(u).left-qe(h).left:r==="s"?d==="start"?qe(h).top-qe(u).bottom:d==="center"?ut(h).y-qe(u).bottom:qe(h).bottom-qe(u).bottom:d==="start"?qe(h).left-qe(u).right:d==="center"?ut(h).x-qe(u).right:qe(h).right-qe(u).right}var f=e.incoming.filter(l).map(function(u){var h=i(u),g=h<0?c(u.source,e):c(e,u.source);return{id:u.source.id,distance:g,weight:h}}),p=e.outgoing.filter(l).map(function(u){var h=i(u),g=h>0?c(e,u.target):c(u.target,e);return{id:u.target.id,distance:g,weight:h}});return(0,R.reduce)(f.concat(p).reduce(function(u,h){return u[h.id+"__weight_"+h.weight]=h,u},{}),function(u,h){var g=h.distance,m=h.weight;return g<0||g>s||(u[String(g)]||(u[String(g)]=0),u[String(g)]+=1*m,(!u.distance||u[u.distance]<u[String(g)])&&(u.distance=g)),u},{}).distance||a}function lx(){return!0}var ix=100;function Du(e,t,o){e.on("autoPlace",ix,function(a){var r=a.shape,l=a.source;return sx(l,r)}),e.on("autoPlace.end",function(a){o.scrollToElement(a.shape)}),this.append=function(a,r,l){e.fire("autoPlace.start",{source:a,shape:r});var i=e.fire("autoPlace",{source:a,shape:r}),s=t.appendShape(a,r,i,a.parent,l);return e.fire("autoPlace.end",{source:a,shape:s}),s}}Du.$inject=["eventBus","modeling","canvas"];function sx(e,t,o){o||(o={});var a=o.defaultDistance||50,r=ut(e);return{x:qe(e).right+a+t.width/2,y:r.y}}function Iu(e,t){e.on("autoPlace.end",500,function(o){t.select(o.shape)})}Iu.$inject=["eventBus","selection"];var cx={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Du],autoPlaceSelectionBehavior:["type",Iu]},dx=10,ux=(e,t)=>e.type===t;function fx(e){return e.incoming.map(t=>t.source)}function px(e){return e.outgoing.map(t=>t.target)}function Ll(e){return px(e).concat(fx(e))}function hx(e){let t=Ll(e);return e.host&&(t=t.concat(Ll(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce((o,a)=>o.concat(Ll(a)),[]))),t.filter(o=>o.type!=="myline")}function gx(e,t,o){const a={x:t.x-o.width/2,y:t.y-o.height/2,width:o.width,height:o.height};return(0,R.find)(hx(e),r=>r===o?!1:Nn(r,a,dx)==="intersect")}function mx(e,t,o,a){let r;for(;r=gx(e,o,t);)o=a(t,o,r);return o}function yx(e){return function(t,o,a){const r={x:o.x,y:o.y};return["x","y"].forEach(l=>{const i=e[l];if(!i)return;const s=l==="x"?"width":"height",{margin:d,minDistance:c}=i;d<0?r[l]=Math.min(a[l]+d-t[s]/2,o[l]-c+d):r[l]=Math.max(a[l]+a[s]+d+t[s]/2,o[l]+c+d)}),r}}function vx(e,t){return bx(e,t)}function bx(e,t){const o=qe(e),a=ut(e),r=rx(e,{filter:s=>ux(s,"myline")}),l=30,i=80;return mx(e,t,{x:o.right+r+t.width/2,y:a.y+wx("left",i)},yx({y:{margin:l,minDistance:i}}))}function wx(e,t){return e.indexOf("top")!==-1?-1*t:e.indexOf("bottom")!==-1?t:0}function Fu(e){e.on("autoPlace",t=>{const{shape:o,source:a}=t;return vx(a,o)})}Fu.$inject=["eventBus"];var Cx={__depends__:[cx],__init__:["myAutoPlace"],myAutoPlace:["type",Fu]};function Ol(e,t,o,a,r,l,i){this._connect=e,this._modeling=o,this._elementFactory=a,this._autoPlace=r,this._create=l,this._myOptions=i,t.registerProvider(this)}Ol.$inject=["connect","contextPad","modeling","elementFactory","autoPlace","create","myOptions"],Ol.prototype.getContextPadEntries=function(e){const t=this._connect,o=this._modeling,a=this._elementFactory,r=this._autoPlace,l=this._create,i=this._myOptions;function s(){o.removeElements([e])}function d(p,u,h){t.start(p,u,h)}function c(p,u,h,g){typeof h!="string"&&(g=h);function m(k,C){const v=a.createShape(ot({type:p},g));l.start(k,v,{source:C})}function w(k,C){const v=a.createShape(ot({type:p},g));r.append(C,v)}return{group:"model",className:u,title:h,action:{dragstart:m,click:w}}}if(e.type==="label")return!1;if(e.type==="myline"||e.type==="endEvent")return{delete:{group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}}};const f={};for(const p in i.palette)if(p!=="create.start-event"){const u=i.palette[p];f[p]=c(u.type,u.className,u.title,u.options)}return f.connect={group:"edit",className:"icon-line-tool",title:"连线",action:{click:d,dragstart:d}},f.delete={group:"edit",className:"icon-delete",title:"删除",action:{click:s,dragstart:s}},f};var xx={__init__:["ContextPadProvider"],ContextPadProvider:["type",Ol]},kx=(0,n.defineComponent)({name:"JWorkflow",__name:"workflow",props:{paletteOptions:{default:void 0},lineStroke:{default:void 0}},emits:["elementDblclick","elementClick","elementCreate"],setup(e,{expose:t,emit:o}){const a=e,r=o,l=(0,n.ref)(),i={"create.start-event":{className:"icon-start-event",type:"startEvent",group:"event",title:"创建开始事件"},"create.end-event":{className:"icon-end-event",type:"endEvent",group:"event",title:"创建结束事件"},"create.and-gateway":{className:"icon-gateway1",type:"gatewayAnd",group:"gateway",title:"并行网关"},"create.xor-gateway":{className:"icon-gateway2",type:"gatewayXor",group:"gateway",title:"互排网关"},"create.inclusive-gateway":{className:"icon-gateway3",type:"gatewayInclusive",group:"gateway",title:"包含网关"},"create.task":{className:"icon-gateway4",type:"userTask",group:"activity",title:"创建任务"},"create.script":{className:"icon-gateway5",type:"scriptTask",group:"activity",title:"创建脚本"},"create.subprocess":{className:"icon-subprocess",type:"subprocess",group:"activity",title:"创建子流程"}};let s,d=1;const c=()=>{d=1,s.get("canvas").zoom("fit-viewport")},f=()=>{const V=s.get("eventBus");V.on("element.dblclick",T=>{r("elementDblclick",T.element.businessObject)}),V.on("element.click",T=>{r("elementClick",T.element.businessObject)}),V.on("create.end",T=>{r("elementCreate",T.elements[0].businessObject)}),V.on("autoPlace.end",T=>{r("elementCreate",T.shape.businessObject)})},p=function(){return{palette:a.paletteOptions||i,lineStroke:a.lineStroke}},u=()=>{let V={__init__:["myOptions"],myOptions:["type",p]};s=new Ca.default({canvas:{container:l.value},modules:[Dw,qr,Ww,aC,kc,mw,sC,dC,uC,Nd,$c,xC,xu,RC,Jc,V,Cx,zd,WC,xx,ox,nx,tx,Ld]});const T=s.get("canvas"),P=s.get("elementFactory");c();const A=P.createRoot();T.setRootElement(A),f()};(0,n.onMounted)(()=>{u()});const h=V=>{const T=V==null?1:d+V;s.get("canvas").zoom(T),d=T},g=()=>{s.get("commandStack").redo()},m=()=>{s.get("commandStack").undo()},w=()=>(s.get("canvas").zoom(1),Od(s.get("elementRegistry").getAll())),k=V=>{s.clear(),c(),Dd(V,s)},C=V=>{s.get("myImporter").update(V.id,V)};return t({reset:()=>{c()},zoom:V=>{h(V)},redo:()=>{g()},undo:()=>{m()},getData:()=>w(),setData:V=>{k(V)},updateElemet:V=>{C(V)}}),(V,T)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"containerRef",ref:l,class:"j-work-flow"},null,512))}}),Sx=kx,$u=ve(hw),Wu=ve(Sx),Ex=(0,n.defineComponent)({name:"JInputCards",__name:"input-cards",props:{id:{type:String,default:""},modelValue:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},editConfig:{type:Object,default:()=>({})},gutter:{type:Number,default:16},span:Number,labelWidth:[String,Number],required:{type:Boolean,default:!1}},emits:["update:modelValue","change","rowChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:l}=tt(),{formData:i}=Sn(),s=(0,n.computed)(()=>a.editConfig.isAddBtn!==!1),d=(0,n.computed)(()=>a.editConfig.addBtnText||"添加"),c=(0,n.computed)(()=>a.editConfig.buttonsAlign||"left"),f=(0,n.computed)(()=>a.editConfig.isRemoveBtn!==!1),p=(0,n.computed)(()=>a.editConfig.readonly),u=(0,n.computed)(()=>a.editConfig.isNullValue!==!1),h=(0,n.ref)([]),g=x=>{r("rowChange",x)},m=()=>{const x={_i:Ft()};a.columns.forEach(E=>{const _=E.config?.valueRowKey||E.id||"";_&&(x[_]=kt(E.config?.defaultValue))}),h.value.push(x),r("change",{id:a.id,value:x,data:x,formData:i,tableData:h.value,type:"add"})},w=x=>{const E=h.value[x];h.value.splice(x,1),r("change",{id:a.id,value:E,data:E,formData:i,tableData:h.value,type:"delete"})},k=()=>{const x={isOk:!0,info:""};if(a.required&&h.value.length===0)return x.isOk=!1,x.info="请添加表格数据",x;const E=h.value.length,_=a.columns,V=_.length;for(let T=0;T<E;T++){const P=h.value[T];for(let A=0;A<V;A++){const N=_[A];if(v(N,T).display!==!1&&N.rule&&N.rule.length>0){const M=N.rule.length;for(let B=0;B<M;B++){const H=N.rule[B];if(H.pattern=H.pattern?H.pattern+"":"",H.pattern&&!St(P[N.prop||""])&&!new RegExp(H.pattern.substring(1,H.pattern.length-1)).test(P[N.prop||""]))return x.info=`${l("第")}${T+1}${l("行")},${l("第")}${A+1}${l("列")},${l(N.label)}:${l(H.message)}`,x.isOk=!1,x;if(H.required&&St(P[N.prop||""]))return x.isOk=!1,x.info=`${l("第")}${T+1}${l("行")},${l("第")}${A+1}${l("列")},${l(N.label)}:${l("不能为空")}`,x}}}}return x};a.modelValue&&a.modelValue.length>0?(h.value=a.modelValue||[],h.value.forEach(x=>{x._i||(x._i=Ft())})):(h.value=[],r("update:modelValue",h.value)),(0,n.watch)(()=>a.modelValue,x=>{h.value=a.modelValue||[],h.value=x||[],h.value.forEach(E=>{E._i||(E._i=Ft())})},{deep:!0});const v=(x,E)=>$t({config:x.config||{},getCompConfig:x.getCompConfig,formData:i,row:h.value[E],getTableData:()=>h.value}),b=x=>{const E=x||a.labelWidth;return typeof E=="string"?E:typeof E=="number"?E+"px":E};t({validate:()=>k()});const{row:y}=wo();return Kn({getTableData:()=>h.value,rowChange:g,pRowData:y}),(x,E)=>{const _=(0,n.resolveComponent)("j-comp"),V=(0,n.resolveComponent)("el-form-item"),T=(0,n.resolveComponent)("el-col"),P=(0,n.resolveComponent)("el-row"),A=(0,n.resolveComponent)("j-button");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createElementVNode)("div",(0,n.mergeProps)({class:"j-input-cards"},x.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.value,(N,M)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-input-cards-item",key:N._i,style:{"margin-bottom":"8px"}},[(0,n.createVNode)(P,{gutter:e.gutter},{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.columns,B=>((0,n.openBlock)(),(0,n.createBlock)(T,{key:B.prop,span:B.config?.span||e.span||24,style:(0,n.normalizeStyle)({"margin-bottom":(B.getInputType?B.getInputType(N):B.inputType)=="j-input-rows"?"8px":void 0})},{default:(0,n.withCtx)(()=>[(0,n.withDirectives)((0,n.createVNode)(V,{"label-width":b(B.config?.labelWidth),label:(0,n.unref)(l)(B.config?.label||""),extra:B.config?.labelExtra,required:B.config?.required},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(_,(0,n.mergeProps)({ref_for:!0},B,{row:N}),null,16,["row"])]),_:2},1032,["label-width","label","extra","required"]),[[n.vShow,v(B,M).display!==!1]])]),_:2},1032,["span","style"]))),128))]),_:2},1032,["gutter"]),f.value&&(u.value||h.value.length>1)&&!p.value?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,class:"j-input-cards-delete",size:"small",shape:"circle",icon:"mdi:close",status:"danger",onClick:B=>w(M)},null,8,["onClick"])):(0,n.createCommentVNode)("",!0)]))),128))],16),s.value&&!p.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,style:(0,n.normalizeStyle)({"text-align":c.value})},[s.value?((0,n.openBlock)(),(0,n.createBlock)(A,{key:0,type:"link",style:{"margin-right":"8px",padding:"0"},label:d.value,icon:"mdi:add",onClick:m},null,8,["label"])):(0,n.createCommentVNode)("",!0)],4)):(0,n.createCommentVNode)("",!0)],64)}}}),_x=Ex,Uu=ve(_x),Bx={class:"j-card-list-body"},Rx={class:"j-card-list-image-error"},Tx=["src"],Vx={key:1},Mx={key:0,class:"j-card-list-button-layer"},Nx={class:"j-card-list-main"},Ax=["title"],jx={class:"j-card-list-menulist"},Px={key:0,class:"j-card-list-pagination"},zx=(0,n.defineComponent)({name:"JCardList",__name:"card-list",props:{loadSrc:{type:Function,default:void 0},labelKey:{default:"f_Name"},dataSource:{default:()=>[]},buttons:{default:()=>[]},fallback:{default:""},isPage:{type:Boolean,default:!1},pageSizes:{default:void 0},pageTotal:{default:0},tablePage:{default:1},pageSize:{default:50},pageLayoutSimple:{type:Boolean,default:!1},setButton:{type:Function,default:void 0},maxBtns:{default:3},loading:{type:Boolean,default:!1},isRadio:{type:Boolean,default:!1},isMultiSelect:{type:Boolean,default:!1},rowKey:{default:"f_Id"},backgroundColor:{default:""},showBigEditButton:{type:Boolean,default:!1},cardWidth:{default:"25%"},cardHeight:{},cardAspectRatio:{default:258/184},imageFit:{default:"fill"}},emits:["click","loadPageData","update:pageSize","update:tablePage","selectionChange"],setup(e,{expose:t,emit:o}){const a=e,r=o,{t:l}=tt(),{openLayer:i}=En(),s=(0,n.computed)(()=>a.dataSource),d=(0,n.computed)(()=>s.value.map(A=>f(A))),c=(0,n.computed)(()=>a.buttons.find(A=>A.id==="edit")),f=A=>a.loadSrc?.(A)||"",p=(0,n.computed)(()=>({width:(typeof a.cardWidth=="number"?`${a.cardWidth}%`:a.cardWidth)||void 0})),u=A=>{const N=a.rowKey||"j_Id",M=N.split(",").map(B=>B.trim()).filter(Boolean);if(M.length<=1){const B=A[N];return B==null?"":String(B)}return M.map(B=>{const H=A[B];return H==null?"":String(H)}).join("::")},h=(A,N)=>u(A)||String(N),g=(0,n.ref)([]),m=(0,n.computed)({get(){return g.value[0]||""},set(A){const N=A==null?"":String(A);N&&(g.value=[N],r("selectionChange",{selections:g.value,rows:C()}))}}),w=A=>{const N=u(A);return N?g.value.includes(N):!1},k=(A,N)=>{const M=A[0],B=u(M);if(B){if(a.isRadio){g.value=[B],r("selectionChange",{selections:g.value,rows:C()});return}N?A.forEach(H=>{const W=u(H);W&&!g.value.includes(W)&&g.value.push(W)}):A.forEach(H=>{const W=u(H);W&&(g.value=g.value.filter(X=>X!==W))}),r("selectionChange",{selections:g.value,rows:C()})}},C=()=>s.value.filter(A=>g.value.includes(u(A))),v=()=>{g.value=[],r("selectionChange",{selections:g.value,rows:[]})},b=A=>{const N=[];let M=kt(a.buttons);a.showBigEditButton&&(M=M.filter(X=>X.id!=="edit")),M=M.filter(X=>X?.config?.display!==!1),A&&a.setButton&&(a.setButton({buttons:M,row:A}),M=M.filter(X=>X?.config?.display!==!1));let B=M.length,H=!1;a.maxBtns&&B>a.maxBtns&&(B=a.maxBtns,H=!0);const W={id:Ft(),label:"",config:{icon:"mdi:dots-horizontal",type:"text",notLabel:!0},children:[]};for(let X=0;X<B;X++){let fe=M[X];H&&X===B-1&&(fe=W),N.push(fe)}if(H&&a.maxBtns)for(let X=a.maxBtns-1;X<M.length;X++){const fe=M[X];W.children?.push(fe),fe.children&&(W.children?.push(...fe.children),delete fe.children)}return N},S=(A,N,M)=>{!A||A.config?.disabled||(A.click?.({data:N,openLayer:i}),r("click",A.id,{item:N,index:M,button:A}))},y=(0,n.computed)({get(){return a.pageSize},set(A){r("update:pageSize",A)}}),x=(0,n.computed)({get(){return a.tablePage},set(A){r("update:tablePage",A)}}),E=(0,n.computed)(()=>a.pageLayoutSimple?"prev, pager, next":"total, prev, pager, next, sizes, jumper"),_=(A,N)=>{r("loadPageData",{rows:N,page:A})};return t({clearSelection:()=>v(),toggleRowSelection:(A,N)=>k(A,N),getSelections:()=>C(),selections:g}),(A,N)=>{const M=(0,n.resolveComponent)("el-image"),B=(0,n.resolveComponent)("j-button"),H=(0,n.resolveComponent)("el-dropdown-item"),W=(0,n.resolveComponent)("el-dropdown-menu"),X=(0,n.resolveComponent)("el-dropdown"),fe=(0,n.resolveComponent)("el-tooltip"),J=(0,n.resolveComponent)("el-radio"),Y=(0,n.resolveComponent)("el-checkbox"),G=(0,n.resolveComponent)("el-pagination"),j=(0,n.resolveDirective)("loading");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:"j-card-list",style:(0,n.normalizeStyle)({paddingBottom:e.isPage?"48px":void 0,backgroundColor:e.backgroundColor||"var(--j-color-bg)"})},[(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",Bx,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(s.value,(me,Pe)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:h(me,Pe),style:(0,n.normalizeStyle)([p.value,{padding:"4px"}])},[(0,n.createElementVNode)("div",{class:"j-card-list-item",style:(0,n.normalizeStyle)({aspectRatio:e.cardAspectRatio})},[(0,n.createVNode)(M,{class:"j-card-list-image",src:f(me),fit:e.imageFit,"preview-src-list":d.value,"initial-index":Pe,"preview-teleported":!0,"hide-on-click-modal":!0},{error:(0,n.withCtx)(()=>[(0,n.createElementVNode)("div",Rx,[e.fallback?((0,n.openBlock)(),(0,n.createElementBlock)("img",{key:0,src:e.fallback},null,8,Tx)):((0,n.openBlock)(),(0,n.createElementBlock)("div",Vx,"加载失败"))])]),_:1},8,["src","fit","preview-src-list","initial-index"]),e.showBigEditButton&&c.value?((0,n.openBlock)(),(0,n.createElementBlock)("div",Mx,[(0,n.createVNode)(B,{class:"j-card-list-edit-btn",type:"primary",label:(0,n.unref)(l)(c.value.label||"编辑"),onClick:pe=>S(c.value,me,Pe)},null,8,["label","onClick"])])):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",Nx,[(0,n.createElementVNode)("div",{class:"j-card-list-title",title:String(me[e.labelKey]??"")},(0,n.toDisplayString)(String(me[e.labelKey]??"")),9,Ax),(0,n.createElementVNode)("div",jx,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(b(me),pe=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:pe.id},[pe.children?.length?((0,n.openBlock)(),(0,n.createBlock)(X,{key:0,trigger:"click"},{dropdown:(0,n.withCtx)(()=>[(0,n.createVNode)(W,null,{default:(0,n.withCtx)(()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(pe.children,Ne=>((0,n.openBlock)(),(0,n.createBlock)(H,{key:Ne.id,disabled:Ne.config?.disabled,onClick:Fe=>S(Ne,me,Pe)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(l)(Ne.label||"")),1)]),_:2},1032,["disabled","onClick"]))),128))]),_:2},1024)]),default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",icon:pe.config?.icon||"mdi:dots-horizontal",notLabel:!0},null,8,["icon"])]),_:2},1024)):((0,n.openBlock)(),(0,n.createBlock)(fe,{key:1,content:(0,n.unref)(l)(pe.label||"")},{default:(0,n.withCtx)(()=>[(0,n.createVNode)(B,{type:"text",icon:pe.config?.icon||"mdi:tool-outline",status:pe.config?.status,disabled:pe.config?.disabled,notLabel:!0,onClick:Ne=>S(pe,me,Pe)},null,8,["icon","status","disabled","onClick"])]),_:2},1032,["content"]))],64))),128))])]),e.isRadio?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"j-card-list-item-radio",onClick:N[1]||(N[1]=(0,n.withModifiers)(()=>{},["stop"]))},[(0,n.createVNode)(J,{style:{height:"14px"},modelValue:m.value,"onUpdate:modelValue":N[0]||(N[0]=pe=>m.value=pe),value:u(me)},null,8,["modelValue","value"])])):(0,n.createCommentVNode)("",!0),e.isMultiSelect?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:"j-card-list-item-checkbox",onClick:N[2]||(N[2]=(0,n.withModifiers)(()=>{},["stop"]))},[(0,n.createVNode)(Y,{style:{height:"14px"},"model-value":w(me),onChange:pe=>k([me],!!pe)},null,8,["model-value","onChange"])])):(0,n.createCommentVNode)("",!0)],4)],4))),128))])),[[j,e.loading]]),e.isPage?((0,n.openBlock)(),(0,n.createElementBlock)("div",Px,[(0,n.createVNode)(G,{"current-page":x.value,"onUpdate:currentPage":N[3]||(N[3]=me=>x.value=me),"page-size":y.value,"onUpdate:pageSize":N[4]||(N[4]=me=>y.value=me),"page-sizes":e.pageSizes||[50,100,200,500],total:e.pageTotal,layout:E.value,onChange:_},null,8,["current-page","page-size","page-sizes","total","layout"])])):(0,n.createCommentVNode)("",!0)],4)}}}),Hx=zx,Ju=ve(Hx),Lx=[$l,Ti,Vi,Mi,Ni,Ai,ji,Pi,zi,Hi,Li,Oi,Di,Ii,qi,Xi,Zi,Qi,es,Ri,ts,ns,os,ls,is,ss,xs,cs,ds,us,fs,ps,hs,gs,ms,ys,vs,bs,ws,Cs,Bs,Rs,Ts,Vs,Ns,As,js,Ps,zs,ks,Ss,_s,Hs,Ls,Os,Ds,Is,Fs,$s,Ws,Us,$u,Wu,Uu,Ju],Ox=e=>{Lx.forEach(t=>{e.component(t.name,t)})},Dx={install:Ox};O.EncryptionFactory=gi,O.EventBus=Tr,O.HashingFactory=Kf,O.INJECT_KEYS=Et,O.JAutoComplete=Di,O.JBarcode=ss,O.JButton=$l,O.JButtonSelect=Bs,O.JButtons=Ti,O.JCardList=Ju,O.JCascaderSelect=Hi,O.JCheckbox=Li,O.JCodeMirror=xs,O.JCollapse=Fs,O.JComp=Vs,O.JCount=cs,O.JCountUp=us,O.JDataPanel=fs,O.JDate=Mi,O.JDecoratedTitle=ws,O.JDialog=Xi,O.JDialogFull=Zi,O.JDivider=ps,O.JDrawer=Qi,O.JDynamicLayer=Ri,O.JEcharts=is,O.JEditor=$s,O.JForm=Ns,O.JFormItem=As,O.JGuid=Ps,O.JHpanel=hs,O.JIcon=ji,O.JInput=Vi,O.JInputButton=ms,O.JInputCards=Uu,O.JInputCode=ys,O.JInputColor=vs,O.JInputCount=ds,O.JInputDecoratedTitle=Cs,O.JInputLayer=Ls,O.JInputMap=Us,O.JInputRows=Hs,O.JInputTag=ts,O.JLayer=es,O.JLayerForm=Os,O.JLayout=Ii,O.JMap=Ws,O.JMenu=Ss,O.JNowTime=Ai,O.JNumber=Oi,O.JPage=js,O.JPanel=zs,O.JRadio=Pi,O.JRate=ns,O.JSelect=zi,O.JSlider=os,O.JSliderCaptcha=ks,O.JSwitch=Ds,O.JTable=qi,O.JTablePanel=_s,O.JTabs=Is,O.JTime=Ni,O.JTitle=bs,O.JTree=Rs,O.JTreeSelect=Ts,O.JUpload=ls,O.JVpanel=gs,O.JWorkflow=Wu,O.JWorkflowViewer=$u,O.assign=ot,O.buildShortUUID=ka,O.buildUUID=Ft,O.calcDate=ai,O.calcDateHours=Ef,O.calcDateText=_f,O.clearJson=bo,O.clone=$o,O.deepClone=kt,O.default=Dx,O.eventBus=qf,O.formatToDate=Uo,O.formatToDateTime=_a,O.fullScreenLoading=kn,O.getCompConfig=$t,O.getCompType=Ea,O.getDayText=Sf,O.getFunction=_r,O.getIsInputComp=Sa,O.getIsTableInputComp=ni,O.getLabel=oi,O.getObjType=Wl,O.getTextWidth=Jt,O.is=Fl,O.isArray=xa,O.isNullOrEmpty=St,O.isObject=ff,O.loadBMap=yi,O.lowerFirst=wf,O.myAesDecrypt=Gf,O.numberToChinese=Jl,O.numberToThousandSeparator=Yl,O.pagination=vf,O.paginationEx=Ul,O.set=Br,O.setGroupMap=Gl,O.toArray=Zl,O.toDecimal=Wo,O.toLeafArray=ti,O.toSimpleTree=Cf,O.toTree=ql,O.uniqueArray=bf,O.upFirst=Kl,O.useAppInject=tt,O.useAppProvide=Xf,O.useAuthPageInject=xi,O.useAuthPageProvide=ki,O.useCompInject=vi,O.useCompProvide=Mr,O.useFormInject=Sn,O.useFormProvide=Vr,O.useHMenuInject=wi,O.useHMenuProvide=Ci,O.useInject=en,O.useLayer=En,O.useLayerInject=Zf,O.useLayerProvide=Si,O.useMenuInject=Co,O.useMenuProvide=bi,O.usePageInject=Ei,O.usePageProvide=_i,O.useProvide=tn,O.useSortable=mi,O.useTableInject=wo,O.useTableProvide=Kn});